From 307f571c7fc270b83ad976d7c97a701d4b3b7e53 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 1 Aug 2015 10:58:55 -0400 Subject: [PATCH] added klein star --- .../energy_collector.lua | 99 ++++++++++++------ .../ee_energy_collectors_klein_star.png | Bin 0 -> 357 bytes 2 files changed, 69 insertions(+), 30 deletions(-) create mode 100644 equivalent_exchange_energy_collectors/textures/ee_energy_collectors_klein_star.png diff --git a/equivalent_exchange_energy_collectors/energy_collector.lua b/equivalent_exchange_energy_collectors/energy_collector.lua index 4bf2196..dc149ae 100644 --- a/equivalent_exchange_energy_collectors/energy_collector.lua +++ b/equivalent_exchange_energy_collectors/energy_collector.lua @@ -1,7 +1,7 @@ local modname = "equivalent_exchange_energy_collectors:" collector = { - emc_gather = function(orig_emc, mark,multiplier) + emc_gather = function(orig_emc, mark, multiplier) return orig_emc + (10^(mark - 1)) * multiplier end, emc_transfer = function(mark,pos,multiplier) @@ -23,14 +23,45 @@ collector = { emc_transferable_nodes_length = emc_transferable_nodes_length + 1 end end + if emc_transferable_nodes_length == 0 then + local generate_amount = math.floor(emc / 10) + local inventory = meta:get_inventory() + local size = inventory:get_size("container") + if emc >= 10 then + meta:set_int("emc", emc - 10*generate_amount) + if mark == 4 then + meta:set_string("formspec", + "size[8,7.5]".. + "label[0,0;Antimatter Collector]".. + "label[4,0;EMC Stored: "..emc - 10*generate_amount.."]".. + "list[current_name;container;0,0.5;8,7;]") + else + meta:set_string("formspec", + "size[8,7.5]".. + "label[0,0;Energy Collector Mark "..mark.."]".. + "label[4,0;EMC Stored: "..emc - 10*generate_amount.."]".. + "list[current_name;container;0,0.5;8,7;]") + end + inventory:add_item("container",modname.."klein_star "..generate_amount) + end + end local newemc = (collector.emc_gather(emc, mark, multiplier)) local distribution = math.floor(newemc / emc_transferable_nodes_length) for j = 1,emc_transferable_nodes_length do - meta:set_string("formspec", - "size[6,1.5]".. - "label[0,0;Energy Collector Mark"..mark.."]".. - "label[4,0;EMC Stored: "..(newemc - distribution).."]".. - "list[current_name;container;0,0.5;6,1;]") + print(mark) + if mark == 4 then + meta:set_string("formspec", + "size[8,7.5]".. + "label[0,0;Antimatter Collector]".. + "label[4,0;EMC Stored: "..(newemc - distribution).."]".. + "list[current_name;container;0,0.5;8,7;]") + else + meta:set_string("formspec", + "size[8,7.5]".. + "label[0,0;Energy Collector Mark "..mark.."]".. + "label[4,0;EMC Stored: "..(newemc - distribution).."]".. + "list[current_name;container;0,0.5;8,7;]") + end meta:set_int("emc",(newemc - distribution)) emc_transferable_nodes[j]:set_int("emc", (emc_transferable_nodes[j]:get_int("emc") + distribution)) end @@ -55,10 +86,10 @@ minetest.register_abm({ local emc = meta:get_int("emc") local multiplier = collector.check_multiplier(pos) meta:set_string("formspec", - "size[6,1.5]".. + "size[8,7.5]".. "label[0,0;Energy Collector Mark 1]".. "label[4,0;EMC Stored: "..collector.emc_gather(emc,1,multiplier).."]".. - "list[current_name;container;0,0.5;6,1;]") + "list[current_name;container;0,0.5;8,7;]") meta:set_int("emc",collector.emc_gather(emc,1,multiplier)) collector.emc_transfer(1,pos,multiplier) end, @@ -73,10 +104,10 @@ minetest.register_abm({ local emc = meta:get_int("emc") local multiplier = collector.check_multiplier(pos) meta:set_string("formspec", - "size[6,1.5]".. + "size[8,7.5]".. "label[0,0;Energy Collector Mark 2]".. "label[4,0;EMC Stored: "..collector.emc_gather(emc,2,multiplier).."]".. - "list[current_name;container;0,0.5;6,1;]") + "list[current_name;container;0,0.5;8,7;]") meta:set_int("emc",collector.emc_gather(emc,2,multiplier)) collector.emc_transfer(2,pos,multiplier) end, @@ -91,10 +122,10 @@ minetest.register_abm({ local emc = meta:get_int("emc") local multiplier = collector.check_multiplier(pos) meta:set_string("formspec", - "size[6,1.5]".. + "size[8,7.5]".. "label[0,0;Energy Collector Mark 3]".. "label[4,0;EMC Stored: "..collector.emc_gather(emc,3,multiplier).."]".. - "list[current_name;container;0,0.5;6,1;]") + "list[current_name;container;0,0.5;8,7;]") meta:set_int("emc",collector.emc_gather(emc,3,multiplier)) collector.emc_transfer(3,pos,multiplier) end, @@ -109,10 +140,10 @@ minetest.register_abm({ local emc = meta:get_int("emc") local multiplier = collector.check_multiplier(pos) meta:set_string("formspec", - "size[6,1.5]".. + "size[8,7.5]".. "label[0,0;Antimatter Collector]".. "label[4,0;EMC Stored: "..collector.emc_gather(emc,4,multiplier).."]".. - "list[current_name;container;0,0.5;6,1;]") + "list[current_name;container;0,0.5;8,7;]") meta:set_int("emc",collector.emc_gather(emc,4,multiplier)) collector.emc_transfer(4,pos,multiplier) end, @@ -137,19 +168,19 @@ minetest.register_node(modname.."mk1", { on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", - "size[6,1.5]".. + "size[8,7.5]".. "label[0,0;Energy Collector Mark 1]".. "label[4,0;EMC Stored: 0]".. - "list[current_name;container;0,0.5;6,1;]") + "list[current_name;container;0,0.5;8,7;]") meta:set_string("infotext", "Energy Collector Mark 1") meta:set_int("emc", 0) local inv = meta:get_inventory() - inv:set_size("container", 6) + inv:set_size("container", 8*7) end, can_dig = function(pos,player) local meta = minetest.env:get_meta(pos); local inv = meta:get_inventory() - return inv:is_empty("main") + return inv:is_empty("container") end, emc = 529605 }) @@ -171,19 +202,19 @@ minetest.register_node(modname.."mk2", { on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", - "size[6,1.5]".. + "size[8,7.5]".. "label[0,0;Energy Collector Mark 2]".. "label[4,0;EMC Stored: 0]".. - "list[current_name;container;0,0.5;6,1;]") + "list[current_name;container;0,0.5;8,7;]") meta:set_string("infotext", "Energy Collector Mark 2") meta:set_int("emc", 0) local inv = meta:get_inventory() - inv:set_size("container", 6) + inv:set_size("container", 8*7) end, can_dig = function(pos,player) local meta = minetest.env:get_meta(pos); local inv = meta:get_inventory() - return inv:is_empty("main") + return inv:is_empty("container") end, emc = 529605 }) @@ -205,19 +236,19 @@ minetest.register_node(modname.."mk3", { on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", - "size[6,1.5]".. + "size[8,7.5]".. "label[0,0;Energy Collector Mark 3]".. "label[4,0;EMC Stored: 0]".. - "list[current_name;container;0,0.5;6,1;]") + "list[current_name;container;0,0.5;8,7;]") meta:set_string("infotext", "Energy Collector Mark 3") meta:set_int("emc", 0) local inv = meta:get_inventory() - inv:set_size("container", 6) + inv:set_size("container", 8*7) end, can_dig = function(pos,player) local meta = minetest.env:get_meta(pos); local inv = meta:get_inventory() - return inv:is_empty("main") + return inv:is_empty("container") end, emc = 529605 }) @@ -239,19 +270,19 @@ minetest.register_node(modname.."antimatter_collector", { on_construct = function(pos) local meta = minetest.get_meta(pos) meta:set_string("formspec", - "size[6,1.5]".. + "size[8,7.5]".. "label[0,0;Antimatter Collector]".. "label[4,0;EMC Stored: 0]".. - "list[current_name;container;0,0.5;6,1;]") + "list[current_name;container;0,0.5;8,7;]") meta:set_string("infotext", "Antimatter Collector") meta:set_int("emc", 0) local inv = meta:get_inventory() - inv:set_size("container", 6) + inv:set_size("container", 8*7) end, can_dig = function(pos,player) local meta = minetest.env:get_meta(pos); local inv = meta:get_inventory() - return inv:is_empty("main") + return inv:is_empty("container") end, emc = 269554885 }) @@ -277,6 +308,14 @@ minetest.register_node(modname.."interdiction_stone", { end, }) +-- Registering Craft Items -- + +minetest.register_craftitem(modname.."klein_star", { + description = "Klein Star", + inventory_image = "ee_energy_collectors_klein_star.png", + emc = 100, +}) + -- Registering Crafts -- minetest.register_craft({ diff --git a/equivalent_exchange_energy_collectors/textures/ee_energy_collectors_klein_star.png b/equivalent_exchange_energy_collectors/textures/ee_energy_collectors_klein_star.png new file mode 100644 index 0000000000000000000000000000000000000000..b53f0297de3507c3c39edd818b7e20de6fadca11 GIT binary patch literal 357 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP~2P2;)zwy9vy$`C1eNT=ySw;r8}RbWB_%{!k$9;OYVn zf2Z_^yl-?gw-nsWDw(!mcjVlzCx-IR>KU4%a$gn(h4ZY|{hQ^Tzxvd1v!Y{_P6ZjC z``J>(QojC}+AW~9nSr6r?0&xM9EsUo~!*}fY~%C^+S%9fpOZb^Ei>G4+J^jwLh3(gev t6r{Wrc;+{;=-UnNJ%7bN+{pj4{T}1B>khv@sz`!->*?y}vd$@?2>@u_h$a94 literal 0 HcmV?d00001