diff --git a/gpu.lua b/gpu.lua index 4f5b37f..1acad1d 100644 --- a/gpu.lua +++ b/gpu.lua @@ -935,7 +935,7 @@ end minetest.register_node("digistuff:gpu", { description = "Digilines 2D Graphics Processor", - groups = { cracky = 3 }, + groups = { cracky = 3, heatsinkable = 1 }, is_ground_content = false, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/ioexpander.lua b/ioexpander.lua index 3f4a4cc..ab505a2 100644 --- a/ioexpander.lua +++ b/ioexpander.lua @@ -107,7 +107,7 @@ for i=0,15,1 do local offstate = i == 0 minetest.register_node("digistuff:ioexpander_"..i, { description = offstate and "Digilines I/O Expander" or string.format("Digilines I/O Expander (on state %X - you hacker you!)",i), - groups = offstate and {cracky = 3,} or {cracky = 3,not_in_creative_inventory = 1,}, + groups = {cracky = 3,heatsinkable=1,not_in_creative_inventory = (not offstate) and 1,}, is_ground_content = false, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/memory.lua b/memory.lua index 33e8503..20f85f7 100644 --- a/memory.lua +++ b/memory.lua @@ -1,6 +1,6 @@ minetest.register_node("digistuff:ram", { description = "Digilines 128Kbit SRAM", - groups = {cracky=3}, + groups = {cracky=3, heatsinkable=1}, is_ground_content = false, on_construct = function(pos) local meta = minetest.get_meta(pos) @@ -64,7 +64,7 @@ minetest.register_node("digistuff:ram", { minetest.register_node("digistuff:eeprom", { description = "Digilines 128Kbit EEPROM", - groups = {cracky=3}, + groups = {cracky=3, heatsinkable=1}, is_ground_content = false, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/nic.lua b/nic.lua index 8c4b415..46b5989 100644 --- a/nic.lua +++ b/nic.lua @@ -1,7 +1,7 @@ local http = ... minetest.register_node("digistuff:nic", { description = "Digilines NIC", - groups = {cracky=3}, + groups = {cracky=3, heatsinkable=1}, is_ground_content = false, on_construct = function(pos) local meta = minetest.get_meta(pos) diff --git a/sillystuff.lua b/sillystuff.lua index 33a6b6e..25aa07c 100644 --- a/sillystuff.lua +++ b/sillystuff.lua @@ -1,18 +1,32 @@ -local heatsinkable_nodes = { - ["digistuff:nic"] = true, - ["digistuff:gpu"] = true, - ["digistuff:ram"] = true, - ["digistuff:eeprom"] = true, -} for i = 0, 15, 1 do local bit0 = i % 2 > 0 and "1" or "0" local bit1 = i % 4 > 1 and "1" or "0" local bit2 = i % 8 > 3 and "1" or "0" local bit3 = i % 16 > 7 and "1" or "0" - heatsinkable_nodes["mesecons_luacontroller:luacontroller" .. bit0 .. bit1 .. bit2 .. bit3] = true - heatsinkable_nodes["mooncontroller:mooncontroller" .. bit0 .. bit1 .. bit2 .. bit3] = true - heatsinkable_nodes["digistuff:ioexpander_" .. i] = true + local bits = bit0 .. bit1 .. bit2 .. bit3 + do + local name = "mesecons_luacontroller:luacontroller" .. bits + local def = core.registered_nodes[name] + if def then + local groups = table.copy(def.groups) + groups.heatsinkable = 1 + core.override_item(name, { + groups = groups + }) + end + end + do + local name = "mooncontroller:mooncontroller" .. bits + local def = core.registered_nodes[name] + if def then + local groups = table.copy(def.groups) + groups.heatsinkable = 1 + core.override_item(name, { + groups = groups + }) + end + end end minetest.register_node("digistuff:heatsink", { @@ -46,7 +60,7 @@ minetest.register_node("digistuff:heatsink", { }, after_place_node = function(pos) local icpos = vector.add(pos,vector.new(0,-1,0)) - if heatsinkable_nodes[minetest.get_node(icpos).name] then + if core.get_item_group(core.get_node(icpos).name, "heatsinkable") then minetest.set_node(pos,{name = "digistuff:heatsink_onic"}) end end,