-- =================================================================== local modname = minetest.get_current_modname() local modpath = minetest.get_modpath (modname) local get_png = function (s) return s end local cvt_node = default.convert_node local reg_node = ocutil.safe_register_node local boxtiles local node_name local p1 local p2 local node_png -- =================================================================== local get_tbboxtiles = function (p1, p2) p1 = get_png (p1) p2 = get_png (p2) return { p1, p1, p2, p2, p2, p2 } end -- =================================================================== node_name = "sfnodes:light_dynamic" node_png = "sfnodes_light_overlay.png" -- reg_node (node_name, { description = "S.F. wall light" , tiles = { node_png } , inventory_image = node_png , wield_image = node_png , drawtype = "signlike" , paramtype = "light" , paramtype2 = "wallmounted" , light_source = 14 , sounds = default.sound_glass() , groups = { cracky=1, oddly_breakable_by_hand=1 } , selection_box = { type = "wallmounted" , fixed = { -0.5, -0.5, -0.5, -0.45, 0.5, 0.5 } , } , }) cvt_node ("scifi_nodes:light_dynamic", node_name) -- =================================================================== node_name = "sfnodes:blink" -- reg_node (node_name, { description = "S.F. blinking light" , sunlight_propagates = false , paramtype = "light" , groups = { cracky=1 } , light_source = 5 , tiles = {{ name = "sfnodes_lightbox.png" , animation = { type = "vertical_frames" , aspect_w = 16 , aspect_h = 16 , length = 2.00 , } , }} , }) cvt_node ("scifi_nodes:blink", node_name) -- =================================================================== node_name = "sfnodes:stripes2" p1 = "sfnodes_dmblock.png" p2 = "sfnodes_stripes2.png" boxtiles = get_tbboxtiles (p1, p2) -- reg_node (node_name, { description = "S.F. hazard stripes2" , sunlight_propagates = false , paramtype = "light" , groups = { cracky=1 } , tiles = boxtiles , }) cvt_node ("scifi_nodes:stripes2", node_name) -- =================================================================== node_name = "sfnodes:lightstripe" -- reg_node (node_name, { description = "S.F. twin lights" , sunlight_propagates = false , light_source = 14 , paramtype = "light" , groups = { cracky=1 } , tiles = { "sfnodes_lightstripe.png" } , }) cvt_node ("scifi_nodes:lightstp", node_name) -- =================================================================== node_name = "sfnodes:lightband" -- reg_node (node_name, { description = "S.F. white light stripe" , groups = { cracky=1 } , light_source = 10 , paramtype = "light" , sunlight_propagates = false , tiles = { get_png ("sfnodes_lightband.png") } , }) cvt_node ("scifi_nodes:whtlightbnd", node_name) -- =================================================================== node_name = "sfnodes:discs" p1 = "sfnodes_box_top.png" p2 = "sfnodes_discs.png" boxtiles = get_tbboxtiles (p1, p2) -- minetest.register_node (node_name, { description = "S.F. disc shelves" , sunlight_propagates = false , paramtype = "light" , groups = { cracky=1 } , tiles = boxtiles , }) cvt_node ("scifi_nodes:discs", node_name) -- =================================================================== local png_bmetal = get_png ("sfnodes_bluemetal.png" ) local png_bmlight = get_png ("sfnodes_blue_metal_light.png" ) node_name = "sfnodes:bllight" -- reg_node (node_name, { description = "S.F. blue metal light" , groups = { cracky=1 } , light_source = 10 , paramtype = "light" , sunlight_propagates = false , tiles = { png_bmetal , png_bmetal , png_bmlight , png_bmlight , png_bmlight , png_bmlight , } , }) cvt_node ("scifi_nodes:blumetlight", node_name) -- =================================================================== node_name = "sfnodes:bmstripes2" node_png = get_png ("sfnodes_bluemetal_stripes2.png") -- reg_node (node_name, { description = "S.F. blue stripe light" , sunlight_propagates = false , light_source = 10 , paramtype = "light" , groups = { cracky=1 } , tiles = { node_png } , }) cvt_node ("scifi_nodes:blumetstr", node_name) -- =================================================================== node_name = "sfnodes:bslight" -- reg_node (node_name, { description = "S.F. black stripe light" , light_source = 10 , paramtype = "light" , groups = { cracky=1 } , sunlight_propagates = false , tiles = { get_png ("sfnodes_black_light2.png") , } , }) cvt_node ("scifi_nodes:blklt2", node_name) -- =================================================================== node_name = "sfnodes:daglass" -- reg_node (node_name, { description = "S.F. dark glass" , drawtype = "glasslike" , groups = { cracky=1 } , paramtype = "light" , sunlight_propagates = false , use_texture_alpha = true , tiles = { get_png ("sfnodes_glass.png") , } , }) cvt_node ("scifi_nodes:glass", node_name) -- =================================================================== node_name = "sfnodes:bblight" p1 = "sfnodes_metal_block.png" p2 = "sfnodes_light.png" boxtiles = get_tbboxtiles (p1, p2) -- reg_node (node_name, { description = "S.F. blue lightbox" , sunlight_propagates = false , light_source = 10 , paramtype = "light" , groups = { cracky=1 } , tiles = boxtiles , }) cvt_node ("scifi_nodes:light", node_name) -- =================================================================== node_name = "sfnodes:gblight" p1 = "sfnodes_metal_block.png" p2 = "sfnodes_greenlight.png" boxtiles = get_tbboxtiles (p1, p2) -- reg_node (node_name, { description = "S.F. green lightbox" , sunlight_propagates = false , light_source = 10 , paramtype = "light" , groups = { cracky=1 } , tiles = boxtiles , }) cvt_node ("scifi_nodes:green_light", node_name) -- =================================================================== node_name = "sfnodes:rblight" p1 = "sfnodes_metal_block.png" p2 = "sfnodes_redlight.png" boxtiles = get_tbboxtiles (p1, p2) -- reg_node (node_name, { description = "S.F. red lightbox" , sunlight_propagates = false , light_source = 10 , paramtype = "light" , groups = { cracky=1 } , tiles = boxtiles , }) cvt_node ("scifi_nodes:red_light", node_name) -- =================================================================== node_name = "sfnodes:black_screen" -- reg_node (node_name, { description = "S.F. black wall screen" , sunlight_propagates = false , paramtype = "light" , groups = { cracky=1 } , light_source = 1 , tiles = {{ name = "sfnodes_black_screen.png" , animation = { type = "vertical_frames" , aspect_w = 16 , aspect_h = 16 , length = 2.00 , } , }} , }) cvt_node ("scifi_nodes:black_screen", node_name) -- =================================================================== node_name = "sfnodes:screen" -- reg_node (node_name, { description = "S.F. electronic screen" , sunlight_propagates = false , paramtype = "light" , groups = { cracky=1} , light_source = 5 , tiles = {{ name = "sfnodes_screen.png" , animation = { type = "vertical_frames" , aspect_w = 16 , aspect_h = 16 , length = 0.50 , } , }} , }) cvt_node ("scifi_nodes:screen", node_name) -- =================================================================== node_name = "sfnodes:screen2" -- reg_node (node_name, { description = "S.F. electronic screen 2" , sunlight_propagates = false , paramtype = "light" , groups = { cracky=1} , light_source = 5 , tiles = {{ name = "sfnodes_screen2.png" , animation = { type = "vertical_frames" , aspect_w = 16 , aspect_h = 16 , length = 0.50 , } , }} , }) cvt_node ("scifi_nodes:screen2", node_name) -- =================================================================== minetest.register_node ("sfnodes:glass_screen", { description = "glass screen", tiles = { "sfnodes_glscrn.png" , "sfnodes_glscrn.png" , "sfnodes_glscrn.png" , "sfnodes_glscrn.png" , "sfnodes_glscrn.png" , "sfnodes_glscrn.png" , }, use_texture_alpha = true , drawtype = "nodebox" , paramtype = "light" , paramtype2 = "facedir" , light_source = default.LIGHT_MAX , sunlight_propagates = true , node_box = { type = "fixed" , fixed = { { -0.4375, -0.5, -0.1250, 0.4375, -0.1875, 0.0625 } , { -0.3750, -0.5, -0.0625, 0.3750, 0.5000, 0.0000 } , } } , groups = { cracky=1, oddly_breakable_by_hand=1 } , sounds = default.node_sound_glass_defaults() , }) cvt_node ("scifi_nodes:glassscreen" , "sfnodes:glass_screen" ) -- =================================================================== reg_node ("sfnodes:tall_screen", { description = "tallscreen" , tiles = { "sfnodes_black.png" , "sfnodes_black.png" , "sfnodes_black.png" , "sfnodes_black.png" , "sfnodes_black.png" , "sfnodes_tallscreen.png" , } , drawtype = "nodebox" , light_source = 5 , paramtype = "light" , paramtype2 = "facedir" , sunlight_propagates = true , node_box = { type = "fixed" , fixed = { { -0.3125, -0.3750, 0.4375, 0.3125, 0.3750, 0.5 } , { -0.3750, 0.3750, 0.3750, 0.3750, 0.5000, 0.5 } , { -0.3750, -0.5000, 0.3750, 0.3750, -0.3750, 0.5 } , { 0.2500, -0.3125, 0.3750, 0.3750, 0.3125, 0.5 } , { -0.3750, -0.2500, 0.3750, -0.2500, 0.3125, 0.5 } , { -0.3125, -0.5000, 0.3750, -0.2500, 0.5000, 0.5 } , { 0.2500, -0.5000, 0.3750, 0.3125, 0.5000, 0.5 } , } }, groups = { cracky=1, oddly_breakable_by_hand=1 } , }) cvt_node ("scifi_nodes:tallscreen" , "sfnodes:tall_screen" ) -- =================================================================== reg_node ("sfnodes:microscope", { description = "Microscope" , drawtype = "nodebox" , paramtype = "light" , paramtype2 = "facedir" , sunlight_propagates = true , tiles = { "sfnodes_white.png" , "sfnodes_black.png" , "sfnodes_white_vent.png" , "sfnodes_white_vent.png" , "sfnodes_white_vent.png" , "sfnodes_white_vent.png" , }, node_box = { type = "fixed" , fixed = { { -0.2500, -0.5000, -0.3125, 0.2500, -0.3750, 0.3125 } , { -0.0625, -0.5000, 0.1250, 0.0625, 0.3125, 0.2500 } , { -0.0625, -0.0625, -0.0625, 0.0625, 0.5000, 0.0625 } , { -0.0625, 0.0625, 0.0625, 0.0625, 0.2500, 0.1250 } , { -0.1250, -0.2500, -0.1250, 0.1250, -0.1875, 0.1875 } , } }, groups = { cracky=1, oddly_breakable_by_hand=1 } , }) cvt_node ("scifi_nodes:microscope" , "sfnodes:microscope" ) -- =================================================================== reg_node ("sfnodes:table", { description = "Metal table" , drawtype = "nodebox" , paramtype = "light" , paramtype2 = "facedir" , tiles = { "sfnodes_grey.png" , "sfnodes_grey.png" , "sfnodes_grey.png" , "sfnodes_grey.png" , "sfnodes_grey.png" , "sfnodes_grey.png" , } , node_box = { type = "fixed", fixed = { { -0.5000, 0.4375, -0.5000, 0.5000, 0.5000, 0.5000 } , { -0.0625, -0.5000, 0.1250, 0.0625, 0.5000, 0.3125 } , { -0.0625, -0.5000, 0.3750, 0.0625, 0.5000, 0.4375 } , { -0.0625, -0.3750, 0.0625, 0.0625, 0.4375, 0.1250 } , { -0.0625, -0.1875, 0.0000, 0.0625, 0.4375, 0.0625 } , { -0.0625, 0.0625, -0.0625, 0.0625, 0.4375, 0.0000 } , { -0.0625, 0.2500, -0.1250, 0.0625, 0.4375, -0.0625 } , } }, sounds = default.node_sound_metal_defaults() , groups = { cracky=1 } , }) cvt_node ("scifi_nodes:table" , "sfnodes:table" ) -- =================================================================== reg_node ("sfnodes:capsule", { description = "sample capsule" , use_texture_alpha = true , drawtype = "nodebox" , paramtype = "light" , paramtype2 = "facedir" , sunlight_propagates = true , tiles = { "sfnodes_capsule.png" , "sfnodes_capsule.png" , "sfnodes_box_top.png" , "sfnodes_box_top.png" , "sfnodes_capsule.png" , "sfnodes_capsule.png" , }, node_box = { type = "fixed", fixed = { { 0.3125, -0.5000, -0.2500, 0.5000, 0.0000, 0.2500 } , { -0.5000, -0.5000, -0.2500, -0.3125, 0.0000, 0.2500 } , { -0.3125, -0.4375, -0.1875, 0.3125, -0.0625, 0.1875 } , } } , groups = { cracky=1, oddly_breakable_by_hand=1 } , sounds = default.node_sound_glass_defaults() , }) cvt_node ("scifi_nodes:capsule" , "sfnodes:capsule" ) -- =================================================================== minetest.register_node ("sfnodes:switch_on", { description = "Wall switch" , sunlight_propagates = true , buildable_to = false , tiles = { "sfnodes_switch_on.png" } , inventory_image = "sfnodes_switch_on.png" , wield_image = "sfnodes_switch_on.png" , drawtype = "signlike" , node_box = { type = "wallmounted" } , selection_box = { type = "wallmounted" } , paramtype = "light" , paramtype2 = "wallmounted" , light_source = 5 , groups = { cracky=1 , oddly_breakable_by_hand=1 , not_in_creative_inventory=1 , } , sounds = default.node_sound_glass_defaults() , on_rightclick = function (pos, node, clicker, item, _) local lid_node = minetest.get_node (pos) minetest.set_node (pos, { name = "sfnodes:switch_off" , param2 = lid_node.param2 }) end }) cvt_node ("scifi_nodes:switch_on" , "sfnodes:switch_on" ) -- =================================================================== reg_node ("sfnodes:switch_off", { description = "Wall switch" , tiles = { "sfnodes_switch_off.png" } , inventory_image = "sfnodes_switch_on.png" , wield_image = "sfnodes_switch_on.png" , drawtype = "signlike" , sunlight_propagates = true , buildable_to = false , node_box = { type = "wallmounted" } , selection_box = { type = "wallmounted" } , paramtype = "light" , paramtype2 = "wallmounted" , groups = { cracky=1 , oddly_breakable_by_hand=1 , } , sounds = default.node_sound_glass_defaults() , on_rightclick = function (pos, node, clicker, item, _) local lid_node = minetest.get_node (pos) minetest.set_node (pos, { name = "sfnodes:switch_on" , param2 = lid_node.param2 }) end }) cvt_node ("scifi_nodes:switch_off" , "sfnodes:switch_off" ) -- =================================================================== node_name = "sfnodes:white_base" p1 = "sfnodes_white2.png" p2 = "sfnodes_white_side.png" boxtiles = get_tbboxtiles (p1, p2) -- reg_node (node_name, { description = "S.F. white wall base" , sunlight_propagates = false , paramtype = "light" , paramtype2 = "facedir" , groups = { cracky=1 } , tiles = boxtiles , }) cvt_node ("scifi_nodes:white_base", node_name) -- =================================================================== node_name = "sfnodes:white_pad" p1 = "sfnodes_white2.png" p2 = "sfnodes_white_pad.png" boxtiles = get_tbboxtiles (p1, p2) -- reg_node (node_name, { description = "S.F. white keypad" , sunlight_propagates = false , paramtype = "light" , paramtype2 = "facedir" , groups = { cracky=1 } , tiles = boxtiles , }) cvt_node ("scifi_nodes:white_pad", node_name) -- =================================================================== local lightbar_cbox = { -0.125, -0.500, -0.500, 0.125, -0.375, 0.500 } node_name = "sfnodes:lightbar" -- minetest.register_node (node_name, { description = "S.F. ceiling light" , drawtype = "nodebox" , paramtype = "light" , paramtype2 = "wallmounted" , sunlight_propagates = true , light_source = 14 , tiles = { get_png ("sfnodes_white2.png") } , node_box = { type = "fixed" , fixed = lightbar_cbox , } , selection_box = { type = "wallmounted" , wallmounted = lightbar_cbox , } , groups = { cracky=1 } , sounds = default.sound_glass() , }) cvt_node ("scifi_nodes:lightbar", node_name) -- =================================================================== local ogcolors = { "blue" , "cyan" , "green" , "orange" , "purple" , "red" , "yellow" , } -- =================================================================== for _, color in ipairs (ogcolors) do local first_lower = ocutil.firstch (color) local color_camel = ocutil.first_to_upper (color) local glass_base = first_lower .. "oglass" local node_name = "sfnodes:" .. glass_base local desc = color_camel .. " Octagon Glass" local img = get_png ("sfnodes_" .. glass_base .. ".png") reg_node (node_name, { description = desc , sunlight_propagates = false , drawtype = "glasslike" , paramtype = "light" , paramtype2 = "facedir" , use_texture_alpha = true , light_source = 10 , groups = { cracky=2 } , tiles = { img } , sounds = default.sound_glass() , }) end -- =================================================================== cvt_node ("scifi_nodes:octbl" , "sfnodes:boglass") cvt_node ("scifi_nodes:octgrn" , "sfnodes:goglass") cvt_node ("scifi_nodes:octrng" , "sfnodes:ooglass") cvt_node ("scifi_nodes:octppl" , "sfnodes:poglass") -- =================================================================== local sgcolors = { "blue" , "cyan" , "green" , "orange" , "purple" , "red" , "yellow" , "grey" , } -- =================================================================== for _, color in ipairs (sgcolors) do local first_lower = ocutil.firstch (color) if color == "grey" then first_lower = "x" end local color_camel = ocutil.first_to_upper (color) local glass_base = first_lower .. "sglass" local node_name = "sfnodes:" .. glass_base local desc = color_camel .. " Square Glass" local img = get_png ("sfnodes_" .. glass_base .. ".png") reg_node (node_name, { description = desc , sunlight_propagates = false , drawtype = "glasslike" , paramtype = "light" , paramtype2 = "facedir" , use_texture_alpha = true , light_source = 10 , groups = { cracky=2 } , tiles = { img } , sounds = default.sound_glass() , }) end -- =================================================================== local node = {} node.types = { { "black" , "black wall" , 0 , "same" } , { "blackoct" , "black octagon" , 0 , "same" } , { "blackpipe" , "black pipe" , 0 , "same" } , { "blackplate" , "Black plate" , 1 , "same" } , { "blacktile" , "black tile" , 0 , "same" } , { "blackvent" , "black vent" , 0 , "same" } , { "blue" , "blue lines" , 0 , "same" } , { "bluebars" , "blue bars" , 1 , "same" } , { "bluegrid" , "Blue Grid" , 5 , "same" } , { "bluemetal" , "blue metal" , 0 , "same" } , { "bluetile" , "blue tile" , 0 , "same" } , { "dmblock" , "dirty metal block" , 0 , "stripes2top" } , { "engine" , "engine" , 0 , "same" } , { "fan" , "Fan" , 0 , "same" } , { "green" , "green lines" , 0 , "same" } , { "grey" , "grey wall" , 0 , "same" } , { "greybars" , "grey bars" , 0 , "same" } , { "greygreenbar" , "gray power pipe" , 10 , "same" } , { "greytile" , "grey tile" , 0 , "same" } , { "holes" , "metal with holes" , 0 , "same" } , { "mesh" , "metal mesh" , 0 , "same" } , { "mesh2" , "metal floormesh" , 0 , "same" } , { "metal_block" , "metal block" , 0 , "lighttop" } , { "octofloor" , "octo-tile floor" , 0 , "same" } , { "pipe" , "wall pipe" , 0 , "same" } , { "pipeside" , "side pipe" , 0 , "same" } , { "pplight" , "purple wall light" , 14 , "ppllght" } , { "red" , "red lines" , 0 , "same" } , { "rough" , "rough metal" , 0 , "same" } , { "rust" , "rusty metal" , 0 , "same" } , { "stripes" , "hazard stripes" , 0 , "same" } , { "tile" , "white tile 1" , 0 , "same" } , { "tile2" , "white tile 2" , 0 , "whitetile" } , { "vent" , "vent" , 0 , "vent2" } , { "wall" , "metal wall" , 0 , "same" } , { "white" , "plastic wall" , 0 , "same" } , { "white2" , "plastic" , 0 , "same" } , { "whiteoct" , "white octagon" , 0 , "same" } , } -- =================================================================== for _, row in ipairs (node.types) do local name = row [1] local desc = row [2] local light = row [3] local equiv = row [4] local img = get_png ("sfnodes_" .. name .. ".png") if light == 0 then light = nil end reg_node ("sfnodes:"..name, { description = "S.F. " .. desc , groups = { cracky=1 } , light_source = light , paramtype = "light" , paramtype2 = "facedir" , tiles = { img } , }) if equiv == "same" then cvt_node ("scifi_nodes:" .. name , "sfnodes:" .. name) elseif ocutil.str_nonempty (equiv) then cvt_node ("scifi_nodes:" .. equiv , "sfnodes:" .. name) end end -- =================================================================== node.plants = { { "glow_flower" , "Glow Flower" , 1.0 , 0 , 14 , "flower1" } , { "triffid" , "Triffid" , 2.0 , 5 , 0 , "flower3" } , { "weeping_flower" , "Weeping flower" , 1.5 , 0 , 0 , "flower4" } , { "bulb_plant" , "Bulb Plant" , 1.0 , 0 , 0 , "plant1" } , { "bjelly_plant" , "Blue Jelly Plant" , 1.2 , 0 , 10 , "plant3" } , { "gjelly_plant" , "Green Jelly Plant" , 1.2 , 0 , 10 , "plant4" } , { "fern_plant" , "Fern Plant" , 1.7 , 0 , 0 , "plant5" } , { "slug_weed" , "Slug weed" , 1.0 , 0 , 10 , "plant8" } , { "grass" , "Alien grass" , 1.0 , 0 , 0 , "grass" } , } -- =================================================================== for _, row in ipairs (node.plants) do local name = row [1] local desc = row [2] local size = row [3] local dmg = row [4] local light = row [5] local old_name = row [6] local node_name = "sfnodes:" .. name local img = get_png ("sfnodes_" .. name .. ".png") reg_node (node_name, { description = desc , drawtype = "plantlike" , is_ground_content = false , light_source = light , paramtype = "light" , visual_scale = size , buildable_to = true , walkable = false , damage_per_second = dmg , tiles = { img } , inventory_image = { img } , groups = { snappy=1, dig_immediate=3, flora=1, oddly_breakable_by_hand=1, } , selection_box = { type = "fixed" , fixed = { { -0.3, -0.5, -0.3, 0.3, 0.5, 0.3 } , } } , }) if ocutil.str_nonempty (old_name) then old_name = "scifi_nodes:" .. old_name cvt_node (old_name, node_name) end end -- =================================================================== dofile (modpath .. "/chests.lua") -- =================================================================== -- End of file.