Revert "Refactor Damage to use Protoypes (#4262)"
This reverts commit 20bf5739a9.
This commit is contained in:
@@ -188,15 +188,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
if (energyRatio < 1.0)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< refs/remotes/origin/master
|
||||
var newDamages = new Dictionary<DamageType, int>(projectileComponent.Damages.Count);
|
||||
=======
|
||||
var newDamages = new Dictionary<string, int>(projectileComponent.Damages.Count);
|
||||
>>>>>>> Refactor damageablecomponent update (#4406)
|
||||
=======
|
||||
var newDamages = new Dictionary<string, int>(projectileComponent.Damages.Count);
|
||||
>>>>>>> refactor-damageablecomponent
|
||||
foreach (var (damageType, damage) in projectileComponent.Damages)
|
||||
{
|
||||
newDamages.Add(damageType, (int) (damage * energyRatio));
|
||||
|
||||
@@ -399,7 +399,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
if (!result.HitEntity.TryGetComponent(out IDamageableComponent? damageable))
|
||||
return;
|
||||
|
||||
damageable.TryChangeDamage(hitscan.DamageType, (int)Math.Round(hitscan.Damage, MidpointRounding.AwayFromZero));
|
||||
damageable.ChangeDamage(hitscan.DamageType, (int)Math.Round(hitscan.Damage, MidpointRounding.AwayFromZero), false, Owner);
|
||||
//I used Math.Round over Convert.toInt32, as toInt32 always rounds to
|
||||
//even numbers if halfway between two numbers, rather than rounding to nearest
|
||||
}
|
||||
|
||||
@@ -27,8 +27,6 @@ using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Prototypes;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Content.Server.Weapon.Ranged
|
||||
{
|
||||
@@ -52,41 +50,11 @@ namespace Content.Server.Weapon.Ranged
|
||||
[DataField("canHotspot")]
|
||||
private bool _canHotspot = true;
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< refs/remotes/origin/master
|
||||
<<<<<<< refs/remotes/origin/master
|
||||
=======
|
||||
>>>>>>> Bring refactor-damageablecomponent branch up-to-date with master (#4510)
|
||||
=======
|
||||
>>>>>>> refactor-damageablecomponent
|
||||
[DataField("clumsyWeaponHandlingSound")]
|
||||
private SoundSpecifier _clumsyWeaponHandlingSound = new SoundPathSpecifier("/Audio/Items/bikehorn.ogg");
|
||||
|
||||
[DataField("clumsyWeaponShotSound")]
|
||||
private SoundSpecifier _clumsyWeaponShotSound = new SoundPathSpecifier("/Audio/Weapons/Guns/Gunshots/bang.ogg");
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< refs/remotes/origin/master
|
||||
=======
|
||||
=======
|
||||
|
||||
>>>>>>> Bring refactor-damageablecomponent branch up-to-date with master (#4510)
|
||||
=======
|
||||
|
||||
>>>>>>> refactor-damageablecomponent
|
||||
// TODO PROTOTYPE Replace this datafield variable with prototype references, once they are supported.
|
||||
// This also requires changing the dictionary type and modifying TryFire(), which uses it.
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("clumsyDamage")]
|
||||
public Dictionary<string, int> ClumsyDamage { get; set; } = new()
|
||||
{
|
||||
{ "Blunt", 10 },
|
||||
{ "Heat", 5 }
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> Refactor damageablecomponent update (#4406)
|
||||
=======
|
||||
>>>>>>> refactor-damageablecomponent
|
||||
|
||||
public Func<bool>? WeaponCanFireHandler;
|
||||
public Func<IEntity, bool>? UserCanFireHandler;
|
||||
@@ -200,9 +168,6 @@ namespace Content.Server.Weapon.Ranged
|
||||
|
||||
if (ClumsyCheck && ClumsyComponent.TryRollClumsy(user, ClumsyExplodeChance))
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< refs/remotes/origin/master
|
||||
<<<<<<< refs/remotes/origin/master
|
||||
SoundSystem.Play(
|
||||
Filter.Pvs(Owner), _clumsyWeaponHandlingSound.GetSound(),
|
||||
Owner.Transform.Coordinates, AudioParams.Default.WithMaxDistance(5));
|
||||
@@ -210,48 +175,18 @@ namespace Content.Server.Weapon.Ranged
|
||||
SoundSystem.Play(
|
||||
Filter.Pvs(Owner), _clumsyWeaponShotSound.GetSound(),
|
||||
Owner.Transform.Coordinates, AudioParams.Default.WithMaxDistance(5));
|
||||
=======
|
||||
>>>>>>> Refactor damageablecomponent update (#4406)
|
||||
|
||||
=======
|
||||
>>>>>>> Bring refactor-damageablecomponent branch up-to-date with master (#4510)
|
||||
//Wound them
|
||||
if (user.TryGetComponent(out IDamageableComponent? health))
|
||||
{
|
||||
<<<<<<< refs/remotes/origin/master
|
||||
health.ChangeDamage(DamageType.Blunt, 10, false, user);
|
||||
health.ChangeDamage(DamageType.Heat, 5, false, user);
|
||||
=======
|
||||
=======
|
||||
//Wound them
|
||||
if (user.TryGetComponent(out IDamageableComponent? health))
|
||||
{
|
||||
>>>>>>> refactor-damageablecomponent
|
||||
foreach (KeyValuePair<string, int> damage in ClumsyDamage)
|
||||
{
|
||||
health.TryChangeDamage(_prototypeManager.Index<DamageTypePrototype>(damage.Key), damage.Value);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> Refactor damageablecomponent update (#4406)
|
||||
=======
|
||||
>>>>>>> refactor-damageablecomponent
|
||||
}
|
||||
|
||||
// Knock them down
|
||||
if (user.TryGetComponent(out StunnableComponent? stun))
|
||||
{
|
||||
stun.Paralyze(3f);
|
||||
}
|
||||
|
||||
// Apply salt to the wound ("Honk!")
|
||||
SoundSystem.Play(
|
||||
Filter.Pvs(Owner), _clumsyWeaponHandlingSound.GetSound(),
|
||||
Owner.Transform.Coordinates, AudioParams.Default.WithMaxDistance(5));
|
||||
|
||||
SoundSystem.Play(
|
||||
Filter.Pvs(Owner), _clumsyWeaponShotSound.GetSound(),
|
||||
Owner.Transform.Coordinates, AudioParams.Default.WithMaxDistance(5));
|
||||
|
||||
user.PopupMessage(Loc.GetString("server-ranged-weapon-component-try-fire-clumsy"));
|
||||
|
||||
Owner.Delete();
|
||||
|
||||
Reference in New Issue
Block a user