Refactors radiation (#2009)
* Work on refactoring radiation. * mmmm grayons * fixes * Now you can specify whether the pulse will decay or not * whoops * Move IRadiationAct to shared, make DamageableComponent implement it instead and add metallic resistances to walls * General improvements, send draw and decay with state. Rename DPS to RadsPerSecond * E N T I T Y C O O R D I N A T E S * Entity coordinates goood * Remove unused using statements * resistances: metallicResistances * - type: Breakable moment Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
2927ab5cd1
commit
6ec2939f15
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.DamageContainer;
|
||||
using Content.Shared.Damage.ResistanceSet;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -19,7 +20,7 @@ namespace Content.Shared.GameObjects.Components.Damage
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IDamageableComponent))]
|
||||
public class DamageableComponent : Component, IDamageableComponent
|
||||
public class DamageableComponent : Component, IDamageableComponent, IRadiationAct
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -388,5 +389,12 @@ namespace Content.Shared.GameObjects.Components.Damage
|
||||
|
||||
Dirty();
|
||||
}
|
||||
|
||||
public void RadiationAct(float frameTime, SharedRadiationPulseComponent radiation)
|
||||
{
|
||||
var totalDamage = Math.Max((int)(frameTime * radiation.RadsPerSecond), 1);
|
||||
|
||||
ChangeDamage(DamageType.Radiation, totalDamage, false, radiation.Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user