forked from mt-mods/missions
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.lua
39 lines (28 loc) · 897 Bytes
/
ui.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
unified_inventory.register_page("missions", {
get_formspec = function(player)
local mission = missions.get_current_mission(player)
local formspec = "background[0,4.5;8,4;ui_main_inventory.png]" ..
"label[1,0;Missions]";
if mission then
formspec = formspec ..
"label[1,1;" .. mission.name .. "]" ..
"button[1,2;4,1;abort_mission;Abort mission]";
else
formspec = formspec .. "label[1,2;No running mission]";
end
return {formspec=formspec}
end
})
unified_inventory.register_button("missions", {
type = "image",
image = "missions_block_preview.png",
tooltip = "Missions"
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "" then return end
if not player then return end
if fields.abort_mission then
local player_name = player:get_player_name()
missions.abort(player_name)
end
end)