forked from Monkestation/Monkestation2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic Watchers & Basilisks (tgstation#77630)
This one is a double feature because Watchers and Basilisks share the same typepath. You might see a couple more of those. As is tradition I decided to fuck with them rather than just port them. Here's what's up. **Basilisks** ![image](https://github.com/tgstation/tgstation/assets/7483112/9e4b0115-65dd-4df7-b62a-21c7be8549bf) ![image](https://github.com/tgstation/tgstation/assets/7483112/59162e68-7d73-4659-9531-5078ff751228) - Have a new soulless sprite which looks less like a living blue hedge. - Walk at you and shoot you while you are not in range (just like before). - Become supercharged if they become "heated" by lava, lasers, or temperature weapons. This was a feature they also previously had but they would never encounter lava, so now it also works if you use the wrong gun on them. - Lose their supercharge if you cool them down. - Otherwise pretty normal mobs. **Watchers** https://www.youtube.com/watch?v=kOq_Bf78k5A Here's a traditional video of me intentionally getting hit by mechanics (trust me its definitely on purpose) - They glow emmissively a little bit so you can see them from further away. - Their eyes light up about 0.5 seconds before they are able to shoot at you. - No longer melee attack, instead try to stay out of melee. - Will occasionally put you into "Overwatch", meaning they will shoot you rapidly if you move or act while they're staring at you for a brief time period (after which you become immune for 12 seconds, and during which other watchers will play fair and stop shooting at you). - If they start taking damage they will also start using their "Gaze" attack, look away or suffer some kind of negative effect! - - Normal watcher gaze flashes and confuses you. - - Magmawing watcher gaze obviously burns (and briefly stuns) you. - - Icewing watcher gaze freezes you and throws you backwards. - Magnetically attract and eat diamonds. They also used to do this, but just if they happened to coincidentally walk past some. **Other accompanying changes** All basic mobs will now adopt the "stop gliding" trait if they get slowed down too much. I moved behaviour for "fire a projectile from this atom" into a helper proc because I was using it in three places and I will probably use it in more places. There are probably other places in the existing code which could be using this. I think I made the basic mob melee attack forecast default a little more forgiving, they were fucking me up too much and I am the playtester. Another one off the list. New tricks for old dogs. Framework for making mobs with ranged attacks "fairer" (you can see when they are ready to shoot you). More (hopefully) versatile AI behaviours which we will reuse later (I hope I'm not duplicating one someone already made). If our players "enjoy" them enough we can give more mobs "don't look at me" mechanics. Removes some soul sprites. :cl: refactor: Basilisks and Watchers now use the basic mob framework. Please bug report any unusual behaviour. sprite: Basilisks have new sprites. add: Basilisks will go into a frenzy if heated by energy weapons or temperature beams as well as by lava. add: Watcher eyes will be illuminated briefly when they are ready to fire at you. add: Watchers can now briefly put you into "Overwatch" and penalise you for moving while they can see you. add: Wounded watchers will occasionally punish players who look at them. balance: Unusual watcher variants are more likely to appear. /:cl:
- Loading branch information
Showing
56 changed files
with
1,086 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
code/datums/ai/basic_mobs/basic_subtrees/maintain_distance.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/// Step away if too close, or towards if too far | ||
/datum/ai_planning_subtree/maintain_distance | ||
/// Blackboard key holding atom we want to stay away from | ||
var/target_key = BB_BASIC_MOB_CURRENT_TARGET | ||
/// How close will we allow our target to get? | ||
var/minimum_distance = 3 | ||
/// How far away will we allow our target to get? | ||
var/maximum_distance = 6 | ||
/// How far do we look for our target? | ||
var/view_distance = 10 | ||
|
||
/datum/ai_planning_subtree/maintain_distance/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) | ||
. = ..() | ||
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 | ||
var/range = get_dist(controller.pawn, target) | ||
if (range < minimum_distance) | ||
controller.queue_behavior(/datum/ai_behavior/step_away, target_key) | ||
return | ||
if (range > maximum_distance) | ||
controller.queue_behavior(/datum/ai_behavior/pursue_to_range, target_key, maximum_distance) | ||
return | ||
|
||
/// Take one step away | ||
/datum/ai_behavior/step_away | ||
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION | ||
required_distance = 0 | ||
action_cooldown = 0.2 SECONDS | ||
|
||
/datum/ai_behavior/step_away/setup(datum/ai_controller/controller, target_key) | ||
. = ..() | ||
var/atom/current_target = controller.blackboard[target_key] | ||
if (QDELETED(current_target)) | ||
return FALSE | ||
|
||
var/mob/living/our_pawn = controller.pawn | ||
our_pawn.face_atom(current_target) | ||
|
||
var/turf/next_step = get_step_away(controller.pawn, current_target) | ||
if (!isnull(next_step) && !next_step.is_blocked_turf(exclude_mobs = TRUE)) | ||
set_movement_target(controller, target = next_step, new_movement = /datum/ai_movement/basic_avoidance/backstep) | ||
return TRUE | ||
|
||
var/list/all_dirs = GLOB.alldirs.Copy() | ||
all_dirs -= get_dir(controller.pawn, next_step) | ||
all_dirs -= get_dir(controller.pawn, current_target) | ||
shuffle_inplace(all_dirs) | ||
|
||
for (var/dir in all_dirs) | ||
next_step = get_step(controller.pawn, dir) | ||
if (!isnull(next_step) && !next_step.is_blocked_turf(exclude_mobs = TRUE)) | ||
set_movement_target(controller, target = next_step, new_movement = /datum/ai_movement/basic_avoidance/backstep) | ||
return TRUE | ||
return FALSE | ||
|
||
/datum/ai_behavior/step_away/perform(seconds_per_tick, datum/ai_controller/controller) | ||
. = ..() | ||
finish_action(controller, succeeded = TRUE) | ||
|
||
/datum/ai_behavior/step_away/finish_action(datum/ai_controller/controller, succeeded) | ||
. = ..() | ||
controller.change_ai_movement_type(initial(controller.ai_movement)) | ||
|
||
/// Pursue a target until we are within a provided range | ||
/datum/ai_behavior/pursue_to_range | ||
behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION | AI_BEHAVIOR_MOVE_AND_PERFORM | ||
|
||
/datum/ai_behavior/pursue_to_range/setup(datum/ai_controller/controller, target_key, range) | ||
. = ..() | ||
var/atom/current_target = controller.blackboard[target_key] | ||
if (QDELETED(current_target)) | ||
return FALSE | ||
if (get_dist(controller.pawn, current_target) <= range) | ||
return FALSE | ||
set_movement_target(controller, current_target) | ||
|
||
/datum/ai_behavior/pursue_to_range/perform(seconds_per_tick, datum/ai_controller/controller, target_key, range) | ||
var/atom/current_target = controller.blackboard[target_key] | ||
if (!QDELETED(current_target) && get_dist(controller.pawn, current_target) > range) | ||
return | ||
finish_action(controller, succeeded = TRUE) |
53 changes: 53 additions & 0 deletions
53
code/datums/ai/basic_mobs/basic_subtrees/ranged_skirmish.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/// Fire a ranged attack without interrupting movement. | ||
/datum/ai_planning_subtree/ranged_skirmish | ||
operational_datums = list(/datum/component/ranged_attacks) | ||
/// Blackboard key holding target atom | ||
var/target_key = BB_BASIC_MOB_CURRENT_TARGET | ||
/// What AI behaviour do we actually run? | ||
var/datum/ai_behavior/ranged_skirmish/attack_behavior = /datum/ai_behavior/ranged_skirmish | ||
|
||
/datum/ai_planning_subtree/ranged_skirmish/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) | ||
. = ..() | ||
var/atom/target = controller.blackboard[target_key] | ||
if(QDELETED(target)) | ||
return | ||
controller.queue_behavior(attack_behavior, target_key, BB_TARGETTING_DATUM, BB_BASIC_MOB_CURRENT_TARGET_HIDING_LOCATION) | ||
|
||
/// How often will we try to perform our ranged attack? | ||
/datum/ai_behavior/ranged_skirmish | ||
action_cooldown = 1 SECONDS | ||
/// If target is further away than this we don't fire | ||
var/max_range = 9 | ||
/// If target is closer than this we don't fire | ||
var/min_range = 2 | ||
|
||
/datum/ai_behavior/ranged_skirmish/setup(datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key) | ||
. = ..() | ||
var/atom/target = controller.blackboard[hiding_location_key] || controller.blackboard[target_key] | ||
return !QDELETED(target) | ||
|
||
/datum/ai_behavior/ranged_skirmish/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targetting_datum_key, hiding_location_key) | ||
. = ..() | ||
var/atom/target = controller.blackboard[target_key] | ||
if (QDELETED(target)) | ||
finish_action(controller, succeeded = FALSE) | ||
return | ||
|
||
var/datum/targetting_datum/targetting_datum = controller.blackboard[targetting_datum_key] | ||
if(!targetting_datum.can_attack(controller.pawn, target)) | ||
finish_action(controller, succeeded = FALSE) | ||
return | ||
|
||
var/hiding_target = targetting_datum.find_hidden_mobs(controller.pawn, target) | ||
controller.set_blackboard_key(hiding_location_key, hiding_target) | ||
|
||
target = hiding_target || target | ||
|
||
var/distance = get_dist(controller.pawn, target) | ||
if (distance > max_range || distance < min_range) | ||
finish_action(controller, succeeded = FALSE) | ||
return | ||
|
||
var/mob/living/basic/gunman = controller.pawn | ||
gunman.RangedAttack(target) | ||
finish_action(controller, succeeded = TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.