From 820afe72a7f37bb0942e2cb6f35cf89fee9c17c1 Mon Sep 17 00:00:00 2001 From: Jacquerel Date: Thu, 17 Aug 2023 22:16:02 +0100 Subject: [PATCH] Converts some actions to mob cooldown actions (#77680) ## About The Pull Request It has come to my attention that it isn't possible for admins to grant the abilities to place web, lay eggs, and issue commands to spiders to arbitrary mobs. This refactors Spider, Goliath, and Meteor Heart abilities (hey what do you know I last touched all of those) such that they can. ## Why It's Good For The Game You **can** create the spider pig as an event. ## Changelog :cl: admin: Adds Spider, Goliath, and Meteor Heart actions to the "Grant Mob Action" menu. /:cl: --- code/datums/mutations/webbing.dm | 4 +- .../living/basic/lavaland/goliath/goliath.dm | 8 +-- .../basic/lavaland/goliath/goliath_actions.dm | 24 ++++---- .../basic/lavaland/watcher/watcher_gaze.dm | 2 +- .../lavaland/watcher/watcher_overwatch.dm | 2 +- .../meteor_heart/chasing_spikes.dm | 9 +-- .../space_fauna/meteor_heart/meteor_heart.dm | 6 +- .../space_fauna/meteor_heart/spine_traps.dm | 10 ++-- .../spider/giant_spider/giant_spiders.dm | 50 ++++++++-------- .../living/basic/space_fauna/spider/spider.dm | 4 +- .../spider/spider_abilities/hivemind.dm | 42 +++++++------- .../spider/spider_abilities/lay_eggs.dm | 46 ++++++++------- .../spider/spider_abilities/web.dm | 58 ++++++++++--------- .../spider/spider_abilities/wrap.dm | 21 +++---- .../young_spider/young_spider_subtypes.dm | 6 +- 15 files changed, 152 insertions(+), 140 deletions(-) diff --git a/code/datums/mutations/webbing.dm b/code/datums/mutations/webbing.dm index 4fce0e29da0..0fda118d0ed 100644 --- a/code/datums/mutations/webbing.dm +++ b/code/datums/mutations/webbing.dm @@ -5,12 +5,12 @@ quality = POSITIVE text_gain_indication = "Your skin feels webby." instability = 15 - power_path = /datum/action/cooldown/lay_web/genetic + power_path = /datum/action/cooldown/mob_cooldown/lay_web/genetic energy_coeff = 1 /datum/mutation/human/webbing/modify() . = ..() - var/datum/action/cooldown/lay_web/genetic/to_modify = . + var/datum/action/cooldown/mob_cooldown/lay_web/genetic/to_modify = . if(!istype(to_modify)) // null or invalid return diff --git a/code/modules/mob/living/basic/lavaland/goliath/goliath.dm b/code/modules/mob/living/basic/lavaland/goliath/goliath.dm index 016fc3a5a87..ffe8d9e4655 100644 --- a/code/modules/mob/living/basic/lavaland/goliath/goliath.dm +++ b/code/modules/mob/living/basic/lavaland/goliath/goliath.dm @@ -43,7 +43,7 @@ /// Slight cooldown to prevent double-dipping if we use both abilities at once COOLDOWN_DECLARE(ability_animation_cooldown) /// Our base tentacles ability - var/datum/action/cooldown/goliath_tentacles/tentacles + var/datum/action/cooldown/mob_cooldown/goliath_tentacles/tentacles /// Things we want to eat off the floor (or a plate, we're not picky) var/static/list/goliath_foods = list(/obj/item/food/grown/ash_flora, /obj/item/food/bait/worm) @@ -66,10 +66,10 @@ tentacles = new (src) tentacles.Grant(src) - var/datum/action/cooldown/tentacle_burst/melee_tentacles = new (src) + var/datum/action/cooldown/mob_cooldown/tentacle_burst/melee_tentacles = new (src) melee_tentacles.Grant(src) AddComponent(/datum/component/revenge_ability, melee_tentacles, targetting = ai_controller.blackboard[BB_TARGETTING_DATUM], max_range = 1, target_self = TRUE) - var/datum/action/cooldown/tentacle_grasp/ranged_tentacles = new (src) + var/datum/action/cooldown/mob_cooldown/tentacle_grasp/ranged_tentacles = new (src) ranged_tentacles.Grant(src) AddComponent(/datum/component/revenge_ability, ranged_tentacles, targetting = ai_controller.blackboard[BB_TARGETTING_DATUM], min_range = 2, max_range = 9) @@ -139,7 +139,7 @@ SIGNAL_HANDLER if (stat == DEAD || ability.IsAvailable()) return // We died or the action failed for some reason like being out of range - if (istype(ability, /datum/action/cooldown/goliath_tentacles)) + if (istype(ability, /datum/action/cooldown/mob_cooldown/goliath_tentacles)) if (ability.cooldown_time <= 2 SECONDS) return icon_state = icon_living diff --git a/code/modules/mob/living/basic/lavaland/goliath/goliath_actions.dm b/code/modules/mob/living/basic/lavaland/goliath/goliath_actions.dm index f98d1630650..bb8adaf61c3 100644 --- a/code/modules/mob/living/basic/lavaland/goliath/goliath_actions.dm +++ b/code/modules/mob/living/basic/lavaland/goliath/goliath_actions.dm @@ -1,5 +1,5 @@ /// Place some grappling tentacles underfoot -/datum/action/cooldown/goliath_tentacles +/datum/action/cooldown/mob_cooldown/goliath_tentacles name = "Unleash Tentacles" desc = "Unleash burrowed tentacles at a targetted location, grappling targets after a delay." button_icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi' @@ -10,17 +10,17 @@ cooldown_time = 12 SECONDS melee_cooldown_time = 0 check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED + shared_cooldown = NONE /// Furthest range we can activate ability at var/max_range = 7 -/datum/action/cooldown/goliath_tentacles/PreActivate(atom/target) +/datum/action/cooldown/mob_cooldown/goliath_tentacles/PreActivate(atom/target) target = get_turf(target) if (get_dist(owner, target) > max_range) return FALSE return ..() -/datum/action/cooldown/goliath_tentacles/Activate(atom/target) - . = ..() +/datum/action/cooldown/mob_cooldown/goliath_tentacles/Activate(atom/target) new /obj/effect/goliath_tentacle(target) var/list/directions = GLOB.cardinals.Copy() for(var/i in 1 to 3) @@ -31,10 +31,11 @@ if (isliving(target)) owner.visible_message(span_warning("[owner] digs its tentacles under [target]!")) + StartCooldown() return TRUE /// Place grappling tentacles around you to grab attackers -/datum/action/cooldown/tentacle_burst +/datum/action/cooldown/mob_cooldown/tentacle_burst name = "Tentacle Burst" desc = "Unleash burrowed tentacles in an area around you, grappling targets after a delay." button_icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi' @@ -44,19 +45,21 @@ cooldown_time = 24 SECONDS melee_cooldown_time = 0 check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED + shared_cooldown = NONE + click_to_activate = FALSE -/datum/action/cooldown/tentacle_burst/Activate(atom/target) - . = ..() +/datum/action/cooldown/mob_cooldown/tentacle_burst/Activate(atom/target) var/list/directions = GLOB.alldirs.Copy() for (var/dir in directions) var/turf/adjacent_target = get_step(target, dir) if(adjacent_target) new /obj/effect/goliath_tentacle(adjacent_target) owner.visible_message(span_warning("[owner] unleashes tentacles from the ground around it!")) + StartCooldown() return TRUE /// Summon a line of tentacles towards the target -/datum/action/cooldown/tentacle_grasp +/datum/action/cooldown/mob_cooldown/tentacle_grasp name = "Tentacle Grasp" desc = "Unleash burrowed tentacles in a line towards a targetted location, grappling targets after a delay." button_icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi' @@ -67,12 +70,13 @@ cooldown_time = 12 SECONDS melee_cooldown_time = 0 check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED + shared_cooldown = NONE -/datum/action/cooldown/tentacle_grasp/Activate(atom/target) - . = ..() +/datum/action/cooldown/mob_cooldown/tentacle_grasp/Activate(atom/target) new /obj/effect/temp_visual/effect_trail/burrowed_tentacle(owner.loc, target) if (isliving(target)) owner.visible_message(span_warning("[owner] reaches for [target] with its tentacles!")) + StartCooldown() return TRUE /// An invisible effect which chases a target, spawning tentacles every so often. diff --git a/code/modules/mob/living/basic/lavaland/watcher/watcher_gaze.dm b/code/modules/mob/living/basic/lavaland/watcher/watcher_gaze.dm index 85d2e384ae3..b90d5928b20 100644 --- a/code/modules/mob/living/basic/lavaland/watcher/watcher_gaze.dm +++ b/code/modules/mob/living/basic/lavaland/watcher/watcher_gaze.dm @@ -11,7 +11,7 @@ cooldown_time = 30 SECONDS check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED click_to_activate = FALSE - shared_cooldown = null + shared_cooldown = NONE /// At what range do we check for vision? var/effect_radius = 7 /// How long does it take to play our various animation stages diff --git a/code/modules/mob/living/basic/lavaland/watcher/watcher_overwatch.dm b/code/modules/mob/living/basic/lavaland/watcher/watcher_overwatch.dm index 59fe0e0903b..ca882da3f2c 100644 --- a/code/modules/mob/living/basic/lavaland/watcher/watcher_overwatch.dm +++ b/code/modules/mob/living/basic/lavaland/watcher/watcher_overwatch.dm @@ -11,7 +11,7 @@ cooldown_time = 20 SECONDS check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED click_to_activate = TRUE - shared_cooldown = null + shared_cooldown = NONE /// Furthest range we can activate ability at var/max_range = 7 /// Type of projectile to fire diff --git a/code/modules/mob/living/basic/space_fauna/meteor_heart/chasing_spikes.dm b/code/modules/mob/living/basic/space_fauna/meteor_heart/chasing_spikes.dm index 729352543ba..a0f9d2fb51b 100644 --- a/code/modules/mob/living/basic/space_fauna/meteor_heart/chasing_spikes.dm +++ b/code/modules/mob/living/basic/space_fauna/meteor_heart/chasing_spikes.dm @@ -1,15 +1,16 @@ /// An ability which makes spikes come out of the ground towards your target -/datum/action/cooldown/chasing_spikes +/datum/action/cooldown/mob_cooldown/chasing_spikes name = "impaling tendril" desc = "Send a spiked subterranean tendril chasing after your target." button_icon = 'icons/mob/simple/meteor_heart.dmi' button_icon_state = "spike" cooldown_time = 10 SECONDS click_to_activate = TRUE + shared_cooldown = NONE /// Lazy list of references to spike trails var/list/active_chasers -/datum/action/cooldown/chasing_spikes/Activate(atom/target) +/datum/action/cooldown/mob_cooldown/chasing_spikes/Activate(atom/target) . = ..() playsound(owner, 'sound/magic/demon_attack1.ogg', vol = 100, vary = TRUE, pressure_affected = FALSE) var/obj/effect/temp_visual/effect_trail/spike_chaser/chaser = new(get_turf(owner), target) @@ -17,12 +18,12 @@ RegisterSignal(chaser, COMSIG_QDELETING, PROC_REF(on_chaser_destroyed)) /// Remove a spike trail from our list of active trails -/datum/action/cooldown/chasing_spikes/proc/on_chaser_destroyed(atom/chaser) +/datum/action/cooldown/mob_cooldown/chasing_spikes/proc/on_chaser_destroyed(atom/chaser) SIGNAL_HANDLER LAZYREMOVE(active_chasers, WEAKREF(chaser)) // Clean up after ourselves -/datum/action/cooldown/chasing_spikes/Remove(mob/removed_from) +/datum/action/cooldown/mob_cooldown/chasing_spikes/Remove(mob/removed_from) QDEL_LIST(active_chasers) return ..() diff --git a/code/modules/mob/living/basic/space_fauna/meteor_heart/meteor_heart.dm b/code/modules/mob/living/basic/space_fauna/meteor_heart/meteor_heart.dm index d2c295c8036..5829b52e437 100644 --- a/code/modules/mob/living/basic/space_fauna/meteor_heart/meteor_heart.dm +++ b/code/modules/mob/living/basic/space_fauna/meteor_heart/meteor_heart.dm @@ -26,9 +26,9 @@ combat_mode = TRUE move_resist = INFINITY // This mob IS the floor /// Action which sends a line of spikes chasing a player - var/datum/action/cooldown/chasing_spikes/spikes + var/datum/action/cooldown/mob_cooldown/chasing_spikes/spikes /// Action which summons areas the player can't stand in - var/datum/action/cooldown/spine_traps/traps + var/datum/action/cooldown/mob_cooldown/spine_traps/traps /// Looping heartbeat sound var/datum/looping_sound/heartbeat/soundloop @@ -77,7 +77,7 @@ soundloop.set_mid_length(HEARTBEAT_NORMAL) /// Animate when using certain abilities -/mob/living/basic/meteor_heart/proc/used_ability(mob/living/owner, datum/action/cooldown/ability) +/mob/living/basic/meteor_heart/proc/used_ability(mob/living/owner, datum/action/cooldown/mob_cooldown/ability) SIGNAL_HANDLER if (ability != spikes) return diff --git a/code/modules/mob/living/basic/space_fauna/meteor_heart/spine_traps.dm b/code/modules/mob/living/basic/space_fauna/meteor_heart/spine_traps.dm index a2a3b52b835..4f7135b1deb 100644 --- a/code/modules/mob/living/basic/space_fauna/meteor_heart/spine_traps.dm +++ b/code/modules/mob/living/basic/space_fauna/meteor_heart/spine_traps.dm @@ -1,10 +1,12 @@ /// Marks several areas with thrusting spines which damage and slow people -/datum/action/cooldown/spine_traps +/datum/action/cooldown/mob_cooldown/spine_traps name = "thrusting spines" desc = "Mark several nearby areas with thrusting spines, which will spring up when disturbed." button_icon = 'icons/mob/simple/meteor_heart.dmi' button_icon_state = "spikes_stabbing" cooldown_time = 15 SECONDS + shared_cooldown = NONE + click_to_activate = FALSE /// Create zones at most this far away var/range = 3 /// Don't create zones within this radius @@ -12,7 +14,7 @@ /// Number of zones to place var/zones_to_create = 3 -/datum/action/cooldown/spine_traps/Activate(atom/target) +/datum/action/cooldown/mob_cooldown/spine_traps/Activate(atom/target) . = ..() playsound(owner, 'sound/magic/demon_consume.ogg', vol = 100, falloff_exponent = 2, vary = TRUE, pressure_affected = FALSE) @@ -31,11 +33,11 @@ created++ /// Returns true if we can place a trap at the specified location -/datum/action/cooldown/spine_traps/proc/is_valid_turf(turf/target_turf) +/datum/action/cooldown/mob_cooldown/spine_traps/proc/is_valid_turf(turf/target_turf) return !target_turf.is_blocked_turf(exclude_mobs = TRUE) && !isspaceturf(target_turf) && !isopenspaceturf(target_turf) /// Places a 3x3 area of spike traps around a central provided point, returns the list of now occupied turfs -/datum/action/cooldown/spine_traps/proc/place_zone(turf/target_turf) +/datum/action/cooldown/mob_cooldown/spine_traps/proc/place_zone(turf/target_turf) var/list/used_turfs = list() for (var/turf/zone_turf in range(1, target_turf)) if (!is_valid_turf(zone_turf)) diff --git a/code/modules/mob/living/basic/space_fauna/spider/giant_spider/giant_spiders.dm b/code/modules/mob/living/basic/space_fauna/spider/giant_spider/giant_spiders.dm index ec0499e13d0..38294dcf277 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/giant_spider/giant_spiders.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/giant_spider/giant_spiders.dm @@ -78,7 +78,7 @@ . = ..() AddElement(/datum/element/web_walker, /datum/movespeed_modifier/average_web) - var/datum/action/cooldown/web_effigy/shed = new(src) + var/datum/action/cooldown/mob_cooldown/web_effigy/shed = new(src) shed.Grant(src) /** @@ -135,7 +135,7 @@ . = ..() ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) - var/datum/action/command_spiders/communication_spiders/spiders_communication = new(src) + var/datum/action/cooldown/mob_cooldown/command_spiders/communication_spiders/spiders_communication = new(src) spiders_communication.Grant(src) /** @@ -161,7 +161,7 @@ speed = 4 player_speed_modifier = -3.1 web_speed = 0.25 - web_type = /datum/action/cooldown/lay_web/sealer + web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer menu_description = "Support spider variant specializing in healing their brethren and placing webbings very swiftly, but has very low amount of health and deals low damage." ///The health HUD applied to the mob. var/health_hud = DATA_HUD_MEDICAL_ADVANCED @@ -208,21 +208,21 @@ web_speed = 0.25 speed = 4 player_speed_modifier = -3.1 - web_type = /datum/action/cooldown/lay_web/sealer + web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer menu_description = "Support spider variant specializing in contruction to protect their brethren, but has very low amount of health and deals low damage." /mob/living/basic/spider/giant/tangle/Initialize(mapload) . = ..() - var/datum/action/cooldown/lay_web/solid_web/web_solid = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/solid_web/web_solid = new(src) web_solid.Grant(src) - var/datum/action/cooldown/lay_web/web_passage/passage_web = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/web_passage/passage_web = new(src) passage_web.Grant(src) - var/datum/action/cooldown/lay_web/web_spikes/spikes_web = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/spikes_web = new(src) spikes_web.Grant(src) - var/datum/action/cooldown/lay_web/sticky_web/web_sticky = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/web_sticky = new(src) web_sticky.Grant(src) AddElement(/datum/element/web_walker, /datum/movespeed_modifier/average_web) @@ -270,17 +270,17 @@ mob_size = MOB_SIZE_LARGE gold_core_spawnable = NO_SPAWN web_speed = 0.7 - web_type = /datum/action/cooldown/lay_web/sealer + web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer menu_description = "Tank spider variant with an enormous amount of health and damage, but is very slow when not on webbing. It also has a charge ability to close distance with a target after a small windup." /// Charging ability var/datum/action/cooldown/mob_cooldown/charge/basic_charge/charge /mob/living/basic/spider/giant/tarantula/Initialize(mapload) . = ..() - var/datum/action/cooldown/lay_web/solid_web/web_solid = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/solid_web/web_solid = new(src) web_solid.Grant(src) - var/datum/action/cooldown/lay_web/web_passage/passage_web = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/web_passage/passage_web = new(src) passage_web.Grant(src) charge = new /datum/action/cooldown/mob_cooldown/charge/basic_charge() @@ -353,36 +353,36 @@ player_speed_modifier = -3.1 gold_core_spawnable = NO_SPAWN web_speed = 0.5 - web_type = /datum/action/cooldown/lay_web/sealer + web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer menu_description = "Royal spider variant specializing in reproduction and leadership, deals low damage." /mob/living/basic/spider/giant/midwife/Initialize(mapload) . = ..() - var/datum/action/cooldown/lay_web/solid_web/web_solid = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/solid_web/web_solid = new(src) web_solid.Grant(src) - var/datum/action/cooldown/lay_web/web_passage/passage_web = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/web_passage/passage_web = new(src) passage_web.Grant(src) - var/datum/action/cooldown/lay_web/web_spikes/spikes_web = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/spikes_web = new(src) spikes_web.Grant(src) - var/datum/action/cooldown/lay_web/sticky_web/web_sticky = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/web_sticky = new(src) web_sticky.Grant(src) - var/datum/action/cooldown/wrap/wrapping = new(src) + var/datum/action/cooldown/mob_cooldown/wrap/wrapping = new(src) wrapping.Grant(src) - var/datum/action/lay_eggs/make_eggs = new(src) + var/datum/action/cooldown/mob_cooldown/lay_eggs/make_eggs = new(src) make_eggs.Grant(src) - var/datum/action/lay_eggs/enriched/make_better_eggs = new(src) + var/datum/action/cooldown/mob_cooldown/lay_eggs/enriched/make_better_eggs = new(src) make_better_eggs.Grant(src) - var/datum/action/set_spider_directive/give_orders = new(src) + var/datum/action/cooldown/mob_cooldown/set_spider_directive/give_orders = new(src) give_orders.Grant(src) - var/datum/action/command_spiders/not_hivemind_talk = new(src) + var/datum/action/cooldown/mob_cooldown/command_spiders/not_hivemind_talk = new(src) not_hivemind_talk.Grant(src) AddElement(/datum/element/web_walker, /datum/movespeed_modifier/average_web) @@ -514,10 +514,10 @@ complete_text = "%SOURCE%'s wounds mend together.",\ ) - var/datum/action/cooldown/lay_web/web_spikes/spikes_web = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/spikes_web = new(src) spikes_web.Grant(src) - var/datum/action/cooldown/lay_web/sticky_web/web_sticky = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/web_sticky = new(src) web_sticky.Grant(src) /// Prevent you from healing other flesh spiders, or healing when on fire @@ -552,10 +552,10 @@ . = ..() ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) - var/datum/action/cooldown/lay_web/web_spikes/spikes_web = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/spikes_web = new(src) spikes_web.Grant(src) - var/datum/action/cooldown/lay_web/sticky_web/web_sticky = new(src) + var/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/web_sticky = new(src) web_sticky.Grant(src) diff --git a/code/modules/mob/living/basic/space_fauna/spider/spider.dm b/code/modules/mob/living/basic/space_fauna/spider/spider.dm index c1d11d2cb10..e96482439f9 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/spider.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/spider.dm @@ -38,7 +38,7 @@ /// Multiplier to apply to web laying speed. Fractional numbers make it faster, because it's a multiplier. var/web_speed = 1 /// Type of webbing ability to learn. - var/web_type = /datum/action/cooldown/lay_web + var/web_type = /datum/action/cooldown/mob_cooldown/lay_web /// The message that the mother spider left for this spider when the egg was layed. var/directive = "" /// Short description of what this mob is capable of, for radial menu uses @@ -57,7 +57,7 @@ if(poison_per_bite) AddElement(/datum/element/venomous, poison_type, poison_per_bite) - var/datum/action/cooldown/lay_web/webbing = new web_type(src) + var/datum/action/cooldown/mob_cooldown/lay_web/webbing = new web_type(src) webbing.webbing_time *= web_speed webbing.Grant(src) ai_controller?.set_blackboard_key(BB_SPIDER_WEB_ACTION, webbing) diff --git a/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/hivemind.dm b/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/hivemind.dm index 77ee38ed7c3..bbeb2b28bb5 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/hivemind.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/hivemind.dm @@ -2,7 +2,7 @@ * Sets a directive to be given to all future spiders created by the user. * This will be overwritten if used again. */ -/datum/action/set_spider_directive +/datum/action/cooldown/mob_cooldown/set_spider_directive name = "Set Directive" desc = "Set a directive for your future children to follow." button_icon = 'icons/mob/actions/actions_animal.dmi' @@ -10,26 +10,27 @@ background_icon_state = "bg_alien" overlay_icon_state = "bg_alien_border" check_flags = AB_CHECK_CONSCIOUS + cooldown_time = 0 + melee_cooldown_time = 0 + shared_cooldown = NONE + click_to_activate = FALSE /// Current directive to apply var/current_directive = "" -/datum/action/set_spider_directive/Trigger(trigger_flags) - . = ..() - if(!.) - return +/datum/action/cooldown/mob_cooldown/set_spider_directive/Activate(atom/target) var/new_directive = tgui_input_text(owner, "Enter the new directive", "Create directive", "[current_directive]") if(isnull(new_directive) || QDELETED(src) || QDELETED(owner) || !IsAvailable(feedback = TRUE)) - return FALSE + return current_directive = new_directive message_admins("[ADMIN_LOOKUPFLW(owner)] set its directive to: '[current_directive]'.") owner.log_message("set its directive to: '[current_directive]'.", LOG_GAME) - return TRUE + StartCooldown() /** * Sends a message to all currently living spiders. */ -/datum/action/command_spiders +/datum/action/cooldown/mob_cooldown/command_spiders name = "Command" desc = "Send a command to all living spiders." button_icon = 'icons/mob/actions/actions_animal.dmi' @@ -37,18 +38,17 @@ background_icon_state = "bg_alien" overlay_icon_state = "bg_alien_border" check_flags = AB_CHECK_CONSCIOUS + cooldown_time = 0 + melee_cooldown_time = 0 + shared_cooldown = NONE + click_to_activate = FALSE -/datum/action/command_spiders/Trigger(trigger_flags) - . = ..() - if(!.) - return - +/datum/action/cooldown/mob_cooldown/command_spiders/Activate(trigger_flags) var/input = tgui_input_text(owner, "Input a command for your legions to follow.", "Command") if(!input || QDELETED(src) || QDELETED(owner) || !IsAvailable(feedback = TRUE)) - return FALSE - + return spider_command(owner, input) - return TRUE + StartCooldown() /** * Sends a big message to all spiders from the target. @@ -58,9 +58,7 @@ * * user - The spider sending the message * * message - The message to be sent */ -/datum/action/command_spiders/proc/spider_command(mob/living/user, message) - if(!message) - return +/datum/action/cooldown/mob_cooldown/command_spiders/proc/spider_command(mob/living/user, message) var/my_message = format_message(user,message) for(var/mob/living/basic/spider as anything in GLOB.spidermobs) to_chat(spider, my_message) @@ -72,17 +70,17 @@ /** * Formats the string to have an appropiate size and text color */ -/datum/action/command_spiders/proc/format_message(mob/living/user, message) +/datum/action/cooldown/mob_cooldown/command_spiders/proc/format_message(mob/living/user, message) return span_spiderbroodmother("Command from [user]: [message]") /** * Sends a small message to all currently living spiders. */ -/datum/action/command_spiders/communication_spiders +/datum/action/cooldown/mob_cooldown/command_spiders/communication_spiders name = "Communication" desc = "Send a report to all living spiders." button_icon = 'icons/mob/actions/actions_animal.dmi' button_icon_state = "message" -/datum/action/command_spiders/communication_spiders/format_message(mob/living/user, message) +/datum/action/cooldown/mob_cooldown/command_spiders/communication_spiders/format_message(mob/living/user, message) return span_spiderscout("Report from [user]: [message]") diff --git a/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/lay_eggs.dm b/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/lay_eggs.dm index cd86a93f75d..28a543be3ac 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/lay_eggs.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/lay_eggs.dm @@ -1,4 +1,4 @@ -/datum/action/lay_eggs +/datum/action/cooldown/mob_cooldown/lay_eggs name = "Lay Eggs" desc = "Lay a cluster of eggs, which will soon grow into a normal spider." button_icon = 'icons/mob/actions/actions_animal.dmi' @@ -6,22 +6,26 @@ background_icon_state = "bg_alien" overlay_icon_state = "bg_alien_border" check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED + cooldown_time = 0 + melee_cooldown_time = 0 + shared_cooldown = NONE + click_to_activate = FALSE ///How long it takes for a broodmother to lay eggs. var/egg_lay_time = 4 SECONDS ///The type of egg we create var/egg_type = /obj/effect/mob_spawn/ghost_role/spider -/datum/action/lay_eggs/Grant(mob/grant_to) +/datum/action/cooldown/mob_cooldown/lay_eggs/Grant(mob/grant_to) . = ..() if (!owner) return RegisterSignals(owner, list(COMSIG_MOVABLE_MOVED, COMSIG_DO_AFTER_BEGAN, COMSIG_DO_AFTER_ENDED), PROC_REF(update_status_on_signal)) -/datum/action/lay_eggs/Remove(mob/removed_from) +/datum/action/cooldown/mob_cooldown/lay_eggs/Remove(mob/removed_from) . = ..() UnregisterSignal(removed_from, list(COMSIG_MOVABLE_MOVED, COMSIG_DO_AFTER_BEGAN, COMSIG_DO_AFTER_ENDED)) -/datum/action/lay_eggs/IsAvailable(feedback = FALSE) +/datum/action/cooldown/mob_cooldown/lay_eggs/IsAvailable(feedback = FALSE) . = ..() if(!.) return FALSE @@ -36,30 +40,28 @@ return FALSE return TRUE -/datum/action/lay_eggs/Trigger(trigger_flags) - . = ..() - if (!.) - return - +/datum/action/cooldown/mob_cooldown/lay_eggs/Activate(atom/target) owner.balloon_alert_to_viewers("laying eggs...") - if(do_after(owner, egg_lay_time, target = get_turf(owner), interaction_key = DOAFTER_SOURCE_SPIDER)) - var/obj/structure/spider/eggcluster/eggs = locate() in get_turf(owner) - if(eggs) - owner.balloon_alert(owner, "already eggs here!") - else - lay_egg() - else + StartCooldown(360 SECONDS, 360 SECONDS) + if(!do_after(owner, egg_lay_time, target = get_turf(owner), interaction_key = DOAFTER_SOURCE_SPIDER)) owner.balloon_alert(owner, "interrupted!") - build_all_button_icons(UPDATE_BUTTON_STATUS) + StartCooldown(0 SECONDS) + return + var/obj/structure/spider/eggcluster/eggs = locate() in get_turf(owner) + if(eggs) + owner.balloon_alert(owner, "already eggs here!") + else + lay_egg() + StartCooldown() -/datum/action/lay_eggs/proc/lay_egg() +/datum/action/cooldown/mob_cooldown/lay_eggs/proc/lay_egg() var/obj/effect/mob_spawn/ghost_role/spider/new_eggs = new egg_type(get_turf(owner)) new_eggs.faction = owner.faction - var/datum/action/set_spider_directive/spider_directive = locate() in owner.actions + var/datum/action/cooldown/mob_cooldown/set_spider_directive/spider_directive = locate() in owner.actions if (spider_directive) new_eggs.directive = spider_directive.current_directive -/datum/action/lay_eggs/enriched +/datum/action/cooldown/mob_cooldown/lay_eggs/enriched name = "Lay Enriched Eggs" desc = "Lay a cluster of eggs, which will soon grow into a greater spider. Requires you drain a human per cluster of these eggs." button_icon_state = "lay_enriched_eggs" @@ -67,7 +69,7 @@ /// How many charges we have to make eggs var/charges = 0 -/datum/action/lay_eggs/enriched/IsAvailable(feedback = FALSE) +/datum/action/cooldown/mob_cooldown/lay_eggs/enriched/IsAvailable(feedback = FALSE) . = ..() if (!.) return FALSE @@ -77,6 +79,6 @@ return FALSE return TRUE -/datum/action/lay_eggs/enriched/lay_egg() +/datum/action/cooldown/mob_cooldown/lay_eggs/enriched/lay_egg() charges-- return ..() diff --git a/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/web.dm b/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/web.dm index 8c061f02907..b7062a2dc17 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/web.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/web.dm @@ -1,5 +1,5 @@ /// Make a sticky web under yourself for area fortification -/datum/action/cooldown/lay_web +/datum/action/cooldown/mob_cooldown/lay_web name = "Spin Web" desc = "Spin a web to slow down potential prey." button_icon = 'icons/mob/actions/actions_animal.dmi' @@ -9,20 +9,22 @@ check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED cooldown_time = 0 SECONDS melee_cooldown_time = 0 + shared_cooldown = NONE + click_to_activate = FALSE /// How long it takes to lay a web var/webbing_time = 4 SECONDS -/datum/action/cooldown/lay_web/Grant(mob/grant_to) +/datum/action/cooldown/mob_cooldown/lay_web/Grant(mob/grant_to) . = ..() if (!owner) return RegisterSignals(owner, list(COMSIG_MOVABLE_MOVED, COMSIG_DO_AFTER_BEGAN, COMSIG_DO_AFTER_ENDED), PROC_REF(update_status_on_signal)) -/datum/action/cooldown/lay_web/Remove(mob/removed_from) +/datum/action/cooldown/mob_cooldown/lay_web/Remove(mob/removed_from) . = ..() UnregisterSignal(removed_from, list(COMSIG_MOVABLE_MOVED, COMSIG_DO_AFTER_BEGAN, COMSIG_DO_AFTER_ENDED)) -/datum/action/cooldown/lay_web/IsAvailable(feedback = FALSE) +/datum/action/cooldown/mob_cooldown/lay_web/IsAvailable(feedback = FALSE) . = ..() if(!.) return FALSE @@ -45,10 +47,10 @@ return TRUE /// Returns true if there's a web we can't put stuff on in our turf -/datum/action/cooldown/lay_web/proc/obstructed_by_other_web() +/datum/action/cooldown/mob_cooldown/lay_web/proc/obstructed_by_other_web() return !!(locate(/obj/structure/spider/stickyweb) in get_turf(owner)) -/datum/action/cooldown/lay_web/Activate() +/datum/action/cooldown/mob_cooldown/lay_web/Activate() . = ..() var/turf/spider_turf = get_turf(owner) var/obj/structure/spider/stickyweb/web = locate() in spider_turf @@ -65,86 +67,86 @@ build_all_button_icons() /// Creates a web in the current turf -/datum/action/cooldown/lay_web/proc/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) +/datum/action/cooldown/mob_cooldown/lay_web/proc/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) new /obj/structure/spider/stickyweb(target_turf) /// Variant for genetics, created webs only allow the creator passage -/datum/action/cooldown/lay_web/genetic +/datum/action/cooldown/mob_cooldown/lay_web/genetic desc = "Spin a web. Only you will be able to traverse your web easily." cooldown_time = 4 SECONDS //the same time to lay a web -/datum/action/cooldown/lay_web/genetic/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) +/datum/action/cooldown/mob_cooldown/lay_web/genetic/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) new /obj/structure/spider/stickyweb/genetic(target_turf, owner) /// Variant which allows webs to be stacked into walls -/datum/action/cooldown/lay_web/sealer +/datum/action/cooldown/mob_cooldown/lay_web/sealer desc = "Spin a web to slow down potential prey. Webs can be stacked to make solid structures." -/datum/action/cooldown/lay_web/sealer/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) +/datum/action/cooldown/mob_cooldown/lay_web/sealer/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) if (existing_web) qdel(existing_web) new /obj/structure/spider/stickyweb/sealed(target_turf) return new /obj/structure/spider/stickyweb(target_turf) -/datum/action/cooldown/lay_web/sealer/obstructed_by_other_web() +/datum/action/cooldown/mob_cooldown/lay_web/sealer/obstructed_by_other_web() return !!(locate(/obj/structure/spider/stickyweb/sealed) in get_turf(owner)) -/datum/action/cooldown/lay_web/solid_web +/datum/action/cooldown/mob_cooldown/lay_web/solid_web name = "Spin Solid Web" desc = "Spin a web to obstruct potential prey." button_icon_state = "lay_solid_web" cooldown_time = 0 SECONDS webbing_time = 5 SECONDS -/datum/action/cooldown/lay_web/solid_web/obstructed_by_other_web() +/datum/action/cooldown/mob_cooldown/lay_web/solid_web/obstructed_by_other_web() return !!(locate(/obj/structure/spider/solid) in get_turf(owner)) -/datum/action/cooldown/lay_web/solid_web/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) +/datum/action/cooldown/mob_cooldown/lay_web/solid_web/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) new /obj/structure/spider/solid(target_turf) -/datum/action/cooldown/lay_web/web_passage +/datum/action/cooldown/mob_cooldown/lay_web/web_passage name = "Spin Web Passage" desc = "Spin a web passage to hide the nest from prey view." button_icon_state = "lay_web_passage" cooldown_time = 0 SECONDS webbing_time = 4 SECONDS -/datum/action/cooldown/lay_web/web_passage/obstructed_by_other_web() +/datum/action/cooldown/mob_cooldown/lay_web/web_passage/obstructed_by_other_web() return !!(locate(/obj/structure/spider/passage) in get_turf(owner)) -/datum/action/cooldown/lay_web/web_passage/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) +/datum/action/cooldown/mob_cooldown/lay_web/web_passage/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) new /obj/structure/spider/passage(target_turf) -/datum/action/cooldown/lay_web/sticky_web +/datum/action/cooldown/mob_cooldown/lay_web/sticky_web name = "Spin Sticky Web" desc = "Spin a sticky web to trap intruders." button_icon_state = "lay_sticky_web" cooldown_time = 20 SECONDS webbing_time = 3 SECONDS -/datum/action/cooldown/lay_web/sticky_web/obstructed_by_other_web() +/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/obstructed_by_other_web() return !!(locate(/obj/structure/spider/sticky) in get_turf(owner)) -/datum/action/cooldown/lay_web/sticky_web/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) +/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) new /obj/structure/spider/sticky(target_turf) -/datum/action/cooldown/lay_web/web_spikes +/datum/action/cooldown/mob_cooldown/lay_web/web_spikes name = "Spin Web Spikes" desc = "Extrude silk spikes to dissuade invaders." button_icon_state = "lay_web_spikes" cooldown_time = 40 SECONDS webbing_time = 3 SECONDS -/datum/action/cooldown/lay_web/web_spikes/obstructed_by_other_web() +/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/obstructed_by_other_web() return !!(locate(/obj/structure/spider/spikes) in get_turf(owner)) -/datum/action/cooldown/lay_web/web_spikes/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) +/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/plant_web(turf/target_turf, obj/structure/spider/stickyweb/existing_web) new /obj/structure/spider/spikes(target_turf) /// Makes a solid statue which you can use as cover -/datum/action/cooldown/web_effigy +/datum/action/cooldown/mob_cooldown/web_effigy name = "Web Effigy" desc = "Shed durable webbing in the shape of your body. It is intimidating and can obstruct attackers. \ It will decay after some time." @@ -154,8 +156,10 @@ overlay_icon_state = "bg_alien_border" cooldown_time = 60 SECONDS melee_cooldown_time = 0 + shared_cooldown = NONE + click_to_activate = FALSE -/datum/action/cooldown/web_effigy/IsAvailable(feedback = FALSE) +/datum/action/cooldown/mob_cooldown/web_effigy/IsAvailable(feedback = FALSE) . = ..() if(!.) return FALSE @@ -165,6 +169,6 @@ return FALSE return TRUE -/datum/action/cooldown/web_effigy/Activate() +/datum/action/cooldown/mob_cooldown/web_effigy/Activate() new /obj/structure/spider/effigy(get_turf(owner)) return ..() diff --git a/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/wrap.dm b/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/wrap.dm index 2c49f5747c7..536f09cef8d 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/wrap.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/spider_abilities/wrap.dm @@ -1,4 +1,4 @@ -/datum/action/cooldown/wrap +/datum/action/cooldown/mob_cooldown/wrap name = "Wrap" desc = "Wrap something or someone in a cocoon. \ If it's a human or similar species, you'll also consume them. \ @@ -11,20 +11,21 @@ check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED click_to_activate = TRUE ranged_mousepointer = 'icons/effects/mouse_pointers/wrap_target.dmi' + shared_cooldown = NONE /// The time it takes to wrap something. var/wrap_time = 5 SECONDS -/datum/action/cooldown/wrap/Grant(mob/grant_to) +/datum/action/cooldown/mob_cooldown/wrap/Grant(mob/grant_to) . = ..() if (!owner) return RegisterSignals(owner, list(COMSIG_DO_AFTER_BEGAN, COMSIG_DO_AFTER_ENDED), PROC_REF(update_status_on_signal)) -/datum/action/cooldown/wrap/Remove(mob/removed_from) +/datum/action/cooldown/mob_cooldown/wrap/Remove(mob/removed_from) . = ..() UnregisterSignal(removed_from, list(COMSIG_DO_AFTER_BEGAN, COMSIG_DO_AFTER_ENDED)) -/datum/action/cooldown/wrap/IsAvailable(feedback = FALSE) +/datum/action/cooldown/mob_cooldown/wrap/IsAvailable(feedback = FALSE) . = ..() if(!. || owner.incapacitated()) return FALSE @@ -34,7 +35,7 @@ return FALSE return TRUE -/datum/action/cooldown/wrap/set_click_ability(mob/on_who) +/datum/action/cooldown/mob_cooldown/wrap/set_click_ability(mob/on_who) . = ..() if(!.) return @@ -43,7 +44,7 @@ button_icon_state = "wrap_1" build_all_button_icons() -/datum/action/cooldown/wrap/unset_click_ability(mob/on_who, refund_cooldown = TRUE) +/datum/action/cooldown/mob_cooldown/wrap/unset_click_ability(mob/on_who, refund_cooldown = TRUE) . = ..() if(!.) return @@ -53,7 +54,7 @@ button_icon_state = "wrap_0" build_all_button_icons() -/datum/action/cooldown/wrap/Activate(atom/to_wrap) +/datum/action/cooldown/mob_cooldown/wrap/Activate(atom/to_wrap) if(!owner.Adjacent(to_wrap)) owner.balloon_alert(owner, "must be closer!") return FALSE @@ -73,7 +74,7 @@ INVOKE_ASYNC(src, PROC_REF(cocoon), to_wrap) return TRUE -/datum/action/cooldown/wrap/proc/cocoon(atom/movable/to_wrap) +/datum/action/cooldown/mob_cooldown/wrap/proc/cocoon(atom/movable/to_wrap) owner.visible_message( span_notice("[owner] begins to secrete a sticky substance around [to_wrap]."), span_notice("You begin wrapping [to_wrap] into a cocoon."), @@ -83,14 +84,14 @@ else owner.balloon_alert(owner, "interrupted!") -/datum/action/cooldown/wrap/proc/wrap_target(atom/movable/to_wrap) +/datum/action/cooldown/mob_cooldown/wrap/proc/wrap_target(atom/movable/to_wrap) var/obj/structure/spider/cocoon/casing = new(to_wrap.loc) if(isliving(to_wrap)) var/mob/living/living_wrapped = to_wrap // You get a point every time you consume a living player, even if they've been consumed before. // You only get a point for any individual corpse once, so you can't keep breaking it out and eating it again. if(ishuman(living_wrapped) && (living_wrapped.stat != DEAD || !HAS_TRAIT(living_wrapped, TRAIT_SPIDER_CONSUMED))) - var/datum/action/lay_eggs/enriched/egg_power = locate() in owner.actions + var/datum/action/cooldown/mob_cooldown/lay_eggs/enriched/egg_power = locate() in owner.actions if(egg_power) egg_power.charges++ egg_power.build_all_button_icons() diff --git a/code/modules/mob/living/basic/space_fauna/spider/young_spider/young_spider_subtypes.dm b/code/modules/mob/living/basic/space_fauna/spider/young_spider/young_spider_subtypes.dm index 4027575ac01..4e100fc0af4 100644 --- a/code/modules/mob/living/basic/space_fauna/spider/young_spider/young_spider_subtypes.dm +++ b/code/modules/mob/living/basic/space_fauna/spider/young_spider/young_spider_subtypes.dm @@ -80,7 +80,7 @@ melee_damage_upper = 4 speed = 0.7 web_speed = 0.5 - web_type = /datum/action/cooldown/lay_web/sealer + web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer ///The health HUD applied to the mob. var/health_hud = DATA_HUD_MEDICAL_ADVANCED @@ -112,7 +112,7 @@ melee_damage_upper = 1 speed = 0.7 web_speed = 0.25 - web_type = /datum/action/cooldown/lay_web/sealer + web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer poison_per_bite = 2 poison_type = /datum/reagent/toxin/acid @@ -151,7 +151,7 @@ melee_damage_upper = 10 speed = 0.7 web_speed = 0.5 - web_type = /datum/action/cooldown/lay_web/sealer + web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer /// Will differentiate into the "viper" giant spider. /mob/living/basic/spider/growing/young/viper