From 6ec2939f15a3776df152756c433f380f4c892955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= <6766154+Zumorica@users.noreply.github.com> Date: Mon, 21 Sep 2020 01:49:40 +0200 Subject: [PATCH] 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 --- .../StationEvents/RadiationPulseComponent.cs | 26 +++- .../StationEvents/RadiationPulseOverlay.cs | 31 +++-- .../StationEvents/RadiationPulseComponent.cs | 114 +++++++++++++----- .../StationEvents/RadiationPulseSystem.cs | 83 ++++--------- .../StationEvents/RadiationStorm.cs | 4 +- .../Components/Damage/DamageableComponent.cs | 10 +- .../Components/SharedRadiationStorm.cs | 32 +++-- .../Components/Interaction/IRadiationAct.cs | 10 ++ .../Constructible/Doors/airlock_base.yml | 1 + .../Constructible/Ground/furniture.yml | 4 + .../Constructible/Ground/instruments.yml | 1 + .../Constructible/Ground/pilot_chair.yml | 1 + .../Entities/Constructible/Ground/pipes.yml | 1 + .../Entities/Constructible/Ground/pumps.yml | 1 + .../Constructible/Ground/scrubbers.yml | 1 + .../Entities/Constructible/Ground/table.yml | 4 +- .../Entities/Constructible/Ground/vents.yml | 1 + .../Entities/Constructible/Ground/wires.yml | 4 + .../Power/AME/ame_controller.yml | 3 +- .../Constructible/Power/AME/ame_structure.yml | 3 +- .../Constructible/Power/cloning_machine.yml | 1 + .../Constructible/Power/debug_power.yml | 1 + .../Constructible/Power/gravity_generator.yml | 1 + .../Constructible/Power/medical_scanner.yml | 1 + .../Constructible/Power/power_base.yml | 1 + .../Constructible/Power/vending_machines.yml | 1 + .../Constructible/Storage/Closets/closet.yml | 1 + .../Storage/StorageTanks/storage_tank.yml | 1 + .../Constructible/Storage/crate_base.yml | 2 + .../Entities/Constructible/Walls/asteroid.yml | 1 + .../Entities/Constructible/Walls/girder.yml | 1 + .../Entities/Constructible/Walls/lighting.yml | 2 + .../Entities/Constructible/Walls/low_wall.yml | 1 + .../Entities/Constructible/Walls/signs.yml | 1 + .../Entities/Constructible/Walls/walls.yml | 19 +++ .../Entities/Constructible/Walls/windows.yml | 1 + .../Entities/Constructible/disposal.yml | 2 + 37 files changed, 250 insertions(+), 123 deletions(-) create mode 100644 Content.Shared/Interfaces/GameObjects/Components/Interaction/IRadiationAct.cs diff --git a/Content.Client/GameObjects/Components/StationEvents/RadiationPulseComponent.cs b/Content.Client/GameObjects/Components/StationEvents/RadiationPulseComponent.cs index 23d57a957c..98dcd7a6ff 100644 --- a/Content.Client/GameObjects/Components/StationEvents/RadiationPulseComponent.cs +++ b/Content.Client/GameObjects/Components/StationEvents/RadiationPulseComponent.cs @@ -6,19 +6,35 @@ using Robust.Shared.GameObjects; namespace Content.Client.GameObjects.Components.StationEvents { [RegisterComponent] + [ComponentReference(typeof(SharedRadiationPulseComponent))] public sealed class RadiationPulseComponent : SharedRadiationPulseComponent { - public TimeSpan EndTime { get; private set; } - + private bool _draw; + private bool _decay; + private float _radsPerSecond; + private float _range; + private TimeSpan _endTime; + + public override float RadsPerSecond => _radsPerSecond; + public override float Range => _range; + public override TimeSpan EndTime => _endTime; + public override bool Draw => _draw; + public override bool Decay => _decay; + public override void HandleComponentState(ComponentState? curState, ComponentState? nextState) { base.HandleComponentState(curState, nextState); - if (!(curState is RadiationPulseMessage state)) + + if (!(curState is RadiationPulseState state)) { return; } - EndTime = state.EndTime; + _radsPerSecond = state.RadsPerSecond; + _range = state.Range; + _draw = state.Draw; + _decay = state.Decay; + _endTime = state.EndTime; } } -} \ No newline at end of file +} diff --git a/Content.Client/StationEvents/RadiationPulseOverlay.cs b/Content.Client/StationEvents/RadiationPulseOverlay.cs index 54c2785afb..18db9fa121 100644 --- a/Content.Client/StationEvents/RadiationPulseOverlay.cs +++ b/Content.Client/StationEvents/RadiationPulseOverlay.cs @@ -25,16 +25,16 @@ namespace Content.Client.StationEvents [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; - + /// /// Current color of a pulse /// private readonly Dictionary _colors = new Dictionary(); - + /// /// Whether our alpha is increasing or decreasing and at what time does it flip (or stop) /// - private readonly Dictionary _transitions = + private readonly Dictionary _transitions = new Dictionary(); /// @@ -43,7 +43,7 @@ namespace Content.Client.StationEvents private readonly Dictionary _alphaRateOfChange = new Dictionary(); private TimeSpan _lastTick; - + // TODO: When worldHandle can do DrawCircle change this. public override OverlaySpace Space => OverlaySpace.ScreenSpace; @@ -64,7 +64,7 @@ namespace Content.Client.StationEvents private Color GetColor(IEntity entity, float elapsedTime, TimeSpan endTime) { var currentTime = _gameTiming.CurTime; - + // New pulse if (!_colors.ContainsKey(entity)) { @@ -92,7 +92,7 @@ namespace Content.Client.StationEvents { bool easingIn; TimeSpan transitionTime; - + if (!_transitions.TryGetValue(entity, out var transition)) { // Start as false because it will immediately be flipped @@ -104,12 +104,12 @@ namespace Content.Client.StationEvents easingIn = transition.EasingIn; transitionTime = endTime; } - + _transitions[entity] = (!easingIn, transitionTime); _colors[entity] = Color.Green.WithAlpha(0.0f); _alphaRateOfChange[entity] = 1.0f / (float) (transitionTime - currentTime).TotalSeconds; } - + protected override void Draw(DrawingHandleBase handle, OverlaySpace currentSpace) { // PVS should control the overlay pretty well so the overlay doesn't get instantiated unless we're near one... @@ -134,19 +134,18 @@ namespace Content.Client.StationEvents { foreach (var pulse in radiationPulses) { - if (grid.Index != pulse.Owner.Transform.GridID) continue; - + if (!pulse.Draw || grid.Index != pulse.Owner.Transform.GridID) continue; + // TODO: Check if viewport intersects circle var circlePosition = _eyeManager.WorldToScreen(pulse.Owner.Transform.WorldPosition); - var comp = (RadiationPulseComponent) pulse; - + // change to worldhandle when implemented screenHandle.DrawCircle( - circlePosition, - comp.Range * 64, - GetColor(pulse.Owner, elapsedTime, comp.EndTime)); + circlePosition, + pulse.Range * 64, + GetColor(pulse.Owner, pulse.Decay ? elapsedTime : 0, pulse.EndTime)); } } } } -} \ No newline at end of file +} diff --git a/Content.Server/GameObjects/Components/StationEvents/RadiationPulseComponent.cs b/Content.Server/GameObjects/Components/StationEvents/RadiationPulseComponent.cs index 86dbe57a12..df2453b4ce 100644 --- a/Content.Server/GameObjects/Components/StationEvents/RadiationPulseComponent.cs +++ b/Content.Server/GameObjects/Components/StationEvents/RadiationPulseComponent.cs @@ -8,58 +8,116 @@ using Robust.Shared.Interfaces.Timing; using Robust.Shared.IoC; using Robust.Shared.Random; using Robust.Shared.Serialization; -using Robust.Shared.Timers; namespace Content.Server.GameObjects.Components.StationEvents { [RegisterComponent] + [ComponentReference(typeof(SharedRadiationPulseComponent))] public sealed class RadiationPulseComponent : SharedRadiationPulseComponent { [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IRobustRandom _random = default!; - private const float MinPulseLifespan = 0.8f; - private const float MaxPulseLifespan = 2.5f; - - public float DPS => _dps; - private float _dps; - + private float _duration; + private float _radsPerSecond; + private float _range; private TimeSpan _endTime; + private bool _draw; + private bool _decay; + + /// + /// Whether the entity will delete itself after a certain duration defined by + /// and + /// + public override bool Decay + { + get => _decay; + set + { + _decay = value; + Dirty(); + } + } + + public float MinPulseLifespan { get; set; } + + public float MaxPulseLifespan { get; set; } + + public override float RadsPerSecond + { + get => _radsPerSecond; + set + { + _radsPerSecond = value; + Dirty(); + } + } + + public string Sound { get; set; } + + public override float Range + { + get => _range; + set + { + _range = value; + Dirty(); + } + } + + public override bool Draw + { + get => _draw; + set + { + _draw = value; + Dirty(); + } + } + + public override TimeSpan EndTime => _endTime; public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); - serializer.DataField(ref _dps, "dps", 40.0f); + serializer.DataField(this, x => x.RadsPerSecond, "dps", 40.0f); + serializer.DataField(this, x => x.Sound, "sound", "/Audio/Weapons/Guns/Gunshots/laser3.ogg"); + serializer.DataField(this, x => x.Range, "range", 5.0f); + serializer.DataField(this, x => x.Draw, "draw", true); + serializer.DataField(this, x => x.Decay, "decay", true); + serializer.DataField(this, x => x.MaxPulseLifespan, "maxPulseLifespan", 2.5f); + serializer.DataField(this, x => x.MinPulseLifespan, "minPulseLifespan", 0.8f); } - public override void Initialize() + public void DoPulse() { - base.Initialize(); - - var currentTime = _gameTiming.CurTime; - var duration = - TimeSpan.FromSeconds( - _random.NextFloat() * (MaxPulseLifespan - MinPulseLifespan) + - MinPulseLifespan); - - _endTime = currentTime + duration; - - Timer.Spawn(duration, - () => + if (Decay) { - if (!Owner.Deleted) - { - Owner.Delete(); - } - }); + var currentTime = _gameTiming.CurTime; + _duration = _random.NextFloat() * (MaxPulseLifespan - MinPulseLifespan) + MinPulseLifespan; + _endTime = currentTime + TimeSpan.FromSeconds(_duration); + } + + if(!string.IsNullOrEmpty(Sound)) + EntitySystem.Get().PlayAtCoords(Sound, Owner.Transform.Coordinates); - EntitySystem.Get().PlayAtCoords("/Audio/Weapons/Guns/Gunshots/laser3.ogg", Owner.Transform.Coordinates); Dirty(); } public override ComponentState GetComponentState() { - return new RadiationPulseMessage(_endTime); + return new RadiationPulseState(_radsPerSecond, _range, Draw, Decay, _endTime); + } + + public void Update(float frameTime) + { + if (!Decay || Owner.Deleted) + return; + + if(_duration <= 0f) + Owner.Delete(); + + _duration -= frameTime; } } } diff --git a/Content.Server/GameObjects/EntitySystems/StationEvents/RadiationPulseSystem.cs b/Content.Server/GameObjects/EntitySystems/StationEvents/RadiationPulseSystem.cs index 0a33eb0d3d..cf2abe467d 100644 --- a/Content.Server/GameObjects/EntitySystems/StationEvents/RadiationPulseSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StationEvents/RadiationPulseSystem.cs @@ -1,87 +1,56 @@ -using System.Collections.Generic; using Content.Server.GameObjects.Components.StationEvents; -using Content.Shared.Damage; -using Content.Shared.GameObjects.Components.Body; -using Content.Shared.GameObjects.Components.Damage; +using Content.Shared.Interfaces.GameObjects.Components; using JetBrains.Annotations; -using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.Interfaces.GameObjects; +using Robust.Shared.Map; namespace Content.Server.GameObjects.EntitySystems.StationEvents { [UsedImplicitly] public sealed class RadiationPulseSystem : EntitySystem { - // Rather than stuffing around with collidables and checking entities on initialize etc. we'll just tick over - // for each entity in range. Seemed easier than checking entities on spawn, then checking collidables, etc. - // Especially considering each pulse is a big chonker, + no circle hitboxes yet. + private const string RadiationPrototype = "RadiationPulse"; - private TypeEntityQuery _speciesQuery; - - /// - /// Damage works with ints so we'll just accumulate damage and once we hit this threshold we'll apply it. - /// - /// This also server to stop spamming the damagethreshold with 1 damage continuously. - private const int DamageThreshold = 10; - - private Dictionary _accumulatedDamage = new Dictionary(); - - public override void Initialize() + public IEntity RadiationPulse(EntityCoordinates coordinates, float range, int dps, bool decay = true, float minPulseLifespan = 0.8f, float maxPulseLifespan = 2.5f, string sound = null) { - base.Initialize(); - _speciesQuery = new TypeEntityQuery(typeof(ISharedBodyManagerComponent)); + var radiationEntity = EntityManager.SpawnEntity(RadiationPrototype, coordinates); + var radiation = radiationEntity.GetComponent(); + + radiation.Range = range; + radiation.RadsPerSecond = dps; + radiation.Draw = false; + radiation.Decay = decay; + radiation.MinPulseLifespan = minPulseLifespan; + radiation.MaxPulseLifespan = maxPulseLifespan; + radiation.Sound = sound; + + radiation.DoPulse(); + + return radiationEntity; } public override void Update(float frameTime) { base.Update(frameTime); - var anyPulses = false; foreach (var comp in ComponentManager.EntityQuery()) { - anyPulses = true; + comp.Update(frameTime); + var ent = comp.Owner; - foreach (var species in EntityManager.GetEntities(_speciesQuery)) + if (ent.Deleted) continue; + + foreach (var entity in EntityManager.GetEntitiesInRange(ent.Transform.Coordinates, comp.Range, true)) { - // Work out if we're in range and accumulate more damage - // If we've hit the DamageThreshold we'll also apply that damage to the mob - // If we're really lagging server can apply multiples of the DamageThreshold at once - if (species.Transform.MapID != comp.Owner.Transform.MapID) continue; + if (entity.Deleted) continue; - if ((species.Transform.WorldPosition - comp.Owner.Transform.WorldPosition).Length > comp.Range) + foreach (var radiation in entity.GetAllComponents()) { - continue; + radiation.RadiationAct(frameTime, comp); } - - var totalDamage = frameTime * comp.DPS; - - if (!_accumulatedDamage.TryGetValue(species, out var accumulatedSpecies)) - { - _accumulatedDamage[species] = 0.0f; - } - - totalDamage += accumulatedSpecies; - _accumulatedDamage[species] = totalDamage; - - if (totalDamage < DamageThreshold) continue; - if (!species.TryGetComponent(out DamageableComponent damageableComponent)) continue; - - var damageMultiple = (int) (totalDamage / DamageThreshold); - _accumulatedDamage[species] = totalDamage % DamageThreshold; - - damageableComponent.ChangeDamage(DamageType.Heat, damageMultiple * DamageThreshold, false, comp.Owner); } } - - if (anyPulses) - { - return; - } - - // probably don't need to worry about clearing this at roundreset unless you have a radiation pulse at roundstart - // (which is currently not possible) - _accumulatedDamage.Clear(); } } } diff --git a/Content.Server/StationEvents/RadiationStorm.cs b/Content.Server/StationEvents/RadiationStorm.cs index 9d3d7854bd..f79434083a 100644 --- a/Content.Server/StationEvents/RadiationStorm.cs +++ b/Content.Server/StationEvents/RadiationStorm.cs @@ -1,4 +1,5 @@ using Content.Server.GameObjects.Components.Mobs; +using Content.Server.GameObjects.Components.StationEvents; using Content.Shared.GameObjects.Components.Mobs; using Content.Shared.Utility; using JetBrains.Annotations; @@ -114,7 +115,8 @@ namespace Content.Server.StationEvents private void SpawnPulse(IMapGrid mapGrid) { - _entityManager.SpawnEntity("RadiationPulse", FindRandomGrid(mapGrid)); + var pulse = _entityManager.SpawnEntity("RadiationPulse", FindRandomGrid(mapGrid)); + pulse.GetComponent().DoPulse(); _timeUntilPulse = _robustRandom.NextFloat() * (MaxPulseDelay - MinPulseDelay) + MinPulseDelay; _pulsesRemaining -= 1; } diff --git a/Content.Shared/GameObjects/Components/Damage/DamageableComponent.cs b/Content.Shared/GameObjects/Components/Damage/DamageableComponent.cs index 551ffd026d..a0903c90d6 100644 --- a/Content.Shared/GameObjects/Components/Damage/DamageableComponent.cs +++ b/Content.Shared/GameObjects/Components/Damage/DamageableComponent.cs @@ -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 /// [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); + } } } diff --git a/Content.Shared/GameObjects/Components/SharedRadiationStorm.cs b/Content.Shared/GameObjects/Components/SharedRadiationStorm.cs index efa28f0919..1e2fd11d43 100644 --- a/Content.Shared/GameObjects/Components/SharedRadiationStorm.cs +++ b/Content.Shared/GameObjects/Components/SharedRadiationStorm.cs @@ -9,30 +9,38 @@ namespace Content.Shared.GameObjects.Components public override string Name => "RadiationPulse"; public override uint? NetID => ContentNetIDs.RADIATION_PULSE; + public virtual float RadsPerSecond { get; set; } + /// /// Radius of the pulse from its position /// - public float Range => _range; - private float _range; + public virtual float Range { get; set; } - public override void ExposeData(ObjectSerializer serializer) - { - base.ExposeData(serializer); - serializer.DataField(ref _range, "range", 5.0f); - } + public virtual bool Decay { get; set; } + public virtual bool Draw { get; set; } + + public virtual TimeSpan EndTime { get; } } - + /// /// For syncing the pulse's lifespan between client and server for the overlay /// [Serializable, NetSerializable] - public sealed class RadiationPulseMessage : ComponentState + public class RadiationPulseState : ComponentState { - public TimeSpan EndTime { get; } + public readonly float RadsPerSecond; + public readonly float Range; + public readonly bool Draw; + public readonly bool Decay; + public readonly TimeSpan EndTime; - public RadiationPulseMessage(TimeSpan endTime) : base(ContentNetIDs.RADIATION_PULSE) + public RadiationPulseState(float radsPerSecond, float range, bool draw, bool decay, TimeSpan endTime) : base(ContentNetIDs.RADIATION_PULSE) { + RadsPerSecond = radsPerSecond; + Range = range; + Draw = draw; + Decay = decay; EndTime = endTime; } } -} \ No newline at end of file +} diff --git a/Content.Shared/Interfaces/GameObjects/Components/Interaction/IRadiationAct.cs b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IRadiationAct.cs new file mode 100644 index 0000000000..b5fa62844d --- /dev/null +++ b/Content.Shared/Interfaces/GameObjects/Components/Interaction/IRadiationAct.cs @@ -0,0 +1,10 @@ +using Content.Shared.GameObjects.Components; +using Robust.Shared.Interfaces.GameObjects; + +namespace Content.Shared.Interfaces.GameObjects.Components +{ + public interface IRadiationAct : IComponent + { + void RadiationAct(float frameTime, SharedRadiationPulseComponent radiation); + } +} diff --git a/Resources/Prototypes/Entities/Constructible/Doors/airlock_base.yml b/Resources/Prototypes/Entities/Constructible/Doors/airlock_base.yml index 324bd96eb9..fd0df24642 100644 --- a/Resources/Prototypes/Entities/Constructible/Doors/airlock_base.yml +++ b/Resources/Prototypes/Entities/Constructible/Doors/airlock_base.yml @@ -61,6 +61,7 @@ offset: Center - type: Destructible deadThreshold: 500 + resistances: metallicResistances placement: mode: SnapgridCenter diff --git a/Resources/Prototypes/Entities/Constructible/Ground/furniture.yml b/Resources/Prototypes/Entities/Constructible/Ground/furniture.yml index a46c09b640..c22cd6a79b 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/furniture.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/furniture.yml @@ -19,6 +19,7 @@ - type: Pullable - type: Destructible deadThreshold: 50 + resistances: metallicResistances - type: entity name: bar stool @@ -52,6 +53,7 @@ - type: Pullable - type: Destructible deadThreshold: 50 + resistances: metallicResistances - type: entity name: dark office chair @@ -87,6 +89,7 @@ - type: Pullable - type: Destructible deadThreshold: 50 + resistances: metallicResistances - type: entity parent: Chair @@ -135,5 +138,6 @@ rotation: -90 - type: Destructible deadThreshold: 75 + resistances: metallicResistances placement: mode: SnapgridCenter diff --git a/Resources/Prototypes/Entities/Constructible/Ground/instruments.yml b/Resources/Prototypes/Entities/Constructible/Ground/instruments.yml index 0d6f8fd52b..bd2bfa43dd 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/instruments.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/instruments.yml @@ -19,6 +19,7 @@ offset: Center - type: Destructible deadThreshold: 50 + resistances: metallicResistances - type: UserInterface interfaces: - key: enum.InstrumentUiKey.Key diff --git a/Resources/Prototypes/Entities/Constructible/Ground/pilot_chair.yml b/Resources/Prototypes/Entities/Constructible/Ground/pilot_chair.yml index e0e94ba172..81fd31f6c2 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/pilot_chair.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/pilot_chair.yml @@ -15,6 +15,7 @@ - type: InteractionOutline - type: Destructible deadThreshold: 100 + resistances: metallicResistances - type: Physics - type: ShuttleController - type: Strap diff --git a/Resources/Prototypes/Entities/Constructible/Ground/pipes.yml b/Resources/Prototypes/Entities/Constructible/Ground/pipes.yml index a2600c5efb..69344c3555 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/pipes.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/pipes.yml @@ -12,6 +12,7 @@ - type: Sprite - type: Destructible thresholdvalue: 100 + resistances: metallicResistances - type: Appearance visuals: - type: PipeVisualizer diff --git a/Resources/Prototypes/Entities/Constructible/Ground/pumps.yml b/Resources/Prototypes/Entities/Constructible/Ground/pumps.yml index 3528fe7b57..75b7d97d77 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/pumps.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/pumps.yml @@ -21,6 +21,7 @@ pumpRSI: Constructible/Atmos/pressurepump.rsi - type: Destructible thresholdvalue: 100 + resistances: metallicResistances - type: entity abstract: true diff --git a/Resources/Prototypes/Entities/Constructible/Ground/scrubbers.yml b/Resources/Prototypes/Entities/Constructible/Ground/scrubbers.yml index e2526c33dc..fcb270dd43 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/scrubbers.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/scrubbers.yml @@ -23,6 +23,7 @@ siphonRSI: Constructible/Atmos/scrubber.rsi - type: Destructible thresholdvalue: 100 + resistances: metallicResistances - type: entity parent: ScrubberBase diff --git a/Resources/Prototypes/Entities/Constructible/Ground/table.yml b/Resources/Prototypes/Entities/Constructible/Ground/table.yml index 3c7bff137d..f763addfe6 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/table.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/table.yml @@ -1,7 +1,7 @@ - type: entity id: Table name: "table" - description: A square piece of metal standing on four metal legs. + description: A square piece of metal standing on four metal legs. components: - type: Clickable - type: InteractionOutline @@ -25,6 +25,7 @@ - type: Climbable - type: Destructible deadThreshold: 50 + resistances: metallicResistances spawnOnDestroy: SteelSheet1 - type: entity @@ -54,4 +55,5 @@ - type: Climbable - type: Destructible deadThreshold: 15 + resistances: metallicResistances spawnOnDestroy: WoodPlank diff --git a/Resources/Prototypes/Entities/Constructible/Ground/vents.yml b/Resources/Prototypes/Entities/Constructible/Ground/vents.yml index 4316be138a..ceb386d991 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/vents.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/vents.yml @@ -22,6 +22,7 @@ - type: VentVisualizer ventRSI: Constructible/Atmos/vent.rsi - type: Destructible + resistances: metallicResistances thresholdvalue: 100 - type: entity diff --git a/Resources/Prototypes/Entities/Constructible/Ground/wires.yml b/Resources/Prototypes/Entities/Constructible/Ground/wires.yml index 90b44d52ee..8ac83f86d4 100644 --- a/Resources/Prototypes/Entities/Constructible/Ground/wires.yml +++ b/Resources/Prototypes/Entities/Constructible/Ground/wires.yml @@ -18,6 +18,7 @@ mode: CardinalFlags - type: Destructible thresholdvalue: 100 + resistances: metallicResistances - type: SubFloorHide - type: entity @@ -39,6 +40,7 @@ wireDroppedOnCutPrototype: HVWireStack1 wireType: HighVoltage - type: Destructible + resistances: metallicResistances spawnondestroy: HVWireStack1 - type: entity @@ -61,6 +63,7 @@ wireDroppedOnCutPrototype: MVWireStack1 wireType: MediumVoltage - type: Destructible + resistances: metallicResistances spawnondestroy: MVWireStack1 - type: entity @@ -85,4 +88,5 @@ wireDroppedOnCutPrototype: ApcExtensionCableStack1 wireType: Apc - type: Destructible + resistances: metallicResistances spawnondestroy: ApcExtensionCableStack1 diff --git a/Resources/Prototypes/Entities/Constructible/Power/AME/ame_controller.yml b/Resources/Prototypes/Entities/Constructible/Power/AME/ame_controller.yml index 53c4c42f14..6fc8346eda 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/AME/ame_controller.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/AME/ame_controller.yml @@ -22,6 +22,7 @@ - SmallImpassable - type: Destructible maxHP: 500 + resistances: metallicResistances - type: SnapGrid offset: Center - type: Anchorable @@ -41,4 +42,4 @@ nodeGroupID: HVPower - type: PowerReceiver - type: PowerSupplier - supplyRate: 0 \ No newline at end of file + supplyRate: 0 diff --git a/Resources/Prototypes/Entities/Constructible/Power/AME/ame_structure.yml b/Resources/Prototypes/Entities/Constructible/Power/AME/ame_structure.yml index 93c9b23a5f..cb44cf2c1e 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/AME/ame_structure.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/AME/ame_structure.yml @@ -23,6 +23,7 @@ - SmallImpassable - type: Destructible maxHP: 500 + resistances: metallicResistances spawnondestroy: AMEPart - type: SnapGrid offset: Center @@ -43,4 +44,4 @@ color: "#00AAFF" - type: Appearance visuals: - - type: AMEVisualizer \ No newline at end of file + - type: AMEVisualizer diff --git a/Resources/Prototypes/Entities/Constructible/Power/cloning_machine.yml b/Resources/Prototypes/Entities/Constructible/Power/cloning_machine.yml index 11125bcc92..2b0fca52b8 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/cloning_machine.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/cloning_machine.yml @@ -35,6 +35,7 @@ cloningTime: 10.0 - type: Destructible deadThreshold: 100 + resistances: metallicResistances - type: Appearance visuals: - type: CloningPodVisualizer diff --git a/Resources/Prototypes/Entities/Constructible/Power/debug_power.yml b/Resources/Prototypes/Entities/Constructible/Power/debug_power.yml index ca870a2241..edba665ee5 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/debug_power.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/debug_power.yml @@ -30,6 +30,7 @@ drawRate: 50 - type: Breakable deadThreshold: 100 + resistances: metallicResistances - type: Anchorable - type: entity diff --git a/Resources/Prototypes/Entities/Constructible/Power/gravity_generator.yml b/Resources/Prototypes/Entities/Constructible/Power/gravity_generator.yml index d783129f87..a8f7fa6a26 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/gravity_generator.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/gravity_generator.yml @@ -30,6 +30,7 @@ - type: InteractionOutline - type: Breakable deadThreshold: 150 + resistances: metallicResistances - type: GravityGenerator - type: UserInterface interfaces: diff --git a/Resources/Prototypes/Entities/Constructible/Power/medical_scanner.yml b/Resources/Prototypes/Entities/Constructible/Power/medical_scanner.yml index c181cef175..07986f40df 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/medical_scanner.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/medical_scanner.yml @@ -35,6 +35,7 @@ - type: MedicalScanner - type: Destructible deadThreshold: 100 + resistances: metallicResistances - type: Appearance visuals: - type: MedicalScannerVisualizer diff --git a/Resources/Prototypes/Entities/Constructible/Power/power_base.yml b/Resources/Prototypes/Entities/Constructible/Power/power_base.yml index 61118ad05e..fb48f858ba 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/power_base.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/power_base.yml @@ -188,3 +188,4 @@ offset: Center - type: Breakable deadThreshold: 100 + resistances: metallicResistances diff --git a/Resources/Prototypes/Entities/Constructible/Power/vending_machines.yml b/Resources/Prototypes/Entities/Constructible/Power/vending_machines.yml index c4b616b3e3..f1b7790560 100644 --- a/Resources/Prototypes/Entities/Constructible/Power/vending_machines.yml +++ b/Resources/Prototypes/Entities/Constructible/Power/vending_machines.yml @@ -32,6 +32,7 @@ offset: Center - type: Breakable deadThreshold: 50 + resistances: metallicResistances - type: UserInterface interfaces: - key: enum.VendingMachineUiKey.Key diff --git a/Resources/Prototypes/Entities/Constructible/Storage/Closets/closet.yml b/Resources/Prototypes/Entities/Constructible/Storage/Closets/closet.yml index 12737a47bb..d79d933646 100644 --- a/Resources/Prototypes/Entities/Constructible/Storage/Closets/closet.yml +++ b/Resources/Prototypes/Entities/Constructible/Storage/Closets/closet.yml @@ -43,6 +43,7 @@ - type: PlaceableSurface - type: Destructible deadThreshold: 100 + resistances: metallicResistances - type: Appearance visuals: - type: StorageVisualizer diff --git a/Resources/Prototypes/Entities/Constructible/Storage/StorageTanks/storage_tank.yml b/Resources/Prototypes/Entities/Constructible/Storage/StorageTanks/storage_tank.yml index 0a0e90e161..8769f3eab0 100644 --- a/Resources/Prototypes/Entities/Constructible/Storage/StorageTanks/storage_tank.yml +++ b/Resources/Prototypes/Entities/Constructible/Storage/StorageTanks/storage_tank.yml @@ -27,6 +27,7 @@ Anchored: false - type: Destructible deadThreshold: 10 + resistances: metallicResistances - type: SolutionContainer maxVol: 1500 caps: RemoveFrom diff --git a/Resources/Prototypes/Entities/Constructible/Storage/crate_base.yml b/Resources/Prototypes/Entities/Constructible/Storage/crate_base.yml index 77aa013b3c..d68b84905e 100644 --- a/Resources/Prototypes/Entities/Constructible/Storage/crate_base.yml +++ b/Resources/Prototypes/Entities/Constructible/Storage/crate_base.yml @@ -38,6 +38,8 @@ - type: PlaceableSurface - type: Destructible deadThreshold: 100 + resistances: metallicResistances + - type: Appearance visuals: - type: StorageVisualizer diff --git a/Resources/Prototypes/Entities/Constructible/Walls/asteroid.yml b/Resources/Prototypes/Entities/Constructible/Walls/asteroid.yml index 03226aa632..f77642ec22 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/asteroid.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/asteroid.yml @@ -18,6 +18,7 @@ layer: [MobMask] - type: Destructible deadThreshold: 100 + resistances: metallicResistances - type: Occluder sizeX: 32 sizeY: 32 diff --git a/Resources/Prototypes/Entities/Constructible/Walls/girder.yml b/Resources/Prototypes/Entities/Constructible/Walls/girder.yml index 730451a73a..d37fd8804c 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/girder.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/girder.yml @@ -16,6 +16,7 @@ layer: [MobMask, Opaque] - type: Destructible deadThreshold: 50 + resistances: metallicResistances spawnOnDestroy: SteelSheet1 - type: SnapGrid offset: Edge diff --git a/Resources/Prototypes/Entities/Constructible/Walls/lighting.yml b/Resources/Prototypes/Entities/Constructible/Walls/lighting.yml index dc672f21aa..9f5735e716 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/lighting.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/lighting.yml @@ -40,6 +40,7 @@ - type: PowerReceiver - type: Destructible deadThreshold: 50 + resistances: metallicResistances - type: entity name: small light @@ -61,3 +62,4 @@ - type: PowerReceiver - type: Destructible deadThreshold: 25 + resistances: metallicResistances diff --git a/Resources/Prototypes/Entities/Constructible/Walls/low_wall.yml b/Resources/Prototypes/Entities/Constructible/Walls/low_wall.yml index cde4c568aa..43e8df9870 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/low_wall.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/low_wall.yml @@ -26,6 +26,7 @@ - SmallImpassable - type: Destructible deadThreshold: 100 + resistances: metallicResistances - type: SnapGrid offset: Center - type: Climbable diff --git a/Resources/Prototypes/Entities/Constructible/Walls/signs.yml b/Resources/Prototypes/Entities/Constructible/Walls/signs.yml index 36d2b59214..09cb992ea0 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/signs.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/signs.yml @@ -10,6 +10,7 @@ - !type:PhysShapeAabb - type: Destructible thresholdvalue: 5 + resistances: metallicResistances - type: Sprite drawdepth: WallTops sprite: Constructible/Misc/decals.rsi diff --git a/Resources/Prototypes/Entities/Constructible/Walls/walls.yml b/Resources/Prototypes/Entities/Constructible/Walls/walls.yml index f1b40df43d..24ae9830d7 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/walls.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/walls.yml @@ -28,6 +28,7 @@ - type: Destructible deadThreshold: 500 spawnOnDestroy: Girder + resistances: metallicResistances - type: Occluder sizeX: 32 sizeY: 32 @@ -51,6 +52,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: brick @@ -67,6 +69,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: clock @@ -83,6 +86,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: clown @@ -100,6 +104,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: cult @@ -116,6 +121,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: debug @@ -132,6 +138,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: diamond @@ -149,6 +156,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: gold @@ -165,6 +173,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: ice @@ -181,6 +190,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: metal @@ -197,6 +207,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: plasma @@ -213,6 +224,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: plastic @@ -231,6 +243,7 @@ - type: Destructible deadThreshold: 600 spawnOnDestroy: Girder + resistances: metallicResistances - type: ReinforcedWall key: walls base: solid @@ -249,6 +262,7 @@ - type: Destructible deadThreshold: 1000 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: riveted @@ -265,6 +279,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: sandstone @@ -281,6 +296,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: silver @@ -299,6 +315,7 @@ deadThreshold: 300 spawnOnDestroy: Girder destroySound: /Audio/Effects/metalbreak.ogg + resistances: metallicResistances - type: IconSmooth key: walls base: solid @@ -315,6 +332,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: uranium @@ -331,6 +349,7 @@ - type: Destructible deadThreshold: 300 spawnOnDestroy: Girder + resistances: metallicResistances - type: IconSmooth key: walls base: wood diff --git a/Resources/Prototypes/Entities/Constructible/Walls/windows.yml b/Resources/Prototypes/Entities/Constructible/Walls/windows.yml index 773e41a95a..2e025a1fc2 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/windows.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/windows.yml @@ -29,6 +29,7 @@ - SmallImpassable - type: Destructible deadThreshold: 100 + resistances: metallicResistances - type: SnapGrid offset: Center - type: Airtight diff --git a/Resources/Prototypes/Entities/Constructible/disposal.yml b/Resources/Prototypes/Entities/Constructible/disposal.yml index 64ee85fe52..53e7f615cb 100644 --- a/Resources/Prototypes/Entities/Constructible/disposal.yml +++ b/Resources/Prototypes/Entities/Constructible/disposal.yml @@ -14,6 +14,7 @@ offset: Center - type: Anchorable - type: Breakable + resistances: metallicResistances - type: Rotatable - type: Pullable @@ -139,6 +140,7 @@ - type: Anchorable - type: Destructible thresholdvalue: 100 + resistances: metallicResistances - type: Appearance visuals: - type: DisposalUnitVisualizer