summaryrefslogtreecommitdiff
path: root/sillystuff.lua
blob: 432c1eee4c8f0e32b7cda87d7b7702e0854807e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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",""}
	}
})