You can now push Wraith Spectacles up (#22188)

* You can now push Wraith Spectacles up

* you need to... actually LOSE the xray vision

* Don't flicker toooo much

* for bonus points, let's us refactor status effects while we're here

* might as well keep that around
This commit is contained in:
Joan Lung
2016-12-15 16:59:26 -05:00
committed by oranges
parent 3b10ab8fdc
commit b2fcbabb0b
11 changed files with 160 additions and 103 deletions
+1 -1
View File
@@ -133,7 +133,7 @@
/datum/status_effect/cyborg_power_regen/tick()
var/mob/living/silicon/robot/cyborg = owner
if(!istype(cyborg) || !cyborg.cell)
cancel_effect()
qdel(src)
return
playsound(cyborg, 'sound/effects/light_flicker.ogg', 50, 1)
cyborg.cell.give(power_to_give)
+2 -3
View File
@@ -19,9 +19,8 @@
/datum/status_effect/freon/tick()
owner.update_canmove()
if(owner)
if(owner.bodytemperature >= 310.055)
cancel_effect()
if(owner && owner.bodytemperature >= 310.055)
qdel(src)
/datum/status_effect/freon/on_remove()
if(!owner.stat)
+37 -29
View File
@@ -1,7 +1,9 @@
//Status effects are used to apply temporary or permanent effects to mobs. Mobs are aware of their status effects at all times.
//This file contains their code, plus code for applying and removing them.
//When making a new status effect, add a define to status_effects.dm in __DEFINES for ease of use!
var/list/status_effects = list() //All status effects affecting literally anyone
var/global/list/all_status_effects = list() //a list of all status effects, if for some reason you need to remove all of them
/datum/status_effect
var/id = "effect" //Used for screen alerts.
var/duration = -1 //How long the status effect lasts in SECONDS. Enter -1 for an effect that never ends unless removed through some means.
@@ -11,13 +13,21 @@ var/list/status_effects = list() //All status effects affecting literally anyone
var/unique = TRUE //If there can be multiple status effects of this type on one mob.
var/alert_type = /obj/screen/alert/status_effect //the alert thrown by the status effect, contains name and description
/datum/status_effect/New()
..()
status_effects += src
/datum/status_effect/New(mob/living/new_owner)
if(new_owner)
owner = new_owner
if(owner)
LAZYADD(owner.status_effects, src)
all_status_effects += src
addtimer(src, "start_ticking", 1) //Give us time to set any variables
/datum/status_effect/Destroy()
status_effects -= src
STOP_PROCESSING(SSprocessing, src)
if(owner)
owner.clear_alert(id)
on_remove()
LAZYREMOVE(owner.status_effects, src)
all_status_effects -= src
return ..()
/datum/status_effect/proc/start_ticking()
@@ -27,13 +37,14 @@ var/list/status_effects = list() //All status effects affecting literally anyone
qdel(src)
return
on_apply()
var/obj/screen/alert/status_effect/A = owner.throw_alert(id, alert_type)
A.attached_effect = src //so the alert can reference us, if it needs to
if(alert_type)
var/obj/screen/alert/status_effect/A = owner.throw_alert(id, alert_type)
A.attached_effect = src //so the alert can reference us, if it needs to
START_PROCESSING(SSprocessing, src)
/datum/status_effect/process()
if(!owner)
cancel_effect()
qdel(src)
return
if(duration != -1)
duration--
@@ -42,14 +53,7 @@ var/list/status_effects = list() //All status effects affecting literally anyone
tick()
tick_interval = initial(tick_interval)
if(!duration)
cancel_effect()
/datum/status_effect/proc/cancel_effect()
STOP_PROCESSING(SSprocessing, src)
if(owner)
owner.clear_alert(id)
on_remove()
qdel(src)
qdel(src)
/datum/status_effect/proc/on_apply() //Called whenever the buff is applied.
/datum/status_effect/proc/tick() //Called every tick.
@@ -69,24 +73,28 @@ var/list/status_effects = list() //All status effects affecting literally anyone
//////////////////
/mob/living/proc/apply_status_effect(effect) //applies a given status effect to this mob, returning the effect if it was successful
. = FALSE
var/datum/status_effect/S1 = effect
LAZYINITLIST(status_effects)
for(var/datum/status_effect/S in status_effects)
if(initial(S1.unique) && S.id == initial(S1.id) && S.owner == src)
if(S.id == initial(S1.id) && initial(S1.unique))
return
S1 = new effect
S1.owner = src
S1 = new effect(src)
. = 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
. = FALSE
var/datum/status_effect/S1 = effect
for(var/datum/status_effect/S in status_effects)
if(initial(S1.id) == S.id && S.owner == src)
S.cancel_effect()
. = TRUE
if(status_effects)
var/datum/status_effect/S1 = effect
for(var/datum/status_effect/S in status_effects)
if(initial(S1.id) == S.id)
qdel(S)
. = TRUE
/mob/living/proc/has_status_effect(effect) //returns TRUE if the mob calling the proc owns the given status effect
var/datum/status_effect/S1 = effect
for(var/datum/status_effect/S in status_effects)
if(initial(S1.id) == S.id && S.owner == src)
return TRUE
/mob/living/proc/has_status_effect(effect) //returns the effect if the mob calling the proc owns the given status effect
. = FALSE
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