mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
Canreach refactor (#93165)
## About The Pull Request ports https://github.com/DaedalusDock/daedalusdock/pull/1144 ports https://github.com/DaedalusDock/daedalusdock/pull/1147 full credit to @Kapu1178 for the juice instead of `reacher.CanReach(target)` we now do `target.CanBeReachedBy(reacher)`, this allows us to give special behavior to atoms which we want to reach, which is exactly what I need for a feature I'm working on. ## Why It's Good For The Game allows us to be more flexible with reachability ## Changelog 🆑 refactor: refactored how reaching items works, report any oddities with being unable to reach something you should be able to! /🆑
This commit is contained in:
@@ -26,7 +26,8 @@
|
||||
|
||||
/datum/ai_behavior/basic_melee_attack/opportunistic/perform(seconds_per_tick, datum/ai_controller/controller, target_key, targeting_strategy_key, hiding_location_key)
|
||||
var/atom/movable/atom_pawn = controller.pawn
|
||||
if(!atom_pawn.CanReach(controller.blackboard[target_key]))
|
||||
var/atom/atom_target = controller.blackboard[target_key]
|
||||
if(!atom_target.IsReachableBy(atom_pawn))
|
||||
return AI_BEHAVIOR_INSTANT | AI_BEHAVIOR_SUCCEEDED
|
||||
. = ..()
|
||||
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
if (QDELETED(target))
|
||||
return FALSE
|
||||
var/mob/living/pawn = controller.pawn
|
||||
if (!pawn.CanReach(target))
|
||||
if (!target.IsReachableBy(pawn))
|
||||
return FALSE
|
||||
return pawn.loc == target || pawn.buckled == target
|
||||
|
||||
|
||||
Reference in New Issue
Block a user