-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinit.lua
139 lines (120 loc) · 4.11 KB
/
init.lua
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
local S = minetest.get_translator("pontoons")
-- MCL2 compatibility
local moditems = {}
if core.get_modpath("mcl_core") and mcl_core then -- means MineClone 2 is loaded, this is its core mod
moditems.IRON_ITEM = "mcl_core:iron_ingot" -- MCL iron
else -- fallback, assume default (MineTest Game) is loaded, otherwise it will error anyway here.
moditems.IRON_ITEM = "default:steel_ingot" -- MCL iron
end
local pontoons_override_logs = minetest.settings:get_bool("pontoons_override_logs") -- default false
local pontoons_override_wood = minetest.settings:get_bool("pontoons_override_wood") -- default false
local pontoons_wood_pontoons = minetest.settings:get_bool("pontoons_wood_pontoons")
if pontoons_wood_pontoons == nil then pontoons_wood_pontoons = true end -- default true
local pontoons_steel_pontoons = minetest.settings:get_bool("pontoons_steel_pontoons")
if pontoons_steel_pontoons == nil then pontoons_steel_pontoons = true end -- default true
local default_modpath = minetest.get_modpath("default")
if pontoons_override_logs or pontoons_override_wood then
local override_def = {liquids_pointable = true}
for node_name, node_def in pairs(minetest.registered_nodes) do
if pontoons_override_logs and minetest.get_item_group(node_name, "tree") > 0 then
minetest.override_item(node_name, override_def)
end
if pontoons_override_wood and minetest.get_item_group(node_name, "wood") > 0 then
minetest.override_item(node_name, override_def)
end
end
end
if pontoons_wood_pontoons then
local default_sound
local wood_burn_time
if default_modpath then
if mcl_sounds then
default_sound = mcl_sounds.node_sound_wood_defaults()
else
default_sound = default.node_sound_wood_defaults()
end
wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("group:wood")}}).time
end
if not wood_burn_time then wood_burn_time = 7 end
minetest.register_node("pontoons:wood_pontoon", {
description = S("Wood Pontoon"),
_doc_items_longdesc = S("A hollow wooden block designed to be built on the surface of liquids."),
tiles = {"pontoon_wood.png"},
paramtype2 = "facedir",
place_param2 = 0,
is_ground_content = false,
liquids_pointable = true,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
sounds = default_sound,
})
-- modify recipe, if "airtank" mod is loaded as it has similar recipe and conflicts with pontoons.
if core.get_modpath("airtanks") and airtanks then
minetest.register_craft({
output = 'pontoons:wood_pontoon 4',
recipe = {
{"group:wood","group:wood","group:wood"},
{"","",""},
{"","","group:wood"},
}
})
else
minetest.register_craft({
output = 'pontoons:wood_pontoon 4',
recipe = {
{"","group:wood",""},
{"group:wood","","group:wood"},
{"","group:wood",""},
}
})
end
minetest.register_craft({
type = "fuel",
recipe = "pontoons:wood_pontoon",
burntime = wood_burn_time,
})
end
if pontoons_steel_pontoons then
local default_sound
if default_modpath then
if mcl_sounds then
default_sound = mcl_sounds.node_sound_metal_defaults()
else
if default.node_sound_metal_defaults then
default_sound = default.node_sound_metal_defaults()
else
default_sound = default.node_sound_wood_defaults()
end
end
end
minetest.register_node("pontoons:steel_pontoon", {
description = S("Steel Pontoon"),
_doc_items_longdesc = S("A hollow steel block designed to be built on the surface of liquids. Magma-safe."),
is_ground_content = false,
tiles = {"pontoon_steel.png"},
liquids_pointable = true,
is_ground_content = false,
groups = {cracky = 1, level = 2},
sounds = default_sound,
})
if default_modpath then
if core.get_modpath("airtanks") and airtanks then
minetest.register_craft({
output = 'pontoons:steel_pontoon',
recipe = {
{"",moditems.IRON_ITEM,""},
{moditems.IRON_ITEM,"",moditems.IRON_ITEM},
{"","",moditems.IRON_ITEM},
}
})
else
minetest.register_craft({
output = 'pontoons:steel_pontoon',
recipe = {
{"",moditems.IRON_ITEM,""},
{moditems.IRON_ITEM,"",moditems.IRON_ITEM},
{"",moditems.IRON_ITEM,""},
}
})
end
end
end