From 4f04035bc45719872d07326599628429192bcc5b Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 13 Apr 2024 20:23:08 -0500 Subject: Add in-car switch panel and independent service, also fix a few bugs Switches for fire service phase 2 (not yet implemented) and car fan and light (no plans) are also available --- drive_entity.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drive_entity.lua') diff --git a/drive_entity.lua b/drive_entity.lua index b651538..d5b8287 100644 --- a/drive_entity.lua +++ b/drive_entity.lua @@ -484,6 +484,9 @@ function celevator.drives.entity.estop(pos) celevator.drives.entity.entitiestonodes(handles) stopbuzz(pos) motorsound(pos,"idle") + local carid = meta:get_int("carid") + if carid ~= 0 then celevator.drives.entity.sheavetonode(carid) end + minetest.after(0.25,celevator.drives.entity.updatecopformspec,pos) end @@ -800,7 +803,8 @@ function celevator.drives.entity.updatecopformspec(drivepos) if carid == 0 then return end local carinfo = minetest.deserialize(celevator.storage:get_string(string.format("car%d",carid))) if not carinfo then return end - local formspec = minetest.get_meta(carinfo.controllerpos):get_string("copformspec") + local copformspec = minetest.get_meta(carinfo.controllerpos):get_string("copformspec") + local switchformspec = minetest.get_meta(carinfo.controllerpos):get_string("switchformspec") local origin = minetest.string_to_pos(drivemeta:get_string("origin")) if not origin then minetest.log("error","[celevator] [entity drive] Invalid origin for drive at "..minetest.pos_to_string(drivepos)) @@ -814,7 +818,9 @@ function celevator.drives.entity.updatecopformspec(drivepos) local piecepos = minetest.get_position_from_hash(hash) local piece = minetest.get_node(piecepos) if piece.name == "celevator:car_010" then - minetest.get_meta(piecepos):set_string("formspec",formspec) + minetest.get_meta(piecepos):set_string("formspec",copformspec) + elseif piece.name == "celevator:car_000" then + minetest.get_meta(piecepos):set_string("formspec",switchformspec) end end end -- cgit v1.2.3