mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-19 12:05:59 +01:00
Monkeys and dogs no longer yoink items they can't reach. (#60150)
* Monkeys and dogs no longer yoink items they can't reach. Title. More ai behavior botherations.
This commit is contained in:
@@ -10,15 +10,12 @@
|
||||
var/mob/living/living_pawn = controller.pawn
|
||||
var/obj/item/fetch_thing = controller.blackboard[BB_FETCH_TARGET]
|
||||
|
||||
if(fetch_thing.anchored || !isturf(fetch_thing.loc) || IS_EDIBLE(fetch_thing)) //either we can't pick it up, or we'd rather eat it, so stop trying.
|
||||
//either we can't pick it up, or we'd rather eat it, so stop trying.
|
||||
if(fetch_thing.anchored || !isturf(fetch_thing.loc) || IS_EDIBLE(fetch_thing) || !living_pawn.CanReach(fetch_thing))
|
||||
finish_action(controller, FALSE)
|
||||
return
|
||||
|
||||
if(in_range(living_pawn, fetch_thing))
|
||||
finish_action(controller, TRUE)
|
||||
return
|
||||
|
||||
finish_action(controller, FALSE)
|
||||
finish_action(controller, TRUE)
|
||||
|
||||
/datum/ai_behavior/fetch/finish_action(datum/ai_controller/controller, success)
|
||||
. = ..()
|
||||
|
||||
@@ -79,12 +79,13 @@
|
||||
var/obj/item/target = controller.blackboard[BB_MONKEY_PICKUPTARGET]
|
||||
|
||||
var/mob/living/victim = target.loc
|
||||
var/mob/living/living_pawn = controller.pawn
|
||||
|
||||
if(!istype(victim))
|
||||
if(!istype(victim) || !living_pawn.CanReach(victim))
|
||||
finish_action(controller, FALSE)
|
||||
return
|
||||
|
||||
var/mob/living/living_pawn = controller.pawn
|
||||
|
||||
|
||||
victim.visible_message(span_warning("[living_pawn] starts trying to take [target] from [victim]!"), span_danger("[living_pawn] tries to take [target]!"))
|
||||
|
||||
@@ -92,7 +93,7 @@
|
||||
|
||||
var/success = FALSE
|
||||
|
||||
if(do_mob(living_pawn, victim, MONKEY_ITEM_SNATCH_DELAY) && target)
|
||||
if(do_mob(living_pawn, victim, MONKEY_ITEM_SNATCH_DELAY) && target && living_pawn.CanReach(victim))
|
||||
|
||||
for(var/obj/item/I in victim.held_items)
|
||||
if(I == target)
|
||||
|
||||
Reference in New Issue
Block a user