Client LuaCsForBarotrauma
CharacterAbilityModifyFlag.cs
1 namespace Barotrauma.Abilities
2 {
4  {
5  private readonly AbilityFlags abilityFlag;
6 
7  private bool lastState;
8  public override bool AllowClientSimulation => true;
9 
10  public CharacterAbilityModifyFlag(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
11  {
12  abilityFlag = CharacterAbilityGroup.ParseFlagType(abilityElement.GetAttributeString("flagtype", ""), CharacterTalent.DebugIdentifier);
13  }
14 
15  protected override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
16  {
17  if (conditionsMatched != lastState)
18  {
19  if (conditionsMatched)
20  {
21  Character.AddAbilityFlag(abilityFlag);
22  }
23  else
24  {
25  Character.RemoveAbilityFlag(abilityFlag);
26  }
27 
28  lastState = conditionsMatched;
29  }
30  }
31  }
32 }
static AbilityFlags ParseFlagType(string flagTypeString, string debugIdentifier)
override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
CharacterAbilityModifyFlag(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
string? GetAttributeString(string key, string? def)
AbilityFlags
AbilityFlags are a set of toggleable flags that can be applied to characters.
Definition: Enums.cs:641