From 08cbd3adfe523ae8ad4e7263f11ff5ae1d521230 Mon Sep 17 00:00:00 2001 From: cheapie Date: Tue, 8 Aug 2023 22:16:42 -0500 Subject: Add initial car motion functionality Place a machine (no texture yet) above the car somewhere when the car is at the lowest floor, then pair it to the drive with the pairing tool. Not much error checking yet, it'll probably crash if you do anything weird. --- car.lua | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'car.lua') diff --git a/car.lua b/car.lua index c89015e..5211ecb 100644 --- a/car.lua +++ b/car.lua @@ -314,11 +314,33 @@ local pieces = { for _,def in ipairs(pieces) do def.groups = { dig_immediate = 2, + _celevator_car = 1, } + local xp = tonumber(string.sub(def._position,1,1)) + local yp = tonumber(string.sub(def._position,2,2)) + local zp = tonumber(string.sub(def._position,3,3)) + if xp > 0 then + def.groups._connects_xm = 1 + end + if xp < 1 then + def.groups._connects_xp = 1 + end + if yp > 0 then + def.groups._connects_ym = 1 + end + if yp < 2 then + def.groups._connects_yp = 1 + end + if zp > 0 then + def.groups._connects_zm = 1 + end + if zp < 2 then + def.groups._connects_zp = 1 + end def.paramtype = "light" def.paramtype2 = "4dir" def.drawtype = "nodebox" def.description = "Car "..def._position - def.light_source = minetest.LIGHT_MAX + def.light_source = 9 minetest.register_node("celevator:car_"..def._position,def) end -- cgit v1.2.3