Revert "Refactor Damage to use Protoypes (#4262)"

This reverts commit 20bf5739a9.
This commit is contained in:
Silver
2021-08-24 00:50:39 -06:00
committed by Silver
parent 20bf5739a9
commit e708091518
121 changed files with 711 additions and 10237 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Body.Part;
using Content.Shared.Body.Part;
using Content.Shared.Damage;
namespace Content.Server.Body
@@ -10,7 +10,7 @@ namespace Content.Server.Body
}
// TODO BODY: Remove and pretend it never existed
public class BodyDamageChangeParams : IBodyHealthChangeParams
public class BodyDamageChangeParams : DamageChangeParams, IBodyHealthChangeParams
{
public BodyDamageChangeParams(BodyPartType part)
{

View File

@@ -13,8 +13,6 @@ using Content.Shared.Atmos;
using Content.Shared.Body.Components;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.IoC;
using Content.Shared.MobState;
using Content.Shared.Notification.Managers;
using Robust.Shared.GameObjects;
@@ -36,22 +34,10 @@ namespace Content.Server.Body.Respiratory
private bool _isShivering;
private bool _isSweating;
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
<<<<<<< refs/remotes/origin/master:Content.Server/Body/Respiratory/RespiratorComponent.cs
=======
[DataField("damageType", required: true)]
private readonly string _damageType = default!;
>>>>>>> update damagecomponent across shared and server:Content.Server/Metabolism/MetabolismComponent.cs
[ViewVariables(VVAccess.ReadWrite)] [DataField("suffocationDamage")] private int _suffocationDamage = 1;
[ViewVariables(VVAccess.ReadWrite)] [DataField("suffocationDamageRecovery")] private int _suffocationDamageRecovery = 1;
=======
>>>>>>> Refactor damageablecomponent update (#4406)
=======
>>>>>>> refactor-damageablecomponent
[ViewVariables] [DataField("needsGases")] public Dictionary<Gas, float> NeedsGases { get; set; } = new();
[ViewVariables] [DataField("producesGases")] public Dictionary<Gas, float> ProducesGases { get; set; } = new();
@@ -108,22 +94,6 @@ namespace Content.Server.Body.Respiratory
[ViewVariables] public bool Suffocating { get; private set; }
[ViewVariables(VVAccess.ReadWrite)] [DataField("suffocationDamage")] private int _damage = 1;
[ViewVariables(VVAccess.ReadWrite)] [DataField("suffocationDamageRecovery")] private int _damageRecovery = 1;
// TODO PROTOTYPE Replace this datafield variable with prototype references, once they are supported.
// Also remove Initialize override, if no longer needed.
[DataField("damageType")]
private readonly string _damageTypeID = "Asphyxiation"!;
[ViewVariables(VVAccess.ReadWrite)]
public DamageTypePrototype DamageType = default!;
protected override void Initialize()
{
base.Initialize();
DamageType = IoCManager.Resolve<IPrototypeManager>().Index<DamageTypePrototype>(_damageTypeID);
}
private Dictionary<Gas, float> NeedsAndDeficit(float frameTime)
{
var needs = new Dictionary<Gas, float>(NeedsGases);
@@ -379,19 +349,7 @@ namespace Content.Server.Body.Respiratory
return;
}
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
<<<<<<< refs/remotes/origin/master:Content.Server/Body/Respiratory/RespiratorComponent.cs
damageable.ChangeDamage(DamageType.Asphyxiation, _suffocationDamage, false);
=======
damageable.ChangeDamage(damageable.GetDamageType(_damageType), _suffocationDamage, false);
>>>>>>> update damagecomponent across shared and server:Content.Server/Metabolism/MetabolismComponent.cs
=======
damageable.TryChangeDamage(DamageType, _damage, false);
>>>>>>> Refactor damageablecomponent update (#4406)
=======
damageable.TryChangeDamage(DamageType, _damage, false);
>>>>>>> refactor-damageablecomponent
}
private void StopSuffocation()
@@ -400,19 +358,7 @@ namespace Content.Server.Body.Respiratory
if (Owner.TryGetComponent(out IDamageableComponent? damageable))
{
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
<<<<<<< refs/remotes/origin/master:Content.Server/Body/Respiratory/RespiratorComponent.cs
damageable.ChangeDamage(DamageType.Asphyxiation, -_suffocationDamageRecovery, false);
=======
damageable.ChangeDamage(damageable.GetDamageType(_damageType), -_suffocationDamageRecovery, false);
>>>>>>> update damagecomponent across shared and server:Content.Server/Metabolism/MetabolismComponent.cs
=======
damageable.TryChangeDamage(DamageType, -_damageRecovery, false);
>>>>>>> Refactor damageablecomponent update (#4406)
=======
damageable.TryChangeDamage(DamageType, -_damageRecovery, false);
>>>>>>> refactor-damageablecomponent
}
if (Owner.TryGetComponent(out ServerAlertsComponent? alertsComponent))