Skip to content

Commit 63364da

Browse files
committed
slight change to score_container signature
- type shouldn't be optional in API, that may mislead people into creating multiple ui nodes with the same id - Better docs, type can be the key of a Scoring_Parameter
1 parent c536339 commit 63364da

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lsp_def/ui.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ function create_UIBox_your_collection_stickers() end
256256
---@param table
257257
---@field scale? number Set scale of text
258258
---@field colour? table HEX colour of the container
259-
---@field type? string Type of scoring component - defaults to `'mult'`
259+
---@field type string Type of scoring component, ex. 'mult'. Can take the key of a Scoring_Parameter
260260
---@field align? string Must be two letters, first indicates vertical alignment, second indicates horizontal alignment
261261
---@field func? string Reference to function in `G.FUNCS` that controls changing the text - defaults to `'hand_'..type..'_UI_set'`
262262
---@field text? string Key of value in `G.GAME.current_round.current_hand` - defaults to `type..'_text'`

src/ui.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@ end
21452145

21462146
function SMODS.GUI.score_container(args)
21472147
local scale = args.scale or 0.4
2148-
local type = args.type or 'mult'
2148+
local type = args.type
21492149
local colour = args.colour or SMODS.Scoring_Parameters[type].colour
21502150
local align = args.align or 'cl'
21512151
local func = args.func or 'hand_type_UI_set'
@@ -2155,6 +2155,7 @@ function SMODS.GUI.score_container(args)
21552155
return
21562156
{n=G.UIT.R, config={align = align, minw = w, minh = h, r = 0.1, colour = colour, id = 'hand_'..type..'_area', emboss = 0.05}, nodes={
21572157
{n=G.UIT.O, config={func = 'flame_handler', no_role = true, id = 'flame_'..type, object = Moveable(0,0,0,0), w = 0, h = 0, _w = w * 1.25, _h = h * 2.5}},
2158+
-- TODO padding should depend only on 2nd letter of alignment?
21582159
align == 'cl' and {n=G.UIT.B, config={w = 0.1, h = 0.1}} or nil,
21592160
{n=G.UIT.O, config={id = 'hand_'..type, func = func, text = text, type = type, scale = scale*2.3, object = DynaText({
21602161
string = {{ref_table = G.GAME.current_round.current_hand, ref_value = text}},

0 commit comments

Comments
 (0)