TemperatureProtection now works directly on entities (#37544)
* init * review * review
This commit is contained in:
@@ -45,8 +45,7 @@ public sealed class TemperatureSystem : EntitySystem
|
||||
SubscribeLocalEvent<TemperatureComponent, AtmosExposedUpdateEvent>(OnAtmosExposedUpdate);
|
||||
SubscribeLocalEvent<TemperatureComponent, RejuvenateEvent>(OnRejuvenate);
|
||||
SubscribeLocalEvent<AlertsComponent, OnTemperatureChangeEvent>(ServerAlert);
|
||||
SubscribeLocalEvent<TemperatureProtectionComponent, InventoryRelayedEvent<ModifyChangedTemperatureEvent>>(
|
||||
OnTemperatureChangeAttempt);
|
||||
Subs.SubscribeWithRelay<TemperatureProtectionComponent, ModifyChangedTemperatureEvent>(OnTemperatureChangeAttempt, held: false);
|
||||
|
||||
SubscribeLocalEvent<InternalTemperatureComponent, MapInitEvent>(OnInit);
|
||||
|
||||
@@ -296,17 +295,16 @@ public sealed class TemperatureSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTemperatureChangeAttempt(EntityUid uid, TemperatureProtectionComponent component,
|
||||
InventoryRelayedEvent<ModifyChangedTemperatureEvent> args)
|
||||
private void OnTemperatureChangeAttempt(EntityUid uid, TemperatureProtectionComponent component, ModifyChangedTemperatureEvent args)
|
||||
{
|
||||
var coefficient = args.Args.TemperatureDelta < 0
|
||||
var coefficient = args.TemperatureDelta < 0
|
||||
? component.CoolingCoefficient
|
||||
: component.HeatingCoefficient;
|
||||
|
||||
var ev = new GetTemperatureProtectionEvent(coefficient);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
args.Args.TemperatureDelta *= ev.Coefficient;
|
||||
args.TemperatureDelta *= ev.Coefficient;
|
||||
}
|
||||
|
||||
private void ChangeTemperatureOnCollide(Entity<ChangeTemperatureOnCollideComponent> ent, ref ProjectileHitEvent args)
|
||||
|
||||
Reference in New Issue
Block a user