Remove IRadiationAct (#7757)

* Move radiation collector to ECS

* Damagable system

* Remove IRadiationAct

* Add small helper field

* Update Content.Server/Radiation/Systems/RadiationSystem.cs

Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>

* Delete comment

* Fixed total rads

Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
This commit is contained in:
Alex Evgrashin
2022-04-28 15:36:25 +03:00
committed by GitHub
parent 8be90ea53b
commit 4aa45dc695
9 changed files with 145 additions and 98 deletions

View File

@@ -1,17 +1,9 @@
using System;
using System.Collections.Generic;
using Content.Shared.Acts;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
using Content.Shared.Radiation;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Damage
{
@@ -25,7 +17,7 @@ namespace Content.Shared.Damage
[RegisterComponent]
[NetworkedComponent()]
[Friend(typeof(DamageableSystem))]
public sealed class DamageableComponent : Component, IRadiationAct
public sealed class DamageableComponent : Component
{
/// <summary>
/// This <see cref="DamageContainerPrototype"/> specifies what damage types are supported by this component.
@@ -77,21 +69,6 @@ namespace Content.Shared.Damage
[ViewVariables]
[DataField("explosionDamageTypes", customTypeSerializer: typeof(PrototypeIdListSerializer<DamageTypePrototype>))]
public List<string> ExplosionDamageTypeIDs = new() { "Piercing", "Heat" };
// TODO RADIATION Remove this.
void IRadiationAct.RadiationAct(float frameTime, SharedRadiationPulseComponent radiation)
{
var damageValue = FixedPoint2.New(MathF.Max((frameTime * radiation.RadsPerSecond), 1));
// Radiation should really just be a damage group instead of a list of types.
DamageSpecifier damage = new();
foreach (var typeID in RadiationDamageTypeIDs)
{
damage.DamageDict.Add(typeID, damageValue);
}
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner, damage);
}
}
[Serializable, NetSerializable]