mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-21 19:19:12 +01:00
Gargoyle adjustments & fixes (#17918)
* Some Gargoyle fixes and cleanup * NO GODMODE WTF
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
var/energy = 100
|
||||
var/transformed = FALSE
|
||||
var/paused = FALSE
|
||||
var/paused_loc
|
||||
var/cooldown
|
||||
|
||||
var/mob/living/carbon/human/gargoyle //easy reference
|
||||
@@ -18,54 +17,61 @@
|
||||
if (!ishuman(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
gargoyle = parent
|
||||
add_verb(gargoyle,/mob/living/carbon/human/proc/gargoyle_transformation)
|
||||
add_verb(gargoyle,/mob/living/carbon/human/proc/gargoyle_pause)
|
||||
add_verb(gargoyle,/mob/living/carbon/human/proc/gargoyle_checkenergy)
|
||||
RegisterSignal(gargoyle, COMSIG_GARGOYLE_TRANSFORMATION, PROC_REF(gargoyle_transformation))
|
||||
RegisterSignal(gargoyle, COMSIG_GARGOYLE_PAUSE, PROC_REF(gargoyle_pause))
|
||||
RegisterSignal(gargoyle, COMSIG_GARGOYLE_CHECK_ENERGY, PROC_REF(gargoyle_checkenergy))
|
||||
add_verb(parent,/mob/living/carbon/human/proc/gargoyle_transformation)
|
||||
add_verb(parent,/mob/living/carbon/human/proc/gargoyle_pause)
|
||||
add_verb(parent,/mob/living/carbon/human/proc/gargoyle_checkenergy)
|
||||
|
||||
RegisterSignal(gargoyle, COMSIG_LIVING_LIFE, PROC_REF(process_component))
|
||||
/datum/component/gargoyle/RegisterWithParent()
|
||||
RegisterSignal(parent, COMSIG_GARGOYLE_TRANSFORMATION, PROC_REF(gargoyle_transformation))
|
||||
RegisterSignal(parent, COMSIG_GARGOYLE_PAUSE, PROC_REF(gargoyle_pause))
|
||||
RegisterSignal(parent, COMSIG_GARGOYLE_CHECK_ENERGY, PROC_REF(gargoyle_checkenergy))
|
||||
|
||||
RegisterSignal(parent, COMSIG_LIVING_LIFE, PROC_REF(process_component))
|
||||
|
||||
/datum/component/gargoyle/UnregisterFromParent()
|
||||
UnregisterSignal(parent, COMSIG_GARGOYLE_TRANSFORMATION)
|
||||
UnregisterSignal(parent, COMSIG_GARGOYLE_PAUSE)
|
||||
UnregisterSignal(parent, COMSIG_GARGOYLE_CHECK_ENERGY)
|
||||
UnregisterSignal(parent, COMSIG_LIVING_LIFE)
|
||||
UnregisterSignal(parent, COMSIG_MOVABLE_MOVED) //happens if gargoyle_pause is used
|
||||
|
||||
/datum/component/gargoyle/proc/process_component()
|
||||
if (QDELETED(gargoyle))
|
||||
if(QDELETED(gargoyle))
|
||||
return
|
||||
if (paused && gargoyle.loc != paused_loc)
|
||||
unpause()
|
||||
if (energy > 0)
|
||||
if (!transformed && !paused)
|
||||
energy = max(0,energy-0.05)
|
||||
else if (!transformed && isturf(gargoyle.loc))
|
||||
gargoyle.gargoyle_transformation()
|
||||
if (transformed)
|
||||
if (!statue)
|
||||
if(transformed)
|
||||
if(!statue)
|
||||
transformed = FALSE
|
||||
if(paused) //We somehow lost our energy while paused.
|
||||
unpause()
|
||||
statue.damage(-0.5)
|
||||
energy = min(energy+0.3, 100)
|
||||
|
||||
//This is where we do all the 'make sure we don't die in statue form' stuff (unless you succumb or take MASSIVE damage.)
|
||||
//Bloodloss will still kill us, but if we are patient enough, we'll survive most other stuff.
|
||||
//If we had 150 brute (crit for most species) it'll take 3000 seconds (50 minutes) to heal back to full hp...So yes, while you can heal, it's not a good idea.
|
||||
if(gargoyle.health < gargoyle.getMaxHealth())
|
||||
gargoyle.adjustBruteLoss(-0.1)
|
||||
gargoyle.adjustFireLoss(-0.1)
|
||||
gargoyle.adjustOxyLoss(-1) //So you don't suffocate to death.
|
||||
gargoyle.adjustToxLoss(-0.1)
|
||||
gargoyle.adjustCloneLoss(-0.02) //yeah this is uber slow, no cheese allowed by combining it with bad genetics.
|
||||
return //Early return. If we're transformed, we can stop, we don't need to check anything else.
|
||||
if(energy > 0)
|
||||
if(!transformed && !paused)
|
||||
energy = max(0,energy-0.05)
|
||||
else if(!transformed && isturf(gargoyle.loc))
|
||||
gargoyle.gargoyle_transformation()
|
||||
|
||||
/datum/component/gargoyle/Destroy(force = FALSE)
|
||||
UnregisterSignal(gargoyle, COMSIG_GARGOYLE_TRANSFORMATION)
|
||||
UnregisterSignal(gargoyle, COMSIG_GARGOYLE_PAUSE)
|
||||
UnregisterSignal(gargoyle, COMSIG_GARGOYLE_CHECK_ENERGY)
|
||||
UnregisterSignal(gargoyle, COMSIG_LIVING_LIFE)
|
||||
gargoyle = null
|
||||
statue = null
|
||||
. = ..()
|
||||
|
||||
/datum/component/gargoyle/proc/unpause()
|
||||
SIGNAL_HANDLER
|
||||
if (!paused || transformed)
|
||||
paused = FALSE
|
||||
paused_loc = null
|
||||
UnregisterSignal(gargoyle, COMSIG_ATOM_ENTERING)
|
||||
return
|
||||
if (gargoyle?.loc != paused_loc)
|
||||
paused = FALSE
|
||||
paused_loc = null
|
||||
energy = max(energy - 5, 0)
|
||||
if (energy == 0)
|
||||
gargoyle.gargoyle_transformation()
|
||||
UnregisterSignal(gargoyle, COMSIG_ATOM_ENTERING)
|
||||
paused = FALSE
|
||||
UnregisterSignal(gargoyle, COMSIG_MOVABLE_MOVED)
|
||||
return
|
||||
|
||||
//verbs or action buttons...?
|
||||
/mob/living/carbon/human/proc/gargoyle_transformation()
|
||||
@@ -76,17 +82,18 @@
|
||||
|
||||
|
||||
/datum/component/gargoyle/proc/gargoyle_transformation()
|
||||
if (gargoyle.stat == DEAD)
|
||||
SIGNAL_HANDLER
|
||||
if(gargoyle.stat == DEAD)
|
||||
return
|
||||
if (energy <= 0 && isturf(gargoyle.loc))
|
||||
if(energy <= 0 && isturf(gargoyle.loc))
|
||||
to_chat(gargoyle, span_danger("You suddenly turn into a [identifier] as you run out of energy!"))
|
||||
else if (cooldown > world.time)
|
||||
else if(cooldown > world.time)
|
||||
var/time_to_wait = (cooldown - world.time) / (1 SECONDS)
|
||||
to_chat(gargoyle, span_warning("You can't transform just yet again! Wait for another [round(time_to_wait,0.1)] seconds!"))
|
||||
return
|
||||
if (istype(gargoyle.loc, /obj/structure/gargoyle))
|
||||
if(istype(gargoyle.loc, /obj/structure/gargoyle))
|
||||
qdel(gargoyle.loc)
|
||||
else if (isturf(gargoyle.loc))
|
||||
else if(isturf(gargoyle.loc))
|
||||
new /obj/structure/gargoyle(gargoyle.loc, gargoyle)
|
||||
|
||||
/mob/living/carbon/human/proc/gargoyle_pause()
|
||||
@@ -96,14 +103,14 @@
|
||||
SEND_SIGNAL(src, COMSIG_GARGOYLE_PAUSE)
|
||||
|
||||
/datum/component/gargoyle/proc/gargoyle_pause()
|
||||
if (gargoyle.stat)
|
||||
SIGNAL_HANDLER
|
||||
if(gargoyle.stat)
|
||||
return
|
||||
|
||||
if (!transformed && !paused)
|
||||
if(!transformed && !paused)
|
||||
paused = TRUE
|
||||
paused_loc = gargoyle.loc
|
||||
RegisterSignal(gargoyle, COMSIG_ATOM_ENTERING, /datum/component/gargoyle/proc/unpause)
|
||||
to_chat(gargoyle, span_notice("You start conserving your energy."))
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, /datum/component/gargoyle/proc/unpause)
|
||||
to_chat(parent, span_notice("You start conserving your energy."))
|
||||
|
||||
/mob/living/carbon/human/proc/gargoyle_checkenergy()
|
||||
set name = "Gargoyle - Check Energy"
|
||||
@@ -112,4 +119,5 @@
|
||||
SEND_SIGNAL(src, COMSIG_GARGOYLE_CHECK_ENERGY)
|
||||
|
||||
/datum/component/gargoyle/proc/gargoyle_checkenergy()
|
||||
to_chat(gargoyle, span_notice("You have [round(energy,0.01)] energy remaining. It is currently [paused ? "stable" : (transformed ? "increasing" : "decreasing")]."))
|
||||
SIGNAL_HANDLER
|
||||
to_chat(parent, span_notice("You have [round(energy,0.01)] energy remaining. It is currently [paused ? "stable" : (transformed ? "increasing" : "decreasing")]."))
|
||||
|
||||
Reference in New Issue
Block a user