summaryrefslogtreecommitdiff
path: root/car.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2023-08-12 23:36:00 -0500
committercheapie <no-email-for-you@example.com>2023-08-12 23:36:00 -0500
commite35e98148acff3c7da7b9b70619ae625fef0bbef (patch)
tree0678a34b8aca08de95ab8219d6474fdd6176855a /car.lua
parenta72dc1ff70cda30dcaa8ea23193795bee508bc9b (diff)
downloadcelevator-e35e98148acff3c7da7b9b70619ae625fef0bbef.tar
celevator-e35e98148acff3c7da7b9b70619ae625fef0bbef.tar.gz
celevator-e35e98148acff3c7da7b9b70619ae625fef0bbef.tar.bz2
celevator-e35e98148acff3c7da7b9b70619ae625fef0bbef.tar.xz
celevator-e35e98148acff3c7da7b9b70619ae625fef0bbef.zip
Initial in-car PI work
PI is now spawned and moves with the car, no actual display yet
Diffstat (limited to 'car.lua')
-rw-r--r--car.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/car.lua b/car.lua
index a391bf7..5ce2983 100644
--- a/car.lua
+++ b/car.lua
@@ -367,3 +367,26 @@ function celevator.car.spawncar(origin,yaw)
end
end
end
+
+minetest.register_abm({
+ label = "Respawn in-car PI displays",
+ nodenames = {"celevator:car_020"},
+ interval = 1,
+ chance = 1,
+ action = function(pos)
+ local entitiesnearby = minetest.get_objects_inside_radius(pos,0.5)
+ for _,i in pairs(entitiesnearby) do
+ if i:get_luaentity() and i:get_luaentity().name == "celevator:incar_pi_entity" then
+ return
+ end
+ end
+ local entity = minetest.add_entity(pos,"celevator:incar_pi_entity")
+ local fdir = vector.rotate_around_axis(minetest.facedir_to_dir(minetest.get_node(pos).param2),vector.new(0,1,0),math.pi/2)
+ local etex = celevator.pi.generatetexture(" --",false,false,false,true)
+ entity:set_properties({
+ textures = {etex},
+ })
+ entity:set_yaw(minetest.dir_to_yaw(fdir))
+ entity:set_pos(vector.add(pos,vector.multiply(fdir,0.44)))
+ end,
+})