summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2025-03-16 12:46:29 -0500
committercheapie <no-email-for-you@example.com>2025-03-16 12:46:29 -0500
commitd77fca515443f428f487e2991c80e5e955628366 (patch)
tree728419d7ce25b3ce92ce4331408b4df6dcc9c5b7
parentfc3a3430f635d29af24af1aa3788199668be1376 (diff)
downloadcelevator-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.lua410
-rw-r--r--init.lua1
-rw-r--r--textures/celevator_car_metal.pngbin0 -> 559 bytes
-rw-r--r--textures/celevator_car_metal_2x.pngbin0 -> 667 bytes
-rw-r--r--textures/celevator_car_metal_ceiling.pngbin0 -> 716 bytes
-rw-r--r--textures/celevator_car_metal_floor.pngbin0 -> 307 bytes
-rw-r--r--textures/celevator_car_metal_inventory.pngbin0 -> 503 bytes
-rw-r--r--textures/celevator_car_metal_top.pngbin0 -> 584 bytes
-rw-r--r--textures/celevator_car_metal_wield.pngbin0 -> 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
diff --git a/init.lua b/init.lua
index 2f66b60..7496cbf 100644
--- a/init.lua
+++ b/init.lua
@@ -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
new file mode 100644
index 0000000..f9fdee6
--- /dev/null
+++ b/textures/celevator_car_metal.png
Binary files differ
diff --git a/textures/celevator_car_metal_2x.png b/textures/celevator_car_metal_2x.png
new file mode 100644
index 0000000..fdbb229
--- /dev/null
+++ b/textures/celevator_car_metal_2x.png
Binary files differ
diff --git a/textures/celevator_car_metal_ceiling.png b/textures/celevator_car_metal_ceiling.png
new file mode 100644
index 0000000..5023c7e
--- /dev/null
+++ b/textures/celevator_car_metal_ceiling.png
Binary files differ
diff --git a/textures/celevator_car_metal_floor.png b/textures/celevator_car_metal_floor.png
new file mode 100644
index 0000000..d944936
--- /dev/null
+++ b/textures/celevator_car_metal_floor.png
Binary files differ
diff --git a/textures/celevator_car_metal_inventory.png b/textures/celevator_car_metal_inventory.png
new file mode 100644
index 0000000..e969f08
--- /dev/null
+++ b/textures/celevator_car_metal_inventory.png
Binary files differ
diff --git a/textures/celevator_car_metal_top.png b/textures/celevator_car_metal_top.png
new file mode 100644
index 0000000..c9d400a
--- /dev/null
+++ b/textures/celevator_car_metal_top.png
Binary files differ
diff --git a/textures/celevator_car_metal_wield.png b/textures/celevator_car_metal_wield.png
new file mode 100644
index 0000000..2c76aa4
--- /dev/null
+++ b/textures/celevator_car_metal_wield.png
Binary files differ