policies and code hooks

This commit is contained in:
silicons
2020-06-26 23:41:44 -07:00
parent ea57a84eb8
commit 0df5aa083b
7 changed files with 42 additions and 1 deletions

View File

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

View File

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

View File

@@ -399,6 +399,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.forceMove(T)
update_icon()
mob_occupant.domutcheck(1) //Waiting until they're out before possible monkeyizing. The 1 argument forces powers to manifest.

View File

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

View File

@@ -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)
..()

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,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.")

View File

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