From 7480f644e291f651ff9fa04b77308f824e215b09 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Tue, 27 May 2014 18:53:36 +0200 Subject: make signs more flexible and easier to add new ones --- roadsigns/init.lua | 2 ++ roadsigns/workshop.lua | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'roadsigns') diff --git a/roadsigns/init.lua b/roadsigns/init.lua index 96646b3..73401fa 100644 --- a/roadsigns/init.lua +++ b/roadsigns/init.lua @@ -1,5 +1,7 @@ --[[ StreetsMod: Poles and signs ]] +streets.workshop = {} + dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/signs.lua") dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/workshop.lua") \ No newline at end of file diff --git a/roadsigns/workshop.lua b/roadsigns/workshop.lua index 815b9ff..b693222 100644 --- a/roadsigns/workshop.lua +++ b/roadsigns/workshop.lua @@ -45,6 +45,16 @@ local forms = { -- } } + +streets.workshop.signs = {} +minetest.after(0, function() + for k, v in pairs(minetest.registered_nodes) do + if v.streets and v.streets.signworkshop then + table.insert(streets.workshop.signs, k) + end + end +end) + minetest.register_node(":streets:signworkshop",{ description = streets.S("Sign workshop"), tiles = {"streets_signworkshop_top.png","streets_signworkshop_bottom.png","streets_signworkshop_side.png","streets_signworkshop_side.png","streets_signworkshop_side.png","streets_signworkshop_front.png"}, @@ -60,10 +70,9 @@ minetest.register_node(":streets:signworkshop",{ inv:set_size("streets:signworkshop_select",1*1) inv:set_size("streets:signworkshop_output",1*1) -- Fill - inv:add_item("streets:signworkshop_list","streets:sign_blank") - inv:add_item("streets:signworkshop_list","streets:sign_lava") - inv:add_item("streets:signworkshop_list","streets:sign_water") - inv:add_item("streets:signworkshop_list","streets:sign_construction") + for k, v in pairs(streets.workshop.signs) do + inv:add_item("streets:signworkshop_list", v) + end -- Meta meta:set_string("infotext",streets.S("Sign workshop idle")) meta:set_string("idle","y") -- cgit v1.2.3