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 System;
using System;
using System.Runtime.CompilerServices;
using Content.Server.Alert;
using Content.Server.Pressure;
@@ -7,24 +7,6 @@ using Content.Shared.Atmos;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Robust.Shared.GameObjects;
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
=======
using Robust.Shared.Serialization.Manager.Attributes;
<<<<<<< refs/remotes/origin/master
using Dependency = Robust.Shared.IoC.DependencyAttribute;
>>>>>>> update damagecomponent across shared and server
=======
using Robust.Shared.Prototypes;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
>>>>>>> Refactor damageablecomponent update (#4406)
=======
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Prototypes;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
>>>>>>> refactor-damageablecomponent
namespace Content.Server.Atmos.Components
{
@@ -36,32 +18,6 @@ namespace Content.Server.Atmos.Components
{
public override string Name => "Barotrauma";
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
<<<<<<< refs/remotes/origin/master
=======
[DataField("damageType", required: true)]
private readonly string _damageType = default!;
=======
=======
>>>>>>> refactor-damageablecomponent
// 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 = "Blunt";
[ViewVariables(VVAccess.ReadWrite)]
public DamageTypePrototype DamageType = default!;
protected override void Initialize()
{
base.Initialize();
DamageType = IoCManager.Resolve<IPrototypeManager>().Index<DamageTypePrototype>(_damageTypeID);
}
<<<<<<< HEAD
>>>>>>> Refactor damageablecomponent update (#4406)
>>>>>>> update damagecomponent across shared and server
=======
>>>>>>> refactor-damageablecomponent
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Update(float airPressure)
{
@@ -84,20 +40,11 @@ namespace Content.Server.Atmos.Components
// Low pressure.
case var p when p <= Atmospherics.WarningLowPressure:
pressure *= lowPressureMultiplier;
if (pressure > Atmospherics.WarningLowPressure)
if(pressure > Atmospherics.WarningLowPressure)
goto default;
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
damageable.ChangeDamage(DamageType.Blunt, Atmospherics.LowPressureDamage, false, Owner);
=======
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
damageable.TryChangeDamage(DamageType, Atmospherics.LowPressureDamage,true);
>>>>>>> Refactor damageablecomponent update (#4406)
=======
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
damageable.TryChangeDamage(DamageType, Atmospherics.LowPressureDamage,true);
>>>>>>> refactor-damageablecomponent
if (status == null) break;
@@ -119,21 +66,7 @@ namespace Content.Server.Atmos.Components
var damage = (int) MathF.Min((pressure / Atmospherics.HazardHighPressure) * Atmospherics.PressureDamageCoefficient, Atmospherics.MaxHighPressureDamage);
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
<<<<<<< refs/remotes/origin/master
damageable.ChangeDamage(DamageType.Blunt, damage, false, Owner);
=======
damageable.ChangeDamage(damageable.GetDamageType(_damageType), damage, false, Owner);
>>>>>>> update damagecomponent across shared and server
=======
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
damageable.TryChangeDamage(DamageType, damage,true);
>>>>>>> Refactor damageablecomponent update (#4406)
=======
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
damageable.TryChangeDamage(DamageType, damage,true);
>>>>>>> refactor-damageablecomponent
if (status == null) break;

View File

@@ -20,8 +20,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Physics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
using Robust.Shared.Prototypes;
using Robust.Shared.IoC;
namespace Content.Server.Atmos.Components
{
@@ -45,18 +43,6 @@ namespace Content.Server.Atmos.Components
[DataField("canResistFire")]
public bool CanResistFire { get; private set; } = false;
// 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 = "Heat"!;
[ViewVariables(VVAccess.ReadWrite)]
public DamageTypePrototype DamageType = default!;
protected override void Initialize()
{
base.Initialize();
DamageType = IoCManager.Resolve<IPrototypeManager>().Index<DamageTypePrototype>(_damageTypeID);
}
public void Extinguish()
{
if (!OnFire) return;
@@ -106,15 +92,7 @@ namespace Content.Server.Atmos.Components
{
// TODO ATMOS Fire resistance from armor
var damage = Math.Min((int) (FireStacks * 2.5f), 10);
<<<<<<< HEAD
<<<<<<< refs/remotes/origin/master
damageable.ChangeDamage(DamageClass.Burn, damage, false);
=======
damageable.TryChangeDamage(DamageType, damage, false);
>>>>>>> Refactor damageablecomponent update (#4406)
=======
damageable.TryChangeDamage(DamageType, damage, false);
>>>>>>> refactor-damageablecomponent
}
AdjustFireStacks(-0.1f * (_resisting ? 10f : 1f));