summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--decorations.lua227
-rw-r--r--drive_entity.lua10
-rw-r--r--textures/celevator_tapehead_front_dlm.pngbin0 -> 3554 bytes
-rw-r--r--textures/celevator_tapehead_front_dlm_dz.pngbin0 -> 3553 bytes
-rw-r--r--textures/celevator_tapehead_front_off.pngbin0 -> 3546 bytes
-rw-r--r--textures/celevator_tapehead_front_ulm.pngbin0 -> 3553 bytes
-rw-r--r--textures/celevator_tapehead_front_ulm_dlm_dz.pngbin0 -> 3545 bytes
-rw-r--r--textures/celevator_tapehead_front_ulm_dz.pngbin0 -> 3554 bytes
-rw-r--r--textures/celevator_tapehead_sides.pngbin0 -> 3527 bytes
9 files changed, 235 insertions, 2 deletions
diff --git a/decorations.lua b/decorations.lua
index 0728ba2..847c06a 100644
--- a/decorations.lua
+++ b/decorations.lua
@@ -245,3 +245,230 @@ minetest.register_node("celevator:tape_bracket",{
},
},
})
+
+minetest.register_entity("celevator:tapehead",{
+ initial_properties = {
+ visual = "wielditem",
+ visual_size = vector.new(0.667,0.667,0.667),
+ wield_item = "celevator:tapehead",
+ static_save = false,
+ pointable = false,
+ glow = minetest.LIGHT_MAX,
+ },
+ on_step = function(self)
+ local obj = self.object
+ if not obj then return end
+ local pos = obj:get_pos()
+ if not pos then return end
+ local roundpos = vector.round(pos)
+ local backdir = minetest.yaw_to_dir(obj:get_yaw())
+ local tapepos = vector.add(roundpos,backdir)
+ local tapename = minetest.get_node(tapepos).name
+ if tapename ~= "celevator:tape" and tapename ~= "celevator:tape_magnets" and tapename ~= "celevator:tape_bracket" then
+ obj:remove()
+ return
+ end
+ local ledstate = ""
+ if tapename == "celevator:tape_magnets" then
+ local offset = pos.y-roundpos.y
+ if offset > -0.45 and offset < 0.05 then
+ ledstate = ledstate.."_ulm"
+ end
+ if offset < 0.45 and offset > -0.05 then
+ ledstate = ledstate.."_dlm"
+ end
+ if offset > -0.3 and offset < 0.3 then
+ ledstate = ledstate.."_dz"
+ end
+ end
+ obj:set_properties({
+ wield_item = "celevator:tapehead"..ledstate,
+ })
+ end,
+})
+
+local function spawntapehead(pos)
+ local toppos = vector.add(pos,vector.new(0,1,0))
+ local entitiesnearby = minetest.get_objects_inside_radius(toppos,0.5)
+ for _,i in pairs(entitiesnearby) do
+ if i:get_luaentity() and i:get_luaentity().name == "celevator:tapehead" then
+ return
+ end
+ end
+ local entity = minetest.add_entity(pos,"celevator:tapehead")
+ local fdir = minetest.fourdir_to_dir(minetest.get_node(pos).param2)
+ fdir = vector.rotate_around_axis(fdir,vector.new(0,1,0),-math.pi/2)
+ entity:set_yaw(minetest.dir_to_yaw(fdir))
+ entity:set_pos(toppos)
+end
+
+minetest.register_abm({
+ label = "Spawn tapeheads",
+ nodenames = {"celevator:car_122"},
+ neighbors = {"celevator:tape","celevator:tape_magnets","celevator:tape_bracket"},
+ interval = 1,
+ chance = 1,
+ action = spawntapehead,
+})
+
+minetest.register_node("celevator:tapehead",{
+ description = "Elevator Positioning System Tapehead (off, you hacker you!)",
+ groups = {
+ not_in_creative_inventory = 1,
+ },
+ drop = "",
+ paramtype = "light",
+ paramtype2 = "4dir",
+ tiles = {
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_front_off.png",
+ },
+ drawtype = "nodebox",
+ use_texture_alpha = "clip",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.4,0.62,0.15,0.1,0.72},
+ {-0.15,-0.4,0.42,0.15,-0.38,0.62},
+ },
+ },
+})
+
+minetest.register_node("celevator:tapehead_ulm",{
+ description = "Elevator Positioning System Tapehead (ULM on, you hacker you!)",
+ groups = {
+ not_in_creative_inventory = 1,
+ },
+ drop = "",
+ paramtype = "light",
+ paramtype2 = "4dir",
+ tiles = {
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_front_ulm.png",
+ },
+ drawtype = "nodebox",
+ use_texture_alpha = "clip",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.4,0.62,0.15,0.1,0.72},
+ {-0.15,-0.4,0.42,0.15,-0.38,0.62},
+ },
+ },
+})
+
+minetest.register_node("celevator:tapehead_ulm_dz",{
+ description = "Elevator Positioning System Tapehead (ULM and DZ on, you hacker you!)",
+ groups = {
+ not_in_creative_inventory = 1,
+ },
+ drop = "",
+ paramtype = "light",
+ paramtype2 = "4dir",
+ tiles = {
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_front_ulm_dz.png",
+ },
+ drawtype = "nodebox",
+ use_texture_alpha = "clip",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.4,0.62,0.15,0.1,0.72},
+ {-0.15,-0.4,0.42,0.15,-0.38,0.62},
+ },
+ },
+})
+
+minetest.register_node("celevator:tapehead_ulm_dlm_dz",{
+ description = "Elevator Positioning System Tapehead (ULM, DLM, and DZ on, you hacker you!)",
+ groups = {
+ not_in_creative_inventory = 1,
+ },
+ drop = "",
+ paramtype = "light",
+ paramtype2 = "4dir",
+ tiles = {
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_front_ulm_dlm_dz.png",
+ },
+ drawtype = "nodebox",
+ use_texture_alpha = "clip",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.4,0.62,0.15,0.1,0.72},
+ {-0.15,-0.4,0.42,0.15,-0.38,0.62},
+ },
+ },
+})
+
+minetest.register_node("celevator:tapehead_dlm_dz",{
+ description = "Elevator Positioning System Tapehead (DLM and DZ on, you hacker you!)",
+ groups = {
+ not_in_creative_inventory = 1,
+ },
+ drop = "",
+ paramtype = "light",
+ paramtype2 = "4dir",
+ tiles = {
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_front_dlm_dz.png",
+ },
+ drawtype = "nodebox",
+ use_texture_alpha = "clip",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.4,0.62,0.15,0.1,0.72},
+ {-0.15,-0.4,0.42,0.15,-0.38,0.62},
+ },
+ },
+})
+
+minetest.register_node("celevator:tapehead_dlm",{
+ description = "Elevator Positioning System Tapehead (DLM on, you hacker you!)",
+ groups = {
+ not_in_creative_inventory = 1,
+ },
+ drop = "",
+ paramtype = "light",
+ paramtype2 = "4dir",
+ tiles = {
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_sides.png",
+ "celevator_tapehead_front_dlm.png",
+ },
+ drawtype = "nodebox",
+ use_texture_alpha = "clip",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.4,0.62,0.15,0.1,0.72},
+ {-0.15,-0.4,0.42,0.15,-0.38,0.62},
+ },
+ },
+})
diff --git a/drive_entity.lua b/drive_entity.lua
index 5a2eed8..2b048d8 100644
--- a/drive_entity.lua
+++ b/drive_entity.lua
@@ -268,7 +268,7 @@ function celevator.drives.entity.nodestoentities(nodes,ename)
})
eref:set_yaw(minetest.dir_to_yaw(minetest.fourdir_to_dir(node.param2)))
table.insert(refs,eref)
- if node.name == "celevator:car_021" then
+ if node.name == "celevator:car_021" or node.name == "celevator:car_122" then
local toppos = vector.add(pos,vector.new(0,1,0))
local topattach = minetest.get_objects_inside_radius(toppos,0.75)
for _,ref in pairs(topattach) do
@@ -281,6 +281,7 @@ function celevator.drives.entity.nodestoentities(nodes,ename)
["celevator:incar_pi_entity"] = true,
["celevator:car_top_box"] = true,
["celevator:car_door"] = true,
+ ["celevator:tapehead"] = true,
}
if attachref:get_luaentity() and included[attachref:get_luaentity().name] then
table.insert(refs,attachref)
@@ -323,6 +324,11 @@ function celevator.drives.entity.entitiestonodes(refs,carid)
if not pos then ok = false end
end
if pos and ename == "celevator:car_moving" then
+ local rounded = {
+ ["celevator:car_top_box"] = true,
+ ["celevator:car_door"] = true,
+ ["celevator:tapehead"] = true,
+ }
for _,i in ipairs(minetest.get_objects_inside_radius(pos,0.9)) do
i:set_velocity(vector.new(0,0,0))
if i:is_player() then
@@ -331,7 +337,7 @@ function celevator.drives.entity.entitiestonodes(refs,carid)
if top then ppos.y = ppos.y+1.1 end
i:set_pos(ppos)
minetest.after(0.5,i.set_pos,i,ppos)
- elseif i:get_luaentity() and (i:get_luaentity().name == "celevator:car_top_box" or i:get_luaentity().name == "celevator:car_door") then
+ elseif i:get_luaentity() and rounded[i:get_luaentity().name] then
local epos = i:get_pos()
epos.y = math.floor(epos.y+0.5)
if i:get_luaentity() and i:get_luaentity().name == "celevator:car_top_box" then
diff --git a/textures/celevator_tapehead_front_dlm.png b/textures/celevator_tapehead_front_dlm.png
new file mode 100644
index 0000000..0c7bce9
--- /dev/null
+++ b/textures/celevator_tapehead_front_dlm.png
Binary files differ
diff --git a/textures/celevator_tapehead_front_dlm_dz.png b/textures/celevator_tapehead_front_dlm_dz.png
new file mode 100644
index 0000000..82fa62b
--- /dev/null
+++ b/textures/celevator_tapehead_front_dlm_dz.png
Binary files differ
diff --git a/textures/celevator_tapehead_front_off.png b/textures/celevator_tapehead_front_off.png
new file mode 100644
index 0000000..06dc330
--- /dev/null
+++ b/textures/celevator_tapehead_front_off.png
Binary files differ
diff --git a/textures/celevator_tapehead_front_ulm.png b/textures/celevator_tapehead_front_ulm.png
new file mode 100644
index 0000000..1e6eeac
--- /dev/null
+++ b/textures/celevator_tapehead_front_ulm.png
Binary files differ
diff --git a/textures/celevator_tapehead_front_ulm_dlm_dz.png b/textures/celevator_tapehead_front_ulm_dlm_dz.png
new file mode 100644
index 0000000..71855ee
--- /dev/null
+++ b/textures/celevator_tapehead_front_ulm_dlm_dz.png
Binary files differ
diff --git a/textures/celevator_tapehead_front_ulm_dz.png b/textures/celevator_tapehead_front_ulm_dz.png
new file mode 100644
index 0000000..2a757b3
--- /dev/null
+++ b/textures/celevator_tapehead_front_ulm_dz.png
Binary files differ
diff --git a/textures/celevator_tapehead_sides.png b/textures/celevator_tapehead_sides.png
new file mode 100644
index 0000000..edf0698
--- /dev/null
+++ b/textures/celevator_tapehead_sides.png
Binary files differ