From 6db9b8c5d72ceac6752df485eabafeb1540196fc Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Thu, 25 Jun 2020 17:59:47 -0700
Subject: [PATCH 1/9] Update config.txt
---
config/config.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/config/config.txt b/config/config.txt
index 35af0e848b..d6d0097c21 100644
--- a/config/config.txt
+++ b/config/config.txt
@@ -8,6 +8,7 @@ $include donator_groupings.txt
$include dynamic_config.txt
$include plushies/defines.txt
$include job_threats.txt
+$include policy.txt
# You can use the @ character at the beginning of a config option to lock it from being edited in-game
# Example usage:
From ea57a84eb884d8621c8b038ae4b9440e2fddc9a3 Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Thu, 25 Jun 2020 18:04:23 -0700
Subject: [PATCH 2/9] Create policy.txt
---
config/policy.txt | 13 +++++++++++++
1 file changed, 13 insertions(+)
create mode 100644 config/policy.txt
diff --git a/config/policy.txt b/config/policy.txt
new file mode 100644
index 0000000000..610acd2be8
--- /dev/null
+++ b/config/policy.txt
@@ -0,0 +1,13 @@
+## Policy configuration
+## Current valid keys are:
+## ON_CLONE - displayed after a successful cloning operation to the cloned person
+## ON_DEFIB_INTACT - displayed after defibbing before memory loss time threshold
+## ON_DEFIB_LATE - displayed after defibbing post memory loss time threshold
+##
+## EXAMPLE:
+## POLICYCONFIG ON_CLONE insert text here span classes are fully supported
+
+## Misc entries for above
+
+## Defib time limit for "cloning memory disorder" memory loss in seconds
+# DEFIB_CMD_TIME_LIMIT 300
From 0df5aa083bfc95445350bda744ef3fe077cc4b82 Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Fri, 26 Jun 2020 23:41:44 -0700
Subject: [PATCH 3/9] policies and code hooks
---
code/__DEFINES/configuration.dm | 8 ++++++++
code/controllers/configuration/entries/policy.dm | 8 ++++++++
code/game/machinery/cloning.dm | 5 +++++
code/game/objects/items/defib.dm | 6 ++++++
.../reagents/chemistry/reagents/medicine_reagents.dm | 7 +++++++
code/modules/surgery/advanced/revival.dm | 8 +++++++-
tgstation.dme | 1 +
7 files changed, 42 insertions(+), 1 deletion(-)
create mode 100644 code/controllers/configuration/entries/policy.dm
diff --git a/code/__DEFINES/configuration.dm b/code/__DEFINES/configuration.dm
index 6b70eb1e0f..39f1385d3b 100644
--- a/code/__DEFINES/configuration.dm
+++ b/code/__DEFINES/configuration.dm
@@ -8,3 +8,11 @@
//flags
#define CONFIG_ENTRY_LOCKED 1 //can't edit
#define CONFIG_ENTRY_HIDDEN 2 //can't see value
+
+// Policy config keys
+/// Displayed to cloned patients
+#define POLICYCONFIG_ON_CLONE "ON_CLONE"
+/// Displayed to defibbed/revival surgery'd patients before the memory loss time threshold
+#define POLICYCONFIG_ON_DEFIB_INTACT "ON_DEFIB_INTACT"
+/// Displayed to defibbed/revival surgery'd patients after the memory loss time threshold
+#define POLICYCONFIG_ON_DEFIB_LATE "ON_DEFIB_LATE"
diff --git a/code/controllers/configuration/entries/policy.dm b/code/controllers/configuration/entries/policy.dm
new file mode 100644
index 0000000000..48bfa666a1
--- /dev/null
+++ b/code/controllers/configuration/entries/policy.dm
@@ -0,0 +1,8 @@
+/// Seconds for CMD on defib-with-memory-loss policy config to display instead of defib-intact config
+/datum/config_entry/number/defib_cmd_time_limit
+ config_entry_value = 300
+ integer = TRUE
+
+/datum/config_entry/keyed_list/policy_config
+ key_mode = KEY_MODE_TEXT
+ value_mode = VALUE_MODE_TEXT
diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm
index cfe9d14663..53e910e973 100644
--- a/code/game/machinery/cloning.dm
+++ b/code/game/machinery/cloning.dm
@@ -399,6 +399,11 @@
to_chat(occupant, "There is a bright flash!
You feel like a new being.")
mob_occupant.flash_act()
+ var/list/policies = CONFIG_GET(keyed_list/policyconfig)
+ var/policy = policies[POLICYCONFIG_ON_CLONE]
+ if(policy)
+ to_chat(occupant, policy)
+
occupant.forceMove(T)
update_icon()
mob_occupant.domutcheck(1) //Waiting until they're out before possible monkeyizing. The 1 argument forces powers to manifest.
diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm
index 7cc76da312..676dec4088 100644
--- a/code/game/objects/items/defib.dm
+++ b/code/game/objects/items/defib.dm
@@ -619,6 +619,12 @@
if(req_defib)
if(defib.healdisk)
H.heal_overall_damage(25, 25)
+ var/list/policies = CONFIG_GET(keyed_list/policyconfig)
+ var/timelimit = CONFIG_GET(number/defib_cmd_time_limit)
+ var/late = timelimit && (tplus > timelimit)
+ var/policy = late? policies[POLICYCONFIG_ON_DEFIB_LATE] : policies[POLICYCONFIG_ON_DEFIB_INTACT]
+ if(policy)
+ to_chat(occupant, policy)
if(req_defib)
defib.deductcharge(revivecost)
cooldown = 1
diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
index 0f53add567..f4af4b69c6 100644
--- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
@@ -928,10 +928,17 @@
M.adjustOxyLoss(-20, 0)
M.adjustToxLoss(-20, 0)
M.updatehealth()
+ var/tplus = world.time - M.timeofdeath
if(M.revive())
M.grab_ghost()
M.emote("gasp")
log_combat(M, M, "revived", src)
+ var/list/policies = CONFIG_GET(keyed_list/policyconfig)
+ var/timelimit = CONFIG_GET(number/defib_cmd_time_limit)
+ var/late = timelimit && (tplus > timelimit)
+ var/policy = late? policies[POLICYCONFIG_ON_DEFIB_LATE] : policies[POLICYCONFIG_ON_DEFIB_INTACT]
+ if(policy)
+ to_chat(occupant, policy)
..()
diff --git a/code/modules/surgery/advanced/revival.dm b/code/modules/surgery/advanced/revival.dm
index cf3a218d80..c93b5eefa5 100644
--- a/code/modules/surgery/advanced/revival.dm
+++ b/code/modules/surgery/advanced/revival.dm
@@ -60,6 +60,7 @@
playsound(get_turf(target), 'sound/magic/lightningbolt.ogg', 50, 1)
target.adjustOxyLoss(-50, 0)
target.updatehealth()
+ var/tplus = world.time - target.timeofdeath
if(target.revive())
user.visible_message("...[target] wakes up, alive and aware!", "IT'S ALIVE!")
target.visible_message("...[target] wakes up, alive and aware!")
@@ -68,7 +69,12 @@
for(var/obj/item/organ/O in target.internal_organs)//zap those buggers back to life!
if(O.organ_flags & ORGAN_FAILING)
O.applyOrganDamage(-5)
- return TRUE
+ var/list/policies = CONFIG_GET(keyed_list/policyconfig)
+ var/timelimit = CONFIG_GET(number/defib_cmd_time_limit)
+ var/late = timelimit && (tplus > timelimit)
+ var/policy = late? policies[POLICYCONFIG_ON_DEFIB_LATE] : policies[POLICYCONFIG_ON_DEFIB_INTACT]
+ if(policy)
+ to_chat(occupant, policy) return TRUE
else
user.visible_message("...[target.p_they()] convulses, then lies still.")
target.visible_message("...[target.p_they()] convulses, then lies still.")
diff --git a/tgstation.dme b/tgstation.dme
index b13f220eb5..20ed62974b 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -267,6 +267,7 @@
#include "code\controllers\configuration\entries\game_options.dm"
#include "code\controllers\configuration\entries\general.dm"
#include "code\controllers\configuration\entries\plushies.dm"
+#include "code\controllers\configuration\entries\policy.dm"
#include "code\controllers\subsystem\acid.dm"
#include "code\controllers\subsystem\adjacent_air.dm"
#include "code\controllers\subsystem\air.dm"
From 1d4a54d8802cd3418050bf6fa5d73fb3d09949c5 Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Fri, 26 Jun 2020 23:47:16 -0700
Subject: [PATCH 4/9] log
---
code/game/machinery/cloning.dm | 1 +
code/game/objects/items/defib.dm | 3 ++-
code/modules/reagents/chemistry/reagents/medicine_reagents.dm | 3 ++-
code/modules/surgery/advanced/revival.dm | 4 +++-
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm
index 53e910e973..49543487ce 100644
--- a/code/game/machinery/cloning.dm
+++ b/code/game/machinery/cloning.dm
@@ -403,6 +403,7 @@
var/policy = policies[POLICYCONFIG_ON_CLONE]
if(policy)
to_chat(occupant, policy)
+ occupant.log_message("revived using cloning, [tplus] deciseconds from time of death.", LOG_GAME)
occupant.forceMove(T)
update_icon()
diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm
index 676dec4088..6a11809c56 100644
--- a/code/game/objects/items/defib.dm
+++ b/code/game/objects/items/defib.dm
@@ -624,7 +624,8 @@
var/late = timelimit && (tplus > timelimit)
var/policy = late? policies[POLICYCONFIG_ON_DEFIB_LATE] : policies[POLICYCONFIG_ON_DEFIB_INTACT]
if(policy)
- to_chat(occupant, policy)
+ to_chat(H, policy)
+ H.log_message("revived using a defibrillator, [tplus] deciseconds from time of death, considered [late? "late" : "memory-intact"] revival under configured policy limits.", LOG_GAME)
if(req_defib)
defib.deductcharge(revivecost)
cooldown = 1
diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
index f4af4b69c6..b9da8271ab 100644
--- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm
@@ -938,7 +938,8 @@
var/late = timelimit && (tplus > timelimit)
var/policy = late? policies[POLICYCONFIG_ON_DEFIB_LATE] : policies[POLICYCONFIG_ON_DEFIB_INTACT]
if(policy)
- to_chat(occupant, policy)
+ to_chat(M, policy)
+ M.log_message("revived using strange reagent, [tplus] deciseconds from time of death, considered [late? "late" : "memory-intact"] revival under configured policy limits.", LOG_GAME)
..()
diff --git a/code/modules/surgery/advanced/revival.dm b/code/modules/surgery/advanced/revival.dm
index c93b5eefa5..a910e73cce 100644
--- a/code/modules/surgery/advanced/revival.dm
+++ b/code/modules/surgery/advanced/revival.dm
@@ -74,7 +74,9 @@
var/late = timelimit && (tplus > timelimit)
var/policy = late? policies[POLICYCONFIG_ON_DEFIB_LATE] : policies[POLICYCONFIG_ON_DEFIB_INTACT]
if(policy)
- to_chat(occupant, policy) return TRUE
+ to_chat(target, policy)
+ target.log_message("revived using surgical revival, [tplus] deciseconds from time of death, considered [late? "late" : "memory-intact"] revival under configured policy limits.", LOG_GAME)
+ return TRUE
else
user.visible_message("...[target.p_they()] convulses, then lies still.")
target.visible_message("...[target.p_they()] convulses, then lies still.")
From 2a0b3ce0362854d9e3e6ee366160460354ca5a5e Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Fri, 26 Jun 2020 23:48:56 -0700
Subject: [PATCH 5/9] typo
---
code/controllers/configuration/entries/policy.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/controllers/configuration/entries/policy.dm b/code/controllers/configuration/entries/policy.dm
index 48bfa666a1..6009811aca 100644
--- a/code/controllers/configuration/entries/policy.dm
+++ b/code/controllers/configuration/entries/policy.dm
@@ -3,6 +3,6 @@
config_entry_value = 300
integer = TRUE
-/datum/config_entry/keyed_list/policy_config
+/datum/config_entry/keyed_list/policyconfig
key_mode = KEY_MODE_TEXT
value_mode = VALUE_MODE_TEXT
From 2ea030ca3ea49931926bd2e605fd84338ee067ec Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Fri, 26 Jun 2020 23:53:52 -0700
Subject: [PATCH 6/9] fix
---
code/game/machinery/cloning.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm
index 49543487ce..1079bae0f5 100644
--- a/code/game/machinery/cloning.dm
+++ b/code/game/machinery/cloning.dm
@@ -403,7 +403,7 @@
var/policy = policies[POLICYCONFIG_ON_CLONE]
if(policy)
to_chat(occupant, policy)
- occupant.log_message("revived using cloning, [tplus] deciseconds from time of death.", LOG_GAME)
+ occupant.log_message("revived using cloning.", LOG_GAME)
occupant.forceMove(T)
update_icon()
From 7b101a801c104fdc274e0941bd7af233d2399655 Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Mon, 29 Jun 2020 04:55:22 -0700
Subject: [PATCH 7/9] Update configuration.dm
---
code/__DEFINES/configuration.dm | 1 +
1 file changed, 1 insertion(+)
diff --git a/code/__DEFINES/configuration.dm b/code/__DEFINES/configuration.dm
index 39f1385d3b..a4bf69b2ad 100644
--- a/code/__DEFINES/configuration.dm
+++ b/code/__DEFINES/configuration.dm
@@ -10,6 +10,7 @@
#define CONFIG_ENTRY_HIDDEN 2 //can't see value
// Policy config keys
+// MAKE SURE THESE ARE UPPERCASE
/// Displayed to cloned patients
#define POLICYCONFIG_ON_CLONE "ON_CLONE"
/// Displayed to defibbed/revival surgery'd patients before the memory loss time threshold
From 836391075fe3cb49e51e2b595b37c27430ec7f1a Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Mon, 29 Jun 2020 05:03:13 -0700
Subject: [PATCH 8/9] Update config_entry.dm
---
code/controllers/configuration/config_entry.dm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/code/controllers/configuration/config_entry.dm b/code/controllers/configuration/config_entry.dm
index 4647b83cd7..7e8b1c8f38 100644
--- a/code/controllers/configuration/config_entry.dm
+++ b/code/controllers/configuration/config_entry.dm
@@ -209,6 +209,8 @@
new_value = new_list
continue_check_value = new_list.len
if(continue_check_value && continue_check_key && ValidateListEntry(new_key, new_value))
+ new_key = preprocess_key(new_key)
+ new_value = preprocess_value(new_value)
config_entry_value[new_key] = new_value
return TRUE
return FALSE
@@ -216,6 +218,12 @@
/datum/config_entry/keyed_list/vv_edit_var(var_name, var_value)
return var_name != "splitter" && ..()
+/datum/config_entry/keyed_list/proc/preprocess_key(key)
+ return key
+
+/datum/config_entry/keyed_list/proc/preprocess_value(value)
+ return value
+
//snowflake for donator things being on one line smh
/datum/config_entry/multi_keyed_flag
vv_VAS = FALSE
From c88b7721ad9af09b5cd229f92a2435ca95826fa3 Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Mon, 29 Jun 2020 05:03:45 -0700
Subject: [PATCH 9/9] Update policy.dm
---
code/controllers/configuration/entries/policy.dm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/code/controllers/configuration/entries/policy.dm b/code/controllers/configuration/entries/policy.dm
index 6009811aca..de611e1813 100644
--- a/code/controllers/configuration/entries/policy.dm
+++ b/code/controllers/configuration/entries/policy.dm
@@ -6,3 +6,6 @@
/datum/config_entry/keyed_list/policyconfig
key_mode = KEY_MODE_TEXT
value_mode = VALUE_MODE_TEXT
+
+/datum/config_entry/keyed_list/policyconfig/preprocess_key(key)
+ return uppertext(..())