[MIRROR] Cleanbot fix (#5720)

* Cleanbot fix (#36003)

cl selea
fix: fixed floorbot
fix: fixed cleanbot
refactor: improved pathiding in case of given minimal distance;improved sanitation
/cl
closes #35995, #35919

* Cleanbot fix
This commit is contained in:
CitadelStationBot
2018-02-27 05:03:42 -06:00
committed by Poojawa
parent f38a3b3a39
commit ff918707ee
3 changed files with 50 additions and 49 deletions
@@ -145,6 +145,12 @@
mode = BOT_IDLE
return
if(loc == get_turf(target))
if(!(check_bot(target) && prob(50))) //Target is not defined at the parent. 50% chance to still try and clean so we dont get stuck on the last blood drop.
UnarmedAttack(target) //Rather than check at every step of the way, let's check before we do an action, so we can rescan before the other bot.
else
shuffle = TRUE //Shuffle the list the next time we scan so we dont both go the same way.
path = list()
if(!path || path.len == 0) //No path, need a new one
//Try to produce a path to the target, and ignore airlocks to which it has access.
path = get_path_to(src, target.loc, /turf/proc/Distance_cardinal, 0, 30, id=access_card)
@@ -159,13 +165,6 @@
mode = BOT_IDLE
return
if(target && loc == target.loc)
if(!(check_bot(target) && prob(50))) //Target is not defined at the parent. 50% chance to still try and clean so we dont get stuck on the last blood drop.
UnarmedAttack(target) //Rather than check at every step of the way, let's check before we do an action, so we can rescan before the other bot.
else
shuffle = TRUE //Shuffle the list the next time we scan so we dont both go the same way.
path = list()
oldloc = loc
/mob/living/simple_animal/bot/cleanbot/proc/get_targets()
@@ -224,24 +224,7 @@
bot_patrol()
if(target)
if(path.len == 0)
if(!isturf(target))
var/turf/TL = get_turf(target)
path = get_path_to(src, TL, /turf/proc/Distance_cardinal, 0, 30, id=access_card,simulated_only = 0)
else
path = get_path_to(src, target, /turf/proc/Distance_cardinal, 0, 30, id=access_card,simulated_only = 0)
if(!bot_move(target))
add_to_ignore(target)
target = null
mode = BOT_IDLE
return
else if( !bot_move(target) )
target = null
mode = BOT_IDLE
return
if(loc == target || loc == target.loc)
if(loc == target || loc == get_turf(target))
if(check_bot(target)) //Target is not defined at the parent
shuffle = TRUE
if(prob(50)) //50% chance to still try to repair so we dont end up with 2 floorbots failing to fix the last breach
@@ -262,6 +245,24 @@
target = null
path = list()
return
if(path.len == 0)
if(!isturf(target))
var/turf/TL = get_turf(target)
path = get_path_to(src, TL, /turf/proc/Distance_cardinal, 0, 30, id=access_card,simulated_only = 0)
else
path = get_path_to(src, target, /turf/proc/Distance_cardinal, 0, 30, id=access_card,simulated_only = 0)
if(!bot_move(target))
add_to_ignore(target)
target = null
mode = BOT_IDLE
return
else if( !bot_move(target) )
target = null
mode = BOT_IDLE
return
oldloc = loc