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