Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/selection_details.js
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | function displaySingle(entState) | ||||
} | } | ||||
if (entState.statusEffects) | if (entState.statusEffects) | ||||
{ | { | ||||
let statusEffectsSection = Engine.GetGUIObjectByName("statusEffectsIcons"); | let statusEffectsSection = Engine.GetGUIObjectByName("statusEffectsIcons"); | ||||
statusEffectsSection.hidden = false; | statusEffectsSection.hidden = false; | ||||
let statusIcons = statusEffectsSection.children; | let statusIcons = statusEffectsSection.children; | ||||
let i = 0; | let i = 0; | ||||
for (let effectName in entState.statusEffects) | for (let effectName in entState.statusEffects) | ||||
Stan: Loop could probably be rewritten to use an index, but I guess it doesn't matter much. | |||||
{ | { | ||||
let effect = entState.statusEffects[effectName]; | let effect = entState.statusEffects[effectName]; | ||||
statusIcons[i].hidden = false; | statusIcons[i].hidden = false; | ||||
statusIcons[i].sprite = "stretched:session/icons/status_effects/" + (effect.Icon || "default") + ".png"; | statusIcons[i].sprite = "stretched:session/icons/status_effects/" + (effect.Icon || "default") + ".png"; | ||||
statusIcons[i].tooltip = getStatusEffectsTooltip(effect); | statusIcons[i].tooltip = getStatusEffectsTooltip(effect); | ||||
let size = statusIcons[i].size; | let size = statusIcons[i].size; | ||||
size.top = i * 18; | size.top = i * 18; | ||||
size.bottom = i * 18 + 16; | size.bottom = i * 18 + 16; | ||||
statusIcons[i].size = size; | statusIcons[i].size = size; | ||||
i++; | |||||
if (++i >= statusIcons.length) | |||||
Done Inline Actionsjust note: == would be enough here, but probably better to have that extra security Silier: just note: == would be enough here, but probably better to have that extra security | |||||
break; | |||||
Done Inline Actionswhy not to compare against statusIcons.length? Silier: why not to compare against statusIcons.length? | |||||
Done Inline ActionsBecause it was late yesterday and I am stupid, probably xD Freagarach: Because it was late yesterday and I am stupid, probably xD | |||||
} | } | ||||
for (; i < statusIcons.length; ++i) | for (; i < statusIcons.length; ++i) | ||||
statusIcons[i].hidden = true; | statusIcons[i].hidden = true; | ||||
} | } | ||||
else | else | ||||
Engine.GetGUIObjectByName("statusEffectsIcons").hidden = true; | Engine.GetGUIObjectByName("statusEffectsIcons").hidden = true; | ||||
let showHealth = entState.hitpoints; | let showHealth = entState.hitpoints; | ||||
▲ Show 20 Lines • Show All 423 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Loop could probably be rewritten to use an index, but I guess it doesn't matter much.