diff --git a/Content.Server/Temperature/Components/ChangeTemperatureOnCollideComponent.cs b/Content.Server/Temperature/Components/ChangeTemperatureOnCollideComponent.cs new file mode 100644 index 0000000000..1f57237624 --- /dev/null +++ b/Content.Server/Temperature/Components/ChangeTemperatureOnCollideComponent.cs @@ -0,0 +1,24 @@ +using Content.Server.Temperature.Systems; +using Content.Server.Temperature.Components; +using Content.Shared.Temperature; + +namespace Content.Server.Temperature.Components; + +/// +/// Put this component on a projectile that you would like to change the temperature on whatever it hits. +/// +[RegisterComponent, Access(typeof(TemperatureSystem))] +public sealed partial class ChangeTemperatureOnCollideComponent : Component +{ + /// + /// The amount it changes the target's temperature by. In Joules. + /// + [DataField] + public float Heat = 0f; + + /// + /// If this heat change ignores heat resistance or not. + /// + [DataField] + public bool IgnoreHeatResistance = true; +} \ No newline at end of file diff --git a/Content.Server/Temperature/Systems/TemperatureSystem.cs b/Content.Server/Temperature/Systems/TemperatureSystem.cs index 8b6fa107cc..c6fa213ccb 100644 --- a/Content.Server/Temperature/Systems/TemperatureSystem.cs +++ b/Content.Server/Temperature/Systems/TemperatureSystem.cs @@ -12,6 +12,8 @@ using Content.Shared.Rejuvenate; using Content.Shared.Temperature; using Robust.Shared.Physics.Components; using Robust.Shared.Prototypes; +using Robust.Shared.Physics.Events; +using Content.Shared.Projectiles; namespace Content.Server.Temperature.Systems; @@ -21,6 +23,7 @@ public sealed class TemperatureSystem : EntitySystem [Dependency] private readonly AtmosphereSystem _atmosphere = default!; [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; + [Dependency] private readonly TemperatureSystem _temperature = default!; /// /// All the components that will have their damage updated at the end of the tick. @@ -47,6 +50,8 @@ public sealed class TemperatureSystem : EntitySystem SubscribeLocalEvent(OnInit); + SubscribeLocalEvent(ChangeTemperatureOnCollide); + // Allows overriding thresholds based on the parent's thresholds. SubscribeLocalEvent(OnParentChange); SubscribeLocalEvent( @@ -300,6 +305,11 @@ public sealed class TemperatureSystem : EntitySystem args.Args.TemperatureDelta *= ev.Coefficient; } + private void ChangeTemperatureOnCollide(Entity ent, ref ProjectileHitEvent args) + { + _temperature.ChangeHeat(args.Target, ent.Comp.Heat, ent.Comp.IgnoreHeatResistance);// adjust the temperature + } + private void OnParentChange(EntityUid uid, TemperatureComponent component, ref EntParentChangedMessage args) { diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml index d2c6497831..42217a88bb 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml @@ -345,16 +345,16 @@ mask: - Opaque fly-by: *flybyfixture - - type: StaminaDamageOnCollide - damage: 40 - type: Projectile # soundHit: Waiting on serv3 impactEffect: BulletImpactEffectDisabler damage: types: - Cold: 10 + Cold: 0 - type: TimedDespawn lifetime: 3 + - type: ChangeTemperatureOnCollide + heat: -50000 - type: entity name: magmawing watcher bolt @@ -373,7 +373,9 @@ impactEffect: BulletImpactEffectOrangeDisabler damage: types: - Heat: 10 + Heat: 0 + - type: ChangeTemperatureOnCollide + heat: 50000 - type: entity id: BulletKinetic