Jump to content

Fuel Bar disappearing when maxed


Recommended Posts

I am having the same issue as the last post on this thread 

 

I added a fuel bar to my item and the fuel bar disappears when the fuel is maxed. I use this code to change the meter but when new = 10 it just disappears.  I have the image/folder for 10 in the chest_meter anim so I'm am not sure why it isn't showing up.

local function OnFuelSectionChange(new, old, inst)
    if inst._fuellevel ~= new then
        inst._fuellevel = new
		inst.AnimState:OverrideSymbol("swap_meter", "chest_meter", tostring(new))
    end
end

I can upload the mod if you need it.

Link to comment
Share on other sites

I came up with a solution of having the swap_meter as the full bar and just using ClearOverrideSymbol to remove the OverrideSymbol.  This seems like a hack to my issue but don't think there will be any issues with it.

local function OnFuelSectionChange(new, old, inst)

    if inst._fuellevel ~= new then
		
		inst._fuellevel = new
		if inst._fuellevel == 10 then
			inst.AnimState:ClearOverrideSymbol("swap_meter")
		else
			inst.AnimState:OverrideSymbol("swap_meter", "chest_meter", tostring(new))
		end

    end
end

 

Link to comment
Share on other sites

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
 Share

×
  • Create New...