From d5be61cc0f8df972419a94d1f8d86c9845d5c249 Mon Sep 17 00:00:00 2001 From: CHOMPStation2StaffMirrorBot <94713762+CHOMPStation2StaffMirrorBot@users.noreply.github.com> Date: Sat, 2 Nov 2024 09:32:45 -0700 Subject: [PATCH] [MIRROR] Metal Vore Solid (#9386) Co-authored-by: SatinIsle <98125273+SatinIsle@users.noreply.github.com> Co-authored-by: ShadowLarkens --- .../ai/ai_holder_subtypes/simple_mob_ai.dm | 29 +++++++++++ code/modules/ai/ai_holder_targeting.dm | 6 ++- .../subtypes/humanoid/mercs/mercs.dm | 48 +++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/code/modules/ai/ai_holder_subtypes/simple_mob_ai.dm b/code/modules/ai/ai_holder_subtypes/simple_mob_ai.dm index 4455b47072..b2d4a89658 100644 --- a/code/modules/ai/ai_holder_subtypes/simple_mob_ai.dm +++ b/code/modules/ai/ai_holder_subtypes/simple_mob_ai.dm @@ -98,6 +98,23 @@ step_rand(holder) holder.face_atom(AM) +// Only attacks you if you're in front of it. +/datum/ai_holder/simple_mob/ranged/guard_limit + guard_limit = TRUE + returns_home = TRUE + +/datum/ai_holder/simple_mob/ranged/guard_limit/pointblank + pointblank = TRUE + +/datum/ai_holder/simple_mob/ranged/guard_limit/aggressive + pointblank = TRUE + var/closest_distance = 1 + +/datum/ai_holder/simple_mob/ranged/guard_limit/kiting + pointblank = TRUE // So we don't need to copypaste post_melee_attack(). + var/run_if_this_close = 4 // If anything gets within this range, it'll try to move away. + var/moonwalk = TRUE // If true, mob turns to face the target while kiting, otherwise they turn in the direction they moved towards. + // Switches intents based on specific criteria. // Used for special mobs who do different things based on intents (and aren't slimes). // Intent switching is generally done in pre_[ranged/special]_attack(), so that the mob can use the right attack for the right time. @@ -142,6 +159,14 @@ return TRUE // We're out in the open, uncloaked, and our target isn't stunned, so lets flee. return FALSE +// Can only target people in view range, will return home +/datum/ai_holder/simple_mob/melee/guard_limit + guard_limit = TRUE + returns_home = TRUE + +/datum/ai_holder/simple_mob/melee/evasive/guard_limit + guard_limit = TRUE + returns_home = TRUE // Simple mobs that aren't hostile, but will fight back. /datum/ai_holder/simple_mob/retaliate @@ -197,3 +222,7 @@ /datum/ai_holder/simple_mob/passive/speedy base_wander_delay = 1 + +// For setting up possible stealth missions +/datum/ai_holder/simple_mob/humanoid/hostile/guard_limit + guard_limit = TRUE diff --git a/code/modules/ai/ai_holder_targeting.dm b/code/modules/ai/ai_holder_targeting.dm index ec600cc99f..d9b272ec38 100644 --- a/code/modules/ai/ai_holder_targeting.dm +++ b/code/modules/ai/ai_holder_targeting.dm @@ -10,6 +10,7 @@ var/micro_hunt = FALSE // Will target mobs at or under the micro_hunt_size size, requires vore_hostile to be true var/micro_hunt_size = 0.25 var/belly_attack = TRUE //Mobs attack if they are in a belly! + var/guard_limit = FALSE //Mobs will not acquire targets unless they are in front of them. var/atom/movable/target = null // The thing (mob or object) we're trying to kill. var/atom/movable/preferred_target = null// If set, and if given the chance, we will always prefer to target this over other options. @@ -52,7 +53,10 @@ . = list() if(!has_targets_list) possible_targets = list_targets() - for(var/possible_target in possible_targets) + for(var/atom/possible_target as anything in possible_targets) + if(guard_limit) + if((holder.dir == 1 && holder.y >= possible_target.y) || (holder.dir == 2 && holder.y <= possible_target.y) || (holder.dir == 4 && holder.x >= possible_target.x) || (holder.dir == 8 && holder.x <= possible_target.x)) //Ignore targets that are behind you + continue if(can_attack(possible_target)) // Can we attack it? . += possible_target diff --git a/code/modules/mob/living/simple_mob/subtypes/humanoid/mercs/mercs.dm b/code/modules/mob/living/simple_mob/subtypes/humanoid/mercs/mercs.dm index cb8665a43c..3c788f6800 100644 --- a/code/modules/mob/living/simple_mob/subtypes/humanoid/mercs/mercs.dm +++ b/code/modules/mob/living/simple_mob/subtypes/humanoid/mercs/mercs.dm @@ -90,14 +90,23 @@ threaten_delay = 30 SECONDS // Mercs will give you 30 seconds to leave or get shot. use_astar = TRUE //CHOMPEdit +/datum/ai_holder/simple_mob/merc/guard_limit + guard_limit = TRUE + /datum/ai_holder/simple_mob/merc/ranged pointblank = TRUE // They get close? Just shoot 'em! firing_lanes = TRUE // But not your buddies! conserve_ammo = TRUE // And don't go wasting bullets! +/datum/ai_holder/simple_mob/merc/ranged/guard_limit + guard_limit = TRUE + /datum/ai_holder/simple_mob/merc/ranged/sniper vision_range = 14 // We're a person with a long-ranged gun. +/datum/ai_holder/simple_mob/merc/ranged/sniper/guard_limit + guard_limit = TRUE + /datum/ai_holder/simple_mob/merc/ranged/sniper/max_range(atom/movable/AM) return holder.ICheckRangedAttack(AM) ? 14 : 1 @@ -448,3 +457,42 @@ /obj/item/grenade/spawnergrenade/manhacks/mercenary = 50, /obj/item/grenade/spawnergrenade/manhacks/mercenary = 30 ) + + +//////////////////////////////// +// Stealth Mission Mercs +//////////////////////////////// + +// Most likely to drop a broken weapon matching them, if it's a gun. +/mob/living/simple_mob/humanoid/merc/melee/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/guard_limit + +/mob/living/simple_mob/humanoid/merc/melee/sword/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/smg/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/laser/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/ionrifle/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/grenadier/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/rifle/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/rifle/mag/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/technician/poi/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/guard_limit + +/mob/living/simple_mob/humanoid/merc/ranged/sniper/guard_limit + ai_holder_type = /datum/ai_holder/simple_mob/merc/ranged/sniper/guard_limit