1. Please be advised of a few specific rules and guidelines for this section.

RELEASED Shield Bars API 1.0

modding resource for displaying overhead bars

  1. GTG3000

    GTG3000 Big Damn Hero

    GTG3000 submitted a new mod:

    Shield Bars API - modding resource for displaying overhead bars

    Read more about this mod...
     
  2. bk3k

    bk3k Oxygen Tank

    You can make player_primary_bars.lua a bit shorter/slightly faster like this
    Code:
    local barsOldInit = init
    
    function init()
        barsOldInit()
        self.barsList = {}
        message.setHandler("setBar", function(_, _, barName, barPercentage, barColor)
            setBar(barName,barPercentage,barColor)
        end)
        message.setHandler("removeBar", function(_, _, barName)
            removeBar(barName)
        end)
       
    end
    
    function overheadBars()
      self.barsList["shieldStamina"] = status.statPositive("shieldHealth") and {
        percentage = status.resource("shieldStamina"),
        color = status.resourcePositive("perfectBlock") and {255, 255, 200, 255} or {200, 200, 0, 255}
        } or nil
     
      return self.barsList
    end
    
    function removeBar(barName)
        self.barsList[barName] = nil
    end
    
    function setBar(barName,barPercentage,barColor)
        self.barsList[barName] = {
            percentage = barPercentage,
            color = barColor,
            stat = barStat
        }
        --sb.logInfo("%s  %s  %s",barName,barPercentage,barColor)
    end
    
    I took a guess with how they process the return on overheadBars() - that it wouldn't necessarily need to be a list - and i was right. So building a whole new table and inserting things into it each time isn't necessary.
     

Share This Page