From fae9422116e7d27798a0fe2c0fb28a9c120a3cde Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 29 Jan 2021 21:22:58 -0600 Subject: [PATCH] Add heatsink (decorative only) --- init.lua | 1 + sillystuff.lua | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 sillystuff.lua diff --git a/init.lua b/init.lua index 77d8e8a..84b5b37 100644 --- a/init.lua +++ b/init.lua @@ -18,6 +18,7 @@ local components = { "controller", "memory", "gpu", + "sillystuff", } if minetest.get_modpath("mesecons_luacontroller") then table.insert(components,"ioexpander") end diff --git a/sillystuff.lua b/sillystuff.lua new file mode 100644 index 0000000..432c1ee --- /dev/null +++ b/sillystuff.lua @@ -0,0 +1,94 @@ +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>2 and "1" or "0" + local bit2 = i%8>4 and "1" or "0" + local bit3 = i%16>8 and "1" or "0" + heatsinkable_nodes["mesecons_luacontroller:luacontroller"..bit0..bit1..bit2..bit3] = true + heatsinkable_nodes["digistuff:ioexpander_"..i] = true +end + +minetest.register_node("digistuff:heatsink", { + description = "Heatsink (decorative)", + groups = {cracky=3}, + tiles = { + "digistuff_piezo_sides.png" + }, + drawtype = "nodebox", + selection_box = { + type = "fixed", + fixed = {-0.19,-0.5,-0.2,0.19,-0.3,0.2 }, + }, + node_box = { + --From Luacontroller + type = "fixed", + fixed = { + {-0.19, -0.5,-0.2, 0.19, -0.45, 0.2}, -- Base + {-0.19,-0.45,-0.2,-0.17, -0.3, 0.2}, + {-0.15,-0.45,-0.2,-0.13, -0.3, 0.2}, + {-0.11,-0.45,-0.2,-0.09, -0.3, 0.2}, + {-0.07,-0.45,-0.2,-0.05, -0.3, 0.2}, + {-0.03,-0.45,-0.2,-0.01, -0.3, 0.2}, + { 0.19,-0.45,-0.2, 0.17, -0.3, 0.2}, + { 0.15,-0.45,-0.2, 0.13, -0.3, 0.2}, + { 0.11,-0.45,-0.2, 0.09, -0.3, 0.2}, + { 0.07,-0.45,-0.2, 0.05, -0.3, 0.2}, + { 0.03,-0.45,-0.2, 0.01, -0.3, 0.2}, + } + }, + after_place_node = function(pos) + local icpos = vector.add(pos,vector.new(0,-1,0)) + if heatsinkable_nodes[minetest.get_node(icpos).name] then + minetest.set_node(pos,{name = "digistuff:heatsink_onic"}) + end + end, + paramtype = "light", + sunlight_propagates = true, +}) + +minetest.register_node("digistuff:heatsink_onic", { + drop = "digistuff:heatsink", + description = "Heatsink (decorative, placed on IC - you hacker you!)", + groups = {cracky=3,not_in_creative_inventory=1,}, + tiles = { + "digistuff_piezo_sides.png" + }, + drawtype = "nodebox", + selection_box = { + type = "fixed", + fixed = {-0.19,-1.3125,-0.2,0.19,-1.1525,0.2 }, + }, + node_box = { + --From Luacontroller + type = "fixed", + fixed = { + {-0.19, -1.3125,-0.2, 0.19, -1.2625, 0.2}, -- Base + {-0.19,-1.2625,-0.2,-0.17, -1.1525, 0.2}, + {-0.15,-1.2625,-0.2,-0.13, -1.1525, 0.2}, + {-0.11,-1.2625,-0.2,-0.09, -1.1525, 0.2}, + {-0.07,-1.2625,-0.2,-0.05, -1.1525, 0.2}, + {-0.03,-1.2625,-0.2,-0.01, -1.1525, 0.2}, + { 0.19,-1.2625,-0.2, 0.17, -1.1525, 0.2}, + { 0.15,-1.2625,-0.2, 0.13, -1.1525, 0.2}, + { 0.11,-1.2625,-0.2, 0.09, -1.1525, 0.2}, + { 0.07,-1.2625,-0.2, 0.05, -1.1525, 0.2}, + { 0.03,-1.2625,-0.2, 0.01, -1.1525, 0.2}, + } + }, + paramtype = "light", + sunlight_propagates = true, +}) + +minetest.register_craft({ + output = "digistuff:heatsink", + recipe = { + {"basic_materials:steel_strip","basic_materials:steel_strip","basic_materials:steel_strip"}, + {"","default:steel_ingot",""} + } +})