diff options
author | cheapie <no-email-for-you@example.com> | 2025-03-16 10:01:15 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2025-03-16 10:01:15 -0500 |
commit | fc3a3430f635d29af24af1aa3788199668be1376 (patch) | |
tree | f7d33adfe95e4e1a3c4c9d93d71a058b25df54b5 /drive_entity.lua | |
parent | b797f8eb6cb73a370e6132e21afd5c1d2e70fdf3 (diff) | |
download | celevator-fc3a3430f635d29af24af1aa3788199668be1376.tar celevator-fc3a3430f635d29af24af1aa3788199668be1376.tar.gz celevator-fc3a3430f635d29af24af1aa3788199668be1376.tar.bz2 celevator-fc3a3430f635d29af24af1aa3788199668be1376.tar.xz celevator-fc3a3430f635d29af24af1aa3788199668be1376.zip |
Add steel doors
Diffstat (limited to 'drive_entity.lua')
-rw-r--r-- | drive_entity.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drive_entity.lua b/drive_entity.lua index cf823c5..2f3b580 100644 --- a/drive_entity.lua +++ b/drive_entity.lua @@ -406,8 +406,10 @@ function celevator.drives.entity.step(dtime) local carparam2 = celevator.get_node(nodes[1]).param2 local cardef = minetest.registered_nodes[celevator.get_node(nodes[1]).name] or {} local cartype = cardef._celevator_car_type or "standard" + local carmeta = celevator.get_meta(startv) meta:set_int("carparam2",carparam2) meta:set_string("cartype",cartype) + meta:set_string("doortype",carmeta:get_string("doortype")) local handles = celevator.drives.entity.nodestoentities(nodes) celevator.drives.entity.entityinfo[hash] = { handles = handles, @@ -444,10 +446,15 @@ function celevator.drives.entity.step(dtime) motorsound(pos,"idle") celevator.drives.entity.sheavetonode(carid) local ok = celevator.drives.entity.entitiestonodes(handles,carid) + local doortype = meta:get_string("doortype") + if (not doortype) or doortype == "" then doortype = "glass" end + local spawnpos = vector.round(vector.add(origin,vector.new(0,apos,0))) if not ok then local carparam2 = meta:get_int("carparam2") local cartype = meta:get_string("cartype") - celevator.car.spawncar(vector.round(vector.add(origin,vector.new(0,apos,0))),minetest.dir_to_yaw(minetest.fourdir_to_dir(carparam2)),carid,cartype) + celevator.car.spawncar(spawnpos,minetest.dir_to_yaw(minetest.fourdir_to_dir(carparam2)),carid,cartype,doortype) + else + celevator.get_meta(spawnpos):set_string("doortype",doortype) end apos = math.floor(apos+0.5) minetest.after(0.25,celevator.drives.entity.updatecopformspec,pos) @@ -494,7 +501,10 @@ function celevator.drives.entity.step(dtime) celevator.drives.entity.sheavetonode(carid) local carparam2 = meta:get_int("carparam2") local cartype = meta:get_string("cartype") - celevator.car.spawncar(vector.round(vector.add(origin,vector.new(0,apos,0))),minetest.dir_to_yaw(minetest.fourdir_to_dir(carparam2)),carid,cartype) + local doortype = meta:get_string("doortype") + if (not doortype) or doortype == "" then doortype = "glass" end + local spawnpos = vector.round(vector.add(origin,vector.new(0,apos,0))) + celevator.car.spawncar(spawnpos,minetest.dir_to_yaw(minetest.fourdir_to_dir(carparam2)),carid,cartype,doortype) apos = math.floor(apos+0.5) minetest.after(0.25,celevator.drives.entity.updatecopformspec,pos) table.remove(entitydrives_running,i) |