diff options
author | cheapie <no-email-for-you@example.com> | 2023-08-12 23:36:00 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2023-08-12 23:36:00 -0500 |
commit | e35e98148acff3c7da7b9b70619ae625fef0bbef (patch) | |
tree | 0678a34b8aca08de95ab8219d6474fdd6176855a /car.lua | |
parent | a72dc1ff70cda30dcaa8ea23193795bee508bc9b (diff) | |
download | celevator-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.lua | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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, +}) |