forked from mt-mods/jumpdrive
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
formspec.lua
71 lines (55 loc) · 1.9 KB
/
formspec.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
local has_technic = minetest.get_modpath("technic")
local inv_offset = 0
if has_technic then
inv_offset = 1.25
end
local inv_width = 8
local mcl_fs = ""
local player_inv_fs = "list[current_player;main;0,".. 4.5+inv_offset .. ";8,4;]"
if minetest.get_modpath("mcl_formspec") then
inv_width = 9
mcl_fs = mcl_formspec.get_itemslot_bg(0,3.25,8,1)
player_inv_fs = ""..
"list[current_player;main;0,5.6;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,5.6,9,3)..
"list[current_player;main;0,8.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,8.74,9,1)
if has_technic then
mcl_fs = mcl_fs..
mcl_formspec.get_itemslot_bg(4,4.5,4,1)
end
end
jumpdrive.update_formspec = function(meta)
local formspec =
"size["..inv_width.."," .. 9.3+inv_offset .. ";]" ..
"field[0.3,0.5;2,1;x;X;" .. meta:get_int("x") .. "]" ..
"field[2.3,0.5;2,1;y;Y;" .. meta:get_int("y") .. "]" ..
"field[4.3,0.5;2,1;z;Z;" .. meta:get_int("z") .. "]" ..
"field[6.3,0.5;2,1;radius;Radius;" .. meta:get_int("radius") .. "]" ..
"button_exit[0,1;2,1;jump;Jump]" ..
"button_exit[2,1;2,1;show;Show]" ..
"button_exit[4,1;2,1;save;Save]" ..
"button[6,1;2,1;reset;Reset]" ..
"button[0,2;4,1;write_book;Write to book]" ..
"button[4,2;4,1;read_book;Read from bookmark]" ..
-- main inventory for fuel and books
"list[context;main;0,3.25;8,1;]" ..
-- player inventory
player_inv_fs..
-- digiline channel
"field[4.3," .. 9.02+inv_offset ..";3.2,1;digiline_channel;Digiline channel;" ..
(meta:get_string("channel") or "") .. "]" ..
"button_exit[7," .. 8.7+inv_offset .. ";1,1;set_digiline_channel;Set]" ..
-- listring stuff
"listring[context;main]" ..
"listring[current_player;main]"..
-- mcl
mcl_fs
if has_technic then
formspec = formspec ..
-- technic upgrades
"label[3,4.7;Upgrades]" ..
"list[context;upgrade;4,4.5;4,1;]"
end
meta:set_string("formspec", formspec)
end