126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
...
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
table.insert(p, wrapMenu(a.w, a.h, 1.2, 2, m.opts))
end
return p
end
local function pptrMatch(a,b)
if a == nil or b == nil then return false end
return a.chipID == b.chipID and a.pgmIndex == b.pgmIndex
end
starlit.interface.install(starlit.type.ui {
id = 'starlit:user-menu';
pages = {
compiler = {
setupState = function(state, user)
................................................................................
local st = string.format('%s / %s', s.desc(amt, true), s.desc(max))
table.insert(tb, {kind = 'hztl', padding = 0.25;
{kind = 'label', w=2, h=barh, text = s.name};
{kind = 'hbar', w=4, h=barh, fac = sv, text = st, color=s.color};
})
end
local abilities = {
{id = 'abl_sprint', label = 'Sprint', img = 'starlit-ui-icon-ability-sprint.png'};
}
table.insert(tb, wrapMenu(6.25,4, 1,2, abilities))
return starlit.ui.build(tb)
end;
};
suit = {
render = function(state, user)
local suit = user:getSuit()
local suitDef = suit:def()
local chipW, chipH = listWrap(suitDef.slots.chips, 5)
|
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
...
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
|
table.insert(p, wrapMenu(a.w, a.h, 1.2, 2, m.opts))
end
return p
end
local function pptrMatch(a,b)
if a == nil or b == nil then return false end
return (a.chipID ~= nil and (a.chipID == b.chipID and a.pgmIndex == b.pgmIndex))
or (a.ref ~= nil and a.ref == b.ref)
end
starlit.interface.install(starlit.type.ui {
id = 'starlit:user-menu';
pages = {
compiler = {
setupState = function(state, user)
................................................................................
local st = string.format('%s / %s', s.desc(amt, true), s.desc(max))
table.insert(tb, {kind = 'hztl', padding = 0.25;
{kind = 'label', w=2, h=barh, text = s.name};
{kind = 'hbar', w=4, h=barh, fac = sv, text = st, color=s.color};
})
end
local abilities = {
maneuver = {};
direct = {};
passive = {};
}
state.abilityMap = {}
for i, a in pairs(user:species().abilities) do
local id = 'abl_'..a.id;
state.abilityMap[id] = a;
table.insert(abilities[a.powerKind], {
id = id;
label = a.name;
desc = a.desc;
img = a.img;
-- HACK
color = pptrMatch(user.power.maneuver, {ref=a}) and
{hue = 150, sat = 0, lum = .3} or nil;
});
end
for i, n in ipairs {'maneuver', 'direct', 'passive'} do
if next(abilities[n]) then
table.insert(tb, wrapMenu(6.25,4, 1,2, abilities[n]))
end
end
return starlit.ui.build(tb)
end;
handle = function(state, user, q)
for k,a in pairs(state.abilityMap) do
if q[k] then
if a.powerKind == 'maneuver' then
if pptrMatch(user.power.maneuver, {ref=a}) then
user.power.maneuver = nil
else
user.power.maneuver = {ref=a}
end
user:suitSound 'starlit-configure'
return true
elseif a.powerKind == 'direct' then
elseif a.powerKind == 'passive' then
else error('bad ability kind ' .. a.powerKind) end
break
end
end
end;
};
suit = {
render = function(state, user)
local suit = user:getSuit()
local suitDef = suit:def()
local chipW, chipH = listWrap(suitDef.slots.chips, 5)
|