From 9043920b69dd75ff09fa23c5bc4e4cf6e32c1b40 Mon Sep 17 00:00:00 2001 From: Elizabeth Lavenza Date: Sat, 13 Apr 2024 18:16:49 -0400 Subject: [PATCH] Fix cooldown abilities never running --- .../bloodsucker/bloodsucker_powers.dm | 2 ++ .../antagonists/disease/disease_abilities.dm | 12 +++--------- code/modules/antagonists/gang/gang.dm | 17 +++++------------ code/modules/antagonists/slaughter/slaughter.dm | 5 +---- .../living/simple_animal/hostile/plaguerat.dm | 5 +---- .../living/simple_animal/hostile/regalrat.dm | 12 ++++-------- 6 files changed, 16 insertions(+), 37 deletions(-) diff --git a/code/modules/antagonists/bloodsucker/bloodsucker_powers.dm b/code/modules/antagonists/bloodsucker/bloodsucker_powers.dm index 019bbe6fbd..bcafb1b856 100644 --- a/code/modules/antagonists/bloodsucker/bloodsucker_powers.dm +++ b/code/modules/antagonists/bloodsucker/bloodsucker_powers.dm @@ -50,6 +50,7 @@ // click.dm <--- Where we can take over mouse clicks // spells.dm /add_ranged_ability() <--- How we take over the mouse click to use a power on a target. +// TODO: Refactor this to use /Activate(). /datum/action/cooldown/bloodsucker/Trigger() // Active? DEACTIVATE AND END! if(active && CheckCanDeactivate(TRUE)) @@ -179,6 +180,7 @@ bs_proc_holder = new () bs_proc_holder.linked_power = src +// TODO: Refactor this to use /Activate() and click_to_activate = TRUE. // Click power: Begin Aim /datum/action/cooldown/bloodsucker/targeted/Trigger() if(active && CheckCanDeactivate(TRUE)) diff --git a/code/modules/antagonists/disease/disease_abilities.dm b/code/modules/antagonists/disease/disease_abilities.dm index fc53575bd8..0b5258dd50 100644 --- a/code/modules/antagonists/disease/disease_abilities.dm +++ b/code/modules/antagonists/disease/disease_abilities.dm @@ -169,9 +169,7 @@ new /datum/disease_ability/symptom/powerful/youth desc = "Force the host you are following to cough with extra force, spreading your infection to those within two meters of your host even if your transmissibility is low.
Cooldown: 10 seconds" cooldown_time = 100 -/datum/action/cooldown/disease_cough/Trigger() - if(!..()) - return FALSE +/datum/action/cooldown/disease_cough/Activate() var/mob/camera/disease/D = owner var/mob/living/L = D.following_host if(!L) @@ -201,9 +199,7 @@ new /datum/disease_ability/symptom/powerful/youth desc = "Force the host you are following to sneeze with extra force, spreading your infection to any victims in a 4 meter cone in front of your host even if your transmissibility is low.
Cooldown: 20 seconds" cooldown_time = 200 -/datum/action/cooldown/disease_sneeze/Trigger() - if(!..()) - return FALSE +/datum/action/cooldown/disease_sneeze/Activate() var/mob/camera/disease/D = owner var/mob/living/L = D.following_host if(!L) @@ -237,9 +233,7 @@ new /datum/disease_ability/symptom/powerful/youth desc = "Cause the host you are following to excrete an infective substance from their pores, causing all objects touching their skin to transmit your infection to anyone who touches them for the next 30 seconds.
Cooldown: 40 seconds" cooldown_time = 400 -/datum/action/cooldown/disease_infect/Trigger() - if(!..()) - return FALSE +/datum/action/cooldown/disease_infect/Activate() var/mob/camera/disease/D = owner var/mob/living/carbon/human/H = D.following_host if(!H) diff --git a/code/modules/antagonists/gang/gang.dm b/code/modules/antagonists/gang/gang.dm index dd90d4b57b..e41c7b1228 100644 --- a/code/modules/antagonists/gang/gang.dm +++ b/code/modules/antagonists/gang/gang.dm @@ -226,19 +226,11 @@ /// The family antagonist datum of the "owner" of this action. var/datum/antagonist/gang/my_gang_datum -/datum/action/cooldown/spawn_induction_package/Trigger() - if(!..()) - return FALSE - if(!IsAvailable()) - return FALSE +/datum/action/cooldown/spawn_induction_package/Activate() if(!my_gang_datum) return FALSE - if(!istype(owner, /mob/living/carbon/human)) + if(!ishuman(owner)) return FALSE - var/mob/living/carbon/human/H = owner - if(H.stat) - return FALSE - var/obj/item/slapper/secret_handshake/secret_handshake_item = new(owner) if(owner.put_in_hands(secret_handshake_item)) to_chat(owner, span_notice("You ready your secret handshake.")) @@ -248,14 +240,15 @@ return FALSE owner.visible_message(span_notice("[owner] is offering to induct people into the Family."), span_notice("You offer to induct people into the Family."), null, 2) - if(H.has_status_effect(STATUS_EFFECT_HANDSHAKE)) + var/mob/living/living_owner = owner + if(living_owner.has_status_effect(STATUS_EFFECT_HANDSHAKE)) return FALSE if(!(locate(/mob/living/carbon) in orange(1, owner))) owner.visible_message(span_danger("[owner] offers to induct people into the Family, but nobody was around."), \ span_warning("You offer to induct people into the Family, but nobody is around."), null, 2) return FALSE - H.apply_status_effect(STATUS_EFFECT_HANDSHAKE, secret_handshake_item) + living_owner.apply_status_effect(STATUS_EFFECT_HANDSHAKE, secret_handshake_item) StartCooldown() return TRUE diff --git a/code/modules/antagonists/slaughter/slaughter.dm b/code/modules/antagonists/slaughter/slaughter.dm index 1dba6f8b88..802d9eb5ea 100644 --- a/code/modules/antagonists/slaughter/slaughter.dm +++ b/code/modules/antagonists/slaughter/slaughter.dm @@ -87,10 +87,7 @@ button_icon_state = "slam" cooldown_time = 45 SECONDS -/datum/action/cooldown/slam/Trigger() - . = ..() - if(!.) - return +/datum/action/cooldown/slam/Activate() var/mob/living/simple_animal/slaughter/user = owner user.slam_mode = !user.slam_mode to_chat(user, user.slam_mode ? "Ready to slam!" : "Maybe not now.") diff --git a/code/modules/mob/living/simple_animal/hostile/plaguerat.dm b/code/modules/mob/living/simple_animal/hostile/plaguerat.dm index d67064a447..88118d179b 100644 --- a/code/modules/mob/living/simple_animal/hostile/plaguerat.dm +++ b/code/modules/mob/living/simple_animal/hostile/plaguerat.dm @@ -167,10 +167,7 @@ GLOBAL_LIST_EMPTY(plague_rats) button_icon_state = "coffer" cooldown_time = 50 -/datum/action/cooldown/scavenge/Trigger() - . = ..() - if(!.) - return +/datum/action/cooldown/scavenge/Activate() var/turf/T = get_turf(owner) var/loot = rand(1,100) switch(loot) diff --git a/code/modules/mob/living/simple_animal/hostile/regalrat.dm b/code/modules/mob/living/simple_animal/hostile/regalrat.dm index 8419271d57..87c7d0519b 100644 --- a/code/modules/mob/living/simple_animal/hostile/regalrat.dm +++ b/code/modules/mob/living/simple_animal/hostile/regalrat.dm @@ -87,11 +87,9 @@ background_icon_state = "bg_clock" button_icon_state = "coffer" cooldown_time = 50 + check_flags = AB_CHECK_CONSCIOUS -/datum/action/cooldown/coffer/Trigger() - . = ..() - if(!. || owner.stat != CONSCIOUS) - return +/datum/action/cooldown/coffer/Activate() var/turf/T = get_turf(owner) var/loot = rand(1,100) switch(loot) @@ -131,12 +129,10 @@ button_icon_state = "riot" background_icon_state = "bg_clock" cooldown_time = 80 + check_flags = AB_CHECK_CONSCIOUS ///Checks to see if there are any nearby mice. Does not count Rats. -/datum/action/cooldown/riot/Trigger() - . = ..() - if(!. || owner.stat != CONSCIOUS) - return +/datum/action/cooldown/riot/Activate() var/cap = CONFIG_GET(number/ratcap) var/something_from_nothing = FALSE for(var/mob/living/simple_animal/mouse/M in oview(owner, 5))