forked from minetest-mods/orbs_of_time
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
187 lines (168 loc) · 6.03 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
-- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
minetest.register_alias("castle:orb_day", "orbs_of_time:orb_day")
minetest.register_alias("castle:orb_night", "orbs_of_time:orb_night")
minetest.register_tool("orbs_of_time:orb_day", {
description = S("Orb of Midday"),
_doc_items_longdesc = S("This magical orb grants you the power to bring the Sun to the zenith of the sky."),
_doc_items_usagehelp = S("When weilded, use this item and the Sun will jump to its highest point. The day will then progress normally from there. This orb can be used eight times - once for each diamond that was used to craft it."),
tiles = {"orbs_orb_day.png"},
inventory_image = "orbs_orb_day.png",
wield_image = "orbs_orb_day_weild.png",
stack_max=1,
groups = { tool=1 },
on_use = function(itemstack, user)
minetest.sound_play("orbs_ding", {pos=user:getpos(), loop=false})
minetest.set_timeofday(0.5)
minetest.sound_play("orbs_birds", {pos=user:getpos(), loop=false})
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/8)
end
return itemstack
end,
})
minetest.register_tool("orbs_of_time:orb_night",{
description = S("Orb of Midnight"),
_doc_items_longdesc = S("This magical orb grants you the power to banish the Sun to the bottom of the world."),
_doc_items_usagehelp = S("When weilded, use this item and the Moon will jump to its highest point. The night will then progress normally from there. This orb can be used eight times - once for each diamond that was used to craft it."),
tiles = {"orbs_orb_night.png"},
inventory_image = "orbs_orb_night.png",
wield_image = "orbs_orb_night_weild.png",
stack_max=1,
groups = { tool=1 },
on_use = function(itemstack, user)
minetest.sound_play("orbs_ding", {pos=user:getpos(), loop=false})
minetest.set_timeofday(0)
minetest.sound_play("orbs_owl", {pos=user:getpos(), loop=false})
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/8)
end
return itemstack
end,
})
minetest.register_tool("orbs_of_time:orb_dawn", {
description = S("Orb of Dawn"),
_doc_items_longdesc = S("This magical orb grants you the power to bring the Sun to eastern horizon."),
_doc_items_usagehelp = S("When weilded, use this item and day will break. The day will then progress normally from there. This orb can be used eight times - once for each diamond that was used to craft it."),
tiles = {"orbs_orb_day.png"},
inventory_image = "orbs_orb_day.png^[lowpart:50:orbs_orb_night.png",
wield_image = "orbs_orb_day_weild.png^[lowpart:75:orbs_orb_night_weild.png",
stack_max=1,
on_use = function(itemstack, user)
minetest.sound_play("orbs_ding", {pos=user:getpos(), loop=false})
minetest.set_timeofday(0.2)
minetest.sound_play("orbs_birds", {pos=user:getpos(), loop=false})
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/8)
end
return itemstack
end,
})
minetest.register_tool("orbs_of_time:orb_dusk",{
description = S("Orb of Dusk"),
_doc_items_longdesc = S("This magical orb grants you the power to send the Sun to western horizon."),
_doc_items_usagehelp = S("When weilded, use this item and night will fall. The night will then progress normally from there. This orb can be used eight times - once for each diamond that was used to craft it."),
tiles = {"orbs_orb_night.png"},
inventory_image = "orbs_orb_night.png^[lowpart:50:orbs_orb_day.png",
wield_image = "orbs_orb_night_weild.png^[lowpart:75:orbs_orb_day_weild.png",
stack_max=1,
on_use = function(itemstack, user)
minetest.sound_play("orbs_ding", {pos=user:getpos(), loop=false})
minetest.set_timeofday(0.8)
minetest.sound_play("orbs_owl", {pos=user:getpos(), loop=false})
if not minetest.settings:get_bool("creative_mode") then
itemstack:add_wear(65535/8)
end
return itemstack
end,
})
-----------
--Crafting
-----------
if minetest.get_modpath("mcl_core") then
minetest.register_craft({
output = "orbs_of_time:orb_day",
recipe = {
{"mcl_core:diamond", "mcl_core:diamond","mcl_core:diamond"},
{"mcl_core:diamond", "mesecons:redstone","mcl_core:diamond"},
{"mcl_core:diamond", "mcl_core:diamond","mcl_core:diamond"}
},
})
minetest.register_craft({
output = "orbs_of_time:orb_night",
recipe = {
{"mcl_core:diamond", "mcl_core:diamond","mcl_core:diamond"},
{"mcl_core:diamond", "mcl_dye:black","mcl_core:diamond"},
{"mcl_core:diamond", "mcl_core:diamond","mcl_core:diamond"}
},
})
else
minetest.register_craft({
output = "orbs_of_time:orb_day",
recipe = {
{"default:diamond", "default:diamond","default:diamond"},
{"default:diamond", "default:mese_crystal_fragment","default:diamond"},
{"default:diamond", "default:diamond","default:diamond"}
},
})
minetest.register_craft({
output = "orbs_of_time:orb_night",
recipe = {
{"default:diamond", "default:diamond","default:diamond"},
{"default:diamond", "default:obsidian_shard","default:diamond"},
{"default:diamond", "default:diamond","default:diamond"}
},
})
end
minetest.register_craft({
output = "orbs_of_time:orb_dawn 2",
recipe = {
{"orbs_of_time:orb_day"},
{"orbs_of_time:orb_night"},
},
})
minetest.register_craft({
output = "orbs_of_time:orb_dusk 2",
recipe = {
{"orbs_of_time:orb_night"},
{"orbs_of_time:orb_day"},
},
})
-----------
--Loot mod support
-----------
if minetest.get_modpath("loot") then
loot.register_loot({
weights = { generic = 10, valuable= 10 },
payload = {
stack = ItemStack("orbs_of_time:orb_day"),
min_size = 1,
max_size = 1,
},
})
loot.register_loot({
weights = { generic = 10, valuable= 10 },
payload = {
stack = ItemStack("orbs_of_time:orb_night"),
min_size = 1,
max_size = 1,
},
})
loot.register_loot({
weights = { generic = 10, valuable= 10 },
payload = {
stack = ItemStack("orbs_of_time:orb_dawn"),
min_size = 1,
max_size = 1,
},
})
loot.register_loot({
weights = { generic = 10, valuable= 10 },
payload = {
stack = ItemStack("orbs_of_time:orb_dusk"),
min_size = 1,
max_size = 1,
},
})
end