mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +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:
@@ -112,7 +112,7 @@
|
||||
/datum/ai_behavior/goliath_dig/perform(seconds_per_tick, datum/ai_controller/controller, target_key)
|
||||
var/turf/target_turf = controller.blackboard[target_key]
|
||||
var/mob/living/basic/basic_mob = controller.pawn
|
||||
if(!basic_mob.CanReach(target_turf))
|
||||
if(!target_turf.IsReachableBy(basic_mob))
|
||||
return AI_BEHAVIOR_DELAY
|
||||
basic_mob.melee_attack(target_turf)
|
||||
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
var/times_to_attack = 4
|
||||
|
||||
/datum/action/cooldown/mob_cooldown/mook_ability/mook_leap/Activate(atom/target)
|
||||
if(owner.CanReach(target))
|
||||
if(target.IsReachableBy(owner))
|
||||
attack_combo(target)
|
||||
StartCooldown()
|
||||
return TRUE
|
||||
@@ -74,14 +74,14 @@
|
||||
owner.throw_at(target = final_turf, range = 7, speed = 1, spin = FALSE, callback = CALLBACK(src, PROC_REF(attack_combo), target))
|
||||
|
||||
/datum/action/cooldown/mob_cooldown/mook_ability/mook_leap/proc/attack_combo(atom/target)
|
||||
if(!owner.CanReach(target))
|
||||
if(!target.IsReachableBy(owner))
|
||||
return FALSE
|
||||
|
||||
for(var/i in 0 to (times_to_attack - 1))
|
||||
addtimer(CALLBACK(src, PROC_REF(attack_target), target), i * attack_interval)
|
||||
|
||||
/datum/action/cooldown/mob_cooldown/mook_ability/mook_leap/proc/attack_target(atom/target)
|
||||
if(!owner.CanReach(target) || owner.stat == DEAD)
|
||||
if(!target.IsReachableBy(owner) || owner.stat == DEAD)
|
||||
return
|
||||
var/mob/living/basic/basic_owner = owner
|
||||
basic_owner.melee_attack(target, ignore_cooldown = TRUE)
|
||||
|
||||
Reference in New Issue
Block a user