From 81abbed3eb4a5a745c96efe8179d0cc3accff299 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Sun, 13 Oct 2013 12:33:14 +0200 Subject: Changed drawtype to nodebox --- roadsigns/signs.lua | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'roadsigns') diff --git a/roadsigns/signs.lua b/roadsigns/signs.lua index a73b294..0a3ecf4 100644 --- a/roadsigns/signs.lua +++ b/roadsigns/signs.lua @@ -5,7 +5,13 @@ if streets.extendedBy.bucket == true and streets.extendedBy.wool then inventory_image = "streets_sign_lava.png", wield_image = "streets_sign_lava.png", groups = {snappy = 1,attached_node = 1}, - drawtype = "signlike", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + fixed = { + {-0.4,-0.5,-0.4,0.4,-0.4,0.4} + } + }, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -33,7 +39,13 @@ if streets.extendedBy.bucket == true and streets.extendedBy.wool then inventory_image = "streets_sign_water.png", wield_image = "streets_sign_water.png", groups = {snappy = 1,attached_node = 1}, - drawtype = "signlike", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + fixed = { + {-0.4,-0.5,-0.4,0.4,-0.4,0.4} + } + }, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -61,7 +73,13 @@ if streets.extendedBy.bucket == true and streets.extendedBy.wool then inventory_image = "streets_sign_construction.png", wield_image = "streets_sign_construction.png", groups = {snappy = 1,attached_node = 1}, - drawtype = "signlike", + drawtype = "nodebox", + node_box = { + type = "wallmounted", + fixed = { + {-0.4,-0.5,-0.4,0.4,-0.4,0.4} + } + }, paramtype = "light", paramtype2 = "wallmounted", walkable = false, -- cgit v1.2.3 From 52b2ae9334403d49103f38d6007f643b52a131f6 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Mon, 14 Oct 2013 12:02:09 +0200 Subject: Signs available in creative mode --- roadsigns/signs.lua | 182 ++++++++++++++++++++++++++-------------------------- 1 file changed, 90 insertions(+), 92 deletions(-) (limited to 'roadsigns') diff --git a/roadsigns/signs.lua b/roadsigns/signs.lua index 0a3ecf4..9010691 100644 --- a/roadsigns/signs.lua +++ b/roadsigns/signs.lua @@ -1,99 +1,97 @@ -if streets.extendedBy.bucket == true and streets.extendedBy.wool then - minetest.register_node(":streets:sign_lava",{ - description = "Warning sign (lava)", - tiles = {"streets_sign_lava.png"}, - inventory_image = "streets_sign_lava.png", - wield_image = "streets_sign_lava.png", - groups = {snappy = 1,attached_node = 1}, - drawtype = "nodebox", - node_box = { - type = "wallmounted", - fixed = { - {-0.4,-0.5,-0.4,0.4,-0.4,0.4} - } - }, - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = { - type = "wallmounted" +minetest.register_node(":streets:sign_lava",{ + description = "Warning sign (lava)", + tiles = {"streets_sign_lava.png"}, + inventory_image = "streets_sign_lava.png", + wield_image = "streets_sign_lava.png", + groups = {snappy = 1,attached_node = 1}, + drawtype = "nodebox", + node_box = { + type = "wallmounted", + fixed = { + {-0.4,-0.5,-0.4,0.4,-0.4,0.4} } - }) - - minetest.register_craft({ - output = "streets:sign_lava 2", - recipe = { - {"wool:red","wool:red","wool:red"}, - {"wool:red","bucket:bucket_lava","wool:red"}, - {"wool:red","wool:red","wool:red"} - }, - replacements = { - {"bucket:bucket_lava", "bucket:bucket_empty"} + }, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "wallmounted" } - }) +}) + +minetest.register_craft({ + output = "streets:sign_lava 2", + recipe = { + {"wool:red","wool:red","wool:red"}, + {"wool:red","bucket:bucket_lava","wool:red"}, + {"wool:red","wool:red","wool:red"} + }, + replacements = { + {"bucket:bucket_lava", "bucket:bucket_empty"} + } +}) - minetest.register_node(":streets:sign_water",{ - description = "Warning sign (water)", - tiles = {"streets_sign_water.png"}, - inventory_image = "streets_sign_water.png", - wield_image = "streets_sign_water.png", - groups = {snappy = 1,attached_node = 1}, - drawtype = "nodebox", - node_box = { - type = "wallmounted", - fixed = { - {-0.4,-0.5,-0.4,0.4,-0.4,0.4} - } - }, - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = { - type = "wallmounted" +minetest.register_node(":streets:sign_water",{ + description = "Warning sign (water)", + tiles = {"streets_sign_water.png"}, + inventory_image = "streets_sign_water.png", + wield_image = "streets_sign_water.png", + groups = {snappy = 1,attached_node = 1}, + drawtype = "nodebox", + node_box = { + type = "wallmounted", + fixed = { + {-0.4,-0.5,-0.4,0.4,-0.4,0.4} } - }) + }, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "wallmounted" + } +}) - minetest.register_craft({ - output = "streets:sign_water 2", - recipe = { - {"wool:red","wool:red","wool:red"}, - {"wool:red","bucket:bucket_water","wool:red"}, - {"wool:red","wool:red","wool:red"} - }, - replacements = { - {"bucket:bucket_water", "bucket:bucket_empty"} - } - }) +minetest.register_craft({ + output = "streets:sign_water 2", + recipe = { + {"wool:red","wool:red","wool:red"}, + {"wool:red","bucket:bucket_water","wool:red"}, + {"wool:red","wool:red","wool:red"} + }, + replacements = { + {"bucket:bucket_water", "bucket:bucket_empty"} + } +}) - minetest.register_node(":streets:sign_construction",{ - description = "Warning sign (Construction area)", - tiles = {"streets_sign_construction.png"}, - inventory_image = "streets_sign_construction.png", - wield_image = "streets_sign_construction.png", - groups = {snappy = 1,attached_node = 1}, - drawtype = "nodebox", - node_box = { - type = "wallmounted", - fixed = { - {-0.4,-0.5,-0.4,0.4,-0.4,0.4} - } - }, - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - sunlight_propagates = true, - selection_box = { - type = "wallmounted" - } - }) - minetest.register_craft({ - output = "streets:sign_construction 2", - recipe = { - {"wool:red","wool:red","wool:red"}, - {"wool:red","default:shovel_steel","wool:red"}, - {"wool:red","wool:red","wool:red"} +minetest.register_node(":streets:sign_construction",{ + description = "Warning sign (Construction area)", + tiles = {"streets_sign_construction.png"}, + inventory_image = "streets_sign_construction.png", + wield_image = "streets_sign_construction.png", + groups = {snappy = 1,attached_node = 1}, + drawtype = "nodebox", + node_box = { + type = "wallmounted", + fixed = { + {-0.4,-0.5,-0.4,0.4,-0.4,0.4} } - }) -end \ No newline at end of file + }, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "wallmounted" + } +}) +minetest.register_craft({ + output = "streets:sign_construction 2", + recipe = { + {"wool:red","wool:red","wool:red"}, + {"wool:red","default:shovel_steel","wool:red"}, + {"wool:red","wool:red","wool:red"} + } +}) \ No newline at end of file -- cgit v1.2.3 From 761e23f88221f74c89299105d0a9920205ebba33 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Mon, 14 Oct 2013 19:30:49 +0200 Subject: Removed craft recipes --- roadsigns/signs.lua | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'roadsigns') diff --git a/roadsigns/signs.lua b/roadsigns/signs.lua index 9010691..70959cd 100644 --- a/roadsigns/signs.lua +++ b/roadsigns/signs.lua @@ -19,18 +19,6 @@ minetest.register_node(":streets:sign_lava",{ type = "wallmounted" } }) - -minetest.register_craft({ - output = "streets:sign_lava 2", - recipe = { - {"wool:red","wool:red","wool:red"}, - {"wool:red","bucket:bucket_lava","wool:red"}, - {"wool:red","wool:red","wool:red"} - }, - replacements = { - {"bucket:bucket_lava", "bucket:bucket_empty"} - } -}) minetest.register_node(":streets:sign_water",{ description = "Warning sign (water)", @@ -54,18 +42,6 @@ minetest.register_node(":streets:sign_water",{ } }) -minetest.register_craft({ - output = "streets:sign_water 2", - recipe = { - {"wool:red","wool:red","wool:red"}, - {"wool:red","bucket:bucket_water","wool:red"}, - {"wool:red","wool:red","wool:red"} - }, - replacements = { - {"bucket:bucket_water", "bucket:bucket_empty"} - } -}) - minetest.register_node(":streets:sign_construction",{ description = "Warning sign (Construction area)", tiles = {"streets_sign_construction.png"}, @@ -86,12 +62,4 @@ minetest.register_node(":streets:sign_construction",{ selection_box = { type = "wallmounted" } -}) -minetest.register_craft({ - output = "streets:sign_construction 2", - recipe = { - {"wool:red","wool:red","wool:red"}, - {"wool:red","default:shovel_steel","wool:red"}, - {"wool:red","wool:red","wool:red"} - } }) \ No newline at end of file -- cgit v1.2.3 From 64ef3a5507eb8c729b2b749c574320f0627f2195 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Mon, 14 Oct 2013 19:31:17 +0200 Subject: Started developement of a sign 'workshop' --- roadsigns/init.lua | 3 ++- roadsigns/workshop.lua | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 roadsigns/workshop.lua (limited to 'roadsigns') diff --git a/roadsigns/init.lua b/roadsigns/init.lua index 4985694..38e8692 100644 --- a/roadsigns/init.lua +++ b/roadsigns/init.lua @@ -2,4 +2,5 @@ StreetsMod: Poles and signs ]] dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/pole.lua") -dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/signs.lua") \ No newline at end of file +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 new file mode 100644 index 0000000..a71eeda --- /dev/null +++ b/roadsigns/workshop.lua @@ -0,0 +1,30 @@ +--[[ + StreetsMod: Create signs in the signworkshop +]] +minetest.register_node(":streets:signworkshop",{ + description = "Sign workshop", + tiles = {}, + groups = {cracky = 1, level = 2}, + after_place_node = function(pos) + minetest.get_meta(pos):set_string("formspec",table.concat({ + "size[12,10]", + "label[3.5,0;Sign workshop - Create signs for your roads!]", + "label[0,0.5;Available signs:]", + "list[context;streets:signworkshop_list;0,1;5,4]", + "label[9,0.5;Needed stuff:]", + "list[context;streets:signworkshop_recipe;8,1;4,1]", + "label[9,2;Put it here:]", + "list[context;streets:signworkshop_input;8,3;4,1]", + "list[current_player;main;2,6;8,4]" + })) + local inv = minetest.get_inventory({type = "node", pos = pos}) + inv:set_size("streets:signworkshop_list",5*4) + inv:set_size("streets:signworkshop_recipe",3*2) + inv:set_size("streets:signworkshop_input",4*1) + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + if to_list ~= "x" then + + end + end, +}) \ No newline at end of file -- cgit v1.2.3 From a776532a30dd80560a26d77ef9ea53848ba76ba7 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Mon, 14 Oct 2013 19:57:41 +0200 Subject: Some more code --- roadsigns/workshop.lua | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'roadsigns') diff --git a/roadsigns/workshop.lua b/roadsigns/workshop.lua index a71eeda..939c570 100644 --- a/roadsigns/workshop.lua +++ b/roadsigns/workshop.lua @@ -15,16 +15,46 @@ minetest.register_node(":streets:signworkshop",{ "list[context;streets:signworkshop_recipe;8,1;4,1]", "label[9,2;Put it here:]", "list[context;streets:signworkshop_input;8,3;4,1]", - "list[current_player;main;2,6;8,4]" + "button[8,4;2,1;streets:signworkshop_send;Start!]", + "label[5.8,0.5;Selected:]", + "list[context;streets:signworkshop_select;6,1;1,1]", + "label[5.8,2.5;Output:]", + "list[context;streets:signworkshop_output;6,3;1,1]", + "list[current_player;main;2,6;8,4]", })) local inv = minetest.get_inventory({type = "node", pos = pos}) inv:set_size("streets:signworkshop_list",5*4) inv:set_size("streets:signworkshop_recipe",3*2) inv:set_size("streets:signworkshop_input",4*1) + inv:set_size("streets:signworkshop_select",1*1) + inv:set_size("streets:signworkshop_output",1*1) + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if listname ~= "streets:signworkshop_input" then + return 0 + else + return 1 + end end, allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - if to_list ~= "x" then - + if to_list == "streets:signworkshop_input" and from_list == "streets:signworkshop_input" then + return 1 + else + return 0 + end + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if listname == "streets:signworkshop_input" or listname == "streets:signworkshop_output" then + return 99 + else + return 0 end end, + on_receive_fields = function(pos, formname, fields, sender) + local inv = minetest.get_inventory({type = "node", pos = pos}) + -- + if inv:is_emtpy("streets:signworkshop_input") ~= true then + + end + end }) \ No newline at end of file -- cgit v1.2.3 From 3646ecaa4b0062bc7a24fb9960e85dd719e69aaf Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Tue, 15 Oct 2013 10:32:37 +0200 Subject: Display recipe and validate input --- roadsigns/signs.lua | 33 +++++++++++++++++++++++++++++++++ roadsigns/workshop.lua | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 2 deletions(-) (limited to 'roadsigns') diff --git a/roadsigns/signs.lua b/roadsigns/signs.lua index 70959cd..0b01ff5 100644 --- a/roadsigns/signs.lua +++ b/roadsigns/signs.lua @@ -1,3 +1,30 @@ +minetest.register_node(":streets:sign_blank",{ + description = "Emtpy sign", + tiles = {"streets_sign_back.png"}, + inventory_image = "streets_sign_back.png", + wield_image = "streets_sign_back.png", + groups = {snappy = 1,attached_node = 1}, + drawtype = "nodebox", + node_box = { + type = "wallmounted", + fixed = { + {-0.4,-0.5,-0.4,0.4,-0.4,0.4} + } + }, + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "wallmounted" + }, + streets = { + signworkshop = { + recipe = {"default:steel_ingot","","",""}, + time = 5 + } + } +}) minetest.register_node(":streets:sign_lava",{ description = "Warning sign (lava)", tiles = {"streets_sign_lava.png"}, @@ -17,7 +44,13 @@ minetest.register_node(":streets:sign_lava",{ sunlight_propagates = true, selection_box = { type = "wallmounted" + }, + streets = { + signworkshop = { + recipe = {"streets:sign_blank","bucket:bucket_lava","",""}, + time = 7 } + } }) minetest.register_node(":streets:sign_water",{ diff --git a/roadsigns/workshop.lua b/roadsigns/workshop.lua index 939c570..283d2b4 100644 --- a/roadsigns/workshop.lua +++ b/roadsigns/workshop.lua @@ -28,6 +28,11 @@ minetest.register_node(":streets:signworkshop",{ inv:set_size("streets:signworkshop_input",4*1) 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") end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) if listname ~= "streets:signworkshop_input" then @@ -37,8 +42,22 @@ minetest.register_node(":streets:signworkshop",{ end end, allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + -- Move items inside input slots if to_list == "streets:signworkshop_input" and from_list == "streets:signworkshop_input" then return 1 + -- List -> selection + elseif from_list == "streets:signworkshop_list" and to_list == "streets:signworkshop_select" then + local inv = minetest.get_meta(pos):get_inventory() + local selected = inv:get_stack("streets:signworkshop_list",from_index):to_table() + local need = minetest.registered_nodes[selected.name].streets.signworkshop.recipe + inv:set_list("streets:signworkshop_recipe",{need[1],need[2],need[3],need[4]}) + return 1 + -- selection -> list + elseif from_list == "streets:signworkshop_select" and to_list == "streets:signworkshop_list" then + local inv = minetest.get_meta(pos):get_inventory() + inv:set_list("streets:signworkshop_recipe",{"","","",""}) + return 1 + -- Every other case else return 0 end @@ -53,8 +72,30 @@ minetest.register_node(":streets:signworkshop",{ on_receive_fields = function(pos, formname, fields, sender) local inv = minetest.get_inventory({type = "node", pos = pos}) -- - if inv:is_emtpy("streets:signworkshop_input") ~= true then - + if inv:is_empty("streets:signworkshop_input") ~= true and inv:is_empty("streets:signworkshop_select") ~= true then + local selection = inv:get_stack("streets:signworkshop_select",1):get_name() + local def = minetest.registered_nodes[selection].streets.signworkshop + local need = inv:get_list("streets:signworkshop_recipe") + local has = inv:get_list("streets:signworkshop_input") + need[1] = need[1]:to_table() + need[2] = need[2]:to_table() + need[3] = need[3]:to_table() + need[4] = need[4]:to_table() + has[1] = has[1]:to_table() + has[2] = has[2]:to_table() + has[3] = has[3]:to_table() + has[4] = has[4]:to_table() + if need[1] == nil then need[1] = { name = "" } end + if need[2] == nil then need[2] = { name = "" } end + if need[3] == nil then need[3] = { name = "" } end + if need[4] == nil then need[4] = { name = "" } end + if has[1] == nil then has[1] = { name = "" } end + if has[2] == nil then has[2] = { name = "" } end + if has[3] == nil then has[3] = { name = "" } end + if has[4] == nil then has[4] = { name = "" } end + if need[1].name == has[1].name and need[2].name == has[2].name and need[3].name == has[3].name and need[4].name == has[4].name then + minetest.chat_send_all("yay") + end end end }) \ No newline at end of file -- cgit v1.2.3 From 7e72af629252db26347a5248c9fdd370739dd16d Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Tue, 15 Oct 2013 14:28:42 +0200 Subject: Finished code --- roadsigns/workshop.lua | 76 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 56 insertions(+), 20 deletions(-) (limited to 'roadsigns') diff --git a/roadsigns/workshop.lua b/roadsigns/workshop.lua index 283d2b4..5ee1af5 100644 --- a/roadsigns/workshop.lua +++ b/roadsigns/workshop.lua @@ -1,28 +1,48 @@ --[[ StreetsMod: Create signs in the signworkshop ]] +local forms = { + inactive = { + "size[12,10]", + "label[3.5,0;Sign workshop - Create signs for your roads!]", + "label[0,0.5;Available signs:]", + "list[context;streets:signworkshop_list;0,1;5,4]", + "label[9,0.5;Needed stuff:]", + "list[context;streets:signworkshop_recipe;8,1;4,1]", + "label[9,2;Put it here:]", + "list[context;streets:signworkshop_input;8,3;4,1]", + "button[8,4;2,1;streets:signworkshop_send;Start!]", + "label[5.8,0.5;Selected:]", + "list[context;streets:signworkshop_select;6,1;1,1]", + "label[5.8,2.5;Output:]", + "list[context;streets:signworkshop_output;6,3;1,1]", + "list[current_player;main;2,6;8,4]", + }, + active = { + "size[12,10]", + "label[3.5,0;Sign workshop - Create signs for your roads!]", + "label[0,0.5;Available signs:]", + "list[context;streets:signworkshop_list;0,1;5,4]", + "label[9,0.5;Needed stuff:]", + "list[context;streets:signworkshop_recipe;8,1;4,1]", + "label[9,2;Put it here:]", + "list[context;streets:signworkshop_input;8,3;4,1]", + "label[5.8,0.5;Selected:]", + "list[context;streets:signworkshop_select;6,1;1,1]", + "label[5.8,2.5;Output:]", + "list[context;streets:signworkshop_output;6,3;1,1]", + "list[current_player;main;2,6;8,4]", + "label[8,4;Please wait...]", + } +} minetest.register_node(":streets:signworkshop",{ description = "Sign workshop", tiles = {}, groups = {cracky = 1, level = 2}, after_place_node = function(pos) - minetest.get_meta(pos):set_string("formspec",table.concat({ - "size[12,10]", - "label[3.5,0;Sign workshop - Create signs for your roads!]", - "label[0,0.5;Available signs:]", - "list[context;streets:signworkshop_list;0,1;5,4]", - "label[9,0.5;Needed stuff:]", - "list[context;streets:signworkshop_recipe;8,1;4,1]", - "label[9,2;Put it here:]", - "list[context;streets:signworkshop_input;8,3;4,1]", - "button[8,4;2,1;streets:signworkshop_send;Start!]", - "label[5.8,0.5;Selected:]", - "list[context;streets:signworkshop_select;6,1;1,1]", - "label[5.8,2.5;Output:]", - "list[context;streets:signworkshop_output;6,3;1,1]", - "list[current_player;main;2,6;8,4]", - })) - local inv = minetest.get_inventory({type = "node", pos = pos}) + minetest.get_meta(pos):set_string("formspec",table.concat(forms.inactive)) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() inv:set_size("streets:signworkshop_list",5*4) inv:set_size("streets:signworkshop_recipe",3*2) inv:set_size("streets:signworkshop_input",4*1) @@ -33,6 +53,9 @@ minetest.register_node(":streets:signworkshop",{ 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") + -- Meta + meta:set_string("infotext","Sign workshop idle") + meta:set_string("idle","y") end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) if listname ~= "streets:signworkshop_input" then @@ -70,9 +93,10 @@ minetest.register_node(":streets:signworkshop",{ end end, on_receive_fields = function(pos, formname, fields, sender) - local inv = minetest.get_inventory({type = "node", pos = pos}) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() -- - if inv:is_empty("streets:signworkshop_input") ~= true and inv:is_empty("streets:signworkshop_select") ~= true then + if inv:is_empty("streets:signworkshop_input") ~= true and inv:is_empty("streets:signworkshop_select") ~= true and meta:get_string("idle") == "y" then local selection = inv:get_stack("streets:signworkshop_select",1):get_name() local def = minetest.registered_nodes[selection].streets.signworkshop local need = inv:get_list("streets:signworkshop_recipe") @@ -94,7 +118,19 @@ minetest.register_node(":streets:signworkshop",{ if has[3] == nil then has[3] = { name = "" } end if has[4] == nil then has[4] = { name = "" } end if need[1].name == has[1].name and need[2].name == has[2].name and need[3].name == has[3].name and need[4].name == has[4].name then - minetest.chat_send_all("yay") + meta:set_string("infotext","Sign workshop working") + meta:set_string("idle","n") + meta:set_string("formspec",table.concat(forms.active)) + -- Clear input + inv:set_list("streets:signworkshop_input",{"","","",""}) + minetest.after(def.time,function() + -- Reset infotext and meta + meta:set_string("infotext","Sign workshop idle") + meta:set_string("idle","y") + meta:set_string("formspec",table.concat(forms.inactive)) + -- Fill output + inv:add_item("streets:signworkshop_output",selection) + end) end end end -- cgit v1.2.3 From fe7607750f24d1ee8daa38d648fc39e056ef6779 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Wed, 16 Oct 2013 09:59:39 +0200 Subject: Finished code --- roadsigns/signs.lua | 16 ++++++++++++++-- roadsigns/workshop.lua | 9 +++++---- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'roadsigns') diff --git a/roadsigns/signs.lua b/roadsigns/signs.lua index 0b01ff5..0992adf 100644 --- a/roadsigns/signs.lua +++ b/roadsigns/signs.lua @@ -21,7 +21,7 @@ minetest.register_node(":streets:sign_blank",{ streets = { signworkshop = { recipe = {"default:steel_ingot","","",""}, - time = 5 + time = 3 } } }) @@ -48,7 +48,7 @@ minetest.register_node(":streets:sign_lava",{ streets = { signworkshop = { recipe = {"streets:sign_blank","bucket:bucket_lava","",""}, - time = 7 + time = 5 } } }) @@ -72,6 +72,12 @@ minetest.register_node(":streets:sign_water",{ sunlight_propagates = true, selection_box = { type = "wallmounted" + }, + streets = { + signworkshop = { + recipe = {"streets:sign_blank","bucket:bucket_water","",""}, + time = 5 + } } }) @@ -94,5 +100,11 @@ minetest.register_node(":streets:sign_construction",{ sunlight_propagates = true, selection_box = { type = "wallmounted" + }, + streets = { + signworkshop = { + recipe = {"streets:sign_blank","default:dirt","",""}, + time = 5 + } } }) \ No newline at end of file diff --git a/roadsigns/workshop.lua b/roadsigns/workshop.lua index 5ee1af5..e5dc0d6 100644 --- a/roadsigns/workshop.lua +++ b/roadsigns/workshop.lua @@ -31,14 +31,15 @@ local forms = { "list[context;streets:signworkshop_select;6,1;1,1]", "label[5.8,2.5;Output:]", "list[context;streets:signworkshop_output;6,3;1,1]", - "list[current_player;main;2,6;8,4]", - "label[8,4;Please wait...]", + "list[current_player;main;2,6;8,4]" + -- } } minetest.register_node(":streets:signworkshop",{ description = "Sign workshop", - tiles = {}, + 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"}, groups = {cracky = 1, level = 2}, + paramtype2 = "facedir", after_place_node = function(pos) minetest.get_meta(pos):set_string("formspec",table.concat(forms.inactive)) local meta = minetest.get_meta(pos) @@ -120,7 +121,7 @@ minetest.register_node(":streets:signworkshop",{ if need[1].name == has[1].name and need[2].name == has[2].name and need[3].name == has[3].name and need[4].name == has[4].name then meta:set_string("infotext","Sign workshop working") meta:set_string("idle","n") - meta:set_string("formspec",table.concat(forms.active)) + meta:set_string("formspec",table.concat(forms.active) .. "label[8,4;Please wait " .. def.time .. " seconds...]") -- Clear input inv:set_list("streets:signworkshop_input",{"","","",""}) minetest.after(def.time,function() -- cgit v1.2.3 From f4a043769c508777ea38192d12ad37ab8cb92c20 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Wed, 16 Oct 2013 19:15:41 +0200 Subject: Added textures for signworkshop --- roadsigns/textures/streets_signworkshop_bottom.png | Bin 0 -> 1942 bytes roadsigns/textures/streets_signworkshop_front.png | Bin 0 -> 2138 bytes roadsigns/textures/streets_signworkshop_side.png | Bin 0 -> 1888 bytes roadsigns/textures/streets_signworkshop_top.png | Bin 0 -> 2026 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 roadsigns/textures/streets_signworkshop_bottom.png create mode 100644 roadsigns/textures/streets_signworkshop_front.png create mode 100644 roadsigns/textures/streets_signworkshop_side.png create mode 100644 roadsigns/textures/streets_signworkshop_top.png (limited to 'roadsigns') diff --git a/roadsigns/textures/streets_signworkshop_bottom.png b/roadsigns/textures/streets_signworkshop_bottom.png new file mode 100644 index 0000000..022bb2c Binary files /dev/null and b/roadsigns/textures/streets_signworkshop_bottom.png differ diff --git a/roadsigns/textures/streets_signworkshop_front.png b/roadsigns/textures/streets_signworkshop_front.png new file mode 100644 index 0000000..83317b1 Binary files /dev/null and b/roadsigns/textures/streets_signworkshop_front.png differ diff --git a/roadsigns/textures/streets_signworkshop_side.png b/roadsigns/textures/streets_signworkshop_side.png new file mode 100644 index 0000000..509a3e3 Binary files /dev/null and b/roadsigns/textures/streets_signworkshop_side.png differ diff --git a/roadsigns/textures/streets_signworkshop_top.png b/roadsigns/textures/streets_signworkshop_top.png new file mode 100644 index 0000000..07f4f06 Binary files /dev/null and b/roadsigns/textures/streets_signworkshop_top.png differ -- cgit v1.2.3 From 114d1b173cd318e1a80d276b67b8d70362547a1b Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Sat, 19 Oct 2013 14:49:06 +0200 Subject: Added drop = '' to some nodes --- roadsigns/pole.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'roadsigns') diff --git a/roadsigns/pole.lua b/roadsigns/pole.lua index 8f2f7ba..478afb9 100644 --- a/roadsigns/pole.lua +++ b/roadsigns/pole.lua @@ -48,7 +48,8 @@ minetest.register_node(":streets:pole_top",{ paramtype = "light", paramtype2 = "facedir", drawtype = "nodebox", - can_dig = function(pos,player) + drop = "", + can_dig = function() return false end, node_box = { -- cgit v1.2.3 From a88b2dcfd60e86205d562b8ba9c402f9345e5ee9 Mon Sep 17 00:00:00 2001 From: webdesigner97 Date: Sun, 24 Nov 2013 19:52:14 +0100 Subject: crafts and inv images --- roadsigns/workshop.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'roadsigns') diff --git a/roadsigns/workshop.lua b/roadsigns/workshop.lua index e5dc0d6..9c68fb7 100644 --- a/roadsigns/workshop.lua +++ b/roadsigns/workshop.lua @@ -135,4 +135,13 @@ minetest.register_node(":streets:signworkshop",{ end end end +}) + +minetest.register_craft({ + output = "streets:signworkshop", + recipe = { + {"default:steel_ingot","default:glass","default:steel_ingot"}, + {"default:steel_ingot","default:diamond","default:steel_ingot"}, + {"default:cobble","default:cobble","default:cobble"} + } }) \ No newline at end of file -- cgit v1.2.3