Merge pull request #12624 from Citadel-Station-13/policy

policy configuration & support hooks for clone memory disorder
This commit is contained in:
Lin
2020-07-11 16:40:38 -05:00
committed by GitHub
10 changed files with 71 additions and 0 deletions

View File

@@ -8,3 +8,12 @@
//flags
#define CONFIG_ENTRY_LOCKED 1 //can't edit
#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
#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"

View File

@@ -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

View File

@@ -0,0 +1,11 @@
/// 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/policyconfig
key_mode = KEY_MODE_TEXT
value_mode = VALUE_MODE_TEXT
/datum/config_entry/keyed_list/policyconfig/preprocess_key(key)
return uppertext(..())

View File

@@ -411,6 +411,11 @@
to_chat(occupant, "<span class='notice'><b>There is a bright flash!</b><br><i>You feel like a new being.</i></span>")
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.log_message("revived using cloning.", LOG_GAME)
mob_occupant.adjustOrganLoss(ORGAN_SLOT_BRAIN, mob_occupant.getCloneLoss())
occupant.forceMove(T)

View File

@@ -619,6 +619,13 @@
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(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

View File

@@ -928,10 +928,18 @@
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(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)
..()

View File

@@ -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!", "<span class='notice'><b>IT'S ALIVE!</b></span>")
target.visible_message("...[target] wakes up, alive and aware!")
@@ -68,6 +69,13 @@
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)
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(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.")

View File

@@ -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:

13
config/policy.txt Normal file
View File

@@ -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 class='notice'>span classes are fully supported</span>
## Misc entries for above
## Defib time limit for "cloning memory disorder" memory loss in seconds
# DEFIB_CMD_TIME_LIMIT 300

View File

@@ -268,6 +268,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"