1
2
3
4
5
6
7
8
9
10
11
12
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
...
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
|
local lib = starlit.mod.lib
function starlit.ui.setupForUser(user)
local function cmode(mode)
if user.actMode == mode then return {hue = 150, sat = 0, lum = .3} end
end
user.entity:set_inventory_formspec(starlit.ui.build {
kind = 'vert', mode = 'sw';
padding = .5, spacing = 0.1;
{kind = 'hztl';
{kind = 'contact', w=1.5,h=1.5, id = 'mode_nano',
img='starlit-ui-icon-nano.png', close=true, color = cmode'nano'};
................................................................................
if user.actMode == mode then
user:actModeSet 'off'
else
user:actModeSet(mode)
end
end
local modes = { nano = true, psi = false, weapon = true }
for e,s in pairs(modes) do
if fields['mode_' .. e] then
if s and (user:naked() or user:getSuit():powerState() == 'off') then
user:suitSound 'starlit-error'
else
setSuitMode(e)
................................................................................
local suit = user:getSuit()
local suitDef = suit:def()
local chipW, chipH = listWrap(suitDef.slots.chips, 5)
local batW, batH = listWrap(suitDef.slots.batteries, 5)
local canW, canH = listWrap(suitDef.slots.canisters, 5)
local suitMode = suit:powerState()
local function modeColor(mode)
if mode == suitMode then return {hue = 180, sat = 0, lum = .5} end
end
return starlit.ui.build {
kind = 'vert', mode = 'sw';
padding = 0.5, spacing = 0.1;
{kind = 'hztl',
{kind = 'img', desc='Batteries', img = 'starlit-item-battery.png', w=1,h=1};
{kind = 'list', target = 'current_player', inv = 'starlit_suit_bat',
|
|
1
2
3
4
5
6
7
8
9
10
11
12
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
...
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
|
local lib = starlit.mod.lib
function starlit.ui.setupForUser(user)
local function cmode(mode)
if user.actMode == mode then return {hue = 290, sat = 0, lum = .1} end
end
user.entity:set_inventory_formspec(starlit.ui.build {
kind = 'vert', mode = 'sw';
padding = .5, spacing = 0.1;
{kind = 'hztl';
{kind = 'contact', w=1.5,h=1.5, id = 'mode_nano',
img='starlit-ui-icon-nano.png', close=true, color = cmode'nano'};
................................................................................
if user.actMode == mode then
user:actModeSet 'off'
else
user:actModeSet(mode)
end
end
-- disable suit modes if the suit is off or the user is naked
local modes = { nano = true, psi = false, weapon = true }
for e,s in pairs(modes) do
if fields['mode_' .. e] then
if s and (user:naked() or user:getSuit():powerState() == 'off') then
user:suitSound 'starlit-error'
else
setSuitMode(e)
................................................................................
local suit = user:getSuit()
local suitDef = suit:def()
local chipW, chipH = listWrap(suitDef.slots.chips, 5)
local batW, batH = listWrap(suitDef.slots.batteries, 5)
local canW, canH = listWrap(suitDef.slots.canisters, 5)
local suitMode = suit:powerState()
local function modeColor(mode)
local c = {
off = {hue = 0, sat = 0, lum = 0};
powerSave = {hue = 60, sat = 0, lum = 0};
on = {hue = 100, sat = 0, lum = 0};
}
if mode == suitMode then return c[mode] end
end
return starlit.ui.build {
kind = 'vert', mode = 'sw';
padding = 0.5, spacing = 0.1;
{kind = 'hztl',
{kind = 'img', desc='Batteries', img = 'starlit-item-battery.png', w=1,h=1};
{kind = 'list', target = 'current_player', inv = 'starlit_suit_bat',
|