summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua102
1 files changed, 79 insertions, 23 deletions
diff --git a/init.lua b/init.lua
index ae4e2e4..3f5a0fd 100644
--- a/init.lua
+++ b/init.lua
@@ -8,7 +8,11 @@ local modes = {
name = "flashing_arrow_right",
desc = "Flashing Right Arrow",
texture = {
- name = "[combine:64x128:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_arrow3.png",
+ name = "[combine:64x128"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_arrow3.png",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
},
},
@@ -16,7 +20,11 @@ local modes = {
name = "flashing_arrow_left",
desc = "Flashing Left Arrow",
texture = {
- name = "[combine:64x128:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_arrow3.png^[transformFX",
+ name = "[combine:64x128"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_arrow3.png^[transformFX",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
},
},
@@ -24,7 +32,11 @@ local modes = {
name = "flashing_arrow_dual",
desc = "Flashing Dual Arrow",
texture = {
- name = "[combine:64x128:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_dualarrow.png",
+ name = "[combine:64x128"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_dualarrow.png",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
},
},
@@ -32,7 +44,15 @@ local modes = {
name = "seq_arrow_right",
desc = "Sequential Right Arrow",
texture = {
- name = "[combine:64x256:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_arrow1.png:0,128=arrowboards_bg.png:0,128=arrowboards_arrow2.png:0,192=arrowboards_bg.png:0,192=arrowboards_arrow3.png",
+ name = "[combine:64x256"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_arrow1.png"..
+ ":0,128=arrowboards_bg.png"..
+ ":0,128=arrowboards_arrow2.png"..
+ ":0,192=arrowboards_bg.png"..
+ ":0,192=arrowboards_arrow3.png",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 3},
},
},
@@ -40,7 +60,15 @@ local modes = {
name = "seq_arrow_left",
desc = "Sequential Left Arrow",
texture = {
- name = "[combine:64x256:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_arrow1.png:0,128=arrowboards_bg.png:0,128=arrowboards_arrow2.png:0,192=arrowboards_bg.png:0,192=arrowboards_arrow3.png^[transformFX",
+ name = "[combine:64x256"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_arrow1.png"..
+ ":0,128=arrowboards_bg.png"..
+ ":0,128=arrowboards_arrow2.png"..
+ ":0,192=arrowboards_bg.png"..
+ ":0,192=arrowboards_arrow3.png^[transformFX",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 3},
},
},
@@ -48,7 +76,15 @@ local modes = {
name = "seq_chevron_right",
desc = "Sequential Right Chevron",
texture = {
- name = "[combine:64x256:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_chevron1.png:0,128=arrowboards_bg.png:0,128=arrowboards_chevron2.png:0,192=arrowboards_bg.png:0,192=arrowboards_chevron3.png",
+ name = "[combine:64x256"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_chevron1.png"..
+ ":0,128=arrowboards_bg.png"..
+ ":0,128=arrowboards_chevron2.png"..
+ ":0,192=arrowboards_bg.png"..
+ ":0,192=arrowboards_chevron3.png",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 3},
},
},
@@ -56,7 +92,15 @@ local modes = {
name = "seq_chevron_left",
desc = "Sequential Left Chevron",
texture = {
- name = "[combine:64x256:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_chevron1.png:0,128=arrowboards_bg.png:0,128=arrowboards_chevron2.png:0,192=arrowboards_bg.png:0,192=arrowboards_chevron3.png^[transformFX",
+ name = "[combine:64x256"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_chevron1.png"..
+ ":0,128=arrowboards_bg.png"..
+ ":0,128=arrowboards_chevron2.png"..
+ ":0,192=arrowboards_bg.png"..
+ ":0,192=arrowboards_chevron3.png^[transformFX",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 3},
},
},
@@ -64,7 +108,11 @@ local modes = {
name = "flashing_caution_corners",
desc = "Flashing Caution (four corners)",
texture = {
- name = "[combine:64x128:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_caution1.png",
+ name = "[combine:64x128"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_caution1.png",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
},
},
@@ -72,7 +120,11 @@ local modes = {
name = "flashing_caution_line",
desc = "Flashing Caution (horizontal line)",
texture = {
- name = "[combine:64x128:0,0=arrowboards_bg.png:0,0=arrowboards_off.png:0,64=arrowboards_bg.png:0,64=arrowboards_caution2.png",
+ name = "[combine:64x128"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_off.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=arrowboards_caution2.png",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
},
},
@@ -80,18 +132,22 @@ local modes = {
name = "alternating_diamond_caution",
desc = "Alternating Diamond Caution",
texture = {
- name = "[combine:64x128:0,0=arrowboards_bg.png:0,0=arrowboards_caution3.png:0,64=arrowboards_bg.png:0,64=(arrowboards_caution3.png^[transformFX)",
+ name = "[combine:64x128"..
+ ":0,0=arrowboards_bg.png"..
+ ":0,0=arrowboards_caution3.png"..
+ ":0,64=arrowboards_bg.png"..
+ ":0,64=(arrowboards_caution3.png^[transformFX)",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
},
},
}
-for k,v in ipairs(modes) do
- minetest.register_node("arrowboards:"..v.name,{
+for _,mode in ipairs(modes) do
+ minetest.register_node("arrowboards:"..mode.name,{
paramtype = "light",
- paramtype2 = "facedir",
+ paramtype2 = "4dir",
groups = {not_in_creative_inventory=1},
- tiles = {"arrowboards_bg.png^[transformFY","arrowboards_bg.png","arrowboards_bg.png","arrowboards_bg.png","arrowboards_bg.png",v.texture},
+ tiles = {"arrowboards_bg.png^[transformFY","arrowboards_bg.png","arrowboards_bg.png","arrowboards_bg.png","arrowboards_bg.png",mode.texture},
drawtype = "nodebox",
light_source = 4,
node_box = {
@@ -114,7 +170,7 @@ end
minetest.register_node("arrowboards:base",{
description = "Arrow Board",
paramtype = "light",
- paramtype2 = "facedir",
+ paramtype2 = "4dir",
groups = {dig_immediate=2},
tiles = {"arrowboards_base.png"},
inventory_image = "arrowboards_inv.png",
@@ -145,26 +201,26 @@ minetest.register_node("arrowboards:base",{
fs = fs..";1]"
meta:set_string("formspec",fs)
end,
- on_receive_fields = function(pos,formname,fields,sender)
+ on_receive_fields = function(pos,_,fields,sender)
local name = sender:get_player_name()
if fields.quit or not fields.mode then return end
if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
minetest.record_protection_violation(pos,name)
return
end
- for k,v in ipairs(modes) do
- if fields.mode == v.desc then
+ for modenum,mode in ipairs(modes) do
+ if fields.mode == mode.desc then
local meta = minetest.get_meta(pos)
local fs = "size[4,1]dropdown[0,0;4;mode;"
for _,v in ipairs(modes) do
fs = fs..v.desc..","
end
fs = string.sub(fs,1,-2)
- fs = fs..";"..k.."]"
+ fs = fs..";"..modenum.."]"
meta:set_string("formspec",fs)
pos.y = pos.y + 1
local node = minetest.get_node(pos)
- node.name = "arrowboards:"..v.name
+ node.name = "arrowboards:"..mode.name
minetest.set_node(pos,node)
end
end
@@ -200,18 +256,18 @@ minetest.register_node("arrowboards:base",{
end
end,
on_rotate = function(pos,node,user,mode,new_param2)
- if not screwdriver then
+ if not minetest.global_exists("screwdriver") then
return false
end
local ret = screwdriver.rotate_simple(pos,node,user,mode,new_param2)
- minetest.after(0,function(pos)
+ minetest.after(0,function()
local newnode = minetest.get_node(pos)
local param2 = newnode.param2
pos.y = pos.y + 1
local topnode = minetest.get_node(pos)
topnode.param2 = param2
minetest.set_node(pos,topnode)
- end,pos)
+ end)
return ret
end,
})