Dogs now flee from mobs with tongs (#78797)

AI dogs with the dog controller behaviour will flee from a target with
tongs in hand.

Untested because I literally cannot play byond.

## Why It's Good For The Game
https://www.youtube.com/watch?v=cXIAZtwvgz0

## Changelog
🆑 oranges
add: Dogs now react to centrist grillers more realistically
/🆑
This commit is contained in:
oranges
2023-10-06 23:47:36 +01:00
committed by GitHub
parent 3f8bea1322
commit d70462a8ec
3 changed files with 48 additions and 0 deletions
@@ -0,0 +1,39 @@
/**
* Find mobs who are holding the configurable object type
*
* This is an extension of basic targeting behaviour, that allows you to
* only target the mob if they have a specific item in their hand.
*
*/
/datum/targetting_datum/basic/holding_object
// We will find mobs who are holding this object in their hands
var/object_type_path = null
/**
* Create an instance of the holding object targeting datum
*
* * object_type_path Pass an object type path, this will be compared to the items
* in targets hands to filter the target list.
*/
/datum/targetting_datum/basic/holding_object/New(object_type_path)
if (!ispath(object_type_path))
stack_trace("trying to create an item targeting datum with no valid typepath")
// Leaving object type as null will make this basically a noop
return
src.object_type_path = object_type_path
///Returns true or false depending on if the target can be attacked by the mob
/datum/targetting_datum/basic/holding_object/can_attack(mob/living/living_mob, atom/target, vision_range, check_faction = FALSE)
if (object_type_path == null)
return FALSE // no op
if(!ismob(target))
return FALSE // no hands no problems
// Look at me, type casting like a grown up
var/mob/targetmob = target
// Check if our parent behaviour agrees we can attack this target (we ignore faction by default)
var/can_attack = ..()
if(can_attack && targetmob.is_holding_item_of_type(object_type_path))
return TRUE // they have the item
// No valid target
return FALSE