anchor.diff:  	var/oldloc = null
   
   	#define HULL_BREACH		1
  -	#define BRIDGE_MODE		2
  +	#define LINE_SPACE_MODE		2
   	#define FIX_TILE		3
   	#define AUTO_TILE		4
   	#define PLACE_TILE		5
  
positive.code: 
  	//Normal scanning procedure. We have tiles loaded, are not emagged.
  	if(!target && emagged < 2)
  		if(targetdirection != null) //The bot is in bridge mode.
  			//Try to find a space tile immediately in our selected direction.
  			var/turf/T = get_step(src, targetdirection)
  			if(istype(T, /turf/open/space))
  				target = T
  
  			else //Find a space tile farther way!
  				target = scan(/turf/open/space)
  			process_type = BRIDGE_MODE
  
  		if(!target)
  			process_type = HULL_BREACH //Ensures the floorbot does not try to "fix" space areas or shuttle docking zones.
  
negative.code: /mob/living/simple_animal/bot/floorbot/proc/repair(turf/target_turf)
  
  	if(istype(target_turf, /turf/open/space/))
  		 //Must be a hull breach or in line mode to continue.
  		if(!is_hull_breach(target_turf) && !targetdirection)
  			target = null
  			return
  	else if(!istype(target_turf, /turf/open/floor))
  		return
  	if(istype(target_turf, /turf/open/space/)) //If we are fixing an area not part of pure space, it is
  		anchored = 1
  		icon_state = "floorbot-c"
  		visible_message("<span class='notice'>[targetdirection ? "[src] begins installing a bridge plating." : "[src] begins to repair the hole."] </span>")
  		mode = BOT_REPAIRING
  		sleep(50)
  		if(mode == BOT_REPAIRING && src.loc == target_turf)
  			if(autotile) //Build the floor and include a tile.
  				target_turf.ChangeTurf(/turf/open/floor/plasteel)
  			else //Build a hull plating without a floor tile.
  				target_turf.ChangeTurf(/turf/open/floor/plating)
  
  	else
  		var/turf/open/floor/F = target_turf
  		if(replacetiles && F.type != initial(tiletype.turf_type) && specialtiles && !istype(F, /turf/open/floor/plating))
  			anchored = 1
  			icon_state = "floorbot-c"
  			mode = BOT_REPAIRING
  			visible_message("<span class='notice'>[src] begins replacing the floor tiles.</span>")
  			sleep(50)
  			if(mode == BOT_REPAIRING && F && src.loc == F)
  				F.broken = 0
  				F.burnt = 0
  				F.ChangeTurf(initial(tiletype.turf_type))
  				specialtiles -= 1
  				if(specialtiles == 0)
  					speak("Requesting refill of custom floortiles to continue replacing.")
  			
  		else if(F.type != initial(tiletype.turf_type) && (F.broken || F.burnt || istype(F, /turf/open/floor/plating)) || F.type == (initial(tiletype.turf_type) && (F.broken || F.burnt)))
  			anchored = 1
  			icon_state = "floorbot-c"
  			mode = BOT_REPAIRING
  			visible_message("<span class='notice'>[src] begins repairing the floor.</span>")
  			sleep(50)
  			if(mode == BOT_REPAIRING && F && src.loc == F)
  				F.broken = 0
  				F.burnt = 0
  				F.ChangeTurf(/turf/open/floor/plasteel)
  	mode = BOT_IDLE
  	update_icon()
  	anchored = 0
  	target = null
  
  /mob/living/simple_animal/bot/floorbot/update_icon()
  	icon_state = "floorbot[on]"
  