diff --git a/code/__DEFINES/actions.dm b/code/__DEFINES/actions.dm index 5bc2b161781..99f9c1aca55 100644 --- a/code/__DEFINES/actions.dm +++ b/code/__DEFINES/actions.dm @@ -41,3 +41,10 @@ DEFINE_BITFIELD(check_flags, list( #define UPDATE_BUTTON_BACKGROUND (1<<2) #define UPDATE_BUTTON_OVERLAY (1<<3) #define UPDATE_BUTTON_STATUS (1<<4) + +/// Takes in a typepath of a `/datum/action` and adds it to `src`. +/// Only useful if you want to add the action and never desire to reference it again ever. +#define GRANT_ACTION(typepath) do {\ + var/datum/action/_ability = new typepath(src);\ + _ability.Grant(src);\ +} while (FALSE) diff --git a/code/datums/brain_damage/imaginary_friend.dm b/code/datums/brain_damage/imaginary_friend.dm index 48fabd701f4..61175593ce4 100644 --- a/code/datums/brain_damage/imaginary_friend.dm +++ b/code/datums/brain_damage/imaginary_friend.dm @@ -83,8 +83,7 @@ var/mob/living/owner var/bubble_icon = "default" - var/datum/action/innate/imaginary_join/join - var/datum/action/innate/imaginary_hide/hide + /mob/camera/imaginary_friend/Login() . = ..() @@ -105,10 +104,11 @@ */ /mob/camera/imaginary_friend/Initialize(mapload) . = ..() - join = new - join.Grant(src) - hide = new - hide.Grant(src) + var/static/list/grantable_actions = list( + /datum/action/innate/imaginary_join, + /datum/action/innate/imaginary_hide, + ) + grant_actions_by_list(grantable_actions) /// Links this imaginary friend to the provided mob /mob/camera/imaginary_friend/proc/attach_to_owner(mob/living/imaginary_friend_owner) diff --git a/code/modules/mob/living/basic/clown/clown.dm b/code/modules/mob/living/basic/clown/clown.dm index 5682edf9339..e55b91bade2 100644 --- a/code/modules/mob/living/basic/clown/clown.dm +++ b/code/modules/mob/living/basic/clown/clown.dm @@ -391,8 +391,7 @@ /mob/living/basic/clown/mutant/glutton/Initialize(mapload) . = ..() - var/datum/action/cooldown/regurgitate/spit = new(src) - spit.Grant(src) + GRANT_ACTION(/datum/action/cooldown/regurgitate) AddElement(/datum/element/swabable, CELL_LINE_TABLE_GLUTTON, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5) AddComponent(/datum/component/tameable, food_types = list(/obj/item/food/cheesiehonkers, /obj/item/food/cornchips), tame_chance = 30, bonus_tame_chance = 0, after_tame = CALLBACK(src, PROC_REF(tamed))) @@ -541,22 +540,15 @@ BB_EMOTE_SEE = list("bites into the banana", "plucks a banana off its head", "photosynthesizes"), BB_EMOTE_SOUND = list('sound/items/bikehorn.ogg'), ) - ///Our peel dropping ability - var/datum/action/cooldown/rustle/banana_rustle - ///Our banana bunch spawning ability - var/datum/action/cooldown/exquisite_bunch/banana_bunch /mob/living/basic/clown/banana/Initialize(mapload) . = ..() - banana_rustle = new() - banana_rustle.Grant(src) - banana_bunch = new() - banana_bunch.Grant(src) -/mob/living/basic/clown/banana/Destroy() - . = ..() - QDEL_NULL(banana_rustle) - QDEL_NULL(banana_bunch) + var/static/list/innate_actions = list( + /datum/action/cooldown/exquisite_bunch, + /datum/action/cooldown/rustle, + ) + grant_actions_by_list(innate_actions) ///drops peels around the mob when activated /datum/action/cooldown/rustle diff --git a/code/modules/mob/living/basic/constructs/_construct.dm b/code/modules/mob/living/basic/constructs/_construct.dm index 71b2eb79fb6..a39949b5208 100644 --- a/code/modules/mob/living/basic/constructs/_construct.dm +++ b/code/modules/mob/living/basic/constructs/_construct.dm @@ -80,9 +80,7 @@ structure_types_typecache = structure_types,\ ) add_traits(list(TRAIT_HEALS_FROM_CULT_PYLONS, TRAIT_SPACEWALK), INNATE_TRAIT) - for(var/spell in construct_spells) - var/datum/action/new_spell = new spell(src) - new_spell.Grant(src) + grant_actions_by_list(construct_spells) var/spell_count = 1 for(var/datum/action/spell as anything in actions) diff --git a/code/modules/mob/living/basic/constructs/artificer.dm b/code/modules/mob/living/basic/constructs/artificer.dm index bf4a086bcdb..8856c0e66a2 100644 --- a/code/modules/mob/living/basic/constructs/artificer.dm +++ b/code/modules/mob/living/basic/constructs/artificer.dm @@ -15,11 +15,11 @@ attack_verb_simple = "ram" attack_sound = 'sound/weapons/punch2.ogg' construct_spells = list( + /datum/action/cooldown/spell/aoe/magic_missile/lesser, + /datum/action/cooldown/spell/conjure/construct/lesser, /datum/action/cooldown/spell/conjure/cult_floor, /datum/action/cooldown/spell/conjure/cult_wall, /datum/action/cooldown/spell/conjure/soulstone, - /datum/action/cooldown/spell/conjure/construct/lesser, - /datum/action/cooldown/spell/aoe/magic_missile/lesser, /datum/action/innate/cult/create_rune/revive, ) playstyle_string = "You are an Artificer. You are incredibly weak and fragile, \ diff --git a/code/modules/mob/living/basic/constructs/juggernaut.dm b/code/modules/mob/living/basic/constructs/juggernaut.dm index 2b8bb7e293d..6beee5554a3 100644 --- a/code/modules/mob/living/basic/constructs/juggernaut.dm +++ b/code/modules/mob/living/basic/constructs/juggernaut.dm @@ -19,8 +19,8 @@ mob_size = MOB_SIZE_LARGE force_threshold = 10 construct_spells = list( - /datum/action/cooldown/spell/forcewall/cult, /datum/action/cooldown/spell/basic_projectile/juggernaut, + /datum/action/cooldown/spell/forcewall/cult, /datum/action/innate/cult/create_rune/wall, ) playstyle_string = span_bold("You are a Juggernaut. Though slow, your shell can withstand heavy punishment, create shield walls, rip apart enemies and walls alike, and even deflect energy weapons.") diff --git a/code/modules/mob/living/basic/festivus_pole.dm b/code/modules/mob/living/basic/festivus_pole.dm index 058b74bfad8..f6dd1a41a2b 100644 --- a/code/modules/mob/living/basic/festivus_pole.dm +++ b/code/modules/mob/living/basic/festivus_pole.dm @@ -40,15 +40,14 @@ ///how much charge we give off to cells around us when rubbed var/recharge_value = 75 + /mob/living/basic/festivus/Initialize(mapload) . = ..() AddComponent(/datum/component/seethrough_mob) var/static/list/death_loot = list(/obj/item/stack/rods) AddElement(/datum/element/death_drops, death_loot) AddComponent(/datum/component/aggro_emote, emote_list = string_list(list("growls")), emote_chance = 20) - var/datum/action/cooldown/mob_cooldown/charge_apc/charge_ability = new(src) - charge_ability.Grant(src) - ai_controller.set_blackboard_key(BB_FESTIVE_APC, charge_ability) + grant_actions_by_list(list(/datum/action/cooldown/mob_cooldown/charge_apc = BB_FESTIVE_APC)) /datum/ai_controller/basic_controller/festivus_pole blackboard = list( diff --git a/code/modules/mob/living/basic/heretic/heretic_summon.dm b/code/modules/mob/living/basic/heretic/_heretic_summon.dm similarity index 100% rename from code/modules/mob/living/basic/heretic/heretic_summon.dm rename to code/modules/mob/living/basic/heretic/_heretic_summon.dm diff --git a/code/modules/mob/living/basic/heretic/ash_spirit.dm b/code/modules/mob/living/basic/heretic/ash_spirit.dm index d12ad5eb8d1..fed64db8adc 100644 --- a/code/modules/mob/living/basic/heretic/ash_spirit.dm +++ b/code/modules/mob/living/basic/heretic/ash_spirit.dm @@ -20,6 +20,4 @@ /datum/action/cooldown/spell/jaunt/ethereal_jaunt/ash, /datum/action/cooldown/spell/pointed/cleave, ) - for (var/action in actions_to_add) - var/datum/action/cooldown/new_action = new action(src) - new_action.Grant(src) + grant_actions_by_list(actions_to_add) diff --git a/code/modules/mob/living/basic/heretic/flesh_stalker.dm b/code/modules/mob/living/basic/heretic/flesh_stalker.dm index 00fecd2f608..f6a051334d2 100644 --- a/code/modules/mob/living/basic/heretic/flesh_stalker.dm +++ b/code/modules/mob/living/basic/heretic/flesh_stalker.dm @@ -11,7 +11,7 @@ melee_damage_upper = 20 sight = SEE_MOBS ai_controller = /datum/ai_controller/basic_controller/stalker - /// Associative list of action types we would like to have, and what blackboard key (if any) to put it in + /// Actions to grant on spawn var/static/list/actions_to_add = list( /datum/action/cooldown/spell/emp/eldritch = BB_GENERIC_ACTION, /datum/action/cooldown/spell/jaunt/ethereal_jaunt/ash = null, @@ -21,12 +21,7 @@ /mob/living/basic/heretic_summon/stalker/Initialize(mapload) . = ..() AddComponent(/datum/component/ai_target_timer) - for (var/action_type in actions_to_add) - var/datum/action/new_action = new action_type(src) - new_action.Grant(src) - var/blackboard_key = actions_to_add[action_type] - if (!isnull(blackboard_key)) - ai_controller?.set_blackboard_key(blackboard_key, new_action) + grant_actions_by_list(actions_to_add) /// Changes shape and lies in wait when it has no target, uses EMP and attacks once it does /datum/ai_controller/basic_controller/stalker diff --git a/code/modules/mob/living/basic/heretic/maid_in_the_mirror.dm b/code/modules/mob/living/basic/heretic/maid_in_the_mirror.dm index 26eaa9d7ebe..b83c4f253f3 100644 --- a/code/modules/mob/living/basic/heretic/maid_in_the_mirror.dm +++ b/code/modules/mob/living/basic/heretic/maid_in_the_mirror.dm @@ -32,8 +32,7 @@ /obj/item/shard, ) AddElement(/datum/element/death_drops, loot) - var/datum/action/cooldown/spell/jaunt/mirror_walk/jaunt = new (src) - jaunt.Grant(src) + GRANT_ACTION(/datum/action/cooldown/spell/jaunt/mirror_walk) /mob/living/basic/heretic_summon/maid_in_the_mirror/death(gibbed) var/turf/death_turf = get_turf(src) diff --git a/code/modules/mob/living/basic/heretic/raw_prophet.dm b/code/modules/mob/living/basic/heretic/raw_prophet.dm index 1b701596095..f3bb1efa7e9 100644 --- a/code/modules/mob/living/basic/heretic/raw_prophet.dm +++ b/code/modules/mob/living/basic/heretic/raw_prophet.dm @@ -15,8 +15,12 @@ maxHealth = 65 health = 65 sight = SEE_MOBS|SEE_OBJS|SEE_TURFS - /// Some ability we use to make people go blind - var/blind_action_type = /datum/action/cooldown/spell/pointed/blind/eldritch + /// List of innate abilities we have to add. + var/static/list/innate_abilities = list( + /datum/action/cooldown/spell/jaunt/ethereal_jaunt/ash/long = null, + /datum/action/cooldown/spell/list_target/telepathy/eldritch = null, + /datum/action/innate/expand_sight = null, + ) /mob/living/basic/heretic_summon/raw_prophet/Initialize(mapload) . = ..() @@ -39,19 +43,13 @@ unlink_message = on_unlink_message, \ ) - // We don't use these for AI so we can just repeat the same adding process - var/static/list/add_abilities = list( - /datum/action/cooldown/spell/jaunt/ethereal_jaunt/ash/long, - /datum/action/cooldown/spell/list_target/telepathy/eldritch, - /datum/action/innate/expand_sight, - ) - for (var/ability_type in add_abilities) - var/datum/action/new_action = new ability_type(src) - new_action.Grant(src) + grant_actions_by_list(get_innate_abilities()) - var/datum/action/cooldown/blind = new blind_action_type(src) - blind.Grant(src) - ai_controller?.set_blackboard_key(BB_TARGETTED_ACTION, blind) +/// Returns a list of abilities that we should add. +/mob/living/basic/heretic_summon/raw_prophet/proc/get_innate_abilities() + var/list/returnable_list = innate_abilities.Copy() + returnable_list += list(/datum/action/cooldown/spell/pointed/blind/eldritch = BB_TARGETTED_ACTION) + return returnable_list /* * Callback for the mind_linker component. @@ -78,7 +76,11 @@ /// NPC variant with a less bullshit ability /mob/living/basic/heretic_summon/raw_prophet/ruins ai_controller = /datum/ai_controller/basic_controller/raw_prophet - blind_action_type = /datum/action/cooldown/mob_cooldown/watcher_gaze + +/mob/living/basic/heretic_summon/raw_prophet/ruins/get_innate_abilities() + var/list/returnable_list = innate_abilities.Copy() + returnable_list += list(/datum/action/cooldown/mob_cooldown/watcher_gaze = BB_TARGETTED_ACTION) + return returnable_list /// Walk and attack people, blind them when we can /datum/ai_controller/basic_controller/raw_prophet diff --git a/code/modules/mob/living/basic/heretic/rust_walker.dm b/code/modules/mob/living/basic/heretic/rust_walker.dm index 0031ce2388d..9dff3c01e31 100644 --- a/code/modules/mob/living/basic/heretic/rust_walker.dm +++ b/code/modules/mob/living/basic/heretic/rust_walker.dm @@ -17,13 +17,12 @@ /mob/living/basic/heretic_summon/rust_walker/Initialize(mapload) . = ..() AddElement(/datum/element/footstep, FOOTSTEP_MOB_RUST) - var/datum/action/cooldown/spell/aoe/rust_conversion/small/conversion = new(src) - conversion.Grant(src) - ai_controller?.set_blackboard_key(BB_GENERIC_ACTION, conversion) - var/datum/action/cooldown/spell/basic_projectile/rust_wave/short/wave = new(src) - wave.Grant(src) - ai_controller?.set_blackboard_key(BB_TARGETTED_ACTION, wave) + var/static/list/grantable_spells = list( + /datum/action/cooldown/spell/aoe/rust_conversion/small = BB_GENERIC_ACTION, + /datum/action/cooldown/spell/basic_projectile/rust_wave/short = BB_TARGETTED_ACTION, + ) + grant_actions_by_list(grantable_spells) /mob/living/basic/heretic_summon/rust_walker/setDir(newdir) . = ..() diff --git a/code/modules/mob/living/basic/icemoon/ice_demon/ice_demon.dm b/code/modules/mob/living/basic/icemoon/ice_demon/ice_demon.dm index 960f875365b..63c2992b513 100644 --- a/code/modules/mob/living/basic/icemoon/ice_demon/ice_demon.dm +++ b/code/modules/mob/living/basic/icemoon/ice_demon/ice_demon.dm @@ -28,15 +28,13 @@ /mob/living/basic/mining/ice_demon/Initialize(mapload) . = ..() - var/datum/action/cooldown/mob_cooldown/slippery_ice_floors/ice_floor = new(src) - ice_floor.Grant(src) - ai_controller.set_blackboard_key(BB_DEMON_SLIP_ABILITY, ice_floor) - var/datum/action/cooldown/mob_cooldown/ice_demon_teleport/demon_teleport = new(src) - demon_teleport.Grant(src) - ai_controller.set_blackboard_key(BB_DEMON_TELEPORT_ABILITY, demon_teleport) - var/datum/action/cooldown/spell/conjure/create_afterimages/afterimage = new(src) - afterimage.Grant(src) - ai_controller.set_blackboard_key(BB_DEMON_CLONE_ABILITY, afterimage) + var/static/list/innate_actions = list( + /datum/action/cooldown/mob_cooldown/slippery_ice_floors = BB_DEMON_SLIP_ABILITY, + /datum/action/cooldown/mob_cooldown/ice_demon_teleport = BB_DEMON_TELEPORT_ABILITY, + /datum/action/cooldown/spell/conjure/create_afterimages = BB_DEMON_CLONE_ABILITY, + ) + grant_actions_by_list(innate_actions) + AddComponent(\ /datum/component/ranged_attacks,\ projectile_type = /obj/projectile/temp/ice_demon,\ diff --git a/code/modules/mob/living/basic/icemoon/ice_whelp/ice_whelp.dm b/code/modules/mob/living/basic/icemoon/ice_whelp/ice_whelp.dm index 8fb02ec83df..768375cfce8 100644 --- a/code/modules/mob/living/basic/icemoon/ice_whelp/ice_whelp.dm +++ b/code/modules/mob/living/basic/icemoon/ice_whelp/ice_whelp.dm @@ -40,17 +40,20 @@ /mob/living/basic/mining/ice_whelp/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_NO_GLIDE, INNATE_TRAIT) + AddElement(/datum/element/footstep, FOOTSTEP_MOB_HEAVY) AddComponent(/datum/component/basic_mob_ability_telegraph) AddComponent(/datum/component/basic_mob_attack_telegraph, telegraph_duration = 0.6 SECONDS) - var/datum/action/cooldown/mob_cooldown/fire_breath/ice/flamethrower = new(src) - flamethrower.Grant(src) - ai_controller.set_blackboard_key(BB_WHELP_STRAIGHTLINE_FIRE, flamethrower) - var/datum/action/cooldown/mob_cooldown/fire_breath/ice/cross/wide_flames = new(src) - wide_flames.Grant(src) - ai_controller.set_blackboard_key(BB_WHELP_WIDESPREAD_FIRE, wide_flames) + RegisterSignal(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(pre_attack)) + var/static/list/innate_actions = list( + /datum/action/cooldown/mob_cooldown/fire_breath/ice = BB_WHELP_STRAIGHTLINE_FIRE, + /datum/action/cooldown/mob_cooldown/fire_breath/ice/cross = BB_WHELP_WIDESPREAD_FIRE, + ) + + grant_actions_by_list(innate_actions) + /mob/living/basic/mining/ice_whelp/proc/pre_attack(mob/living/sculptor, atom/target) SIGNAL_HANDLER diff --git a/code/modules/mob/living/basic/jungle/mega_arachnid/mega_arachnid.dm b/code/modules/mob/living/basic/jungle/mega_arachnid/mega_arachnid.dm index bb109fdde61..3a6ed50db10 100644 --- a/code/modules/mob/living/basic/jungle/mega_arachnid/mega_arachnid.dm +++ b/code/modules/mob/living/basic/jungle/mega_arachnid/mega_arachnid.dm @@ -36,16 +36,16 @@ /mob/living/basic/mega_arachnid/Initialize(mapload) . = ..() - AddComponent(/datum/component/seethrough_mob) - var/datum/action/cooldown/spell/pointed/projectile/flesh_restraints/restrain = new(src) - var/datum/action/cooldown/mob_cooldown/secrete_acid/acid_spray = new(src) - acid_spray.Grant(src) - restrain.Grant(src) + var/static/list/innate_actions = list( + /datum/action/cooldown/mob_cooldown/secrete_acid = BB_ARACHNID_SLIP, + /datum/action/cooldown/spell/pointed/projectile/flesh_restraints = BB_ARACHNID_RESTRAIN, + ) + grant_actions_by_list(innate_actions) + AddElement(/datum/element/swabable, CELL_LINE_TABLE_MEGA_ARACHNID, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5) + AddComponent(/datum/component/seethrough_mob) AddComponent(/datum/component/appearance_on_aggro, alpha_on_aggro = 255, alpha_on_deaggro = alpha) AddComponent(/datum/component/tree_climber, climbing_distance = 15) - ai_controller.set_blackboard_key(BB_ARACHNID_RESTRAIN, restrain) - ai_controller.set_blackboard_key(BB_ARACHNID_SLIP, acid_spray) /mob/living/basic/mega_arachnid/Login() . = ..() diff --git a/code/modules/mob/living/basic/jungle/seedling/seedling.dm b/code/modules/mob/living/basic/jungle/seedling/seedling.dm index 296cead44c4..46c67ffa0e4 100644 --- a/code/modules/mob/living/basic/jungle/seedling/seedling.dm +++ b/code/modules/mob/living/basic/jungle/seedling/seedling.dm @@ -56,12 +56,12 @@ /mob/living/basic/seedling/Initialize(mapload) . = ..() - var/datum/action/cooldown/mob_cooldown/projectile_attack/rapid_fire/seedling/seed_attack = new(src) - seed_attack.Grant(src) - ai_controller.set_blackboard_key(BB_RAPIDSEEDS_ABILITY, seed_attack) - var/datum/action/cooldown/mob_cooldown/solarbeam/beam_attack = new(src) - beam_attack.Grant(src) - ai_controller.set_blackboard_key(BB_SOLARBEAM_ABILITY, beam_attack) + var/static/list/innate_actions = list( + /datum/action/cooldown/mob_cooldown/projectile_attack/rapid_fire/seedling = BB_RAPIDSEEDS_ABILITY, + /datum/action/cooldown/mob_cooldown/solarbeam = BB_SOLARBEAM_ABILITY, + ) + + grant_actions_by_list(innate_actions) var/petal_color = pick(possible_colors) diff --git a/code/modules/mob/living/basic/jungle/venus_human_trap.dm b/code/modules/mob/living/basic/jungle/venus_human_trap.dm index 2f2858eb6ce..bfe7c1e8497 100644 --- a/code/modules/mob/living/basic/jungle/venus_human_trap.dm +++ b/code/modules/mob/living/basic/jungle/venus_human_trap.dm @@ -174,9 +174,10 @@ /mob/living/basic/venus_human_trap/Initialize(mapload) . = ..() AddElement(/datum/element/lifesteal, 5) - var/datum/action/cooldown/vine_tangle/tangle = new(src) - tangle.Grant(src) - ai_controller.set_blackboard_key(BB_TARGETTED_ACTION, tangle) + var/static/list/innate_actions = list( + /datum/action/cooldown/vine_tangle = BB_TARGETTED_ACTION, + ) + grant_actions_by_list(innate_actions) /mob/living/basic/venus_human_trap/RangedAttack(atom/victim) if(!combat_mode) diff --git a/code/modules/mob/living/basic/lavaland/bileworm/_bileworm.dm b/code/modules/mob/living/basic/lavaland/bileworm/_bileworm.dm index 3d6bc299ccd..d2e04b60d26 100644 --- a/code/modules/mob/living/basic/lavaland/bileworm/_bileworm.dm +++ b/code/modules/mob/living/basic/lavaland/bileworm/_bileworm.dm @@ -37,8 +37,6 @@ /mob/living/basic/mining/bileworm/Initialize(mapload) . = ..() - //traits and elements - ADD_TRAIT(src, TRAIT_IMMOBILIZED, INNATE_TRAIT) if(ispath(evolve_path)) @@ -47,16 +45,14 @@ //setup mob abilities - var/datum/action/cooldown/mob_cooldown/projectile_attack/dir_shots/bileworm/spew_bile = new attack_action_path(src) - spew_bile.Grant(src) //well, one of them has to start on infinite cooldown + var/datum/action/cooldown/mob_cooldown/projectile_attack/dir_shots/bileworm/spew_bile = new(src) + spew_bile.Grant(src) spew_bile.StartCooldownSelf(INFINITY) - var/datum/action/cooldown/mob_cooldown/resurface/resurface = new(src) - resurface.Grant(src) - var/datum/action/cooldown/mob_cooldown/devour/devour = new(src) - devour.Grant(src) - var/datum/action/adjust_vision/bileworm/adjust_vision = new(src) - adjust_vision.Grant(src) - ai_controller.set_blackboard_key(BB_BILEWORM_SPEW_BILE, spew_bile) - ai_controller.set_blackboard_key(BB_BILEWORM_RESURFACE, resurface) - ai_controller.set_blackboard_key(BB_BILEWORM_DEVOUR, devour) + ai_controller?.set_blackboard_key(BB_BILEWORM_SPEW_BILE, spew_bile) + + var/static/list/other_innate_actions = list( + /datum/action/adjust_vision/bileworm = null, + /datum/action/cooldown/mob_cooldown/devour = BB_BILEWORM_DEVOUR, + /datum/action/cooldown/mob_cooldown/resurface = BB_BILEWORM_RESURFACE, + ) diff --git a/code/modules/mob/living/basic/lavaland/brimdemon/brimdemon.dm b/code/modules/mob/living/basic/lavaland/brimdemon/brimdemon.dm index 2c22977d9c6..dbd017837a9 100644 --- a/code/modules/mob/living/basic/lavaland/brimdemon/brimdemon.dm +++ b/code/modules/mob/living/basic/lavaland/brimdemon/brimdemon.dm @@ -43,10 +43,6 @@ beam.Grant(src) ai_controller.set_blackboard_key(BB_TARGETTED_ACTION, beam) -/mob/living/basic/mining/brimdemon/Destroy() - QDEL_NULL(beam) - return ..() - /mob/living/basic/mining/brimdemon/RangedAttack(atom/target, modifiers) beam.Trigger(target = target) diff --git a/code/modules/mob/living/basic/lavaland/goldgrub/goldgrub.dm b/code/modules/mob/living/basic/lavaland/goldgrub/goldgrub.dm index 843f288e1a9..28a76cb2d97 100644 --- a/code/modules/mob/living/basic/lavaland/goldgrub/goldgrub.dm +++ b/code/modules/mob/living/basic/lavaland/goldgrub/goldgrub.dm @@ -47,12 +47,12 @@ else can_lay_eggs = FALSE - var/datum/action/cooldown/mob_cooldown/spit_ore/spit = new(src) - var/datum/action/cooldown/mob_cooldown/burrow/burrow = new(src) - spit.Grant(src) - burrow.Grant(src) - ai_controller.set_blackboard_key(BB_SPIT_ABILITY, spit) - ai_controller.set_blackboard_key(BB_BURROW_ABILITY, burrow) + var/static/list/innate_actions = list( + /datum/action/cooldown/mob_cooldown/spit_ore = BB_SPIT_ABILITY, + /datum/action/cooldown/mob_cooldown/burrow = BB_BURROW_ABILITY, + ) + grant_actions_by_list(innate_actions) + AddElement(/datum/element/wall_tearer, allow_reinforced = FALSE) AddComponent(/datum/component/ai_listen_to_weather) AddComponent(\ diff --git a/code/modules/mob/living/basic/lavaland/goliath/goliath.dm b/code/modules/mob/living/basic/lavaland/goliath/goliath.dm index 6f57e1dec67..20beac22176 100644 --- a/code/modules/mob/living/basic/lavaland/goliath/goliath.dm +++ b/code/modules/mob/living/basic/lavaland/goliath/goliath.dm @@ -44,6 +44,8 @@ COOLDOWN_DECLARE(ability_animation_cooldown) /// Our base tentacles ability var/datum/action/cooldown/mob_cooldown/goliath_tentacles/tentacles + /// Our melee tentacles ability + var/datum/action/cooldown/mob_cooldown/tentacle_burst/melee_tentacles /// Our long-ranged tentacles ability var/datum/action/cooldown/mob_cooldown/tentacle_grasp/tentacle_line /// Things we want to eat off the floor (or a plate, we're not picky) @@ -76,7 +78,7 @@ tentacles = new (src) tentacles.Grant(src) - var/datum/action/cooldown/mob_cooldown/tentacle_burst/melee_tentacles = new (src) + 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) tentacle_line = new (src) @@ -88,12 +90,6 @@ ai_controller.set_blackboard_key(BB_BASIC_FOODS, goliath_foods) ai_controller.set_blackboard_key(BB_GOLIATH_TENTACLES, tentacles) - -/mob/living/basic/mining/goliath/Destroy() - QDEL_NULL(tentacles) - QDEL_NULL(tentacle_line) - return ..() - /mob/living/basic/mining/goliath/examine(mob/user) . = ..() if (saddled) diff --git a/code/modules/mob/living/basic/lavaland/legion/legion.dm b/code/modules/mob/living/basic/lavaland/legion/legion.dm index 7c6bd0fd170..5ed501b452d 100644 --- a/code/modules/mob/living/basic/lavaland/legion/legion.dm +++ b/code/modules/mob/living/basic/lavaland/legion/legion.dm @@ -41,7 +41,7 @@ var/datum/action/cooldown/mob_cooldown/skull_launcher/skull_launcher = new(src) skull_launcher.Grant(src) skull_launcher.spawn_type = brood_type - ai_controller.blackboard[BB_TARGETTED_ACTION] = skull_launcher + ai_controller.set_blackboard_key(BB_TARGETTED_ACTION, skull_launcher) /// Create what we want to drop on death, in proc form so we can always return a static list /mob/living/basic/mining/legion/proc/get_loot_list() diff --git a/code/modules/mob/living/basic/lavaland/mook/mook.dm b/code/modules/mob/living/basic/lavaland/mook/mook.dm index cfc7abe8f24..463c9d5de79 100644 --- a/code/modules/mob/living/basic/lavaland/mook/mook.dm +++ b/code/modules/mob/living/basic/lavaland/mook/mook.dm @@ -52,9 +52,7 @@ move_resist = MOVE_RESIST_DEFAULT,\ ) AddComponent(/datum/component/ai_retaliate_advanced, CALLBACK(src, PROC_REF(attack_intruder))) - var/datum/action/cooldown/mob_cooldown/mook_ability/mook_jump/jump = new(src) - jump.Grant(src) - ai_controller.set_blackboard_key(BB_MOOK_JUMP_ABILITY, jump) + grant_actions_by_list(get_innate_abilities()) ore_overlay = mutable_appearance(icon, "mook_ore_overlay") @@ -68,6 +66,13 @@ AddComponent(/datum/component/obeys_commands, pet_commands) +/// Returns a list of actions and blackboard keys to pass into `grant_actions_by_list`. +/mob/living/basic/mining/mook/proc/get_innate_abilities() + var/static/list/innate_abilities = list( + /datum/action/cooldown/mob_cooldown/mook_ability/mook_jump = BB_MOOK_JUMP_ABILITY, + ) + return innate_abilities + /mob/living/basic/mining/mook/proc/grant_healer_abilities() AddComponent(\ /datum/component/healing_touch,\ @@ -198,9 +203,18 @@ neutral_stance = mutable_appearance(icon, "mook_axe_overlay") attack_stance = mutable_appearance(icon, "axe_strike_overlay") update_appearance() - var/datum/action/cooldown/mob_cooldown/mook_ability/mook_leap/leap = new(src) - leap.Grant(src) - ai_controller.set_blackboard_key(BB_MOOK_LEAP_ABILITY, leap) + +/mob/living/basic/mining/mook/worker/get_innate_abilities() + var/static/list/worker_innate_abilites = null + + if(isnull(worker_innate_abilites)) + worker_innate_abilites = list() + worker_innate_abilites += ..() + worker_innate_abilites += list( + /datum/action/cooldown/mob_cooldown/mook_ability/mook_leap = BB_MOOK_LEAP_ABILITY, + ) + + return worker_innate_abilites /mob/living/basic/mining/mook/worker/attack_sequence(atom/target) . = ..() diff --git a/code/modules/mob/living/basic/minebots/minebot.dm b/code/modules/mob/living/basic/minebots/minebot.dm index 061c9a624f7..ad03da1e697 100644 --- a/code/modules/mob/living/basic/minebots/minebot.dm +++ b/code/modules/mob/living/basic/minebots/minebot.dm @@ -58,14 +58,13 @@ after_tame = CALLBACK(src, PROC_REF(activate_bot)),\ ) - var/datum/action/cooldown/mob_cooldown/minedrone/toggle_light/toggle_light_action = new(src) - var/datum/action/cooldown/mob_cooldown/minedrone/toggle_meson_vision/toggle_meson_vision_action = new(src) - var/datum/action/cooldown/mob_cooldown/minedrone/dump_ore/dump_ore_action = new(src) - toggle_light_action.Grant(src) - toggle_meson_vision_action.Grant(src) - dump_ore_action.Grant(src) - ai_controller.set_blackboard_key(BB_MINEBOT_LIGHT_ABILITY, toggle_light_action) - ai_controller.set_blackboard_key(BB_MINEBOT_DUMP_ABILITY, dump_ore_action) + var/static/list/innate_actions = list( + /datum/action/cooldown/mob_cooldown/minedrone/toggle_light = BB_MINEBOT_LIGHT_ABILITY, + /datum/action/cooldown/mob_cooldown/minedrone/toggle_meson_vision = null, + /datum/action/cooldown/mob_cooldown/minedrone/dump_ore = BB_MINEBOT_DUMP_ABILITY, + ) + + grant_actions_by_list(innate_actions) stored_gun = new(src) var/obj/item/implant/radio/mining/comms = new(src) diff --git a/code/modules/mob/living/basic/space_fauna/carp/carp.dm b/code/modules/mob/living/basic/space_fauna/carp/carp.dm index cccb29c4386..75be113f651 100644 --- a/code/modules/mob/living/basic/space_fauna/carp/carp.dm +++ b/code/modules/mob/living/basic/space_fauna/carp/carp.dm @@ -105,11 +105,6 @@ ai_controller.set_blackboard_key(BB_CARP_RIFT, teleport) ai_controller.set_blackboard_key(BB_OBSTACLE_TARGETTING_WHITELIST, allowed_obstacle_targets) - -/mob/living/basic/carp/Destroy() - QDEL_NULL(teleport) - return ..() - /// Tell the elements and the blackboard what food we want to eat /mob/living/basic/carp/proc/setup_eating() AddElement(/datum/element/basic_eating, food_types = desired_food) diff --git a/code/modules/mob/living/basic/space_fauna/changeling/flesh_spider.dm b/code/modules/mob/living/basic/space_fauna/changeling/flesh_spider.dm index a64250d891c..606df8f136f 100644 --- a/code/modules/mob/living/basic/space_fauna/changeling/flesh_spider.dm +++ b/code/modules/mob/living/basic/space_fauna/changeling/flesh_spider.dm @@ -63,13 +63,12 @@ outline_colour = COLOR_PINK,\ ) - var/datum/action/cooldown/mob_cooldown/lay_web/webbing = new(src) - webbing.webbing_time *= 0.7 - webbing.Grant(src) - ai_controller?.set_blackboard_key(BB_SPIDER_WEB_ACTION, webbing) + var/static/list/innate_actions = list( + /datum/action/cooldown/mob_cooldown/lay_web = BB_SPIDER_WEB_ACTION, + /datum/action/cooldown/mob_cooldown/lay_web/sticky_web = null, + /datum/action/cooldown/mob_cooldown/lay_web/web_spikes = null, + ) + grant_actions_by_list(innate_actions) - var/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/spikes_web = new(src) - spikes_web.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/web_sticky = new(src) - web_sticky.Grant(src) +/datum/action/cooldown/mob_cooldown/lay_web/flesh + webbing_time = 3 SECONDS diff --git a/code/modules/mob/living/basic/space_fauna/demon/demon_subtypes.dm b/code/modules/mob/living/basic/space_fauna/demon/demon_subtypes.dm index ed3c131949d..d8c419ea2e3 100644 --- a/code/modules/mob/living/basic/space_fauna/demon/demon_subtypes.dm +++ b/code/modules/mob/living/basic/space_fauna/demon/demon_subtypes.dm @@ -37,8 +37,7 @@ /mob/living/basic/demon/slaughter/Initialize(mapload) . = ..() - var/datum/action/cooldown/spell/jaunt/bloodcrawl/slaughter_demon/crawl = new crawl_type(src) - crawl.Grant(src) + GRANT_ACTION(/datum/action/cooldown/spell/jaunt/bloodcrawl/slaughter_demon) RegisterSignal(src, COMSIG_LIVING_UNARMED_ATTACK, PROC_REF(on_attack)) RegisterSignals(src, list(COMSIG_MOB_ENTER_JAUNT, COMSIG_MOB_AFTER_EXIT_JAUNT), PROC_REF(on_crawl)) diff --git a/code/modules/mob/living/basic/space_fauna/eyeball/_eyeball.dm b/code/modules/mob/living/basic/space_fauna/eyeball/_eyeball.dm index 47e43704079..b72815d8325 100644 --- a/code/modules/mob/living/basic/space_fauna/eyeball/_eyeball.dm +++ b/code/modules/mob/living/basic/space_fauna/eyeball/_eyeball.dm @@ -52,9 +52,11 @@ /mob/living/basic/eyeball/Initialize(mapload) . = ..() - var/datum/action/cooldown/spell/pointed/death_glare/glare = new(src) - glare.Grant(src) - ai_controller.set_blackboard_key(BB_GLARE_ABILITY, glare) + var/static/list/innate_actions = list( + /datum/action/cooldown/spell/pointed/death_glare = BB_GLARE_ABILITY + ) + grant_actions_by_list(innate_actions) + AddElement(/datum/element/simple_flying) AddComponent(/datum/component/tameable, food_types = list(/obj/item/food/grown/carrot), tame_chance = 100, after_tame = CALLBACK(src, PROC_REF(on_tame))) ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT) diff --git a/code/modules/mob/living/basic/space_fauna/hivebot/_hivebot.dm b/code/modules/mob/living/basic/space_fauna/hivebot/_hivebot.dm index db0d310a71c..d914e0589c4 100644 --- a/code/modules/mob/living/basic/space_fauna/hivebot/_hivebot.dm +++ b/code/modules/mob/living/basic/space_fauna/hivebot/_hivebot.dm @@ -95,8 +95,7 @@ /mob/living/basic/hivebot/mechanic/Initialize(mapload) . = ..() - var/datum/action/cooldown/spell/conjure/foam_wall/foam = new(src) - foam.Grant(src) + GRANT_ACTION(/datum/action/cooldown/spell/conjure/foam_wall) RegisterSignal(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(pre_attack)) /mob/living/basic/hivebot/mechanic/proc/pre_attack(mob/living/fixer, atom/target) 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 6a41993526e..72f2001011c 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 @@ -2,6 +2,8 @@ #define HEARTBEAT_FAST (0.6 SECONDS) #define HEARTBEAT_FRANTIC (0.4 SECONDS) +#define SPIKES_ABILITY_TYPEPATH /datum/action/cooldown/mob_cooldown/chasing_spikes + /mob/living/basic/meteor_heart name = "meteor heart" desc = "A pulsing lump of flesh and bone growing directly out of the ground." @@ -25,10 +27,7 @@ maximum_survivable_temperature = 1500 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/mob_cooldown/chasing_spikes/spikes - /// Action which summons areas the player can't stand in - var/datum/action/cooldown/mob_cooldown/spine_traps/traps + /// Looping heartbeat sound var/datum/looping_sound/heartbeat/soundloop @@ -39,14 +38,11 @@ AddElement(/datum/element/death_drops, death_loot) AddElement(/datum/element/relay_attackers) - spikes = new(src) - spikes.Grant(src) - ai_controller.set_blackboard_key(BB_METEOR_HEART_GROUND_SPIKES, spikes) - - traps = new(src) - traps.Grant(src) - ai_controller.set_blackboard_key(BB_METEOR_HEART_SPINE_TRAPS, traps) - + var/static/list/innate_actions = list( + SPIKES_ABILITY_TYPEPATH = BB_METEOR_HEART_GROUND_SPIKES, + /datum/action/cooldown/mob_cooldown/spine_traps = BB_METEOR_HEART_SPINE_TRAPS, + ) + grant_actions_by_list(innate_actions) ai_controller.set_ai_status(AI_STATUS_OFF) RegisterSignal(src, COMSIG_MOB_ABILITY_FINISHED, PROC_REF(used_ability)) @@ -60,12 +56,13 @@ soundloop.pressure_affected = FALSE soundloop.start() - - AddComponent(/datum/component/bloody_spreader,\ + AddComponent(\ + /datum/component/bloody_spreader,\ blood_left = INFINITY,\ blood_dna = list("meaty DNA" = "MT-"),\ diseases = null,\ ) + /// Called when we get mad at something, either for attacking us or attacking the nearby area /mob/living/basic/meteor_heart/proc/aggro() if (ai_controller.ai_status == AI_STATUS_ON) @@ -85,13 +82,11 @@ /// Animate when using certain abilities /mob/living/basic/meteor_heart/proc/used_ability(mob/living/owner, datum/action/cooldown/mob_cooldown/ability) SIGNAL_HANDLER - if (ability != spikes) + if(!istype(ability, SPIKES_ABILITY_TYPEPATH)) return Shake(1, 0, 1.5 SECONDS) /mob/living/basic/meteor_heart/Destroy() - QDEL_NULL(spikes) - QDEL_NULL(traps) QDEL_NULL(soundloop) return ..() @@ -136,3 +131,5 @@ #undef HEARTBEAT_NORMAL #undef HEARTBEAT_FAST #undef HEARTBEAT_FRANTIC + +#undef SPIKES_ABILITY_TYPEPATH diff --git a/code/modules/mob/living/basic/space_fauna/netherworld/creature.dm b/code/modules/mob/living/basic/space_fauna/netherworld/creature.dm index cdde6ad05e4..c55376c4fcc 100644 --- a/code/modules/mob/living/basic/space_fauna/netherworld/creature.dm +++ b/code/modules/mob/living/basic/space_fauna/netherworld/creature.dm @@ -39,8 +39,7 @@ min_health_slowdown = -1.5,\ ) - var/datum/action/cooldown/spell/jaunt/creature_teleport/teleport = new(src) - teleport.Grant(src) + GRANT_ACTION(/datum/action/cooldown/spell/jaunt/creature_teleport) /mob/living/basic/creature/proc/can_be_seen(turf/location) // Check for darkness diff --git a/code/modules/mob/living/basic/space_fauna/paper_wizard/paper_wizard.dm b/code/modules/mob/living/basic/space_fauna/paper_wizard/paper_wizard.dm index 519e8ba1a73..c4ea41cad37 100644 --- a/code/modules/mob/living/basic/space_fauna/paper_wizard/paper_wizard.dm +++ b/code/modules/mob/living/basic/space_fauna/paper_wizard/paper_wizard.dm @@ -36,21 +36,16 @@ AddElement(/datum/element/effect_trail, /obj/effect/temp_visual/paper_scatter) /mob/living/basic/paper_wizard/proc/grant_abilities() - summon = new(src) - summon.Grant(src) - ai_controller.set_blackboard_key(BB_WIZARD_SUMMON_MINIONS, summon) - mimic = new(src) - mimic.Grant(src) - ai_controller.set_blackboard_key(BB_WIZARD_MIMICS, mimic) + var/static/list/innate_actions = list( + /datum/action/cooldown/spell/conjure/wizard_summon_minions = BB_WIZARD_SUMMON_MINIONS, + /datum/action/cooldown/spell/pointed/wizard_mimic = BB_WIZARD_MIMICS, + ) + + grant_actions_by_list(innate_actions) /mob/living/basic/paper_wizard/proc/grant_loot() AddElement(/datum/element/death_drops, dropped_loot) -/mob/living/basic/paper_wizard/Destroy() - QDEL_NULL(summon) - QDEL_NULL(mimic) - return ..() - /datum/ai_controller/basic_controller/paper_wizard blackboard = list( BB_TARGETTING_DATUM = new /datum/targetting_datum/basic, diff --git a/code/modules/mob/living/basic/space_fauna/regal_rat/regal_rat.dm b/code/modules/mob/living/basic/space_fauna/regal_rat/regal_rat.dm index 24e53b3bf44..de0c0324f80 100644 --- a/code/modules/mob/living/basic/space_fauna/regal_rat/regal_rat.dm +++ b/code/modules/mob/living/basic/space_fauna/regal_rat/regal_rat.dm @@ -64,13 +64,12 @@ after_assumed_control = CALLBACK(src, PROC_REF(became_player_controlled)),\ ) - var/datum/action/cooldown/mob_cooldown/domain/domain = new(src) - domain.Grant(src) - ai_controller.set_blackboard_key(BB_DOMAIN_ABILITY, domain) + var/static/list/innate_actions = list( + /datum/action/cooldown/mob_cooldown/domain = BB_DOMAIN_ABILITY, + /datum/action/cooldown/mob_cooldown/riot = BB_RAISE_HORDE_ABILITY, + ) - var/datum/action/cooldown/mob_cooldown/riot/riot = new(src) - riot.Grant(src) - ai_controller.set_blackboard_key(BB_RAISE_HORDE_ABILITY, riot) + grant_actions_by_list(innate_actions) /mob/living/basic/regal_rat/examine(mob/user) . = ..() diff --git a/code/modules/mob/living/basic/space_fauna/revenant/_revenant.dm b/code/modules/mob/living/basic/space_fauna/revenant/_revenant.dm index 856b5820b98..6da3352c9d6 100644 --- a/code/modules/mob/living/basic/space_fauna/revenant/_revenant.dm +++ b/code/modules/mob/living/basic/space_fauna/revenant/_revenant.dm @@ -97,9 +97,7 @@ AddElement(/datum/element/simple_flying) add_traits(list(TRAIT_SPACEWALK, TRAIT_SIXTHSENSE, TRAIT_FREE_HYPERSPACE_MOVEMENT), INNATE_TRAIT) - for(var/ability in abilities) - var/datum/action/spell = new ability(src) - spell.Grant(src) + grant_actions_by_list(abilities) RegisterSignal(src, COMSIG_LIVING_BANED, PROC_REF(on_baned)) RegisterSignal(src, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(on_move)) diff --git a/code/modules/mob/living/basic/space_fauna/space_dragon/space_dragon.dm b/code/modules/mob/living/basic/space_fauna/space_dragon/space_dragon.dm index 412b0376457..547e35cf413 100644 --- a/code/modules/mob/living/basic/space_fauna/space_dragon/space_dragon.dm +++ b/code/modules/mob/living/basic/space_fauna/space_dragon/space_dragon.dm @@ -76,11 +76,6 @@ buffet = new(src) buffet.Grant(src) -/mob/living/basic/space_dragon/Destroy() - QDEL_NULL(fire_breath) - QDEL_NULL(buffet) - return ..() - /mob/living/basic/space_dragon/Login() . = ..() if(!isnull(chosen_colour)) 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 a1aaf954c36..c79731bcdd1 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 @@ -19,7 +19,12 @@ melee_damage_upper = 25 gold_core_spawnable = HOSTILE_SPAWN ai_controller = /datum/ai_controller/basic_controller/giant_spider + /// Actions to grant on Initialize + var/list/innate_actions = null +/mob/living/basic/spider/giant/Initialize(mapload) + . = ..() + grant_actions_by_list(innate_actions) /** * ### Ambush Spider @@ -42,7 +47,8 @@ melee_damage_upper = 30 speed = 5 player_speed_modifier = -3.1 - menu_description = "Slow spider, with a strong disarming pull and above avarage health and damage." + menu_description = "Slow spider, with a strong disarming pull and above average health and damage." + innate_actions = list(/datum/action/cooldown/mob_cooldown/sneak/spider) /mob/living/basic/spider/giant/ambush/Initialize(mapload) . = ..() @@ -50,9 +56,6 @@ AddElement(/datum/element/web_walker, /datum/movespeed_modifier/slow_web) - var/datum/action/cooldown/mob_cooldown/sneak/spider/sneak_web = new(src) - sneak_web.Grant(src) - /** * ### Guard Spider * A subtype of the giant spider which is similar on every single way, @@ -74,13 +77,11 @@ speed = 5 player_speed_modifier = -4 menu_description = "Tanky and strong able to shed a carcass for protection." + innate_actions = list(/datum/action/cooldown/mob_cooldown/web_effigy) /mob/living/basic/spider/giant/guard/Initialize(mapload) . = ..() - AddElement(/datum/element/web_walker, /datum/movespeed_modifier/average_web) - var/datum/action/cooldown/mob_cooldown/web_effigy/shed = new(src) - shed.Grant(src) /** * ### Hunter Spider @@ -105,7 +106,6 @@ /mob/living/basic/spider/giant/hunter/Initialize(mapload) . = ..() - AddElement(/datum/element/web_walker, /datum/movespeed_modifier/fast_web) /** @@ -131,14 +131,12 @@ player_speed_modifier = -3.1 sight = SEE_SELF|SEE_MOBS menu_description = "Fast spider able to see enemies through walls, send messages to the nest and the ability to travel in vents." + innate_actions = list(/datum/action/cooldown/mob_cooldown/command_spiders/communication_spiders) /mob/living/basic/spider/giant/scout/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) - var/datum/action/cooldown/mob_cooldown/command_spiders/communication_spiders/spiders_communication = new(src) - spiders_communication.Grant(src) - /** * ### Nurse Spider * @@ -210,21 +208,16 @@ speed = 4 player_speed_modifier = -3.1 web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer - menu_description = "Avarage speed spider with self healing abilities and multiple web types to reinforce the nest with little to no damage and low health." + menu_description = "Average speed spider with self healing abilities and multiple web types to reinforce the nest with little to no damage and low health." + innate_actions = list( + /datum/action/cooldown/mob_cooldown/lay_web/solid_web, + /datum/action/cooldown/mob_cooldown/lay_web/sticky_web, + /datum/action/cooldown/mob_cooldown/lay_web/web_passage, + /datum/action/cooldown/mob_cooldown/lay_web/web_spikes, + ) /mob/living/basic/spider/giant/tangle/Initialize(mapload) . = ..() - var/datum/action/cooldown/mob_cooldown/lay_web/solid_web/web_solid = new(src) - web_solid.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_web/web_passage/passage_web = new(src) - passage_web.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/spikes_web = new(src) - spikes_web.Grant(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) @@ -364,7 +357,12 @@ web_speed = 0.7 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 + innate_actions = list( + /datum/action/cooldown/mob_cooldown/charge/basic_charge, + /datum/action/cooldown/mob_cooldown/lay_web/solid_web, + /datum/action/cooldown/mob_cooldown/lay_web/web_passage, + ) + /// Charging ability, kept seperate from innate_actions due to implementation details var/datum/action/cooldown/mob_cooldown/charge/basic_charge/charge /mob/living/basic/spider/giant/tarantula/Initialize(mapload) @@ -405,15 +403,14 @@ player_speed_modifier = -2.5 gold_core_spawnable = NO_SPAWN menu_description = "Assassin spider variant with an unmatched speed and very deadly poison, but has very low amount of health and damage." + innate_actions = list( + /datum/action/cooldown/mob_cooldown/defensive_mode, + ) /mob/living/basic/spider/giant/viper/Initialize(mapload) . = ..() - AddElement(/datum/element/bonus_damage) - var/datum/action/cooldown/mob_cooldown/defensive_mode/defensive_action = new(src) - defensive_action.Grant(src) - /** * ### Spider Broodmother * @@ -440,38 +437,21 @@ web_speed = 0.5 web_type = /datum/action/cooldown/mob_cooldown/lay_web/sealer menu_description = "Royal spider variant specializing in reproduction and leadership, deals low damage." + innate_actions = list( + /datum/action/cooldown/mob_cooldown/command_spiders, + /datum/action/cooldown/mob_cooldown/lay_eggs, + /datum/action/cooldown/mob_cooldown/lay_eggs/abnormal, + /datum/action/cooldown/mob_cooldown/lay_eggs/enriched, + /datum/action/cooldown/mob_cooldown/lay_web/solid_web, + /datum/action/cooldown/mob_cooldown/lay_web/sticky_web, + /datum/action/cooldown/mob_cooldown/lay_web/web_passage, + /datum/action/cooldown/mob_cooldown/lay_web/web_spikes, + /datum/action/cooldown/mob_cooldown/set_spider_directive, + /datum/action/cooldown/mob_cooldown/wrap, + ) /mob/living/basic/spider/giant/midwife/Initialize(mapload) . = ..() - var/datum/action/cooldown/mob_cooldown/lay_web/solid_web/web_solid = new(src) - web_solid.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_web/web_passage/passage_web = new(src) - passage_web.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/spikes_web = new(src) - spikes_web.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/web_sticky = new(src) - web_sticky.Grant(src) - - var/datum/action/cooldown/mob_cooldown/wrap/wrapping = new(src) - wrapping.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_eggs/make_eggs_tier1 = new(src) - make_eggs_tier1.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_eggs/abnormal/make_eggs_tier2 = new(src) - make_eggs_tier2.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_eggs/enriched/make_eggs_tier3 = new(src) - make_eggs_tier3.Grant(src) - - var/datum/action/cooldown/mob_cooldown/set_spider_directive/give_orders = new(src) - give_orders.Grant(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) @@ -586,18 +566,15 @@ unsuitable_heat_damage = 1 menu_description = "Stronger assassin spider variant with an unmatched speed, high amount of health and very deadly poison, but deals very low amount of damage. It also has ability to ventcrawl." apply_spider_antag = FALSE + innate_actions = list( + /datum/action/cooldown/mob_cooldown/lay_web/sticky_web, + /datum/action/cooldown/mob_cooldown/lay_web/web_spikes, + ) /mob/living/basic/spider/giant/viper/wizard/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) - var/datum/action/cooldown/mob_cooldown/lay_web/web_spikes/spikes_web = new(src) - spikes_web.Grant(src) - - var/datum/action/cooldown/mob_cooldown/lay_web/sticky_web/web_sticky = new(src) - web_sticky.Grant(src) - - /** * ### Sergeant Araneus * 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 de44bc74180..809755e3555 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 @@ -32,10 +32,9 @@ /mob/living/basic/spider/growing/young/ambush/Initialize(mapload) . = ..() - AddElement(/datum/element/web_walker, /datum/movespeed_modifier/slow_web) - var/datum/action/cooldown/mob_cooldown/sneak/spider/sneak_web = new(src) - sneak_web.Grant(src) + GRANT_ACTION(/datum/action/cooldown/mob_cooldown/sneak/spider) + AddElement(/datum/element/web_walker, /datum/movespeed_modifier/slow_web) /// Will differentiate into the "scout" giant spider. /mob/living/basic/spider/growing/young/scout diff --git a/code/modules/mob/living/basic/space_fauna/statue/statue.dm b/code/modules/mob/living/basic/space_fauna/statue/statue.dm index d2ea5e8a831..c525c03bda0 100644 --- a/code/modules/mob/living/basic/space_fauna/statue/statue.dm +++ b/code/modules/mob/living/basic/space_fauna/statue/statue.dm @@ -56,14 +56,14 @@ /mob/living/basic/statue/Initialize(mapload, mob/living/creator) . = ..() - AddComponent(/datum/component/unobserved_actor, unobserved_flags = NO_OBSERVED_MOVEMENT | NO_OBSERVED_ATTACKS) ADD_TRAIT(src, TRAIT_UNOBSERVANT, INNATE_TRAIT) + AddComponent(/datum/component/unobserved_actor, unobserved_flags = NO_OBSERVED_MOVEMENT | NO_OBSERVED_ATTACKS) - // Give spells - var/datum/action/cooldown/spell/aoe/flicker_lights/flicker = new(src) - flicker.Grant(src) - var/datum/action/cooldown/spell/aoe/blindness/blind = new(src) - blind.Grant(src) + var/static/list/innate_actions = list( + /datum/action/cooldown/spell/aoe/blindness, + /datum/action/cooldown/spell/aoe/flicker_lights, + ) + grant_actions_by_list(innate_actions) // Set creator if(creator) diff --git a/code/modules/mob/living/carbon/alien/adult/caste/drone.dm b/code/modules/mob/living/carbon/alien/adult/caste/drone.dm index 3a1843dd93c..ff208baabd2 100644 --- a/code/modules/mob/living/carbon/alien/adult/caste/drone.dm +++ b/code/modules/mob/living/carbon/alien/adult/caste/drone.dm @@ -6,8 +6,7 @@ icon_state = "aliend" /mob/living/carbon/alien/adult/drone/Initialize(mapload) - var/datum/action/cooldown/alien/evolve_to_praetorian/evolution = new(src) - evolution.Grant(src) + GRANT_ACTION(/datum/action/cooldown/alien/evolve_to_praetorian) return ..() /mob/living/carbon/alien/adult/drone/create_internal_organs() diff --git a/code/modules/mob/living/carbon/alien/adult/caste/praetorian.dm b/code/modules/mob/living/carbon/alien/adult/caste/praetorian.dm index a26eb31231c..8fa142a38f0 100644 --- a/code/modules/mob/living/carbon/alien/adult/caste/praetorian.dm +++ b/code/modules/mob/living/carbon/alien/adult/caste/praetorian.dm @@ -9,11 +9,12 @@ /mob/living/carbon/alien/adult/royal/praetorian/Initialize(mapload) real_name = name - var/datum/action/cooldown/spell/aoe/repulse/xeno/tail_whip = new(src) - tail_whip.Grant(src) + var/static/list/innate_actions = list( + /datum/action/cooldown/alien/evolve_to_queen, + /datum/action/cooldown/spell/aoe/repulse/xeno, + ) - var/datum/action/cooldown/alien/evolve_to_queen/evolution = new(src) - evolution.Grant(src) + grant_actions_by_list(innate_actions) return ..() diff --git a/code/modules/mob/living/carbon/alien/adult/caste/sentinel.dm b/code/modules/mob/living/carbon/alien/adult/caste/sentinel.dm index 7fffdf35522..bef621905f4 100644 --- a/code/modules/mob/living/carbon/alien/adult/caste/sentinel.dm +++ b/code/modules/mob/living/carbon/alien/adult/caste/sentinel.dm @@ -7,8 +7,7 @@ alien_speed = 0.2 /mob/living/carbon/alien/adult/sentinel/Initialize(mapload) - var/datum/action/cooldown/mob_cooldown/sneak/alien/sneaky_beaky = new(src) - sneaky_beaky.Grant(src) + GRANT_ACTION(/datum/action/cooldown/mob_cooldown/sneak/alien) return ..() /mob/living/carbon/alien/adult/sentinel/create_internal_organs() diff --git a/code/modules/mob/living/carbon/alien/adult/queen.dm b/code/modules/mob/living/carbon/alien/adult/queen.dm index dd8e61b6699..df03ce3fa9e 100644 --- a/code/modules/mob/living/carbon/alien/adult/queen.dm +++ b/code/modules/mob/living/carbon/alien/adult/queen.dm @@ -55,11 +55,11 @@ real_name = src.name - var/datum/action/cooldown/spell/aoe/repulse/xeno/tail_whip = new(src) - tail_whip.Grant(src) - - var/datum/action/cooldown/alien/promote/promotion = new(src) - promotion.Grant(src) + var/static/list/innate_actions = list( + /datum/action/cooldown/alien/promote, + /datum/action/cooldown/spell/aoe/repulse/xeno, + ) + grant_actions_by_list(innate_actions) return ..() diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 0b1396520b3..f4159813ed9 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -31,10 +31,12 @@ //This is fine right now, if we're adding organ specific damage this needs to be updated /mob/living/carbon/alien/larva/Initialize(mapload) - var/datum/action/cooldown/alien/larva_evolve/evolution = new(src) - evolution.Grant(src) - var/datum/action/cooldown/alien/hide/hide = new(src) - hide.Grant(src) + var/static/list/innate_actions = list( + /datum/action/cooldown/alien/hide, + /datum/action/cooldown/alien/larva_evolve, + ) + grant_actions_by_list(innate_actions) + return ..() /mob/living/carbon/alien/larva/create_internal_organs() 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 432fb2acbae..eed67aecde4 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/_megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/_megafauna.dm @@ -59,9 +59,7 @@ AddComponent(/datum/component/gps, gps_name) ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT) add_traits(list(TRAIT_NO_TELEPORT, TRAIT_MARTIAL_ARTS_IMMUNE), MEGAFAUNA_TRAIT) - for(var/action_type in attack_action_types) - var/datum/action/innate/megafauna_attack/attack_action = new action_type() - attack_action.Grant(src) + grant_actions_by_list(attack_action_types) /mob/living/simple_animal/hostile/megafauna/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE) //Safety check diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm index 113f7431ffc..2e562eb5659 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm @@ -67,21 +67,23 @@ Difficulty: Medium . = ..() miner_saw = new(src) ADD_TRAIT(src, TRAIT_NO_FLOATING_ANIM, INNATE_TRAIT) - dash = new /datum/action/cooldown/mob_cooldown/dash() - kinetic_accelerator = new /datum/action/cooldown/mob_cooldown/projectile_attack/kinetic_accelerator() - dash_attack = new /datum/action/cooldown/mob_cooldown/dash_attack() - transform_weapon = new /datum/action/cooldown/mob_cooldown/transform_weapon() + + dash = new /datum/action/cooldown/mob_cooldown/dash + kinetic_accelerator = new /datum/action/cooldown/mob_cooldown/projectile_attack/kinetic_accelerator + dash_attack = new /datum/action/cooldown/mob_cooldown/dash_attack + transform_weapon = new /datum/action/cooldown/mob_cooldown/transform_weapon dash.Grant(src) kinetic_accelerator.Grant(src) dash_attack.Grant(src) transform_weapon.Grant(src) + AddComponent(/datum/component/boss_music, 'sound/lavaland/bdm_boss.ogg', 167 SECONDS) /mob/living/simple_animal/hostile/megafauna/blood_drunk_miner/Destroy() - QDEL_NULL(dash) - QDEL_NULL(kinetic_accelerator) - QDEL_NULL(dash_attack) - QDEL_NULL(transform_weapon) + dash = null + kinetic_accelerator = null + dash_attack = null + transform_weapon = null return ..() /mob/living/simple_animal/hostile/megafauna/blood_drunk_miner/OpenFire() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index a1336bd6a09..eaeaddc3e03 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -86,10 +86,10 @@ Difficulty: Hard /mob/living/simple_animal/hostile/megafauna/bubblegum/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_NO_FLOATING_ANIM, INNATE_TRAIT) - triple_charge = new /datum/action/cooldown/mob_cooldown/charge/triple_charge() - hallucination_charge = new /datum/action/cooldown/mob_cooldown/charge/hallucination_charge() - hallucination_charge_surround = new /datum/action/cooldown/mob_cooldown/charge/hallucination_charge/hallucination_surround() - blood_warp = new /datum/action/cooldown/mob_cooldown/blood_warp() + triple_charge = new(src) + hallucination_charge = new(src) + hallucination_charge_surround = new(src) + blood_warp = new(src) triple_charge.Grant(src) hallucination_charge.Grant(src) hallucination_charge_surround.Grant(src) @@ -105,10 +105,10 @@ Difficulty: Hard sound_volume = 200) /mob/living/simple_animal/hostile/megafauna/bubblegum/Destroy() - QDEL_NULL(triple_charge) - QDEL_NULL(hallucination_charge) - QDEL_NULL(hallucination_charge_surround) - QDEL_NULL(blood_warp) + triple_charge = null + hallucination_charge = null + hallucination_charge_surround = null + blood_warp = null return ..() /mob/living/simple_animal/hostile/megafauna/bubblegum/update_cooldowns(list/cooldown_updates, ignore_staggered = FALSE) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index 10873e398e5..4d08a29740b 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -71,11 +71,11 @@ /mob/living/simple_animal/hostile/megafauna/colossus/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_NO_FLOATING_ANIM, INNATE_TRAIT) //we don't want this guy to float, messes up his animations. - spiral_shots = new /datum/action/cooldown/mob_cooldown/projectile_attack/spiral_shots/colossus() - random_shots = new /datum/action/cooldown/mob_cooldown/projectile_attack/random_aoe/colossus() - shotgun_blast = new /datum/action/cooldown/mob_cooldown/projectile_attack/shotgun_blast/colossus() - dir_shots = new /datum/action/cooldown/mob_cooldown/projectile_attack/dir_shots/alternating/colossus() - colossus_final = new /datum/action/cooldown/mob_cooldown/projectile_attack/colossus_final() + spiral_shots = new(src) + random_shots = new(src) + shotgun_blast = new(src) + dir_shots = new(src) + colossus_final = new(src) spiral_shots.Grant(src) random_shots.Grant(src) shotgun_blast.Grant(src) @@ -87,10 +87,10 @@ /mob/living/simple_animal/hostile/megafauna/colossus/Destroy() RemoveElement(/datum/element/projectile_shield) - QDEL_NULL(spiral_shots) - QDEL_NULL(random_shots) - QDEL_NULL(shotgun_blast) - QDEL_NULL(dir_shots) + spiral_shots = null + random_shots = null + shotgun_blast = null + dir_shots = null return ..() /mob/living/simple_animal/hostile/megafauna/colossus/OpenFire() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm index aac1964cbf2..dc49d71f796 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/demonic_frost_miner.dm @@ -62,12 +62,12 @@ Difficulty: Extremely Hard /mob/living/simple_animal/hostile/megafauna/demonic_frost_miner/Initialize(mapload) . = ..() - frost_orbs = new /datum/action/cooldown/mob_cooldown/projectile_attack/rapid_fire/shrapnel() - hard_frost_orbs = new /datum/action/cooldown/mob_cooldown/projectile_attack/rapid_fire/shrapnel/strong() - snowball_machine_gun = new /datum/action/cooldown/mob_cooldown/projectile_attack/rapid_fire() - hard_snowball_machine_gun = new /datum/action/cooldown/mob_cooldown/direct_and_aoe() - ice_shotgun = new /datum/action/cooldown/mob_cooldown/projectile_attack/shotgun_blast/pattern() - hard_ice_shotgun = new /datum/action/cooldown/mob_cooldown/projectile_attack/shotgun_blast/pattern/circular() + frost_orbs = new(src) + hard_frost_orbs = new(src) + snowball_machine_gun = new(src) + hard_snowball_machine_gun = new(src) + ice_shotgun = new(src) + hard_ice_shotgun = new(src) frost_orbs.Grant(src) hard_frost_orbs.Grant(src) snowball_machine_gun.Grant(src) @@ -83,12 +83,12 @@ Difficulty: Extremely Hard AddComponent(/datum/component/boss_music, 'sound/lavaland/bdm_boss.ogg', 167 SECONDS) /mob/living/simple_animal/hostile/megafauna/demonic_frost_miner/Destroy() - QDEL_NULL(frost_orbs) - QDEL_NULL(hard_frost_orbs) - QDEL_NULL(snowball_machine_gun) - QDEL_NULL(hard_snowball_machine_gun) - QDEL_NULL(ice_shotgun) - QDEL_NULL(hard_ice_shotgun) + frost_orbs = null + hard_frost_orbs = null + snowball_machine_gun = null + hard_snowball_machine_gun = null + ice_shotgun = null + hard_ice_shotgun = null return ..() /mob/living/simple_animal/hostile/megafauna/demonic_frost_miner/OpenFire() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm index 4f102b9e3d4..abf93dcdaea 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm @@ -80,10 +80,10 @@ /mob/living/simple_animal/hostile/megafauna/dragon/Initialize(mapload) . = ..() - fire_cone = new /datum/action/cooldown/mob_cooldown/fire_breath/cone() - meteors = new /datum/action/cooldown/mob_cooldown/meteors() - mass_fire = new /datum/action/cooldown/mob_cooldown/fire_breath/mass_fire() - lava_swoop = new /datum/action/cooldown/mob_cooldown/lava_swoop() + fire_cone = new(src) + meteors = new(src) + mass_fire = new(src) + lava_swoop = new(src) fire_cone.Grant(src) meteors.Grant(src) mass_fire.Grant(src) @@ -95,10 +95,10 @@ AddElement(/datum/element/change_force_on_death, move_force = MOVE_FORCE_DEFAULT) /mob/living/simple_animal/hostile/megafauna/dragon/Destroy() - QDEL_NULL(fire_cone) - QDEL_NULL(meteors) - QDEL_NULL(mass_fire) - QDEL_NULL(lava_swoop) + fire_cone = null + meteors = null + mass_fire = null + lava_swoop = null return ..() /mob/living/simple_animal/hostile/megafauna/dragon/OpenFire() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm index 881a6cf17d6..00e5d1f7a15 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm @@ -29,9 +29,7 @@ /mob/living/simple_animal/hostile/asteroid/elite/Initialize(mapload) . = ..() AddComponent(/datum/component/seethrough_mob) - for(var/action_type in attack_action_types) - var/datum/action/innate/elite_attack/attack_action = new action_type() - attack_action.Grant(src) + grant_actions_by_list(attack_action_types) //Prevents elites from attacking members of their faction (can't hurt themselves either) and lets them mine rock with an attack despite not being able to smash walls. /mob/living/simple_animal/hostile/asteroid/elite/AttackingTarget(atom/attacked_target) diff --git a/code/modules/mob/living/simple_animal/hostile/ooze.dm b/code/modules/mob/living/simple_animal/hostile/ooze.dm index 5639051bffc..2e1db456b5b 100644 --- a/code/modules/mob/living/simple_animal/hostile/ooze.dm +++ b/code/modules/mob/living/simple_animal/hostile/ooze.dm @@ -41,6 +41,8 @@ ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) AddElement(/datum/element/content_barfer) + grant_actions_by_list(get_innate_actions()) + /mob/living/simple_animal/hostile/ooze/attacked_by(obj/item/I, mob/living/user) if(!eat_atom(I, TRUE)) return ..() @@ -71,6 +73,10 @@ if(ooze_nutrition <= 0) adjustBruteLoss(0.25 * seconds_per_tick) +/// Returns an applicable list of actions to grant to the mob. Will return a list or null. +/mob/living/simple_animal/hostile/ooze/proc/get_innate_actions() + return null + ///Does ooze_nutrition + supplied amount and clamps it within 0 and 500 /mob/living/simple_animal/hostile/ooze/proc/adjust_ooze_nutrition(amount) ooze_nutrition = clamp(ooze_nutrition + amount, 0, 500) @@ -106,23 +112,20 @@ armour_penetration = 15 obj_damage = 20 death_message = "collapses into a pile of goo!" - ///The ability to give yourself a metabolic speed boost which raises heat - var/datum/action/cooldown/metabolicboost/boost ///The ability to consume mobs var/datum/action/consume/consume ///Initializes the mobs abilities and gives them to the mob /mob/living/simple_animal/hostile/ooze/gelatinous/Initialize(mapload) . = ..() - boost = new - boost.Grant(src) consume = new consume.Grant(src) -/mob/living/simple_animal/hostile/ooze/gelatinous/Destroy() - . = ..() - QDEL_NULL(boost) - QDEL_NULL(consume) +/mob/living/simple_animal/hostile/ooze/gelatinous/get_innate_actions() + var/static/list/innate_actions = list( + /datum/action/cooldown/metabolicboost, + ) + return innate_actions ///If this mob gets resisted by something, its trying to escape consumption. /mob/living/simple_animal/hostile/ooze/gelatinous/container_resist_act(mob/living/user) @@ -285,12 +288,12 @@ death_message = "deflates and spills its vital juices!" edible_food_types = MEAT | VEGETABLES -/mob/living/simple_animal/hostile/ooze/grapes/Initialize(mapload) - . = ..() - var/datum/action/cooldown/globules/glob_shooter = new(src) - glob_shooter.Grant(src) - var/datum/action/cooldown/gel_cocoon/gel_cocoon = new(src) - gel_cocoon.Grant(src) +/mob/living/simple_animal/hostile/ooze/grapes/get_innate_actions() + var/static/list/innate_actions = list( + /datum/action/cooldown/globules, + /datum/action/cooldown/gel_cocoon, + ) + return innate_actions /mob/living/simple_animal/hostile/ooze/grapes/add_cell_sample() AddElement(/datum/element/swabable, CELL_LINE_TABLE_GRAPE, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 5) diff --git a/code/modules/mob/living/simple_animal/hostile/vatbeast.dm b/code/modules/mob/living/simple_animal/hostile/vatbeast.dm index 7c6edeb88da..a0fe73b32bf 100644 --- a/code/modules/mob/living/simple_animal/hostile/vatbeast.dm +++ b/code/modules/mob/living/simple_animal/hostile/vatbeast.dm @@ -28,8 +28,7 @@ /mob/living/simple_animal/hostile/vatbeast/Initialize(mapload) . = ..() - var/datum/action/cooldown/tentacle_slap/slapper = new(src) - slapper.Grant(src) + GRANT_ACTION(/datum/action/cooldown/tentacle_slap) add_cell_sample() AddComponent(/datum/component/tameable, list(/obj/item/food/fries, /obj/item/food/cheesyfries, /obj/item/food/cornchips, /obj/item/food/carrotfries), tame_chance = 30, bonus_tame_chance = 0, after_tame = CALLBACK(src, PROC_REF(tamed))) diff --git a/code/modules/mob/living/simple_animal/hostile/wizard.dm b/code/modules/mob/living/simple_animal/hostile/wizard.dm index d2957effd3c..59b44077661 100644 --- a/code/modules/mob/living/simple_animal/hostile/wizard.dm +++ b/code/modules/mob/living/simple_animal/hostile/wizard.dm @@ -57,12 +57,6 @@ blink.outer_tele_radius = 3 blink.Grant(src) -/mob/living/simple_animal/hostile/wizard/Destroy() - QDEL_NULL(fireball) - QDEL_NULL(magic_missile) - QDEL_NULL(blink) - return ..() - /mob/living/simple_animal/hostile/wizard/handle_automated_action() . = ..() if(target && next_cast < world.time) diff --git a/code/modules/mob/living/simple_animal/slime/powers.dm b/code/modules/mob/living/simple_animal/slime/powers.dm index 9e858d4f02d..28bfffa6d40 100644 --- a/code/modules/mob/living/simple_animal/slime/powers.dm +++ b/code/modules/mob/living/simple_animal/slime/powers.dm @@ -164,8 +164,7 @@ amount_grown = 0 for(var/datum/action/innate/slime/evolve/E in actions) E.Remove(src) - var/datum/action/innate/slime/reproduce/reproduce_action = new - reproduce_action.Grant(src) + GRANT_ACTION(/datum/action/innate/slime/reproduce) regenerate_icons() update_name() else diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 5f52e79aaab..4e76848eb90 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -560,3 +560,21 @@ raw_lines += recent_speech[key] return raw_lines + +/// Takes in an associated list (key `/datum/action` typepaths, value is the AI blackboard key) and handles granting the action and adding it to the mob's AI controller blackboard. +/// This is only useful in instances where you don't want to store the reference to the action on a variable on the mob. +/// You can set the value to null if you don't want to add it to the blackboard (like in player controlled instances). Is also safe with null AI controllers. +/// Assumes that the action will be initialized and held in the mob itself, which is typically standard. +/mob/proc/grant_actions_by_list(list/input) + if(length(input) <= 0) + return + + for(var/action in input) + var/datum/action/ability = new action(src) + ability.Grant(src) + + var/blackboard_key = input[action] + if(isnull(blackboard_key)) + continue + + ai_controller?.set_blackboard_key(blackboard_key, ability) diff --git a/tgstation.dme b/tgstation.dme index cd20fc6c24b..47ca13b3d6e 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4428,11 +4428,11 @@ #include "code\modules\mob\living\basic\farm_animals\gorilla\gorilla_accessories.dm" #include "code\modules\mob\living\basic\farm_animals\gorilla\gorilla_ai.dm" #include "code\modules\mob\living\basic\farm_animals\gorilla\gorilla_emotes.dm" +#include "code\modules\mob\living\basic\heretic\_heretic_summon.dm" #include "code\modules\mob\living\basic\heretic\ash_spirit.dm" #include "code\modules\mob\living\basic\heretic\fire_shark.dm" #include "code\modules\mob\living\basic\heretic\flesh_stalker.dm" #include "code\modules\mob\living\basic\heretic\flesh_worm.dm" -#include "code\modules\mob\living\basic\heretic\heretic_summon.dm" #include "code\modules\mob\living\basic\heretic\maid_in_the_mirror.dm" #include "code\modules\mob\living\basic\heretic\raw_prophet.dm" #include "code\modules\mob\living\basic\heretic\rust_walker.dm"