Faction Test 100.13.0.0

This commit is contained in:
Markus Isberg
2023-01-11 15:36:23 +02:00
parent 1650735468
commit caa5a2f762
145 changed files with 2100 additions and 1111 deletions
@@ -75,13 +75,14 @@ namespace Barotrauma.Abilities
if (wt == WeaponType.Any || !weapontype.HasFlag(wt)) { continue; }
switch (wt)
{
// it is possible that an item that has both a melee and a projectile component will return true
// even when not used as a melee/ranged weapon respectively
// attackdata should contain data regarding whether the attack is melee or not
case WeaponType.Melee:
//if the item has an active projectile component (has been fired), don't consider it a melee weapon
if (item?.GetComponent<Projectile>() is { IsActive: true }) { continue; }
if (item?.GetComponent<MeleeWeapon>() != null) { return true; }
break;
case WeaponType.Ranged:
//if the item has a melee weapon component that's being used now, don't consider it a projectile
if (item?.GetComponent<MeleeWeapon>() is { Hitting: true }) { continue; }
if (item?.GetComponent<Projectile>() != null) { return true; }
break;
case WeaponType.HandheldRanged:
@@ -17,6 +17,14 @@ namespace Barotrauma.Abilities
tags = abilityElement.GetAttributeIdentifierImmutableHashSet("tags", ImmutableHashSet<Identifier>.Empty);
}
public override void InitializeAbility(bool addingFirstTime)
{
if (addingFirstTime)
{
VerifyState(conditionsMatched: true, timeSinceLastUpdate: 0.0f);
}
}
protected override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
{
if (conditionsMatched)
@@ -13,6 +13,11 @@
value = abilityElement.GetAttributeFloat("value", 0f);
}
public override void InitializeAbility(bool addingFirstTime)
{
VerifyState(conditionsMatched: true, timeSinceLastUpdate: 0.0f);
}
protected override void VerifyState(bool conditionsMatched, float timeSinceLastUpdate)
{
if (conditionsMatched != lastState)
@@ -1,5 +1,6 @@
#nullable enable
using System;
using Barotrauma.Extensions;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -17,6 +18,9 @@ namespace Barotrauma.Abilities
{
if (!addingFirstTime) { return; }
// do not run client-side in multiplayer
if (GameMain.NetworkMember is { IsClient: true }) { return; }
JobPrefab? apprentice = CharacterAbilityApplyStatusEffectsToApprenticeship.GetApprenticeJob(Character, JobPrefab.Prefabs.ToImmutableHashSet());
if (apprentice is null)
{
@@ -49,6 +49,16 @@ namespace Barotrauma.Abilities
break;
}
}
switch (abilityEffectType)
{
case AbilityEffectType.OnDieToCharacter:
if (characterAbilities.Any(a => a.RequiresAlive))
{
DebugConsole.AddWarning($"Potential error in talent {characterTalent}: an ability group has the type {AbilityEffectType.OnDieToCharacter}, but includes abilities that require the character to be alive, meaning they will never execute.");
}
break;
}
}
public void ActivateAbilityGroup(bool addingFirstTime)