Beds, Medical Beds, Stasis Beds (#6695)

This commit is contained in:
Rane
2022-04-15 18:53:52 -04:00
committed by GitHub
parent 3383350c03
commit 5376aed6ea
36 changed files with 534 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
using Content.Shared.Disease;
using Content.Server.Buckle.Components;
using Content.Server.Bed.Components;
namespace Content.Server.Disease.Cures
{
@@ -7,7 +8,6 @@ namespace Content.Server.Disease.Cures
/// Cures the disease after a certain amount of time
/// strapped.
/// </summary>
/// TODO: Revisit after bed pr merged
public sealed class DiseaseBedrestCure : DiseaseCure
{
[ViewVariables(VVAccess.ReadWrite)]
@@ -18,7 +18,8 @@ namespace Content.Server.Disease.Cures
public override bool Cure(DiseaseEffectArgs args)
{
if (!args.EntityManager.TryGetComponent<BuckleComponent>(args.DiseasedEntity, out var buckle))
if (!args.EntityManager.TryGetComponent<BuckleComponent>(args.DiseasedEntity, out var buckle) ||
!args.EntityManager.HasComponent<HealOnBuckleComponent>(buckle.BuckledTo?.Owner))
return false;
if (buckle.Buckled)
Ticker++;

View File

@@ -4,6 +4,7 @@ using Content.Shared.Disease;
using Content.Shared.Disease.Components;
using Content.Server.Disease.Components;
using Content.Server.Clothing.Components;
using Content.Server.Body.Systems;
using Content.Shared.MobState.Components;
using Content.Shared.Examine;
using Content.Shared.Inventory;
@@ -47,6 +48,8 @@ namespace Content.Server.Disease
SubscribeLocalEvent<DiseaseProtectionComponent, GotUnequippedEvent>(OnUnequipped);
SubscribeLocalEvent<DiseaseVaccineComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<DiseaseVaccineComponent, ExaminedEvent>(OnExamined);
// Handling stuff from other systems
SubscribeLocalEvent<DiseaseCarrierComponent, ApplyMetabolicMultiplierEvent>(OnApplyMetabolicMultiplier);
// Private events stuff
SubscribeLocalEvent<TargetVaxxSuccessfulEvent>(OnTargetVaxxSuccessful);
SubscribeLocalEvent<VaxxCancelledEvent>(OnVaxxCancelled);
@@ -285,6 +288,26 @@ namespace Content.Server.Disease
}
}
private void OnApplyMetabolicMultiplier(EntityUid uid, DiseaseCarrierComponent component, ApplyMetabolicMultiplierEvent args)
{
if (args.Apply)
{
foreach (var disease in component.Diseases)
{
disease.TickTime *= args.Multiplier;
return;
}
}
foreach (var disease in component.Diseases)
{
disease.TickTime /= args.Multiplier;
if (disease.Accumulator >= disease.TickTime)
disease.Accumulator = disease.TickTime;
}
}
///
/// Helper functions
///