From 70cc742966e3fa3f0d81a6d6de4bd98304ddca35 Mon Sep 17 00:00:00 2001 From: AnturK Date: Mon, 8 Jun 2020 16:16:58 +0200 Subject: [PATCH] Removes pointless processing status effects from mining mobs. (#51481) * Removes pointless processing status effects from mining mobs. * Status effects are bad mkay. --- code/datums/status_effects/neutral.dm | 3 +++ code/datums/status_effects/status_effect.dm | 5 +++-- code/modules/mining/equipment/kinetic_crusher.dm | 4 ++++ .../mob/living/simple_animal/hostile/megafauna/megafauna.dm | 1 - .../living/simple_animal/hostile/mining_mobs/mining_mobs.dm | 4 ---- .../research/xenobiology/crossbreeding/_status_effects.dm | 1 + 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/code/datums/status_effects/neutral.dm b/code/datums/status_effects/neutral.dm index 24bb9317332..d4250f58cb0 100644 --- a/code/datums/status_effects/neutral.dm +++ b/code/datums/status_effects/neutral.dm @@ -13,6 +13,7 @@ /datum/status_effect/crusher_damage //tracks the damage dealt to this mob by kinetic crushers id = "crusher_damage" duration = -1 + tick_interval = -1 status_type = STATUS_EFFECT_UNIQUE alert_type = null var/total_damage = 0 @@ -147,6 +148,7 @@ /datum/status_effect/heldup id = "heldup" duration = -1 + tick_interval = -1 status_type = STATUS_EFFECT_MULTIPLE alert_type = /obj/screen/alert/status_effect/heldup @@ -159,6 +161,7 @@ /datum/status_effect/holdup id = "holdup" duration = -1 + tick_interval = -1 status_type = STATUS_EFFECT_UNIQUE alert_type = /obj/screen/alert/status_effect/holdup diff --git a/code/datums/status_effects/status_effect.dm b/code/datums/status_effects/status_effect.dm index 891102a291d..3130dd9a749 100644 --- a/code/datums/status_effects/status_effect.dm +++ b/code/datums/status_effects/status_effect.dm @@ -5,7 +5,7 @@ /datum/status_effect var/id = "effect" //Used for screen alerts. var/duration = -1 //How long the status effect lasts in DECISECONDS. Enter -1 for an effect that never ends unless removed through some means. - var/tick_interval = 10 //How many deciseconds between ticks, approximately. Leave at 10 for every second. + var/tick_interval = 10 //How many deciseconds between ticks, approximately. Leave at 10 for every second. Setting this to -1 will stop processing if duration is also unlimited. var/mob/living/owner //The mob affected by the status effect. var/status_type = STATUS_EFFECT_UNIQUE //How many of the effect can be on one mob, and what happens when you try to add another var/on_remove_on_mob_delete = FALSE //if we call on_remove() when the mob is deleted @@ -31,7 +31,8 @@ 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 linked_alert = A //so we can reference the alert, if we need to - START_PROCESSING(SSfastprocess, src) + if(duration > 0 || initial(tick_interval) > 0) //don't process if we don't care + START_PROCESSING(SSfastprocess, src) return TRUE /datum/status_effect/Destroy() diff --git a/code/modules/mining/equipment/kinetic_crusher.dm b/code/modules/mining/equipment/kinetic_crusher.dm index f9a2c39eb01..2553edeb394 100644 --- a/code/modules/mining/equipment/kinetic_crusher.dm +++ b/code/modules/mining/equipment/kinetic_crusher.dm @@ -81,6 +81,8 @@ user.drop_all_held_items() return var/datum/status_effect/crusher_damage/C = target.has_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) + if(!C) + C = target.apply_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) var/target_health = target.health ..() for(var/t in trophies) @@ -117,6 +119,8 @@ if(!CM || CM.hammer_synced != src || !L.remove_status_effect(STATUS_EFFECT_CRUSHERMARK)) return var/datum/status_effect/crusher_damage/C = L.has_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) + if(!C) + C = L.apply_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) var/target_health = L.health for(var/t in trophies) var/obj/item/crusher_trophy/T = t diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm index 46a48b9710b..22f170ef90d 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm @@ -59,7 +59,6 @@ . = ..() if(gps_name && true_spawn) AddComponent(/datum/component/gps, gps_name) - apply_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) ADD_TRAIT(src, TRAIT_NO_TELEPORT, MEGAFAUNA_TRAIT) ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT) for(var/action_type in attack_action_types) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm index 957318e28c9..60bb88299a5 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/mining_mobs.dm @@ -21,10 +21,6 @@ var/icon_aggro = null var/crusher_drop_mod = 25 -/mob/living/simple_animal/hostile/asteroid/Initialize(mapload) - . = ..() - apply_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING) - /mob/living/simple_animal/hostile/asteroid/Aggro() ..() if(vision_range == aggro_vision_range && icon_aggro) diff --git a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm index f524afe7caa..540f6a9c1aa 100644 --- a/code/modules/research/xenobiology/crossbreeding/_status_effects.dm +++ b/code/modules/research/xenobiology/crossbreeding/_status_effects.dm @@ -60,6 +60,7 @@ /datum/status_effect/slimerecall id = "slime_recall" duration = -1 //Will be removed by the extract. + tick_interval = -1 alert_type = null var/interrupted = FALSE var/mob/target