mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
Implement field-deltas for melee (#33977)
* Implement field-deltas for melee * Review
This commit is contained in:
committed by
deltanedas
parent
58d9519566
commit
abd67a4715
@@ -104,7 +104,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
if (gun.NextFire > component.NextAttack)
|
||||
{
|
||||
component.NextAttack = gun.NextFire;
|
||||
Dirty(uid, component);
|
||||
DirtyField(uid, component, nameof(MeleeWeaponComponent.NextAttack));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
return;
|
||||
|
||||
component.NextAttack = minimum;
|
||||
Dirty(uid, component);
|
||||
DirtyField(uid, component, nameof(MeleeWeaponComponent.NextAttack));
|
||||
}
|
||||
|
||||
private void OnGetBonusMeleeDamage(EntityUid uid, BonusMeleeDamageComponent component, ref GetMeleeDamageEvent args)
|
||||
@@ -168,7 +168,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
return;
|
||||
|
||||
weapon.Attacking = false;
|
||||
Dirty(weaponUid, weapon);
|
||||
DirtyField(weaponUid, weapon, nameof(MeleeWeaponComponent.Attacking));
|
||||
}
|
||||
|
||||
private void OnLightAttack(LightAttackEvent msg, EntitySessionEventArgs args)
|
||||
@@ -401,7 +401,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
swings++;
|
||||
}
|
||||
|
||||
Dirty(weaponUid, weapon);
|
||||
DirtyField(weaponUid, weapon, nameof(MeleeWeaponComponent.NextAttack));
|
||||
|
||||
// Do this AFTER attack so it doesn't spam every tick
|
||||
var ev = new AttemptMeleeEvent();
|
||||
@@ -451,6 +451,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
RaiseLocalEvent(user, ref attackEv);
|
||||
|
||||
weapon.Attacking = true;
|
||||
DirtyField(weaponUid, weapon, nameof(MeleeWeaponComponent.Attacking));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -847,15 +848,21 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
//Setting deactivated damage to the weapon's regular value before changing it.
|
||||
itemToggleMelee.DeactivatedDamage ??= meleeWeapon.Damage;
|
||||
meleeWeapon.Damage = itemToggleMelee.ActivatedDamage;
|
||||
DirtyField(uid, meleeWeapon, nameof(MeleeWeaponComponent.Damage));
|
||||
}
|
||||
|
||||
meleeWeapon.HitSound = itemToggleMelee.ActivatedSoundOnHit;
|
||||
if (meleeWeapon.HitSound?.Equals(itemToggleMelee.ActivatedSoundOnHit) != true)
|
||||
{
|
||||
meleeWeapon.HitSound = itemToggleMelee.ActivatedSoundOnHit;
|
||||
DirtyField(uid, meleeWeapon, nameof(MeleeWeaponComponent.HitSound));
|
||||
}
|
||||
|
||||
if (itemToggleMelee.ActivatedSoundOnHitNoDamage != null)
|
||||
{
|
||||
//Setting the deactivated sound on no damage hit to the weapon's regular value before changing it.
|
||||
itemToggleMelee.DeactivatedSoundOnHitNoDamage ??= meleeWeapon.NoDamageSound;
|
||||
meleeWeapon.NoDamageSound = itemToggleMelee.ActivatedSoundOnHitNoDamage;
|
||||
DirtyField(uid, meleeWeapon, nameof(MeleeWeaponComponent.NoDamageSound));
|
||||
}
|
||||
|
||||
if (itemToggleMelee.ActivatedSoundOnSwing != null)
|
||||
@@ -863,28 +870,41 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
//Setting the deactivated sound on no damage hit to the weapon's regular value before changing it.
|
||||
itemToggleMelee.DeactivatedSoundOnSwing ??= meleeWeapon.SwingSound;
|
||||
meleeWeapon.SwingSound = itemToggleMelee.ActivatedSoundOnSwing;
|
||||
DirtyField(uid, meleeWeapon, nameof(MeleeWeaponComponent.SwingSound));
|
||||
}
|
||||
|
||||
if (itemToggleMelee.DeactivatedSecret)
|
||||
{
|
||||
meleeWeapon.Hidden = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (itemToggleMelee.DeactivatedDamage != null)
|
||||
{
|
||||
meleeWeapon.Damage = itemToggleMelee.DeactivatedDamage;
|
||||
DirtyField(uid, meleeWeapon, nameof(MeleeWeaponComponent.Damage));
|
||||
}
|
||||
|
||||
meleeWeapon.HitSound = itemToggleMelee.DeactivatedSoundOnHit;
|
||||
DirtyField(uid, meleeWeapon, nameof(MeleeWeaponComponent.HitSound));
|
||||
|
||||
if (itemToggleMelee.DeactivatedSoundOnHitNoDamage != null)
|
||||
{
|
||||
meleeWeapon.NoDamageSound = itemToggleMelee.DeactivatedSoundOnHitNoDamage;
|
||||
DirtyField(uid, meleeWeapon, nameof(MeleeWeaponComponent.NoDamageSound));
|
||||
}
|
||||
|
||||
if (itemToggleMelee.DeactivatedSoundOnSwing != null)
|
||||
{
|
||||
meleeWeapon.SwingSound = itemToggleMelee.DeactivatedSoundOnSwing;
|
||||
DirtyField(uid, meleeWeapon, nameof(MeleeWeaponComponent.SwingSound));
|
||||
}
|
||||
|
||||
if (itemToggleMelee.DeactivatedSecret)
|
||||
{
|
||||
meleeWeapon.Hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
Dirty(uid, meleeWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user