-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
339 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Content.Server/Backmen/Disease/Components/DiseaseInfectionSpeadEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Content.Shared.Backmen.Disease; | ||
|
||
namespace Content.Server.Backmen.Disease.Components; | ||
|
||
public sealed class DiseaseInfectionSpreadEvent : EntityEventArgs | ||
{ | ||
public EntityUid Owner { get; init; } = default!; | ||
public DiseasePrototype Disease { get; init; } = default!; | ||
public float Range { get; init; } = default!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 21 additions & 27 deletions
48
Content.Server/Backmen/Disease/Cures/DiseaseCureSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,34 @@ | ||
using Content.Shared.Backmen.Disease; | ||
using Content.Server.Bed.Components; | ||
using Content.Server.Body.Components; | ||
using Content.Server.Temperature.Components; | ||
using Content.Shared.Backmen.Disease; | ||
using Content.Shared.Bed.Sleep; | ||
using Content.Shared.Buckle.Components; | ||
|
||
namespace Content.Server.Backmen.Disease.Cures; | ||
|
||
public sealed partial class DiseaseCureSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly DiseaseSystem _disease = default!; | ||
private EntityQuery<BuckleComponent> _buckleQuery; | ||
private EntityQuery<HealOnBuckleComponent> _healOnBuckleQuery; | ||
private EntityQuery<SleepingComponent> _sleepingComponentQuery; | ||
private EntityQuery<BloodstreamComponent> _bloodstreamQuery; | ||
private EntityQuery<TemperatureComponent> _temperatureQuery; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<DiseaseCureArgs>(DoGenericCure); | ||
} | ||
|
||
private void DoGenericCure(DiseaseCureArgs args) | ||
{ | ||
if(args.Handled) | ||
return; | ||
SubscribeLocalEvent<DiseaseCarrierComponent, DiseaseCureArgs<DiseaseBedrestCure>>(DiseaseBedrestCure); | ||
SubscribeLocalEvent<DiseaseCarrierComponent, DiseaseCureArgs<DiseaseBodyTemperatureCure>>(DiseaseBodyTemperatureCure); | ||
SubscribeLocalEvent<DiseaseCarrierComponent, DiseaseCureArgs<DiseaseJustWaitCure>>(DiseaseJustWaitCure); | ||
SubscribeLocalEvent<DiseaseCarrierComponent, DiseaseCureArgs<DiseaseReagentCure>>(DiseaseReagentCure); | ||
|
||
switch (args.DiseaseCure) | ||
{ | ||
case DiseaseBedrestCure ds1: | ||
args.Handled = true; | ||
DiseaseBedrestCure(args, ds1); | ||
return; | ||
case DiseaseBodyTemperatureCure ds2: | ||
args.Handled = true; | ||
DiseaseBodyTemperatureCure(args, ds2); | ||
return; | ||
case DiseaseJustWaitCure ds3: | ||
args.Handled = true; | ||
DiseaseJustWaitCure(args, ds3); | ||
return; | ||
case DiseaseReagentCure ds4: | ||
args.Handled = true; | ||
DiseaseReagentCure(args, ds4); | ||
return; | ||
} | ||
_buckleQuery = GetEntityQuery<BuckleComponent>(); | ||
_healOnBuckleQuery = GetEntityQuery<HealOnBuckleComponent>(); | ||
_sleepingComponentQuery = GetEntityQuery<SleepingComponent>(); | ||
_bloodstreamQuery = GetEntityQuery<BloodstreamComponent>(); | ||
_temperatureQuery = GetEntityQuery<TemperatureComponent>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Content.Server.Backmen.Disease.Components; | ||
using Content.Server.Backmen.Disease.Effects; | ||
using Robust.Shared.CPUJob.JobQueues; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Server.Backmen.Disease; | ||
|
||
public sealed class DiseaseInfectionSpread : Job<object> | ||
{ | ||
private readonly DiseaseInfectionSpreadEvent _ev; | ||
private readonly DiseaseEffectSystem _effectSystem; | ||
|
||
public DiseaseInfectionSpread(DiseaseInfectionSpreadEvent ev, DiseaseEffectSystem effectSystem, double maxTime, CancellationToken cancellation = default) : base(maxTime, cancellation) | ||
{ | ||
_ev = ev; | ||
_effectSystem = effectSystem; | ||
} | ||
|
||
public DiseaseInfectionSpread(DiseaseInfectionSpreadEvent ev, DiseaseEffectSystem effectSystem, double maxTime, IStopwatch stopwatch, CancellationToken cancellation = default) : base(maxTime, stopwatch, cancellation) | ||
{ | ||
_ev = ev; | ||
_effectSystem = effectSystem; | ||
} | ||
|
||
protected override async Task<object?> Process() | ||
{ | ||
_effectSystem.DoSpread(_ev.Owner, _ev.Disease, _ev.Range); | ||
return null; | ||
} | ||
} |
Oops, something went wrong.