diff --git a/code/game/communications.dm b/code/game/communications.dm index 16cd14b7fb7..895d36813ce 100644 --- a/code/game/communications.dm +++ b/code/game/communications.dm @@ -173,12 +173,7 @@ var/const/RADIO_CHAT = "3" //deprecated var/const/RADIO_ATMOSIA = "4" var/const/RADIO_NAVBEACONS = "5" var/const/RADIO_AIRLOCK = "6" -var/const/RADIO_SECBOT = "7" -var/const/RADIO_MULEBOT = "8" var/const/RADIO_MAGNETS = "9" -var/const/RADIO_CLEANBOT = "10" -var/const/RADIO_FLOORBOT = "11" -var/const/RADIO_MEDBOT = "12" /datum/radio_frequency diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm index 19883679181..c0b32b5d4d8 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -48,8 +48,6 @@ var/beacon_freq = 1445 // navigation beacon frequency var/control_freq = 1447 // bot control frequency - var/bot_filter // The radio filter the bot uses to identify itself on the network. - var/bot_type = 0 //The type of bot it is, for radio control. #define SEC_BOT 1 // Secutritrons (Beepsky) and ED-209s #define MULE_BOT 2 // MULEbots @@ -69,7 +67,7 @@ #define BOT_SUMMON 6 // summoned by PDA #define BOT_CLEANING 7 // cleaning (cleanbots) #define BOT_REPAIRING 8 // repairing hull breaches (floorbots) - #define BOT_MOVING 9 // for clean/floor bots, when moving. + #define BOT_MOVING 9 // for clean/floor/med bots, when moving. #define BOT_HEALING 10 // healing people (medbots) #define BOT_RESPONDING 11 // responding to a call from the AI #define BOT_LOADING 12 // loading/unloading @@ -103,19 +101,19 @@ set_custom_texts() Radio = new /obj/item/device/radio(src) Radio.listening = 0 //Makes bot radios transmit only so no one hears things while adjacent to one. + spawn(5) + add_to_beacons() /obj/machinery/bot/Destroy() if(radio_controller) radio_controller.remove_object(src,beacon_freq) - if(bot_filter) - radio_controller.remove_object(src,control_freq) + radio_controller.remove_object(src,control_freq) ..() -/obj/machinery/bot/proc/add_to_beacons(bot_filter) //Master filter control for bots. Must be placed in the bot's local New() to support map spawned bots. +/obj/machinery/bot/proc/add_to_beacons() //Master radio control for bots. Must be placed in the bot's local New() to support map spawned bots. if(radio_controller) radio_controller.add_object(src, beacon_freq, filter = RADIO_NAVBEACONS) - if(bot_filter) - radio_controller.add_object(src, control_freq, filter = bot_filter) + radio_controller.add_object(src, control_freq) /obj/machinery/bot/proc/explode() @@ -376,12 +374,13 @@ obj/machinery/bot/proc/scan(var/scan_type, var/old_target, var/scan_range = DEFA for (var/scan in view (scan_range, src) ) //Search for something in range! if(!istype(scan, scan_type)) //Check that the thing we found is the type we want! continue //If not, keep searching! - if( !(scan in ignore_list) && (scan != old_target) ) //Filter for blacklisted elements, usually unreachable or previously processed oness - var/scan_result = process_scan(scan) //Some bots may require additional processing when a result is selected. - if( scan_result ) - final_result = scan_result - else - continue //The current element failed assessment, move on to the next. + if( (scan in ignore_list) || (scan == old_target) ) //Filter for blacklisted elements, usually unreachable or previously processed oness + continue + var/scan_result = process_scan(scan) //Some bots may require additional processing when a result is selected. + if( scan_result ) + final_result = scan_result + else + continue //The current element failed assessment, move on to the next. return final_result //When the scan finds a target, run bot specific processing to select it for the next step. Empty by default. @@ -405,8 +404,13 @@ obj/machinery/bot/proc/bot_move(var/dest, var/move_speed) if(!dest || !path || path.len == 0) //A-star failed or a path/destination was not set. path = list() return 0 - if(get_turf(src) == get_turf(dest)) //We have arrived, no need to move again. + dest = get_turf(dest) //We must always compare turfs, so get the turf of the dest var if dest was originally something else. + var/turf/last_node = get_turf(path[path.len]) //This is the turf at the end of the path, it should be equal to dest. + if(get_turf(src) == dest) //We have arrived, no need to move again. return 1 + else if (dest != last_node) //The path should lead us to our given destination. If this is not true, we must stop. + path = list() + return 0 var/success var/step_count = move_speed ? move_speed : speed //If a value is passed into move_speed, use that instead of the default speed var. if(step_count >= 1 && tries < 4) @@ -703,8 +707,6 @@ obj/machinery/bot/proc/start_patrol() // send a radio signal with multiple data key/values /obj/machinery/bot/proc/post_signal_multiple(var/freq, var/list/keyval) - if(!z || z != 1) //Bot control will only work on station. - return var/datum/radio_frequency/frequency = radio_controller.return_frequency(freq) if(!frequency) return @@ -718,8 +720,6 @@ obj/machinery/bot/proc/start_patrol() // world << "sent [key],[keyval[key]] on [freq]" if(signal.data["findbeacon"]) frequency.post_signal(src, signal, filter = RADIO_NAVBEACONS) - else if(signal.data["type"] == bot_type) - frequency.post_signal(src, signal, filter = bot_filter) else frequency.post_signal(src, signal) @@ -731,7 +731,8 @@ obj/machinery/bot/proc/start_patrol() "type" = bot_type, "name" = name, "loca" = get_area(src), // area - "mode" = mode + "mode" = mode, + "sect" = z // z-level, or "sector" ) post_signal_multiple(control_freq, kv) diff --git a/code/game/machinery/bots/cleanbot.dm b/code/game/machinery/bots/cleanbot.dm index b9b28435749..2b327a0da30 100644 --- a/code/game/machinery/bots/cleanbot.dm +++ b/code/game/machinery/bots/cleanbot.dm @@ -27,7 +27,6 @@ var/blood = 1 var/list/target_types = list() var/obj/effect/decal/cleanable/target - var/obj/effect/decal/cleanable/oldtarget var/max_targets = 50 //Maximum number of targets a cleanbot can ignore. var/oldloc = null req_one_access = list(access_janitor, access_robotics) @@ -40,7 +39,6 @@ var/next_dest_loc radio_frequency = SERV_FREQ //Service bot_type = CLEAN_BOT - bot_filter = RADIO_CLEANBOT /obj/machinery/bot/cleanbot/New() ..() @@ -51,9 +49,6 @@ botcard.access = J.get_access() prev_access = botcard.access - spawn(5) - add_to_beacons(bot_filter) - /obj/machinery/bot/cleanbot/turn_on() ..() icon_state = "cleanbot[on]" @@ -68,7 +63,6 @@ ..() ignore_list = list() //Allows the bot to clean targets it previously ignored due to being unreachable. target = null - oldtarget = null oldloc = null /obj/machinery/bot/cleanbot/set_custom_texts() @@ -163,21 +157,14 @@ text("[on ? "On" : "Off"]")) visible_message("[src] makes an excited beeping booping sound!") if(!target) //Search for cleanables it can see. - target = scan(/obj/effect/decal/cleanable/, oldtarget) - oldtarget = target + target = scan(/obj/effect/decal/cleanable/) - if(!target) - if(loc != oldloc) - oldtarget = null + if(!target && auto_patrol) //Search for cleanables it can see. + if(mode == BOT_IDLE || mode == BOT_START_PATROL) + start_patrol() - if(auto_patrol) - if(mode == BOT_IDLE || mode == BOT_START_PATROL) - start_patrol() - - if(mode == BOT_PATROL) - bot_patrol() - - return + if(mode == BOT_PATROL) + bot_patrol() if(target) if(!path || path.len == 0) //No path, need a new one diff --git a/code/game/machinery/bots/ed209bot.dm b/code/game/machinery/bots/ed209bot.dm index 87f53d40a0c..0e210e2918a 100644 --- a/code/game/machinery/bots/ed209bot.dm +++ b/code/game/machinery/bots/ed209bot.dm @@ -35,7 +35,6 @@ var/shoot_sound = 'sound/weapons/Taser.ogg' radio_frequency = SEC_FREQ bot_type = SEC_BOT - bot_filter = RADIO_SECBOT /obj/item/weapon/ed209_assembly @@ -62,8 +61,6 @@ botcard.access = J.get_access() prev_access = botcard.access - - add_to_beacons(bot_filter) if(lasercolor) shot_delay = 6//Longer shot delay because JESUS CHRIST check_records = 0//Don't actively target people set to arrest diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm index 17ccdcc5830..11885135158 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -45,13 +45,11 @@ var/nagged = 0 //Prevents the Floorbot nagging more than once per refill. var/max_targets = 50 var/turf/target - var/turf/oldtarget var/oldloc = null req_one_access = list(access_construction, access_robotics) var/targetdirection radio_frequency = ENG_FREQ //Engineering channel bot_type = FLOOR_BOT - bot_filter = RADIO_FLOORBOT var/process_type //Determines what to do when process_scan() recieves a target. See process_scan() for details. #define HULL_BREACH 1 #define BRIDGE_MODE 2 @@ -67,9 +65,6 @@ botcard.access = J.get_access() prev_access = botcard.access - spawn(5) - add_to_beacons(bot_filter) - /obj/machinery/bot/floorbot/turn_on() . = ..() updateicon() @@ -83,7 +78,6 @@ /obj/machinery/bot/floorbot/bot_reset() ..() target = null - oldtarget = null oldloc = null ignore_list = list() nagged = 0 @@ -209,11 +203,11 @@ 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, oldtarget) + 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, oldtarget) + target = scan(/obj/item/stack/sheet/metal) process_type = null return else @@ -232,24 +226,24 @@ target = T else //Find a space tile farther way! - target = scan(/turf/space, oldtarget) + 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, oldtarget) + target = scan(/turf/space) if(!target && replacetiles) //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, oldtarget) + target = scan(/turf/simulated/floor) if(!target && fixfloors) //Repairs damaged floors and tiles. process_type = FIX_TILE - target = scan(/turf/simulated/floor, oldtarget) + target = scan(/turf/simulated/floor) if(!target && emagged == 2) //We are emagged! Time to rip up the floors! process_type = TILE_EMAG - target = scan(/turf/simulated/floor, oldtarget) + target = scan(/turf/simulated/floor) if(!target) @@ -261,11 +255,6 @@ if(mode == BOT_PATROL) bot_patrol() - if(!target) - if(loc != oldloc) - oldtarget = null - return - if(target) if(path.len == 0) if(!istype(target, /turf/)) @@ -276,12 +265,10 @@ if(!bot_move(target)) add_to_ignore(target) - oldtarget = target target = null mode = BOT_IDLE return else if( !bot_move(target) ) - oldtarget = target target = null mode = BOT_IDLE return diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm index 4445626eb5e..04be70bdf3c 100644 --- a/code/game/machinery/bots/medbot.dm +++ b/code/game/machinery/bots/medbot.dm @@ -40,7 +40,6 @@ var/treat_virus = 1 //If on, the bot will attempt to treat viral infections, curing them if possible. var/shut_up = 0 //self explanatory :) bot_type = MED_BOT - bot_filter = RADIO_MEDBOT /obj/machinery/bot/medbot/mysterious name = "\improper Mysterious Medibot" @@ -104,7 +103,6 @@ else botcard.access = botcard_access prev_access = botcard.access - add_to_beacons(bot_filter) /obj/machinery/bot/medbot/turn_on() . = ..() @@ -124,6 +122,12 @@ last_found = world.time declare_cooldown = 0 +/obj/machinery/bot/medbot/proc/soft_reset() //Allows the medibot to still actively perform its medical duties without being completely halted as a hard reset does. + path = list() + patient = null + mode = BOT_IDLE + last_found = world.time + /obj/machinery/bot/medbot/set_custom_texts() text_hack = "You corrupt [name]'s reagent processor circuits." @@ -271,7 +275,7 @@ if (H.stat == 2) return - if ((H == oldpatient) && (world.time < last_found + 100)) + if ((H == oldpatient) && (world.time < last_found + 200)) return if(assess_patient(H)) @@ -306,10 +310,7 @@ if(frustration > 8) oldpatient = patient - patient = null - mode = BOT_IDLE - last_found = world.time - path = list() + soft_reset() if(!patient) if(!shut_up && prob(1)) @@ -334,21 +335,19 @@ last_found = world.time else if(stationary_mode && patient) //Since we cannot move in this mode, ignore the patient and wait for another. - patient = null - mode = BOT_IDLE - last_found = world.time + soft_reset() return if(patient && path.len == 0 && (get_dist(src,patient) > 1)) - spawn(0) - path = get_path_to(loc, get_turf(patient), /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance_cardinal, 0, 30,id=botcard) + path = get_path_to(loc, get_turf(patient), /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance_cardinal, 0, 30,id=botcard) + mode = BOT_MOVING + if(!path.len) //Do not chase a patient we cannot reach. + soft_reset() if(path.len > 0 && patient) if(!bot_move(patient)) oldpatient = patient - patient = null - mode = BOT_IDLE - last_found = world.time + soft_reset() return if(path.len > 8 && patient) diff --git a/code/game/machinery/bots/mulebot.dm b/code/game/machinery/bots/mulebot.dm index c810c626fbe..5b5b65e1ea1 100644 --- a/code/game/machinery/bots/mulebot.dm +++ b/code/game/machinery/bots/mulebot.dm @@ -23,7 +23,6 @@ var/global/mulebot_count = 0 beacon_freq = 1400 control_freq = 1447 bot_type = MULE_BOT - bot_filter = RADIO_MULEBOT blood_DNA = list() suffix = "" @@ -71,8 +70,6 @@ var/global/mulebot_count = 0 cell.maxcharge = 2000 spawn(5) // must wait for map loading to finish - add_to_beacons(bot_filter) - mulebot_count += 1 if(!suffix) suffix = "#[mulebot_count]" @@ -883,8 +880,6 @@ obj/machinery/bot/mulebot/bot_reset() //world << "sent [key],[keyval[key]] on [freq]" if (signal.data["findbeacon"]) frequency.post_signal(src, signal, filter = RADIO_NAVBEACONS) - else if (signal.data["type"] == MULE_BOT) - frequency.post_signal(src, signal, filter = RADIO_MULEBOT) else frequency.post_signal(src, signal) diff --git a/code/game/machinery/bots/secbot.dm b/code/game/machinery/bots/secbot.dm index 0596bbe5b5e..fd2ac1c9d82 100644 --- a/code/game/machinery/bots/secbot.dm +++ b/code/game/machinery/bots/secbot.dm @@ -25,7 +25,6 @@ var/arrest_type = 0 //If true, don't handcuff radio_frequency = SEC_FREQ //Security channel bot_type = SEC_BOT - bot_filter = RADIO_SECBOT /obj/machinery/bot/secbot/beepsky name = "Officer Beep O'sky" @@ -58,7 +57,6 @@ var/datum/job/detective/J = new/datum/job/detective botcard.access = J.get_access() prev_access = botcard.access - add_to_beacons(bot_filter) /obj/machinery/bot/secbot/turn_on() diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index e383f8633dc..e93ceeb89dc 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -318,7 +318,7 @@ var/global/list/obj/item/device/pda/PDAs = list() dat += "
Power Monitor
Floorbot Access
Medical Records
[scanmode == 1 ? "Disable" : "Enable"] Medical Scanner
Medibot Access
Security Records
Security Bot Access
Bots Access
Custodial Locator
Cleanbot Access
Cleanbot Access
Signaler System
Remote Signaling System
Multi-Bot Interlink