/
dont_target_friends.dm
32 lines (25 loc) · 1.38 KB
/
dont_target_friends.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/// Don't target an atom in our friends list (or turfs), anything else is fair game
/datum/targeting_strategy/basic/not_friends
/// Stop regarding someone as a valid target once they pass this stat level, setting it to DEAD means you will happily attack corpses
var/attack_until_past_stat = HARD_CRIT
/// If we can try to closed turfs or not
var/attack_closed_turf = FALSE
///Returns true or false depending on if the target can be attacked by the mob
/datum/targeting_strategy/basic/not_friends/can_attack(mob/living/living_mob, atom/target, vision_range)
if(attack_closed_turf && isclosedturf(target))
return TRUE
if(target in living_mob.ai_controller.blackboard[BB_FRIENDS_LIST])
return FALSE
return ..()
///friends dont care about factions
/datum/targeting_strategy/basic/not_friends/faction_check(mob/living/living_mob, mob/living/the_target)
return FALSE
/datum/targeting_strategy/basic/not_friends/attack_closed_turfs
attack_closed_turf = TRUE
/// Subtype that allows us to target items while deftly avoiding attacking our allies. Be careful when it comes to targeting items as an AI could get trapped targeting something it can't destroy.
/datum/targeting_strategy/basic/not_friends/allow_items
/datum/targeting_strategy/basic/not_friends/allow_items/can_attack(mob/living/living_mob, atom/the_target, vision_range)
. = ..()
if(isitem(the_target))
// trust fall exercise
return TRUE