MSUTeam / MSU

Modding Standards and Utilities for Battle Brothers
21 stars 4 forks source link

[REQUEST] Framework for tracking round number of a skill for an entity #351

Open Darxo opened 4 months ago

Darxo commented 4 months ago

Is your feature request related to a problem? Please describe. Some skills can only be used once per turn or round on the same entity. Turn and Round is so closely related that they can often just conbined to once per round. If we want to track whether we already used a skill on an entity we can do either of two things:

As the variant with flags is potentially much cleaner and performant I suggest implementing native support for it in msu.

Describe the solution you'd like Implement an framework into skill.nut consisting of the following two functions


// Write the current round number in a tactical manager flag that consists of the id of an entity and the id of this skill
function markEntityWithRound( _entity )
{
    ::Tactical.Entities.getFlags().set(_targetEntity.getID() + this.getID() + "MarkedWithRoundNumber", ::Time.getRound());
}

// Return the round number imprinted into a tactical manager flag for that entity; Returns 0 if no flag exists yet for it
function getRoundOfMarkedEntity( _entity )
{
    if (::Tactical.Entities.getFlags().has(_targetEntity.getID() + this.getID() + "MarkedWithRoundNumber"))
    {
        return ::Tactical.Entities.getFlags().get(_targetEntity.getID() + this.getID() + "MarkedWithRoundNumber");
    }

    return 0;
}
LordMidas commented 2 months ago

I think this is an extremely niche use case and does not need a framework in MSU.