Yet another bots refactor (#23162)

* initial test commit

* 2nd stage

* hull breach bug found

* 3rd small

* Master Merge

* fml

* one more time

* Merge failed incredibly bad, except commits

* 4th small

* 5th - Hull breach auto/replace tile bug fixed

* sleep

* avoid to avoid_bot

* indentation

* get_turf()

* even more comments

* Define edits

* eat tile order edit

* ui goes big

* Minor edits

* suggestions

* S Floor

* S Weapons check

* review

* I dont want TGUI on this

* Missed one

* review IF

* Returned the Return

* if error

* mode ==

* Reviews, Ty contra

* we shall NAG

* review

* Reviews

* Oppsie fixed

* tgui typo*

* TGUI Backend *fixed*

* Revert tgui backend edit, oopsie, small text edits

* Reviews

* emag autodoc + else if hateboner

* revert a change, non relevant

* undef

* revert tgui window size edit

* cleanbot cleanable list

* minor edit

* Review isspaceturf

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* List

* Emagged 1/0

* Cleanbot list edit

* emagged 1/0 2

* removed comment

* emag_act revert

* didnt commit?

---------

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Deniz
2023-12-31 10:18:31 +00:00
committed by GitHub
co-authored by Ryan
parent 4ce63de343
commit c49f362039
13 changed files with 165 additions and 157 deletions
@@ -181,7 +181,7 @@
return threatcount
//Check for weapons
if(judgebot.weaponscheck)
if(judgebot.weapons_check)
if(judgebot.check_for_weapons(l_hand))
threatcount += 4
if(judgebot.check_for_weapons(r_hand))
@@ -1595,7 +1595,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
threatcount += 4
//Check for weapons
if(judgebot.weaponscheck)
if(judgebot.weapons_check)
if(!idcard || !(ACCESS_WEAPONS in idcard.access))
if(judgebot.check_for_weapons(l_hand))
threatcount += 4
@@ -34,7 +34,7 @@
var/disabling_timer_id = null
var/list/player_access = list()
var/emagged = 0
var/emagged = FALSE
var/obj/item/card/id/access_card // the ID card that the bot "holds"
var/list/prev_access = list()
var/on = TRUE
@@ -201,6 +201,9 @@
return ..()
/mob/living/simple_animal/bot/mob_negates_gravity()
return anchored
/mob/living/simple_animal/bot/death(gibbed)
// Only execute the below if we successfully died
. = ..()
@@ -214,11 +217,10 @@
/mob/living/simple_animal/bot/emag_act(mob/user)
if(locked) //First emag application unlocks the bot's interface. Apply a screwdriver to use the emag again.
locked = FALSE
emagged = 1
to_chat(user, "<span class='notice'>You bypass [src]'s controls.</span>")
return
if(!locked && open) //Bot panel is unlocked by ID or emag, and the panel is screwed open. Ready for emagging.
emagged = 2
emagged = TRUE
remote_disabled = TRUE //Manually emagging the bot locks out the AI built in panel.
locked = TRUE //Access denied forever!
bot_reset()
@@ -469,12 +471,13 @@ scan() will search for a given type (such as turfs, human mobs, or objects) in t
Arguments: The object type to be searched (such as "/mob/living/carbon/human"), the old scan result to be ignored, if one exists,
and the view range, which defaults to 7 (full screen) if an override is not passed.
If the bot maintains an ignore list, it is also checked here.
If the bot has avoid_bot, which inserts its own path, it will ignore turfs with the same bot type
Example usage: patient = scan(/mob/living/carbon/human, oldpatient, 1)
The proc would return a human next to the bot to be set to the patient var.
Pass the desired type path itself, declaring a temporary var beforehand is not required.
*/
/mob/living/simple_animal/bot/proc/scan(atom/scan_type, atom/old_target, scan_range = DEFAULT_SCAN_RANGE)
/mob/living/simple_animal/bot/proc/scan(atom/scan_type, atom/old_target, scan_range = DEFAULT_SCAN_RANGE, avoid_bot)
var/final_result
for(var/scan in view(scan_range, src)) //Search for something in range!
var/atom/A = scan
@@ -482,6 +485,8 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r
continue //If not, keep searching!
if((A.UID() in ignore_list) || (A == old_target)) //Filter for blacklisted elements, usually unreachable or previously processed oness
continue
if(turf_has_bot(avoid_bot, get_turf(A))) //Ignores targets that already have a bot of the same type on it, meant for cleanbot and floorbot seperation
continue
var/scan_result = process_scan(A) //Some bots may require additional processing when a result is selected.
if(scan_result)
final_result = scan_result
@@ -489,6 +494,14 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r
continue //The current element failed assessment, move on to the next.
return final_result
/mob/living/simple_animal/bot/proc/turf_has_bot(avoid_bot, turf/turf_to_search)
if(!avoid_bot)
return FALSE
for(var/bot in turf_to_search)
if(istype(bot, avoid_bot))
return TRUE
return FALSE
//When the scan finds a target, run bot specific processing to select it for the next step. Empty by default.
/mob/living/simple_animal/bot/proc/process_scan(atom/scan_target)
return scan_target
@@ -736,7 +749,7 @@ Pass a positive integer as an argument to override a bot's default speed.
return FALSE
// check to see if we are the commanded bot
if(emagged == 2 || remote_disabled || hijacked) //Emagged bots do not respect anyone's authority! Bots with their remote controls off cannot get commands.
if(emagged || remote_disabled || hijacked) //Emagged bots do not respect anyone's authority! Bots with their remote controls off cannot get commands.
return FALSE
if(client)
@@ -879,8 +892,8 @@ Pass a positive integer as an argument to override a bot's default speed.
/mob/living/simple_animal/bot/proc/handle_hacking(mob/M) // refactored out of Topic/ to allow re-use by TGUIs
if(!canhack(M))
return
if(emagged != 2)
emagged = 2
if(!emagged)
emagged = TRUE
hacked = TRUE
locked = TRUE
to_chat(M, "<span class='warning'>[text_hack]</span>")
@@ -890,7 +903,7 @@ Pass a positive integer as an argument to override a bot's default speed.
else if(!hacked)
to_chat(M, "<span class='userdanger'>[text_dehack_fail]</span>")
else
emagged = 0
emagged = FALSE
hacked = FALSE
to_chat(M, "<span class='notice'>[text_dehack]</span>")
show_laws()
@@ -905,7 +918,7 @@ Pass a positive integer as an argument to override a bot's default speed.
return FALSE
if(user.incapacitated() || !(issilicon(user) || in_range(src, user)))
return TRUE
if(emagged == 2) //An emagged bot cannot be controlled by humans, silicons can if one hacked it.
if(emagged) //An emagged bot cannot be controlled by humans, silicons can if one hacked it.
if(!hacked) //Manually emagged by a human - access denied to all.
return TRUE
else if(!(issilicon(user) || ispulsedemon(user))) //Bot is hacked, so only silicons are allowed access.
@@ -919,7 +932,7 @@ Pass a positive integer as an argument to override a bot's default speed.
/mob/living/simple_animal/bot/proc/hack(mob/user)
var/hack
if(issilicon(user) || user.can_admin_interact()) //Allows silicons or admins to toggle the emag status of a bot.
hack += "[emagged == 2 ? "Software compromised! Unit may exhibit dangerous or erratic behavior." : "Unit operating normally. Release safety lock?"]<BR>"
hack += "[emagged ? "Software compromised! Unit may exhibit dangerous or erratic behavior." : "Unit operating normally. Release safety lock?"]<BR>"
hack += "Harm Prevention Safety System: <A href='?src=[UID()];operation=hack'>[emagged ? "<span class='bad'>DANGER</span>" : "Engaged"]</A><BR>"
else if(!locked) //Humans with access can use this option to hide a bot from the AI's remote control panel and PDA control.
hack += "Remote network control radio: <A href='?src=[UID()];operation=remote'>[remote_disabled ? "Disconnected" : "Connected"]</A><BR>"
@@ -1006,7 +1019,7 @@ Pass a positive integer as an argument to override a bot's default speed.
if(paicard && paicard.pai && paicard.pai.master && paicard.pai.pai_law0)
to_chat(src, "<span class='warning'>Your master, [paicard.pai.master], may overrule any and all laws.</span>")
to_chat(src, "0. [paicard.pai.pai_law0]")
if(emagged >= 2)
if(emagged)
to_chat(src, "<span class='danger'>1. #$!@#$32K#$</span>")
else
to_chat(src, "1. You are a machine built to serve the station's crew and AI(s).")
@@ -29,10 +29,27 @@
var/failed_steps
var/next_dest
var/next_dest_loc
var/static/list/clean_dirt = list(
/obj/effect/decal/cleanable/vomit,
/obj/effect/decal/cleanable/blood/gibs/robot,
/obj/effect/decal/cleanable/crayon,
/obj/effect/decal/cleanable/liquid_fuel,
/obj/effect/decal/cleanable/molten_object,
/obj/effect/decal/cleanable/tomato_smudge,
/obj/effect/decal/cleanable/egg_smudge,
/obj/effect/decal/cleanable/pie_smudge,
/obj/effect/decal/cleanable/flour,
/obj/effect/decal/cleanable/ash,
/obj/effect/decal/cleanable/greenglow,
/obj/effect/decal/cleanable/dirt
)
var/static/list/clean_blood = list(
/obj/effect/decal/cleanable/blood,
/obj/effect/decal/cleanable/trail_holder
)
/mob/living/simple_animal/bot/cleanbot/Initialize(mapload)
. = ..()
get_targets()
icon_state = "cleanbot[on]"
var/datum/job/janitor/J = new/datum/job/janitor
@@ -80,9 +97,8 @@
to_chat(user, "<span class='danger'>[src] buzzes and beeps.</span>")
/mob/living/simple_animal/bot/cleanbot/process_scan(obj/effect/decal/cleanable/D)
for(var/T in target_types)
if(istype(D, T))
return D
if(is_type_in_typecache(D, clean_dirt) || blood && is_type_in_typecache(D, clean_blood))
return D
/mob/living/simple_animal/bot/cleanbot/handle_automated_action()
if(!..())
@@ -91,7 +107,7 @@
if(mode == BOT_CLEANING)
return
if(emagged == 2) //Emag functions
if(emagged) //Emag functions
if(issimulatedturf(loc))
if(prob(10)) //Wets floors randomly
var/turf/simulated/T = loc
@@ -105,7 +121,7 @@
audible_message("[src] makes an excited beeping booping sound!")
if(!target) //Search for cleanables it can see.
target = scan(/obj/effect/decal/cleanable)
target = scan(/obj/effect/decal/cleanable, avoid_bot = /mob/living/simple_animal/bot/cleanbot)
if(!target && auto_patrol) //Search for cleanables it can see.
if(mode == BOT_IDLE || mode == BOT_START_PATROL)
@@ -136,32 +152,6 @@
oldloc = loc
/mob/living/simple_animal/bot/cleanbot/proc/get_targets()
target_types = new/list()
target_types += /obj/effect/decal/cleanable/blood/oil
target_types += /obj/effect/decal/cleanable/vomit
target_types += /obj/effect/decal/cleanable/blood/gibs/robot
target_types += /obj/effect/decal/cleanable/crayon
target_types += /obj/effect/decal/cleanable/liquid_fuel
target_types += /obj/effect/decal/cleanable/molten_object
target_types += /obj/effect/decal/cleanable/tomato_smudge
target_types += /obj/effect/decal/cleanable/egg_smudge
target_types += /obj/effect/decal/cleanable/pie_smudge
target_types += /obj/effect/decal/cleanable/flour
target_types += /obj/effect/decal/cleanable/ash
target_types += /obj/effect/decal/cleanable/greenglow
target_types += /obj/effect/decal/cleanable/dirt
if(blood)
target_types += /obj/effect/decal/cleanable/blood/xeno/
target_types += /obj/effect/decal/cleanable/blood/gibs/xeno
target_types += /obj/effect/decal/cleanable/blood/
target_types += /obj/effect/decal/cleanable/blood/gibs/
target_types += /obj/effect/decal/cleanable/blood/tracks
target_types += /obj/effect/decal/cleanable/dirt
target_types += /obj/effect/decal/cleanable/trail_holder
/mob/living/simple_animal/bot/cleanbot/proc/start_clean(obj/effect/decal/cleanable/target)
anchored = TRUE
icon_state = "cleanbot-c"
@@ -226,7 +216,6 @@
remote_disabled = !remote_disabled
if("blood")
blood =!blood
get_targets()
if("ejectpai")
ejectpai()
@@ -38,7 +38,7 @@
var/last_found //There's a delay
var/declare_arrests = TRUE //When making an arrest, should it notify everyone wearing sechuds?
var/idcheck = FALSE //If true, arrest people with no IDs
var/weaponscheck = TRUE //If true, arrest people for weapons if they don't have access
var/weapons_check = TRUE //If true, arrest people for weapons if they don't have access
var/check_records = TRUE //Does it check security records?
var/arrest_type = FALSE //If true, don't handcuff
var/projectile = /obj/item/projectile/beam/disabler //Holder for projectile type
@@ -111,7 +111,7 @@
/mob/living/simple_animal/bot/ed209/ui_data(mob/user)
var/list/data = ..()
data["check_id"] = idcheck
data["check_weapons"] = weaponscheck
data["check_weapons"] = weapons_check
data["check_warrant"] = check_records
data["arrest_mode"] = arrest_type // detain or arrest
data["arrest_declare"] = declare_arrests // announce arrests on radio
@@ -139,7 +139,7 @@
if("disableremote")
remote_disabled = !remote_disabled
if("authweapon")
weaponscheck = !weaponscheck
weapons_check = !weapons_check
if("authid")
idcheck = !idcheck
if("authwarrant")
@@ -185,7 +185,7 @@
/mob/living/simple_animal/bot/ed209/emag_act(mob/user)
..()
if(emagged == 2)
if(emagged)
if(user)
to_chat(user, "<span class='warning'>You short out [src]'s target assessment circuits.</span>")
oldtarget_name = user.name
@@ -416,7 +416,7 @@
/mob/living/simple_animal/bot/ed209/proc/set_weapon() //used to update the projectile type and firing sound
shoot_sound = 'sound/weapons/laser.ogg'
if(emagged == 2)
if(emagged)
if(lasercolor)
projectile = /obj/item/projectile/beam/disabler
else
@@ -482,11 +482,11 @@
var/mob/toshoot = pick(targets)
if(toshoot)
targets-=toshoot
if(prob(50) && emagged < 2)
emagged = 2
if(prob(50) && !emagged && !locked)
emagged = TRUE
set_weapon()
shootAt(toshoot)
emagged = 0
emagged = FALSE
set_weapon()
else
shootAt(toshoot)
@@ -17,19 +17,25 @@
req_access = list(ACCESS_CONSTRUCTION, ACCESS_ROBOTICS)
window_id = "autofloor"
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.
/// Determines what to do when process_scan() recieves a target. See process_scan() for details.
var/process_type
/// Tiles in inventory
var/amount = 10
var/replacetiles = 0
var/eattiles = 0
var/maketiles = 0
var/fixfloors = 0
var/autotile = 0
var/nag_on_empty = 1
var/nagged = 0 //Prevents the Floorbot nagging more than once per refill.
/// Add tiles to existing floor
var/replace_tiles = FALSE
/// Add floor tiles to inventory
var/eat_tiles = FALSE
/// Convert metal into floor tiles (drops on floor)
var/make_tiles = FALSE
var/fix_floor = FALSE
/// Fix the floor and include a tile.
var/autotile = FALSE
var/nag_on_empty = TRUE
/// Prevents the Floorbot nagging more than once per refill.
var/nagged = FALSE
var/max_targets = 50
var/turf/target
var/oldloc = null
var/oldloc
var/toolbox_color = ""
#define HULL_BREACH 1
@@ -37,6 +43,7 @@
#define AUTO_TILE 4
#define REPLACE_TILE 5
#define TILE_EMAG 6
#define MAX_AMOUNT 50 // Maximum tiles bot can have in storage
/mob/living/simple_animal/bot/floorbot/Initialize(mapload, new_toolbox_color)
. = ..()
@@ -75,10 +82,10 @@
/mob/living/simple_animal/bot/floorbot/ui_data(mob/user)
var/list/data = ..()
data["hullplating"] = autotile
data["replace"] = replacetiles
data["eat"] = eattiles
data["make"] = maketiles
data["fixfloor"] = fixfloors
data["replace"] = replace_tiles
data["eat"] = eat_tiles
data["make"] = make_tiles
data["fixfloor"] = fix_floor
data["nag_empty"] = nag_on_empty
data["magnet"] = anchored
data["tiles_amount"] = amount
@@ -109,15 +116,15 @@
if("autotile")
autotile = !autotile
if("replacetiles")
replacetiles = !replacetiles
replace_tiles = !replace_tiles
if("eattiles")
eattiles = !eattiles
eat_tiles = !eat_tiles
if("maketiles")
maketiles = !maketiles
make_tiles = !make_tiles
if("fixfloors")
fix_floor = !fix_floor
if("nagonempty")
nag_on_empty = !nag_on_empty
if("fixfloors")
fixfloors = !fixfloors
if("anchored")
anchored = !anchored
if("ejectpai")
@@ -126,9 +133,9 @@
/mob/living/simple_animal/bot/floorbot/attackby(obj/item/W , mob/user, params)
if(istype(W, /obj/item/stack/tile/plasteel))
var/obj/item/stack/tile/plasteel/T = W
if(amount >= 50)
if(amount >= MAX_AMOUNT)
return
var/loaded = min(50-amount, T.amount)
var/loaded = min(MAX_AMOUNT - amount, T.amount)
T.use(loaded)
amount += loaded
if(loaded > 0)
@@ -147,45 +154,45 @@
to_chat(user, "<span class='danger'>[src] buzzes and beeps.</span>")
/mob/living/simple_animal/bot/floorbot/handle_automated_action()
if(!..())
. = ..()
if(!.)
return
if(mode == BOT_REPAIRING)
if(mode == BOT_REPAIRING || mode == BOT_EAT_TILE || mode == BOT_MAKE_TILE)
return
if(amount <= 0 && !target) //Out of tiles! We must refill!
if(eattiles) //Configured to find and consume floortiles!
target = scan(/obj/item/stack/tile/plasteel)
process_type = null
if(!target && maketiles) //We did not manage to find any floor tiles! Scan for metal stacks and make our own!
target = scan(/obj/item/stack/sheet/metal)
process_type = null
return
else
if(nag_on_empty) //Floorbot is empty and cannot acquire more tiles, nag the engineers for more!
nag()
if(prob(5))
audible_message("[src] makes an excited booping beeping sound!")
//Normal scanning procedure. We have tiles loaded, are not emagged.
if(!target && emagged < 2 && amount > 0)
if(!target && !emagged && amount)
if(!target)
process_type = HULL_BREACH //Ensures the floorbot does not try to "fix" space areas or shuttle docking zones.
target = scan(/turf/space)
target = scan(/turf/space, avoid_bot = /mob/living/simple_animal/bot/floorbot)
if(!target && replacetiles) //Finds a floor without a tile and gives it one.
if(!target && replace_tiles) //Finds a floor without a tile and gives it one.
process_type = REPLACE_TILE //The target must be the floor and not a tile. The floor must not already have a floortile.
target = scan(/turf/simulated/floor)
target = scan(/turf/simulated/floor, avoid_bot = /mob/living/simple_animal/bot/floorbot)
if(!target && fixfloors) //Repairs damaged floors and tiles.
if(!target && fix_floor) //Repairs damaged floors and tiles.
process_type = FIX_TILE
target = scan(/turf/simulated/floor)
target = scan(/turf/simulated/floor, avoid_bot = /mob/living/simple_animal/bot/floorbot)
if(!target && emagged == 2) //We are emagged! Time to rip up the floors!
if(!target && emagged) //We are emagged! Time to rip up the floors!
process_type = TILE_EMAG
target = scan(/turf/simulated/floor)
target = scan(/turf/simulated/floor, avoid_bot = /mob/living/simple_animal/bot/floorbot)
if(amount < MAX_AMOUNT && !target) //Out of tiles! We must refill!
if(eat_tiles) //Configured to find and consume floortiles!
target = scan(/obj/item/stack/tile/plasteel)
process_type = null
if(!target && make_tiles) //We did not manage to find any floor tiles! Scan for metal stacks and make our own!
target = scan(/obj/item/stack/sheet/metal)
process_type = null
if(!target && nag_on_empty) //Floorbot is empty and cannot acquire more tiles, nag the engineers for more!
nag()
if(!target)
@@ -199,13 +206,17 @@
if(target)
if(loc == target || loc == target.loc)
if(istype(target, /obj/item/stack/tile/plasteel))
start_eattile(target)
else if(istype(target, /obj/item/stack/sheet/metal))
if(istype(target, /obj/item/stack/sheet/metal))
start_maketile(target)
else if(isturf(target) && emagged < 2)
if(isturf(target) && !emagged)
repair(target)
else if(emagged == 2 && isfloorturf(target))
if(emagged && isfloorturf(target))
var/turf/simulated/floor/F = target
anchored = TRUE
mode = BOT_REPAIRING
@@ -221,9 +232,9 @@
if(!length(path))
if(!isturf(target))
var/turf/TL = get_turf(target)
path = get_path_to(src, TL, 30, id=access_card,simulated_only = 0)
path = get_path_to(src, TL, 30, id = access_card, simulated_only = 0)
else
path = get_path_to(src, target, 30, id=access_card,simulated_only = 0)
path = get_path_to(src, target, 30, id = access_card, simulated_only = 0)
if(!bot_move(target))
add_to_ignore(target)
@@ -245,15 +256,11 @@
/mob/living/simple_animal/bot/floorbot/proc/nag() //Annoy everyone on the channel to refill us!
if(!nagged)
speak("Requesting refill at <b>[get_area(src)]</b>!", radio_channel)
speak("Requesting refill [MAX_AMOUNT - amount] at <b>[get_area(src)]</b>!", radio_channel)
nagged = TRUE
/mob/living/simple_animal/bot/floorbot/proc/is_hull_breach(turf/t) //Ignore space tiles not considered part of a structure, also ignores shuttle docking areas.
var/area/t_area = get_area(t)
if(t_area && (t_area.name == "Space" || findtext(t_area.name, "huttle")))
return 0
else
return 1
return !isspaceturf(get_area(t))
//Floorbots, having several functions, need sort out special conditions here.
/mob/living/simple_animal/bot/floorbot/process_scan(atom/scan_target)
@@ -310,33 +317,19 @@
visible_message("<span class='notice'>[src] begins repairing the floor.</span>")
addtimer(CALLBACK(src, PROC_REF(make_bridge_plating), F), 5 SECONDS)
/mob/living/simple_animal/bot/floorbot/proc/make_floor(turf/simulated/floor/F)
if(mode != BOT_REPAIRING)
return
F.broken = FALSE
F.burnt = FALSE
F.ChangeTurf(/turf/simulated/floor/plasteel)
mode = BOT_IDLE
amount--
update_icon(UPDATE_OVERLAYS)
anchored = FALSE
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(replacetiles)
F.break_tile_to_plating()
if(autotile || replace_tiles)
if(process_type != HULL_BREACH)
F.break_tile_to_plating()
target_turf.ChangeTurf(/turf/simulated/floor/plasteel)
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)
target_turf.ChangeTurf(/turf/simulated/floor/plating)
mode = BOT_IDLE
amount--
update_icon(UPDATE_OVERLAYS)
@@ -347,7 +340,8 @@
if(!istype(T, /obj/item/stack/tile/plasteel))
return
visible_message("<span class='notice'>[src] begins to collect tiles.</span>")
mode = BOT_REPAIRING
mode = BOT_EAT_TILE
update_icon(UPDATE_OVERLAYS)
addtimer(CALLBACK(src, PROC_REF(do_eattile), T), 2 SECONDS)
/mob/living/simple_animal/bot/floorbot/proc/do_eattile(obj/item/stack/tile/plasteel/T)
@@ -355,8 +349,8 @@
target = null
mode = BOT_IDLE
return
if(amount + T.amount > 50)
var/i = 50 - amount
if((amount + T.amount) > MAX_AMOUNT)
var/i = MAX_AMOUNT - amount
amount += i
T.amount -= i
else
@@ -370,7 +364,8 @@
if(!istype(M, /obj/item/stack/sheet/metal))
return
visible_message("<span class='notice'>[src] begins to create tiles.</span>")
mode = BOT_REPAIRING
mode = BOT_MAKE_TILE
update_icon(UPDATE_OVERLAYS)
addtimer(CALLBACK(src, PROC_REF(do_maketile), M), 2 SECONDS)
/mob/living/simple_animal/bot/floorbot/proc/do_maketile(obj/item/stack/sheet/metal/M)
@@ -387,13 +382,14 @@
qdel(M)
target = null
mode = BOT_IDLE
update_icon(UPDATE_OVERLAYS)
/mob/living/simple_animal/bot/floorbot/update_icon_state()
return
/mob/living/simple_animal/bot/floorbot/update_overlays()
. = ..()
if(mode == BOT_REPAIRING)
if(mode == BOT_REPAIRING || mode == BOT_EAT_TILE || mode == BOT_MAKE_TILE)
. += "floorbot_work"
else
. += "floorbot_[on ? "on" : "off"]"
@@ -431,3 +427,11 @@
start_maketile(A)
else
..()
#undef HULL_BREACH
#undef FIX_TILE
#undef AUTO_TILE
#undef REPLACE_TILE
#undef TILE_EMAG
#undef MAX_AMOUNT
@@ -122,7 +122,7 @@
/mob/living/simple_animal/bot/honkbot/emag_act(mob/user)
..()
if(emagged == 2)
if(emagged)
if(user)
to_chat(user, "<span class='warning'>You short out [src]'s target assessment circuits. It gives out an evil laugh!!</span>")
oldtarget_name = user.name
@@ -140,7 +140,7 @@
return
if(iscarbon(A))
var/mob/living/carbon/C = A
if(emagged <= 1)
if(!emagged)
honk_attack(A)
else
if(!C.IsStunned() || arrest_type)
@@ -159,13 +159,13 @@
..()
/mob/living/simple_animal/bot/honkbot/proc/bike_horn() //use bike_horn
if(emagged <= 1)
if(!emagged)
if(!spam_flag)
playsound(src, honksound, 50, TRUE, -1)
spam_flag = TRUE //prevent spam
sensor_blink()
addtimer(CALLBACK(src, PROC_REF(spam_flag_false)), cooldowntimehorn)
else if(emagged == 2) //emagged honkbots will spam short and memorable sounds.
else if(emagged) //emagged honkbots will spam short and memorable sounds.
if(!spam_flag)
playsound(src, "honkbot_e", 50, 0)
spam_flag = TRUE // prevent spam
@@ -195,7 +195,7 @@
C.Weaken(10 SECONDS)
if(client) //prevent spam from players..
spam_flag = TRUE
if(emagged <= 1) //HONK once, then leave
if(!emagged) //HONK once, then leave
threatlevel -= 6
target = oldtarget_name
else // you really don't want to hit an emagged honkbot
@@ -279,12 +279,12 @@
if((C.name == oldtarget_name) && (world.time < last_found + 100))
continue
if(threatlevel <= 3 && emagged <= 1)
if(threatlevel <= 3 && !emagged)
if(C in view(4, src)) //keep the range short for patrolling
if(!spam_flag)
bike_horn()
else if(threatlevel >= 4)
if(!spam_flag || emagged > 1)
if(!spam_flag || emagged)
target = C
oldtarget_name = C.name
bike_horn()
@@ -295,7 +295,7 @@
break
else
continue
else if(emagged > 1)
else if(emagged)
bike_horn() //just spam the shit outta this
/mob/living/simple_animal/bot/honkbot/explode() //doesn't drop cardboard nor its assembly, since its a very frail material.
@@ -101,7 +101,7 @@
Radio.syndiekey = new /obj/item/encryptionkey/syndicate
/mob/living/simple_animal/bot/medbot/syndicate/emagged
emagged = 2
emagged = TRUE
declare_crit = FALSE
drops_parts = FALSE
@@ -258,7 +258,7 @@
/mob/living/simple_animal/bot/medbot/emag_act(mob/user)
..()
if(emagged == 2)
if(emagged)
declare_crit = FALSE
if(user)
to_chat(user, "<span class='notice'>You short out [src]'s reagent synthesis circuits.</span>")
@@ -412,7 +412,7 @@
if(H.dna.species && H.dna.species.reagent_tag == PROCESS_SYN)
return FALSE
if(emagged == 2 || hijacked) //Everyone needs our medicine. (Our medicine is toxins)
if(emagged || hijacked) //Everyone needs our medicine. (Our medicine is toxins)
return TRUE
if(syndicate_aligned && !("syndicate" in C.faction))
@@ -461,7 +461,7 @@
var/reagent_id
var/beaker_injection //If and what kind of beaker reagent needs to be injected
if(emagged == 2 || hijacked) //Emagged! Time to poison everybody.
if(emagged || hijacked) //Emagged! Time to poison everybody.
reagent_id = "pancuronium"
else
beaker_injection = assess_beaker_injection(C)
@@ -149,8 +149,8 @@
update_icon()
/mob/living/simple_animal/bot/mulebot/emag_act(mob/user)
if(emagged < 1)
emagged = 1
if(!emagged)
emagged = TRUE
if(!open)
locked = !locked
to_chat(user, "<span class='notice'>You [locked ? "lock" : "unlock"] [src]'s controls!</span>")
@@ -30,7 +30,7 @@
var/last_found //There's a delay
var/declare_arrests = TRUE //When making an arrest, should it notify everyone on the security channel?
var/idcheck = FALSE //If true, arrest people with no IDs
var/weaponscheck = FALSE //If true, arrest people for weapons if they lack access
var/weapons_check = FALSE //If true, arrest people for weapons if they lack access
var/check_records = TRUE //Does it check security records?
var/arrest_type = FALSE //If true, don't handcuff
var/harmbaton = FALSE //If true, beat instead of stun
@@ -43,7 +43,7 @@
name = "Officer Beepsky"
desc = "It's Officer Beepsky! Powered by a potato and a shot of whiskey."
idcheck = FALSE
weaponscheck = FALSE
weapons_check = FALSE
auto_patrol = TRUE
/mob/living/simple_animal/bot/secbot/beepsky/explode()
@@ -63,7 +63,7 @@
name = "Prison Ofitser"
desc = "It's Prison Ofitser! Powered by the tears and sweat of prisoners."
idcheck = FALSE
weaponscheck = TRUE
weapons_check = TRUE
auto_patrol = TRUE
/mob/living/simple_animal/bot/secbot/buzzsky
@@ -74,7 +74,7 @@
declare_arrests = FALSE
arrest_type = TRUE
harmbaton = TRUE
emagged = 2
emagged = TRUE
/mob/living/simple_animal/bot/secbot/armsky
name = "Sergeant-at-Armsky"
@@ -82,7 +82,7 @@
maxHealth = 100
idcheck = TRUE
arrest_type = TRUE
weaponscheck = TRUE
weapons_check = TRUE
/mob/living/simple_animal/bot/secbot/Initialize(mapload)
. = ..()
@@ -126,7 +126,7 @@
/mob/living/simple_animal/bot/secbot/ui_data(mob/user)
var/list/data = ..()
data["check_id"] = idcheck
data["check_weapons"] = weaponscheck
data["check_weapons"] = weapons_check
data["check_warrant"] = check_records
data["arrest_mode"] = arrest_type // detain or arrest
data["arrest_declare"] = declare_arrests // announce arrests on radio
@@ -154,7 +154,7 @@
if("disableremote")
remote_disabled = !remote_disabled
if("authweapon")
weaponscheck = !weaponscheck
weapons_check = !weapons_check
if("authid")
idcheck = !idcheck
if("authwarrant")
@@ -187,7 +187,7 @@
/mob/living/simple_animal/bot/secbot/emag_act(mob/user)
..()
if(emagged == 2)
if(emagged)
if(user)
to_chat(user, "<span class='danger'>You short out [src]'s target assessment circuits.</span>")
oldtarget_name = user.name
@@ -12,7 +12,7 @@
idcheck = TRUE
arrest_type = TRUE
auto_patrol = TRUE
emagged = 2
emagged = TRUE
faction = list("syndicate")
shoot_sound = 'sound/weapons/wave.ogg'
anchored = TRUE