Skip to content

Commit

Permalink
Floorbot bug fix + Bridgemode Removal (ParadiseSS13#22531)
Browse files Browse the repository at this point in the history
* commented out

* deleted bridge mode and targetdirection

* Fixes replace tiles bug

* Autotile - Damaged floor fix

* Break_tile var moved up. SHOULD be final

* Update code/modules/mob/living/simple_animal/bot/floorbot.dm

Co-authored-by: Henri215 <[email protected]>

---------

Co-authored-by: Henri215 <[email protected]>
  • Loading branch information
Oyu07 and Henri215 authored Oct 22, 2023
1 parent 37d3a3d commit eaa4148
Showing 1 changed file with 12 additions and 43 deletions.
55 changes: 12 additions & 43 deletions code/modules/mob/living/simple_animal/bot/floorbot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
window_name = "Automatic Station Floor Repairer v1.1"

var/process_type //Determines what to do when process_scan() recieves a target. See process_scan() for details.
var/targetdirection
var/amount = 10
var/replacetiles = 0
var/eattiles = 0
Expand All @@ -34,7 +33,6 @@
var/toolbox_color = ""

#define HULL_BREACH 1
#define BRIDGE_MODE 2
#define FIX_TILE 3
#define AUTO_TILE 4
#define REPLACE_TILE 5
Expand Down Expand Up @@ -83,13 +81,6 @@
dat += "Repair damaged tiles and platings: <A href='?src=[UID()];operation=fix'>[fixfloors ? "Yes" : "No"]</A><BR>"
dat += "Traction Magnets: <A href='?src=[UID()];operation=anchor'>[anchored ? "Engaged" : "Disengaged"]</A><BR>"
dat += "Patrol Station: <A href='?src=[UID()];operation=patrol'>[auto_patrol ? "Yes" : "No"]</A><BR>"
var/bmode
if(targetdirection)
bmode = dir2text(targetdirection)
else
bmode = "disabled"
dat += "Bridge Mode : <A href='?src=[UID()];operation=bridgemode'>[bmode]</A><BR>"

return dat


Expand Down Expand Up @@ -135,20 +126,6 @@
nag_on_empty = !nag_on_empty
if("anchor")
anchored = !anchored

if("bridgemode")
var/setdir = input("Select construction direction:") as null|anything in list("north","east","south","west","disable")
switch(setdir)
if("north")
targetdirection = 1
if("south")
targetdirection = 2
if("east")
targetdirection = 4
if("west")
targetdirection = 8
if("disable")
targetdirection = null
update_controls()

/mob/living/simple_animal/bot/floorbot/handle_automated_action()
Expand Down Expand Up @@ -176,16 +153,6 @@

//Normal scanning procedure. We have tiles loaded, are not emagged.
if(!target && emagged < 2 && amount > 0)
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(isspaceturf(T))
target = T

else //Find a space tile farther way!
target = scan(/turf/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.
target = scan(/turf/space)
Expand Down Expand Up @@ -279,10 +246,6 @@
if(is_hull_breach(scan_target)) //Ensure that the targeted space turf is actually part of the station, and not random space.
result = scan_target
anchored = TRUE //Prevent the floorbot being blown off-course while trying to reach a hull breach.
if(BRIDGE_MODE) //Only space turfs in our chosen direction are considered.
if(get_dir(src, scan_target) == targetdirection)
result = scan_target
anchored = TRUE
if(REPLACE_TILE)
F = scan_target
if(istype(F, /turf/simulated/floor/plating)) //The floor must not already have a tile.
Expand All @@ -301,8 +264,8 @@

/mob/living/simple_animal/bot/floorbot/proc/repair(turf/target_turf)
if(isspaceturf(target_turf))
//Must be a hull breach or in bridge mode to continue.
if(!is_hull_breach(target_turf) && !targetdirection)
//Must be a hull breach to continue.
if(!is_hull_breach(target_turf))
target = null
return

Expand All @@ -317,7 +280,7 @@
anchored = TRUE

if(isspaceturf(target_turf)) //If we are fixing an area not part of pure space, it is
visible_message("<span class='notice'>[targetdirection ? "[src] begins installing a bridge plating." : "[src] begins to repair the hole."] </span>")
visible_message("<span class='notice'>[src] begins to repair the hole.</span>")
mode = BOT_REPAIRING
update_icon(UPDATE_ICON_STATE)
addtimer(CALLBACK(src, PROC_REF(make_bridge_plating), target_turf), 5 SECONDS)
Expand All @@ -343,13 +306,19 @@
target = null

/mob/living/simple_animal/bot/floorbot/proc/make_bridge_plating(turf/target_turf)
var/turf/simulated/floor/F = target
if(mode != BOT_REPAIRING)
return

if(autotile) //Build the floor and include a tile.
if(replacetiles)
F.break_tile_to_plating()
target_turf.ChangeTurf(/turf/simulated/floor/plasteel)
else //Build a hull plating without a floor tile.
target_turf.ChangeTurf(/turf/simulated/floor/plating)
else
if(autotile) //Build the floor and include a tile.
F.break_tile_to_plating()
target_turf.ChangeTurf(/turf/simulated/floor/plasteel)
else //Build a hull plating without a floor tile.
target_turf.ChangeTurf(/turf/simulated/floor/plating)
mode = BOT_IDLE
amount--
update_icon(UPDATE_ICON_STATE)
Expand Down

0 comments on commit eaa4148

Please sign in to comment.