summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE24
-rw-r--r--depends.txt0
-rw-r--r--init.lua224
-rw-r--r--textures/arrowboards_arrow1.pngbin0 -> 244 bytes
-rw-r--r--textures/arrowboards_arrow2.pngbin0 -> 245 bytes
-rw-r--r--textures/arrowboards_arrow3.pngbin0 -> 242 bytes
-rw-r--r--textures/arrowboards_base.pngbin0 -> 6485 bytes
-rw-r--r--textures/arrowboards_bg.pngbin0 -> 4552 bytes
-rw-r--r--textures/arrowboards_caution1.pngbin0 -> 241 bytes
-rw-r--r--textures/arrowboards_caution2.pngbin0 -> 229 bytes
-rw-r--r--textures/arrowboards_caution3.pngbin0 -> 243 bytes
-rw-r--r--textures/arrowboards_chevron1.pngbin0 -> 244 bytes
-rw-r--r--textures/arrowboards_chevron2.pngbin0 -> 250 bytes
-rw-r--r--textures/arrowboards_chevron3.pngbin0 -> 246 bytes
-rw-r--r--textures/arrowboards_dualarrow.pngbin0 -> 249 bytes
-rw-r--r--textures/arrowboards_inv.pngbin0 -> 1442 bytes
-rw-r--r--textures/arrowboards_off.pngbin0 -> 214 bytes
17 files changed, 248 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..68a49da
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
diff --git a/depends.txt b/depends.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/depends.txt
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..0d35b8e
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,224 @@
+local modes = {
+ {
+ name = "off",
+ desc = "Off",
+ texture = "arrowboards_bg.png^arrowboards_off.png",
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
+ },
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
+ },
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
+ },
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 3},
+ },
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 3},
+ },
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 3},
+ },
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 3},
+ },
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
+ },
+ },
+ {
+ 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",
+ animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 1.5},
+ },
+ },
+ {
+ 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)",
+ 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,{
+ paramtype = "light",
+ paramtype2 = "facedir",
+ 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},
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.04,-0.5,0.5,0.5,-0.4}, --Display
+ {-0.4,-0.5,-0.5,-0.3,-0.04,-0.4}, --Left Pole
+ {0.4,-0.5,-0.5,0.3,-0.04,-0.4}, --Right Pole
+ },
+ },
+ selection_box = {
+ type = "fixed",
+ fixed = {
+ {0,0,0,0,0,0},
+ },
+ },
+ })
+end
+
+minetest.register_node("arrowboards:base",{
+ description = "Arrow Board",
+ paramtype = "light",
+ paramtype2 = "facedir",
+ groups = {dig_immediate=2},
+ tiles = {"arrowboards_base.png"},
+ inventory_image = "arrowboards_inv.png",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.5,-0.5,0.5,-0.25,0.5}, --Base
+ {-0.4,-0.25,-0.5,-0.3,0.5,-0.4}, --Left Pole
+ {0.4,-0.25,-0.5,0.3,0.5,-0.4}, --Right Pole
+ },
+ },
+ selection_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.5,-0.5,0.5,-0.25,0.5}, --Base
+ {-0.5,-0.25,-0.5,0.5,1.5,-0.4}, -- The Rest
+ },
+ },
+ on_construct = function(pos)
+ 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..";1]"
+ meta:set_string("formspec",fs)
+ end,
+ on_receive_fields = function(pos,formname,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
+ 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.."]"
+ meta:set_string("formspec",fs)
+ pos.y = pos.y + 1
+ local node = minetest.get_node(pos)
+ node.name = "arrowboards:"..v.name
+ minetest.set_node(pos,node)
+ end
+ end
+ end,
+ --Some of this might be "borrowed" from the LTC-4000E :P
+ after_place_node = function(pos,placer)
+ local node = minetest.get_node(pos)
+ local toppos = {x=pos.x,y=pos.y + 1,z=pos.z}
+ local topnode = minetest.get_node(toppos)
+ local placername = placer:get_player_name()
+ if topnode.name ~= "air" then
+ if placer:is_player() then
+ minetest.chat_send_player(placername,"Can't place arrow board - no room for the top half!")
+ end
+ minetest.set_node(pos,{name="air"})
+ return true
+ end
+ if minetest.is_protected(toppos,placername) and not minetest.check_player_privs(placername,{protection_bypass=true}) then
+ if placer:is_player() then
+ minetest.chat_send_player(placername,"Can't place arrow board - top half is protected!")
+ minetest.record_protection_violation(toppos,placername)
+ end
+ minetest.set_node(pos,{name="air"})
+ return true
+ end
+ node.name = "arrowboards:off"
+ minetest.set_node(toppos,node)
+ end,
+ on_destruct = function(pos)
+ pos.y = pos.y + 1
+ if string.sub(minetest.get_node(pos).name,1,12) == "arrowboards:" then
+ minetest.set_node(pos,{name="air"})
+ end
+ end,
+ on_rotate = function(pos,node,user,mode,new_param2)
+ if not screwdriver then
+ return false
+ end
+ local ret = screwdriver.rotate_simple(pos,node,user,mode,new_param2)
+ minetest.after(0,function(pos)
+ 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)
+ return ret
+ end,
+})
+
+minetest.register_craft({
+ output = "arrowboards:base",
+ recipe = {
+ {"mesecons_lightstone:lightstone_yellow_off","mesecons_luacontroller:luacontroller0000","mesecons_lightstone:lightstone_yellow_off"},
+ {"mesecons_lightstone:lightstone_yellow_off","default:steel_ingot","mesecons_lightstone:lightstone_yellow_off"},
+ {"default:steel_ingot","default:steel_ingot","default:steel_ingot"},
+ },
+})
diff --git a/textures/arrowboards_arrow1.png b/textures/arrowboards_arrow1.png
new file mode 100644
index 0000000..783fcd5
--- /dev/null
+++ b/textures/arrowboards_arrow1.png
Binary files differ
diff --git a/textures/arrowboards_arrow2.png b/textures/arrowboards_arrow2.png
new file mode 100644
index 0000000..113cf72
--- /dev/null
+++ b/textures/arrowboards_arrow2.png
Binary files differ
diff --git a/textures/arrowboards_arrow3.png b/textures/arrowboards_arrow3.png
new file mode 100644
index 0000000..4c7dc9f
--- /dev/null
+++ b/textures/arrowboards_arrow3.png
Binary files differ
diff --git a/textures/arrowboards_base.png b/textures/arrowboards_base.png
new file mode 100644
index 0000000..f3b6759
--- /dev/null
+++ b/textures/arrowboards_base.png
Binary files differ
diff --git a/textures/arrowboards_bg.png b/textures/arrowboards_bg.png
new file mode 100644
index 0000000..6657225
--- /dev/null
+++ b/textures/arrowboards_bg.png
Binary files differ
diff --git a/textures/arrowboards_caution1.png b/textures/arrowboards_caution1.png
new file mode 100644
index 0000000..fec7d8f
--- /dev/null
+++ b/textures/arrowboards_caution1.png
Binary files differ
diff --git a/textures/arrowboards_caution2.png b/textures/arrowboards_caution2.png
new file mode 100644
index 0000000..b2e8d93
--- /dev/null
+++ b/textures/arrowboards_caution2.png
Binary files differ
diff --git a/textures/arrowboards_caution3.png b/textures/arrowboards_caution3.png
new file mode 100644
index 0000000..2214ff0
--- /dev/null
+++ b/textures/arrowboards_caution3.png
Binary files differ
diff --git a/textures/arrowboards_chevron1.png b/textures/arrowboards_chevron1.png
new file mode 100644
index 0000000..dead36b
--- /dev/null
+++ b/textures/arrowboards_chevron1.png
Binary files differ
diff --git a/textures/arrowboards_chevron2.png b/textures/arrowboards_chevron2.png
new file mode 100644
index 0000000..a180c4b
--- /dev/null
+++ b/textures/arrowboards_chevron2.png
Binary files differ
diff --git a/textures/arrowboards_chevron3.png b/textures/arrowboards_chevron3.png
new file mode 100644
index 0000000..bb9736a
--- /dev/null
+++ b/textures/arrowboards_chevron3.png
Binary files differ
diff --git a/textures/arrowboards_dualarrow.png b/textures/arrowboards_dualarrow.png
new file mode 100644
index 0000000..dd1d8fc
--- /dev/null
+++ b/textures/arrowboards_dualarrow.png
Binary files differ
diff --git a/textures/arrowboards_inv.png b/textures/arrowboards_inv.png
new file mode 100644
index 0000000..3155019
--- /dev/null
+++ b/textures/arrowboards_inv.png
Binary files differ
diff --git a/textures/arrowboards_off.png b/textures/arrowboards_off.png
new file mode 100644
index 0000000..6cb129e
--- /dev/null
+++ b/textures/arrowboards_off.png
Binary files differ