mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-04-26 18:11:54 +01:00
* port minebots to basic mobs and add some behavior * remove unused define * update is_blocked_turf usage * fix radio, goldgrub, and armor upgrade * standardize blackboard names * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: warriorstar-orion <orion@snowfrost.garden> * lewc review * whoops * Apply suggestions from code review Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com> Signed-off-by: warriorstar-orion <orion@snowfrost.garden> --------- Signed-off-by: warriorstar-orion <orion@snowfrost.garden> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
32 lines
1.2 KiB
Plaintext
32 lines
1.2 KiB
Plaintext
/datum/ai_behavior/find_mineral_wall
|
|
|
|
/datum/ai_behavior/find_mineral_wall/perform(seconds_per_tick, datum/ai_controller/controller, found_wall_key)
|
|
var/mob/living_pawn = controller.pawn
|
|
|
|
for(var/turf/simulated/mineral/potential_wall in oview(9, living_pawn))
|
|
if(!check_if_mineable(controller, potential_wall)) // check if its surrounded by walls
|
|
continue
|
|
controller.set_blackboard_key(found_wall_key, potential_wall) // closest wall first!
|
|
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_SUCCEEDED
|
|
|
|
return AI_BEHAVIOR_DELAY | AI_BEHAVIOR_FAILED
|
|
|
|
/// Check to see if we can get to and mine the turf the mineral is in
|
|
/datum/ai_behavior/find_mineral_wall/proc/check_if_mineable(datum/ai_controller/controller, turf/target_wall)
|
|
var/mob/living/source = controller.pawn
|
|
var/direction_to_turf = get_dir(target_wall, source)
|
|
if(!IS_DIR_DIAGONAL(direction_to_turf))
|
|
return TRUE
|
|
var/list/directions_to_check = list()
|
|
for(var/direction_check in GLOB.cardinal)
|
|
if(direction_check & direction_to_turf)
|
|
directions_to_check += direction_check
|
|
|
|
for(var/direction in directions_to_check)
|
|
var/turf/test_turf = get_step(target_wall, direction)
|
|
if(isnull(test_turf))
|
|
continue
|
|
if(!test_turf.is_blocked_turf(source_atom = source))
|
|
return TRUE
|
|
return FALSE
|