mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
Surgery on napping people wakes them up. (#17661)
* Surgery on napping people wakes them up. * Fix a potential afreeze issue * Code review * has_status_effect now returns `null` if no status effect * move `voluntary` to be an arg to New * Update code/modules/surgery/helpers.dm Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> * And this other IsSleeping call Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
This commit is contained in:
@@ -402,6 +402,13 @@
|
||||
id = "sleeping"
|
||||
tick_interval = 2 SECONDS
|
||||
needs_update_stat = TRUE
|
||||
/// Whether we decided to take a nap on our own.
|
||||
/// As opposed to being hard knocked out with N2O or similar.
|
||||
var/voluntary = FALSE
|
||||
|
||||
/datum/status_effect/incapacitating/sleeping/on_creation(mob/living/new_owner, set_duration, voluntary = FALSE)
|
||||
..()
|
||||
src.voluntary = voluntary
|
||||
|
||||
/datum/status_effect/incapacitating/sleeping/tick()
|
||||
if(!iscarbon(owner))
|
||||
|
||||
@@ -105,8 +105,9 @@
|
||||
// HELPER PROCS //
|
||||
//////////////////
|
||||
|
||||
/mob/living/proc/apply_status_effect(effect, ...) //applies a given status effect to this mob, returning the effect if it was successful
|
||||
. = FALSE
|
||||
/// Applies a given status effect to this mob, returning the effect if it was successful or null otherwise
|
||||
/mob/living/proc/apply_status_effect(effect, ...)
|
||||
. = null
|
||||
var/datum/status_effect/S1 = effect
|
||||
LAZYINITLIST(status_effects)
|
||||
for(var/datum/status_effect/S in status_effects)
|
||||
@@ -123,7 +124,8 @@
|
||||
S1 = new effect(arguments)
|
||||
. = S1
|
||||
|
||||
/mob/living/proc/remove_status_effect(effect, ...) //removes all of a given status effect from this mob, returning TRUE if at least one was removed
|
||||
/// Removes all of a given status effect from this mob, returning TRUE if at least one was removed
|
||||
/mob/living/proc/remove_status_effect(effect, ...)
|
||||
. = FALSE
|
||||
var/list/arguments = args.Copy(2)
|
||||
if(status_effects)
|
||||
@@ -133,15 +135,17 @@
|
||||
qdel(S)
|
||||
. = TRUE
|
||||
|
||||
/mob/living/proc/has_status_effect(effect) //returns the effect if the mob calling the proc owns the given status effect
|
||||
. = FALSE
|
||||
/// Returns the effect if the mob calling the proc owns the given status effect, or null otherwise
|
||||
/mob/living/proc/has_status_effect(effect)
|
||||
. = null
|
||||
if(status_effects)
|
||||
var/datum/status_effect/S1 = effect
|
||||
for(var/datum/status_effect/S in status_effects)
|
||||
if(initial(S1.id) == S.id)
|
||||
return S
|
||||
|
||||
/mob/living/proc/has_status_effect_list(effect) //returns a list of effects with matching IDs that the mod owns; use for effects there can be multiple of
|
||||
/// Returns a list of effects with matching IDs that the mod owns; use for effects there can be multiple of
|
||||
/mob/living/proc/has_status_effect_list(effect)
|
||||
. = list()
|
||||
if(status_effects)
|
||||
var/datum/status_effect/S1 = effect
|
||||
|
||||
Reference in New Issue
Block a user