Skip to content

Commit

Permalink
CPR Remake (#487)
Browse files Browse the repository at this point in the history
This is a re implementation and complete rewrite of the original
Nyanotrasen CPR feature, this time as its own completely standalone
system. Unlike the original CPR, this system requires no modification of
base game code, and can be toggled on and off via CVars while the server
is running.

Fixes #473
Fixes SS14-Classic#49

🆑
- add: CPR has been added to the game. People with CPR training can now
perform CPR on anyone who is in either crit or dead states.
- add: CPR Training has been added to the game as a new positive trait.
All medical staff start with this trait for free.

---------

Signed-off-by: VMSolidus <[email protected]>
  • Loading branch information
VMSolidus committed Aug 10, 2024
1 parent d6459a7 commit c2d4e2a
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 5 deletions.
49 changes: 49 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2300,6 +2300,55 @@ public static readonly CVarDef<float>
public static readonly CVarDef<float> StationGoalsChance =
CVarDef.Create("game.station_goals_chance", 1f, CVar.SERVERONLY);


#region CPR System
/// <summary>
/// Controls whether the entire CPR system runs. When false, nobody can perform CPR. You should probably remove the trait too
/// if you are wishing to permanently disable the system on your server.
/// </summary>
public static readonly CVarDef<bool> EnableCPR =
CVarDef.Create("cpr.enable", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles whether or not CPR reduces rot timers(As an abstraction of delaying brain death, the IRL actual purpose of CPR)
/// </summary>
public static readonly CVarDef<bool> CPRReducesRot =
CVarDef.Create("cpr.reduces_rot", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles whether or not CPR heals airloss, included for completeness sake. I'm not going to stop you if your intention is to make CPR do nothing.
/// I guess it might be funny to troll your players with? I won't judge.
/// </summary>
public static readonly CVarDef<bool> CPRHealsAirloss =
CVarDef.Create("cpr.heals_airloss", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// The chance for a patient to be resuscitated when CPR is successfully performed.
/// Setting this above 0 isn't very realistic, but people who see CPR in movies and TV will expect CPR to work this way.
/// </summary>
public static readonly CVarDef<float> CPRResuscitationChance =
CVarDef.Create("cpr.resuscitation_chance", 0.05f, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// By default, CPR reduces rot timers by an amount of seconds equal to the time spent performing CPR. This is an optional multiplier that can increase or decrease the amount
/// of rot reduction. Set it to 2 for if you want 3 seconds of CPR to reduce 6 seconds of rot.
/// </summary>
/// <remarks>
/// If you're wondering why there isn't a CVar for setting the duration of the doafter, that's because it's not actually possible to have a timespan in cvar form
/// Curiously, it's also not possible for **shared** systems to set variable timespans. Which is where this system lives.
/// </remarks>
public static readonly CVarDef<float> CPRRotReductionMultiplier =
CVarDef.Create("cpr.rot_reduction_multiplier", 1f, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// By default, CPR heals airloss by 1 point for every second spent performing CPR. Just like above, this directly multiplies the healing amount.
/// Set it to 2 to get 6 points of airloss healing for every 3 seconds of CPR.
/// </summary>
public static readonly CVarDef<float> CPRAirlossReductionMultiplier =
CVarDef.Create("cpr.airloss_reduction_multiplier", 1f, CVar.REPLICATED | CVar.SERVER);

#endregion

#region Contests System

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4940,3 +4940,11 @@ Entries:
message: Added an unlockable PKA and Jetpack module to Salvage Cyborgs
id: 6218
time: '2024-08-06T01:14:31.0000000+00:00'
- author: VMSolidus
changes:
- type: Add
message: Arachne have been reimplemented!
- type: Add
message: Oneirophages are back!
id: 6219
time: '2024-08-06T04:52:32.0000000+00:00'
3 changes: 3 additions & 0 deletions Resources/Prototypes/DeltaV/Roles/Jobs/Security/brigmedic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
special:
- !type:AddImplantSpecial
implants: [ MindShieldImplant ]
- !type:AddComponentSpecial
components:
- type: CPRTraining

- type: startingGear
id: CorpsmanGear # see Prototypes/Roles/Jobs/Fun/misc_startinggear.yml for "BrigmedicGear"
Expand Down
9 changes: 4 additions & 5 deletions Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
- type: trait
id: CPRTraining
category: Uncategorized
category: Mental
points: -2
components:
- type: CPRTraining
requirements:
- !type:CharacterJobRequirement
inverted: true
Expand All @@ -11,10 +13,7 @@
- MedicalIntern
- Paramedic
- ChiefMedicalOfficer
- Borg
- MedicalBorg
components:
- type: CPRTraining
- Brigmedic

- type: trait
id: HeavyweightDrunk
Expand Down

0 comments on commit c2d4e2a

Please sign in to comment.