zombie claw animation fix (#12537)

This commit is contained in:
Nemanja
2022-11-19 11:07:09 -05:00
committed by GitHub
parent 57a2081e08
commit dad7d17c10
4 changed files with 19 additions and 7 deletions

View File

@@ -121,7 +121,8 @@ namespace Content.Server.Zombies
var melee = EnsureComp<MeleeWeaponComponent>(target);
melee.ClickAnimation = zombiecomp.AttackAnimation;
melee.WideAnimation = zombiecomp.AttackAnimation;
melee.Range = 0.75f;
melee.Range = 1.5f;
Dirty(melee);
//We have specific stuff for humanoid zombies because they matter more
if (TryComp<HumanoidComponent>(target, out var huApComp)) //huapcomp
@@ -170,7 +171,7 @@ namespace Content.Server.Zombies
_damageable.SetAllDamage(damageablecomp, 0);
//gives it the funny "Zombie ___" name.
if (TryComp<MetaDataComponent>(target, out var meta))
var meta = MetaData(target);
meta.EntityName = Loc.GetString("zombie-name-prefix", ("target", meta.EntityName));
_identity.QueueIdentityUpdate(target);

View File

@@ -140,11 +140,18 @@ public sealed class MeleeWeaponComponentState : ComponentState
public TimeSpan NextAttack;
public TimeSpan? WindUpStart;
public MeleeWeaponComponentState(float attackRate, bool attacking, TimeSpan nextAttack, TimeSpan? windupStart)
public string ClickAnimation;
public string WideAnimation;
public float Range;
public MeleeWeaponComponentState(float attackRate, bool attacking, TimeSpan nextAttack, TimeSpan? windupStart, string clickAnimation, string wideAnimation, float range)
{
AttackRate = attackRate;
Attacking = attacking;
NextAttack = nextAttack;
WindUpStart = windupStart;
ClickAnimation = clickAnimation;
WideAnimation = wideAnimation;
Range = range;
}
}

View File

@@ -205,7 +205,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
private void OnGetState(EntityUid uid, MeleeWeaponComponent component, ref ComponentGetState args)
{
args.State = new MeleeWeaponComponentState(component.AttackRate, component.Attacking, component.NextAttack,
component.WindUpStart);
component.WindUpStart, component.ClickAnimation, component.WideAnimation, component.Range);
}
private void OnHandleState(EntityUid uid, MeleeWeaponComponent component, ref ComponentHandleState args)
@@ -217,6 +217,10 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
component.AttackRate = state.AttackRate;
component.NextAttack = state.NextAttack;
component.WindUpStart = state.WindUpStart;
component.ClickAnimation = state.ClickAnimation;
component.WideAnimation = state.WideAnimation;
component.Range = state.Range;
}
public MeleeWeaponComponent? GetWeapon(EntityUid entity)

View File

@@ -53,12 +53,12 @@ namespace Content.Shared.Zombies
/// The attack arc of the zombie
/// </summary>
[DataField("attackArc", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string AttackAnimation = "WeaponArcClaw";
public string AttackAnimation = "WeaponArcBite";
/// <summary>
/// The role prototype of the zombie antag role
/// </summary>
[DataField("zombieRoldId", customTypeSerializer: typeof(PrototypeIdSerializer<AntagPrototype>))]
[DataField("zombieRoleId", customTypeSerializer: typeof(PrototypeIdSerializer<AntagPrototype>))]
public readonly string ZombieRoleId = "Zombie";
}
}