diff --git a/code/__DEFINES/ai/ai_blackboard.dm b/code/__DEFINES/ai/ai_blackboard.dm index 289f7586222..7003e812c9f 100644 --- a/code/__DEFINES/ai/ai_blackboard.dm +++ b/code/__DEFINES/ai/ai_blackboard.dm @@ -44,6 +44,8 @@ /// Generic key for a non-specific targetted action #define BB_TARGETTED_ACTION "BB_targetted_action" +/// Generic key for a non-specific action +#define BB_GENERIC_ACTION "BB_generic_action" ///How long have we spent with no target? #define BB_TARGETLESS_TIME "BB_targetless_time" diff --git a/code/__DEFINES/ai/monsters.dm b/code/__DEFINES/ai/monsters.dm index 4040bdb23a8..ebb924e42e1 100644 --- a/code/__DEFINES/ai/monsters.dm +++ b/code/__DEFINES/ai/monsters.dm @@ -59,11 +59,6 @@ /// We increment this counter every time we try to move while dragging an arm and if we go too long we'll give up trying to get out of line of sight and just eat the fingers #define BB_LOBSTROSITY_FINGER_LUST "BB_lobstrosity_finger_lust" -/// Key containing overwatch ability information -#define BB_WATCHER_OVERWATCH "BB_watcher_overwatch" -/// Key containing gazae ability information -#define BB_WATCHER_GAZE "BB_watcher_gaze" - // eyeball keys ///the death glare ability #define BB_GLARE_ABILITY "BB_glare_ability" diff --git a/code/datums/ai/basic_mobs/basic_subtrees/maintain_distance.dm b/code/datums/ai/basic_mobs/basic_subtrees/maintain_distance.dm index b80a28836a0..61631178163 100644 --- a/code/datums/ai/basic_mobs/basic_subtrees/maintain_distance.dm +++ b/code/datums/ai/basic_mobs/basic_subtrees/maintain_distance.dm @@ -11,6 +11,9 @@ /datum/ai_planning_subtree/maintain_distance/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) . = ..() + var/mob/living/living_pawn = controller.pawn + if(LAZYLEN(living_pawn.do_afters)) + return var/atom/target = controller.blackboard[target_key] if (!isliving(target) || !can_see(controller.pawn, target, view_distance)) return // Don't run away from cucumbers, they're not snakes diff --git a/code/datums/ai/basic_mobs/basic_subtrees/use_mob_ability.dm b/code/datums/ai/basic_mobs/basic_subtrees/use_mob_ability.dm index 2c618e98e72..1d7bfd62ad7 100644 --- a/code/datums/ai/basic_mobs/basic_subtrees/use_mob_ability.dm +++ b/code/datums/ai/basic_mobs/basic_subtrees/use_mob_ability.dm @@ -4,7 +4,7 @@ */ /datum/ai_planning_subtree/use_mob_ability /// Blackboard key for the ability - var/ability_key + var/ability_key = BB_GENERIC_ACTION /// Behaviour to perform using ability var/use_ability_behaviour = /datum/ai_behavior/use_mob_ability /// If true we terminate planning after trying to use the ability. diff --git a/code/datums/components/ranged_attacks.dm b/code/datums/components/ranged_attacks.dm index aecaa2c1808..f75d29a10f4 100644 --- a/code/datums/components/ranged_attacks.dm +++ b/code/datums/components/ranged_attacks.dm @@ -66,6 +66,7 @@ /// Actually fire the damn thing /datum/component/ranged_attacks/proc/async_fire_ranged_attack(mob/living/basic/firer, atom/target, modifiers) + firer.face_atom(target) if(projectile_type) firer.fire_projectile(projectile_type, target, projectile_sound) SEND_SIGNAL(parent, COMSIG_BASICMOB_POST_ATTACK_RANGED, target, modifiers) diff --git a/code/modules/mob/living/basic/lavaland/watcher/watcher.dm b/code/modules/mob/living/basic/lavaland/watcher/watcher.dm index b94ba914298..28ed712d061 100644 --- a/code/modules/mob/living/basic/lavaland/watcher/watcher.dm +++ b/code/modules/mob/living/basic/lavaland/watcher/watcher.dm @@ -1,4 +1,4 @@ -/// A floating eyeball which keeps its distance and plays red light/green light with you. +/// A floating eyeball which keeps its distance and sometimes make you look away. /mob/living/basic/mining/watcher name = "watcher" desc = "A levitating, monocular creature held aloft by wing-like veins. A sharp spine of crystal protrudes from its body." @@ -59,14 +59,10 @@ ) update_appearance(UPDATE_OVERLAYS) - var/datum/action/cooldown/mob_cooldown/watcher_overwatch/overwatch = new(src) - overwatch.Grant(src) - overwatch.projectile_type = projectile_type - ai_controller.set_blackboard_key(BB_WATCHER_OVERWATCH, overwatch) - var/datum/action/cooldown/mob_cooldown/watcher_gaze/gaze = new gaze_attack(src) gaze.Grant(src) - ai_controller.set_blackboard_key(BB_WATCHER_GAZE, gaze) + ai_controller.set_blackboard_key(BB_GENERIC_ACTION, gaze) + AddComponent(/datum/component/revenge_ability, gaze, targetting = ai_controller.blackboard[BB_TARGETTING_DATUM]) /mob/living/basic/mining/watcher/update_overlays() . = ..() diff --git a/code/modules/mob/living/basic/lavaland/watcher/watcher_ai.dm b/code/modules/mob/living/basic/lavaland/watcher/watcher_ai.dm index b08245963f4..7686c12ee3e 100644 --- a/code/modules/mob/living/basic/lavaland/watcher/watcher_ai.dm +++ b/code/modules/mob/living/basic/lavaland/watcher/watcher_ai.dm @@ -9,38 +9,20 @@ /datum/ai_planning_subtree/target_retaliate, /datum/ai_planning_subtree/simple_find_target, /datum/ai_planning_subtree/use_mob_ability/gaze, - /datum/ai_planning_subtree/targeted_mob_ability/overwatch, /datum/ai_planning_subtree/ranged_skirmish/watcher, /datum/ai_planning_subtree/maintain_distance, ) -/datum/ai_planning_subtree/targeted_mob_ability/overwatch - ability_key = BB_WATCHER_OVERWATCH - operational_datums = list(/datum/component/ai_target_timer) - -/datum/ai_planning_subtree/targeted_mob_ability/overwatch/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) - var/mob/living/living_pawn = controller.pawn - if (living_pawn.do_after_count()) - return // Don't interrupt our other ability - var/atom/target = controller.blackboard[target_key] - if (QDELETED(target) || HAS_TRAIT(target, TRAIT_OVERWATCH_IMMUNE)) - return // We should probably let miners move sometimes - var/time_on_target = controller.blackboard[BB_BASIC_MOB_HAS_TARGET_TIME] || 0 - if (time_on_target < 5 SECONDS) - return // We need to spend some time acquiring our target first - return ..() - /datum/ai_planning_subtree/use_mob_ability/gaze - ability_key = BB_WATCHER_GAZE finish_planning = TRUE /datum/ai_planning_subtree/use_mob_ability/gaze/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) - var/mob/living/watcher = controller.pawn - if (watcher.health > watcher.maxHealth * 0.66) // When we're a little hurt - return var/mob/living/target = controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] if (!isliving(target)) return // Don't do this if there's nothing hostile around or if our target is a mech + var/time_on_target = controller.blackboard[BB_BASIC_MOB_HAS_TARGET_TIME] || 0 + if (time_on_target < 5 SECONDS) + return // We need to spend some time acquiring our target first return ..() /datum/ai_planning_subtree/ranged_skirmish/watcher 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 e4eb9562f53..9426db41cca 100644 --- a/code/modules/mob/living/basic/lavaland/watcher/watcher_gaze.dm +++ b/code/modules/mob/living/basic/lavaland/watcher/watcher_gaze.dm @@ -8,7 +8,7 @@ button_icon_state = "gaze" background_icon_state = "bg_demon" overlay_icon_state = "bg_demon_border" - cooldown_time = 30 SECONDS + cooldown_time = 20 SECONDS check_flags = AB_CHECK_CONSCIOUS | AB_CHECK_INCAPACITATED click_to_activate = FALSE shared_cooldown = NONE 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 36ad2d61b4c..0c8194c524a 100644 --- a/code/modules/mob/living/basic/lavaland/watcher/watcher_overwatch.dm +++ b/code/modules/mob/living/basic/lavaland/watcher/watcher_overwatch.dm @@ -1,5 +1,6 @@ /** * Automatically shoot at a target if they do anything while this is active on them. + * Currently not given to any mob, but retained so admins can use it. */ /datum/action/cooldown/mob_cooldown/watcher_overwatch name = "Overwatch"