diff options
author | cheapie <no-email-for-you@example.com> | 2025-03-16 12:46:29 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2025-03-16 12:46:29 -0500 |
commit | d77fca515443f428f487e2991c80e5e955628366 (patch) | |
tree | 728419d7ce25b3ce92ce4331408b4df6dcc9c5b7 | |
parent | fc3a3430f635d29af24af1aa3788199668be1376 (diff) | |
download | celevator-d77fca515443f428f487e2991c80e5e955628366.tar celevator-d77fca515443f428f487e2991c80e5e955628366.tar.gz celevator-d77fca515443f428f487e2991c80e5e955628366.tar.bz2 celevator-d77fca515443f428f487e2991c80e5e955628366.tar.xz celevator-d77fca515443f428f487e2991c80e5e955628366.zip |
Add metal car
-rw-r--r-- | car_metal.lua | 410 | ||||
-rw-r--r-- | init.lua | 1 | ||||
-rw-r--r-- | textures/celevator_car_metal.png | bin | 0 -> 559 bytes | |||
-rw-r--r-- | textures/celevator_car_metal_2x.png | bin | 0 -> 667 bytes | |||
-rw-r--r-- | textures/celevator_car_metal_ceiling.png | bin | 0 -> 716 bytes | |||
-rw-r--r-- | textures/celevator_car_metal_floor.png | bin | 0 -> 307 bytes | |||
-rw-r--r-- | textures/celevator_car_metal_inventory.png | bin | 0 -> 503 bytes | |||
-rw-r--r-- | textures/celevator_car_metal_top.png | bin | 0 -> 584 bytes | |||
-rw-r--r-- | textures/celevator_car_metal_wield.png | bin | 0 -> 390 bytes |
9 files changed, 411 insertions, 0 deletions
diff --git a/car_metal.lua b/car_metal.lua new file mode 100644 index 0000000..1b18ced --- /dev/null +++ b/car_metal.lua @@ -0,0 +1,410 @@ +local pieces = { + { + _position = "000", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.6,-0.5,0.5,-0.5,0.5}, + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + {-0.5,-1.5,-0.5,0.5,-0.6,-0.45}, + }, + }, + tiles = { + "celevator_car_metal_floor.png^celevator_door_sill_single.png", + "celevator_car_bottom.png", + "celevator_car_metal.png^celevator_car_wall_bottom.png^celevator_car_switch_panel.png", + "celevator_cabinet_sides.png^celevator_car_side_overlay.png^[transformR90", + "celevator_cabinet_sides.png", + }, + _keyswitches = true, + }, + { + _position = "001", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.6,-0.5,0.5,-0.5,0.5}, + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + }, + }, + tiles = { + "celevator_car_metal_floor.png", + "celevator_car_bottom_center.png", + "celevator_car_metal.png^celevator_car_wall_bottom.png^celevator_car_wall_vent.png", + "celevator_cabinet_sides.png^celevator_car_side_center_overlay.png", + "celevator_cabinet_sides.png", + }, + }, + { + _position = "002", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.6,-0.5,0.5,-0.5,0.5}, + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + {-0.45,-0.5,0.45,0.5,0.5,0.5}, + }, + }, + tiles = { + "celevator_car_metal_floor.png", + "celevator_car_bottom.png", + "celevator_car_metal.png^celevator_car_wall_bottom.png", + "celevator_cabinet_sides.png^celevator_car_side_overlay.png", + "celevator_cabinet_sides.png", + "celevator_car_metal.png^celevator_car_wall_bottom.png", + }, + }, + { + _position = "100", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.6,-0.5,0.5,-0.5,0.5}, + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + {-0.5,-1.5,-0.5,0.5,-0.6,-0.45}, + }, + }, + tiles = { + "celevator_car_metal_floor.png^celevator_door_sill_double.png", + "celevator_car_bottom.png", + "celevator_cabinet_sides.png^celevator_car_side_overlay.png", + "celevator_car_metal.png^celevator_car_wall_bottom.png", + "celevator_cabinet_sides.png", + }, + }, + { + _position = "101", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.6,-0.5,0.5,-0.5,0.5}, + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + }, + }, + tiles = { + "celevator_car_metal_floor.png", + "celevator_car_bottom_center.png^[transformFX", + "celevator_cabinet_sides.png^celevator_car_side_center_overlay.png", + "celevator_car_metal.png^celevator_car_wall_bottom.png^celevator_car_wall_vent.png", + "celevator_cabinet_sides.png", + }, + }, + { + _position = "102", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.6,-0.5,0.5,-0.5,0.5}, + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + {-0.5,-0.5,0.45,0.45,0.5,0.5}, + }, + }, + tiles = { + "celevator_car_metal_floor.png", + "celevator_car_bottom.png", + "celevator_cabinet_sides.png^celevator_car_side_overlay.png^[transformR90", + "celevator_car_metal.png^celevator_car_wall_bottom.png", + "celevator_cabinet_sides.png", + "celevator_car_metal.png^celevator_car_wall_bottom.png", + }, + }, + { + _position = "010", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_car_metal_2x.png^celevator_cop.png", + "celevator_cabinet_sides.png", + }, + _cop = true, + }, + { + _position = "011", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_car_metal.png^celevator_car_handrail_end.png", + "celevator_cabinet_sides.png^celevator_car_side_center2_overlay.png", + "celevator_cabinet_sides.png", + }, + }, + { + _position = "012", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + {-0.45,-0.5,0.45,0.5,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_car_metal.png^(celevator_car_handrail_end.png^[transformFX)", + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_car_metal.png", + }, + }, + { + _position = "110", + node_box = { + type = "fixed", + fixed = { + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_car_metal.png^(celevator_car_handrail_end.png^[transformFX)", + "celevator_cabinet_sides.png", + }, + }, + { + _position = "111", + node_box = { + type = "fixed", + fixed = { + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png^celevator_car_side_center2_overlay.png", + "celevator_car_metal.png^celevator_car_handrail_center.png", + "celevator_cabinet_sides.png", + }, + }, + { + _position = "112", + node_box = { + type = "fixed", + fixed = { + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + {-0.5,-0.5,0.45,0.45,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_car_metal.png^celevator_car_handrail_end.png", + "celevator_cabinet_sides.png", + "celevator_car_metal.png", + }, + }, + { + _position = "020", + node_box = { + type = "fixed", + fixed = { + {-0.5,0.5,-0.5,0.5,0.6,0.5}, + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + {-0.5,0.6,-0.4,0.5,1,-0.1}, + }, + }, + tiles = { + "celevator_cabinet_sides.png", + "celevator_car_metal_ceiling.png", + "celevator_car_metal_top.png", + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_dooroperator_left.png", + }, + _pi = true, + }, + { + _position = "021", + node_box = { + type = "fixed", + fixed = { + {-0.5,0.5,-0.5,0.5,0.6,0.5}, + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png^celevator_car_top_center_overlay.png", + "celevator_car_metal_ceiling.png", + "celevator_car_metal_top.png", + "celevator_cabinet_sides.png^celevator_car_side_center_overlay.png", + "celevator_cabinet_sides.png", + }, + _cartopbox = true, + }, + { + _position = "022", + node_box = { + type = "fixed", + fixed = { + {-0.5,0.5,-0.5,0.5,0.6,0.5}, + {-0.5,-0.5,-0.5,-0.45,0.5,0.5}, + {-0.45,-0.5,0.45,0.5,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png^celevator_car_top_hatch.png", + "celevator_car_metal_ceiling.png", + "celevator_car_metal_top.png", + "celevator_cabinet_sides.png", + "celevator_cabinet_sides.png", + "celevator_car_metal_top.png", + }, + }, + { + _position = "120", + node_box = { + type = "fixed", + fixed = { + {-0.5,0.5,-0.5,0.5,0.6,0.5}, + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + {-0.5,0.6,-0.4,0.5,1,-0.1}, + }, + }, + tiles = { + "celevator_cabinet_sides.png", + "celevator_car_metal_ceiling.png", + "celevator_cabinet_sides.png", + "celevator_car_metal_top.png", + "celevator_cabinet_sides.png", + "celevator_dooroperator_right.png", + }, + }, + { + _position = "121", + node_box = { + type = "fixed", + fixed = { + {-0.5,0.5,-0.5,0.5,0.6,0.5}, + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png^celevator_car_top_center_overlay.png^[transformFX", + "celevator_car_metal_ceiling.png", + "celevator_cabinet_sides.png^celevator_car_side_center_overlay.png", + "celevator_car_metal_top.png", + "celevator_cabinet_sides.png", + }, + }, + { + _position = "122", + node_box = { + type = "fixed", + fixed = { + {-0.5,0.5,-0.5,0.5,0.6,0.5}, + {0.45,-0.5,-0.5,0.5,0.5,0.5}, + {-0.5,-0.5,0.45,0.45,0.5,0.5}, + }, + }, + tiles = { + "celevator_cabinet_sides.png^celevator_car_top_misc.png", + "celevator_car_metal_ceiling.png", + "celevator_cabinet_sides.png", + "celevator_car_metal_top.png", + "celevator_cabinet_sides.png", + "celevator_car_metal_top.png", + }, + _tapehead = true, + }, +} + +celevator.car.register("metal",pieces,vector.new(2,3,3)) + + +minetest.register_node("celevator:car_metal",{ + description = "Metal Elevator Car", + paramtype2 = "4dir", + buildable_to = true, + inventory_image = "celevator_car_metal_inventory.png", + wield_image = "celevator_car_metal_wield.png", + wield_scale = vector.new(1,1,10), + tiles = {"celevator_transparent.png"}, + after_place_node = function(pos,player) + if not player:is_player() then + minetest.remove_node(pos) + return true + end + local name = player:get_player_name() + local newnode = minetest.get_node(pos) + local facedir = minetest.dir_to_yaw(minetest.fourdir_to_dir(newnode.param2)) + for x=0,1,1 do + for y=0,2,1 do + for z=0,2,1 do + local offsetdesc = string.format("%dm to the right, %dm up, and %dm back",x,y,z) + local placeoffset = vector.new(x,y,z) + local placepos = vector.add(pos,vector.rotate_around_axis(placeoffset,vector.new(0,1,0),facedir)) + local replaces = minetest.get_node(placepos).name + if not (minetest.registered_nodes[replaces] and minetest.registered_nodes[replaces].buildable_to) then + minetest.chat_send_player(name,string.format("Can't place car here - position %s is blocked!",offsetdesc)) + minetest.remove_node(pos) + return true + end + if minetest.is_protected(placepos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.chat_send_player(name,string.format("Can't place car here - position %s is protected!",offsetdesc)) + minetest.record_protection_violation(placepos,name) + minetest.remove_node(pos) + return true + end + end + end + end + for x=0,1,1 do + for y=0,2,1 do + for z=0,2,1 do + local piecename = string.format("celevator:car_metal_%d%d%d",x,y,z) + local placeoffset = vector.new(x,y,z) + local placepos = vector.add(pos,vector.rotate_around_axis(placeoffset,vector.new(0,1,0),facedir)) + minetest.set_node(placepos,{name=piecename,param2=newnode.param2}) + end + end + end + end, +}) + +celevator.car.types.metal.remove = function(rootpos,rootdir) + local toberemoved = { + ["celevator:car_top_box"] = true, + ["celevator:incar_pi_entity"] = true, + ["celevator:car_door"] = true, + } + for x=0,1,1 do + for y=0,2,1 do + for z=0,2,1 do + local piecename = string.format("celevator:car_metal_%d%d%d",x,y,z) + local pieceoffset = vector.new(x,y,z) + local piecepos = vector.add(rootpos,vector.rotate_around_axis(pieceoffset,vector.new(0,1,0),rootdir)) + if minetest.get_node(piecepos).name == piecename then + minetest.remove_node(piecepos) + local erefs = minetest.get_objects_inside_radius(piecepos,0.5) + for _,ref in pairs(erefs) do + if ref:get_luaentity() and toberemoved[ref:get_luaentity().name] then + ref:remove() + end + end + end + end + end + end + local cartopboxpos = vector.add(rootpos,vector.rotate_around_axis(vector.new(0,3,1),vector.new(0,1,0),rootdir)) + local erefs = minetest.get_objects_inside_radius(cartopboxpos,0.5) + for _,ref in pairs(erefs) do + if ref:get_luaentity() and toberemoved[ref:get_luaentity().name] then + ref:remove() + end + end +end @@ -3,6 +3,7 @@ local components = { "car", "car_standard", "car_glassback", + "car_metal", "doors", "drive_null", "drive_entity", diff --git a/textures/celevator_car_metal.png b/textures/celevator_car_metal.png Binary files differnew file mode 100644 index 0000000..f9fdee6 --- /dev/null +++ b/textures/celevator_car_metal.png diff --git a/textures/celevator_car_metal_2x.png b/textures/celevator_car_metal_2x.png Binary files differnew file mode 100644 index 0000000..fdbb229 --- /dev/null +++ b/textures/celevator_car_metal_2x.png diff --git a/textures/celevator_car_metal_ceiling.png b/textures/celevator_car_metal_ceiling.png Binary files differnew file mode 100644 index 0000000..5023c7e --- /dev/null +++ b/textures/celevator_car_metal_ceiling.png diff --git a/textures/celevator_car_metal_floor.png b/textures/celevator_car_metal_floor.png Binary files differnew file mode 100644 index 0000000..d944936 --- /dev/null +++ b/textures/celevator_car_metal_floor.png diff --git a/textures/celevator_car_metal_inventory.png b/textures/celevator_car_metal_inventory.png Binary files differnew file mode 100644 index 0000000..e969f08 --- /dev/null +++ b/textures/celevator_car_metal_inventory.png diff --git a/textures/celevator_car_metal_top.png b/textures/celevator_car_metal_top.png Binary files differnew file mode 100644 index 0000000..c9d400a --- /dev/null +++ b/textures/celevator_car_metal_top.png diff --git a/textures/celevator_car_metal_wield.png b/textures/celevator_car_metal_wield.png Binary files differnew file mode 100644 index 0000000..2c76aa4 --- /dev/null +++ b/textures/celevator_car_metal_wield.png |