mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
## About The Pull Request Moves the genetic damage status effect's `qdel()` after making the status effect's owner a gorilla. Basically un-fucks the interaction, as it was accidentally fucked in #74799, see https://github.com/tgstation/tgstation/issues/74981#issuecomment-1546140751 ## Why It's Good For The Game Fixes #74981 ## Changelog 🆑 fix: made gorilla transformation when affected by excess amounts of genetic damage work /🆑
61 lines
2.3 KiB
Plaintext
61 lines
2.3 KiB
Plaintext
#define GORILLA_MUTATION_CHANCE_PER_SECOND 0.25
|
|
#define GORILLA_MUTATION_MINIMUM_DAMAGE 2500
|
|
|
|
/datum/status_effect/genetic_damage
|
|
id = "genetic_damage"
|
|
alert_type = null
|
|
status_type = STATUS_EFFECT_REFRESH // New effects will add to total_damage
|
|
duration = -1
|
|
tick_interval = 2 SECONDS
|
|
on_remove_on_mob_delete = TRUE // Need to unregister from owner, be_replaced() would cause runtimes
|
|
remove_on_fullheal = TRUE
|
|
/// The total genetic damage accumulated on the mob
|
|
var/total_damage = 0
|
|
/// The amount of genetic damage a mob can sustain before taking toxin damage
|
|
var/minimum_before_tox_damage = 500
|
|
/// The amount of genetic damage to remove per second
|
|
var/remove_per_second = 1 / 3
|
|
/// The amount of toxin damage to deal per second, if over the minimum before taking damage
|
|
var/toxin_damage_per_second = 1 / 3
|
|
|
|
/datum/status_effect/genetic_damage/on_creation(mob/living/new_owner, total_damage)
|
|
. = ..()
|
|
src.total_damage = total_damage
|
|
RegisterSignal(new_owner, COMSIG_LIVING_HEALTHSCAN, PROC_REF(on_healthscan))
|
|
|
|
/datum/status_effect/genetic_damage/on_remove()
|
|
. = ..()
|
|
UnregisterSignal(owner, COMSIG_LIVING_HEALTHSCAN)
|
|
|
|
/datum/status_effect/genetic_damage/refresh(mob/living/owner, total_damage)
|
|
. = ..()
|
|
src.total_damage += total_damage
|
|
|
|
/datum/status_effect/genetic_damage/tick(seconds_per_tick, times_fired)
|
|
if(ismonkey(owner) && total_damage >= GORILLA_MUTATION_MINIMUM_DAMAGE && SPT_PROB(GORILLA_MUTATION_CHANCE_PER_SECOND, seconds_per_tick))
|
|
var/mob/living/carbon/carbon_owner = owner
|
|
carbon_owner.gorillize()
|
|
qdel(src)
|
|
return
|
|
|
|
if(total_damage >= minimum_before_tox_damage)
|
|
owner.adjustToxLoss(toxin_damage_per_second * seconds_per_tick)
|
|
|
|
total_damage -= remove_per_second * seconds_per_tick
|
|
if(total_damage <= 0)
|
|
qdel(src)
|
|
return
|
|
|
|
/datum/status_effect/genetic_damage/proc/on_healthscan(datum/source, list/render_list, advanced)
|
|
SIGNAL_HANDLER
|
|
|
|
if(advanced)
|
|
render_list += "<span class='alert ml-1'>Genetic damage: [round(total_damage / minimum_before_tox_damage * 100, 0.1)]%</span>\n"
|
|
else if(total_damage >= minimum_before_tox_damage)
|
|
render_list += "<span class='alert ml-1'>Severe genetic damage detected.</span>\n"
|
|
else
|
|
render_list += "<span class='alert ml-1'>Minor genetic damage detected.</span>\n"
|
|
|
|
#undef GORILLA_MUTATION_CHANCE_PER_SECOND
|
|
#undef GORILLA_MUTATION_MINIMUM_DAMAGE
|