Jump to content

Health Badge Crash on Custom Art


GlassArrow
  • Fixed

The HealthBadge widget has an undeclared variable on line 21 when using custom art for it. The HealthBadge inherits from Badge and creates self.circleframe if anim is nil. When anim is not nil, circleframe is never declared (line 26 of Badge). Note that in HealthBadge anim is named art. This is seen when playing the forged forge mod since that uses the art variable. A simple fix would be to check whether or not circleframe exists or to check if art exists, either seems to work (see below). I also put the circleframe2 inside that check as well since it seemed unneeded when supplying custom art.

HealthBadge Line 21:

self.circleframe:GetAnimState():Hide("frame")
self.circleframe2 = self.underNumber:AddChild(UIAnim())
self.circleframe2:GetAnimState():SetBank("status_meter")
self.circleframe2:GetAnimState():SetBuild("status_meter")
self.circleframe2:GetAnimState():PlayAnimation("frame")

Badge Line 26:

if anim ~= nil then
  self.anim = self:AddChild(UIAnim())
  self.anim:GetAnimState():SetBank(anim)
  self.anim:GetAnimState():SetBuild(anim)
  self.anim:GetAnimState():PlayAnimation("anim")
else
  --self.bg clashes with existing mods
  self.backing = self:AddChild(UIAnim())
  self.backing:GetAnimState():SetBank("status_meter")
  self.backing:GetAnimState():SetBuild("status_meter")
  self.backing:GetAnimState():PlayAnimation("bg")

  self.anim = self:AddChild(UIAnim())
  self.anim:GetAnimState():SetBank("status_meter")
  self.anim:GetAnimState():SetBuild("status_meter")
  self.anim:GetAnimState():PlayAnimation("anim")
  if tint ~= nil then
    self.anim:GetAnimState():SetMultColour(unpack(tint))
  end

  --self.frame clashes with existing mods
  self.circleframe = self:AddChild(UIAnim())
  self.circleframe:GetAnimState():SetBank("status_meter")
  self.circleframe:GetAnimState():SetBuild("status_meter")
  self.circleframe:GetAnimState():PlayAnimation("frame")
  if iconbuild ~= nil then
    self.circleframe:GetAnimState():OverrideSymbol("icon", iconbuild, "icon")
  end
end

Possible Fix:

if self.circleframe or art then -- Can use either of these parameters for the check
  self.circleframe:GetAnimState():Hide("frame")
  self.circleframe2 = self.underNumber:AddChild(UIAnim())
  self.circleframe2:GetAnimState():SetBank("status_meter")
  self.circleframe2:GetAnimState():SetBuild("status_meter")
  self.circleframe2:GetAnimState():PlayAnimation("frame")
end

 


Steps to Reproduce
Easiest way to reproduce would be to start a game with the Forged Forge mod on. The game will crash once you leave the lobby and the HUD is created. The official Forge will probably also have this same crash.



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...