diff options
author | cheapie <no-email-for-you@example.com> | 2024-04-11 20:35:10 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2024-04-11 20:35:10 -0500 |
commit | b6dcb50bdcad37a9f7bc1f757e026423452fbea9 (patch) | |
tree | 7a37d287c6b5b28aed4760b531a607b32270a8af | |
parent | 5fa200dc576a8389f1ba237a301f339764b7a7a9 (diff) | |
download | celevator-b6dcb50bdcad37a9f7bc1f757e026423452fbea9.tar celevator-b6dcb50bdcad37a9f7bc1f757e026423452fbea9.tar.gz celevator-b6dcb50bdcad37a9f7bc1f757e026423452fbea9.tar.bz2 celevator-b6dcb50bdcad37a9f7bc1f757e026423452fbea9.tar.xz celevator-b6dcb50bdcad37a9f7bc1f757e026423452fbea9.zip |
Fix (hopefully) for falling out when the car stops
-rw-r--r-- | drive_entity.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drive_entity.lua b/drive_entity.lua index 4b6dff3..51407b7 100644 --- a/drive_entity.lua +++ b/drive_entity.lua @@ -244,12 +244,14 @@ function celevator.drives.entity.entitiestonodes(refs,carid) local ok = true for _,eref in ipairs(refs) do local pos = eref:get_pos() + local top = false if pos and (eref:get_luaentity().name == "celevator:car_moving" or eref:get_luaentity().name == "celevator:hwdoor_moving") then pos = vector.round(pos) local node = { name = eref:get_properties().wield_item, param2 = minetest.dir_to_fourdir(minetest.yaw_to_dir(eref:get_yaw())) } + if minetest.get_item_group(eref:get_properties().wield_item,"_connects_yp") ~= 1 then top = true end minetest.set_node(pos,node) eref:remove() if carid then minetest.get_meta(pos):set_int("carid",carid) end @@ -259,6 +261,14 @@ function celevator.drives.entity.entitiestonodes(refs,carid) else ok = false end + for _,i in ipairs(minetest.get_objects_inside_radius(pos,1)) do + if i:is_player() then + local ppos = i:get_pos() + if top then ppos.y = ppos.y+1 end + i:set_pos(ppos) + minetest.after(0.5,i.set_pos,i,ppos) + end + end end return ok end |