summaryrefslogtreecommitdiff
path: root/car.lua
diff options
context:
space:
mode:
Diffstat (limited to 'car.lua')
-rw-r--r--car.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/car.lua b/car.lua
index 61937fc..5549f53 100644
--- a/car.lua
+++ b/car.lua
@@ -301,6 +301,21 @@ local pieces = {
if carid == 0 then return end
local carinfo = minetest.deserialize(celevator.storage:get_string(string.format("car%d",carid)))
if not (carinfo and carinfo.controllerpos) then return end
+ if control == "inspectswitch" then
+ local boxpos = vector.add(pos,vector.new(0,1,0))
+ local erefs = minetest.get_objects_inside_radius(boxpos,0.5)
+ for _,ref in pairs(erefs) do
+ if ref:get_luaentity().name == "celevator:car_top_box" then
+ local state = ref:get_properties().wield_item
+ if state == "celevator:car_top_box_off" then
+ state = "celevator:car_top_box_on"
+ elseif state == "celevator:car_top_box_on" then
+ state = "celevator:car_top_box_off"
+ end
+ ref:set_properties({wield_item = state})
+ end
+ end
+ end
celevator.controller.handlecartopbox(carinfo.controllerpos,control)
end,
after_dig_node = function(pos)