commit | author | age
|
731a82
|
1 |
--[[ |
S |
2 |
supported_nodes |
|
3 |
This table stores all nodes that are compatible with the wrench mod. |
|
4 |
Syntax: |
|
5 |
[<node name>] = { |
|
6 |
lists = {"<inventory list name>"}, |
|
7 |
metas = {["<meta name>"] = STRING, |
|
8 |
["<meta name>"] = INT, |
|
9 |
["<meta name>"] = FLOAT}, |
|
10 |
owned = true, |
|
11 |
store_meta_always = true, |
|
12 |
} |
|
13 |
owned - nodes that are protected by owner requirements (Ex. locked chests) |
|
14 |
store_meta_always - when nodes are broken this ensures metadata and |
|
15 |
inventory is always stored (Ex. active state for machines) |
|
16 |
--]] |
|
17 |
|
|
18 |
wrench.META_TYPE_INT = 0 |
|
19 |
wrench.META_TYPE_FLOAT = 1 |
|
20 |
wrench.META_TYPE_STRING = 2 |
|
21 |
|
|
22 |
local INT, STRING, FLOAT = |
|
23 |
wrench.META_TYPE_INT, |
|
24 |
wrench.META_TYPE_STRING, |
|
25 |
wrench.META_TYPE_FLOAT |
|
26 |
|
|
27 |
wrench.registered_nodes = { |
|
28 |
["default:chest"] = { |
|
29 |
lists = {"main"}, |
|
30 |
}, |
|
31 |
["default:chest_locked"] = { |
|
32 |
lists = {"main"}, |
|
33 |
metas = {owner = STRING, |
|
34 |
infotext = STRING}, |
|
35 |
owned = true, |
|
36 |
}, |
|
37 |
["default:furnace"] = { |
|
38 |
lists = {"fuel", "src", "dst"}, |
|
39 |
metas = {infotext = STRING, |
|
40 |
fuel_totaltime = FLOAT, |
|
41 |
fuel_time = FLOAT, |
|
42 |
src_totaltime = FLOAT, |
|
43 |
src_time = FLOAT}, |
|
44 |
}, |
|
45 |
["default:furnace_active"] = { |
|
46 |
lists = {"fuel", "src", "dst"}, |
|
47 |
metas = {infotext = STRING, |
|
48 |
fuel_totaltime = FLOAT, |
|
49 |
fuel_time = FLOAT, |
|
50 |
src_totaltime = FLOAT, |
|
51 |
src_time = FLOAT}, |
|
52 |
store_meta_always = true, |
|
53 |
}, |
|
54 |
["default:sign_wall"] = { |
|
55 |
metas = {infotext = STRING, |
|
56 |
text = STRING}, |
|
57 |
}, |
|
58 |
} |
|
59 |
|
|
60 |
function wrench:original_name(name) |
|
61 |
for key, value in pairs(self.registered_nodes) do |
|
62 |
if name == value.name then |
|
63 |
return key |
|
64 |
end |
|
65 |
end |
|
66 |
end |
|
67 |
|
|
68 |
function wrench:register_node(name, def) |
|
69 |
self.registered_nodes[name] = def |
|
70 |
end |
|
71 |
|