summaryrefslogtreecommitdiff
path: root/car.lua
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2023-08-08 22:16:42 -0500
committercheapie <no-email-for-you@example.com>2023-08-08 22:16:42 -0500
commit08cbd3adfe523ae8ad4e7263f11ff5ae1d521230 (patch)
treee9881649c7e2f78dcb5a7c16971455906019853a /car.lua
parentca33ea9d98cbf6dbd5afa668ce676ba0d9064632 (diff)
downloadcelevator-08cbd3adfe523ae8ad4e7263f11ff5ae1d521230.tar
celevator-08cbd3adfe523ae8ad4e7263f11ff5ae1d521230.tar.gz
celevator-08cbd3adfe523ae8ad4e7263f11ff5ae1d521230.tar.bz2
celevator-08cbd3adfe523ae8ad4e7263f11ff5ae1d521230.tar.xz
celevator-08cbd3adfe523ae8ad4e7263f11ff5ae1d521230.zip
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.
Diffstat (limited to 'car.lua')
-rw-r--r--car.lua24
1 files changed, 23 insertions, 1 deletions
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