RageLeague

"AddCombatPartyDef" does nothing if party is not defined

Recommended Posts

RageLeague    1491

Title.

Under "content/combat_parties", this is defined:

function AddCombatPartyDef(id, fn)
    if GENERATORS[id] then
        print (loc.format( "Combat party generator {1} is already defined. If you aren't reloading combat, look into this", id ))
        GENERATORS[id] = fn
    end
end

For some reason, the function is added if a function already exists, and not if the function does not exist.

Share this post


Link to post
Share on other sites
rooks    263

Thanks for the heads up.  This looks to be an old (strangely defined) function, as I can't find anywhere in the code that uses it.

  • Thanks 1

Share this post


Link to post
Share on other sites
RageLeague    1491
7 hours ago, rooks said:

Thanks for the heads up.  This looks to be an old (strangely defined) function, as I can't find anywhere in the code that uses it.

Maybe it's for modders?

Either way, I'm using it for custom combat parties.

Speaking of which, is there a way to make the helper function in the combat party def publicly accessible? It seems like it is applicable in many situations.

Share this post


Link to post
Share on other sites
rooks    263

Ah in that case I will amend AddCombatPartyDef like this:

Spoiler


function AddCombatPartyDef(id, fn)
    if GENERATORS[id] then
        print (loc.format( "Combat party generator {1} is already defined. If you aren't reloading combat, look into this", id ))
    end
    GENERATORS[id] = fn
end
 

As for the helper functions, the best I can do is make them global.  Which ones were you referring to specifically?  PickTeams, FindValidTeams, etc.?

  • Thanks 1

Share this post


Link to post
Share on other sites
RageLeague    1491

Yeah, it would be helpful for PickTeams and FindValidTeams be global.

PT_RANGES and COUNT_RANGES might also be helpful to make global.

Share this post


Link to post
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