From 3c02addeef70c14c9338f19ddb554ab804e81fa8 Mon Sep 17 00:00:00 2001 From: GunHog Date: Thu, 15 Jan 2015 16:47:03 -0600 Subject: [PATCH 1/4] Fixes bot targeting logic It was possible for a unreachable target to essentially disable a bot's (cleanbots mostly) ability to perform its function. This fixes cleanbots ignoring valid and reachable stains, and ignoring stains while in patrol mode. --- code/game/machinery/bots/bots.dm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm index 1253c55cd19..8fc63a9f5e9 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -375,12 +375,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. From 2ff6962950eaec99801da81c9b13e655d1b5e715 Mon Sep 17 00:00:00 2001 From: GunHog Date: Fri, 16 Jan 2015 14:31:34 -0600 Subject: [PATCH 2/4] Further corrects bot targeting Made the scan() proc return 0 if the path does not match the destination. Removed 'oldtarget' vars from floorbots and cleanbots, they were made redundant by the ignore list. --- code/game/machinery/bots/bots.dm | 7 ++++++- code/game/machinery/bots/cleanbot.dm | 21 ++++++--------------- code/game/machinery/bots/floorbot.dm | 23 +++++++---------------- 3 files changed, 19 insertions(+), 32 deletions(-) diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm index 8fc63a9f5e9..69d7d87dd55 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -405,8 +405,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) diff --git a/code/game/machinery/bots/cleanbot.dm b/code/game/machinery/bots/cleanbot.dm index 45c7aad316d..0d4ffb40b75 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) @@ -68,7 +67,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 +161,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/floorbot.dm b/code/game/machinery/bots/floorbot.dm index c740b26f02f..0ef722fbc21 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -45,7 +45,6 @@ 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 @@ -83,7 +82,6 @@ /obj/machinery/bot/floorbot/bot_reset() ..() target = null - oldtarget = null oldloc = null ignore_list = list() nagged = 0 @@ -209,11 +207,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 +230,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 +259,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 +269,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 From 3f762ee6b590bae4241bc1d0735a654bd2d3bd13 Mon Sep 17 00:00:00 2001 From: GunHog Date: Wed, 8 Apr 2015 20:12:01 -0500 Subject: [PATCH 3/4] PDA Upgrade and Bot Fixes -The Captain's PDA can now access multiple bots! - The Captain and HoP PDAs can now also remotely access Newscasters! - Bot radio code now no longer uses filters to allow for multi-access radio control. - Bots can now patrol while off station. --- code/game/communications.dm | 5 -- code/game/machinery/bots/bots.dm | 19 +++---- code/game/machinery/bots/cleanbot.dm | 4 -- code/game/machinery/bots/ed209bot.dm | 3 -- code/game/machinery/bots/floorbot.dm | 4 -- code/game/machinery/bots/medbot.dm | 2 - code/game/machinery/bots/mulebot.dm | 5 -- code/game/machinery/bots/secbot.dm | 2 - code/game/objects/items/devices/PDA/PDA.dm | 12 +++-- code/game/objects/items/devices/PDA/cart.dm | 41 +++++++++++++-- code/game/objects/items/devices/PDA/radio.dm | 53 +++++++++----------- html/changelogs/Gun_Hog-PDA-Upgrade.yml | 38 ++++++++++++++ 12 files changed, 113 insertions(+), 75 deletions(-) create mode 100644 html/changelogs/Gun_Hog-PDA-Upgrade.yml 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..a0a27d7e88c 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 @@ -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() @@ -703,8 +701,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 +714,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 +725,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..5852546b702 100644 --- a/code/game/machinery/bots/cleanbot.dm +++ b/code/game/machinery/bots/cleanbot.dm @@ -40,7 +40,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 +50,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]" 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..ced5c105339 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -51,7 +51,6 @@ 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 +66,6 @@ botcard.access = J.get_access() prev_access = botcard.access - spawn(5) - add_to_beacons(bot_filter) - /obj/machinery/bot/floorbot/turn_on() . = ..() updateicon() diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm index 4445626eb5e..917f21dc7b7 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() . = ..() 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 46d41aff01f..8dec1ea4f58 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -311,7 +311,7 @@ var/global/list/obj/item/device/pda/PDAs = list() dat += "

Engineering Functions

" dat += "
    " dat += "
  • Power Monitor
  • " - if(istype(cartridge.radio, /obj/item/radio/integrated/floorbot)) + if(cartridge.access_floorbots) dat += "
  • Floorbot Access
  • " dat += "
" if (cartridge.access_medical) @@ -319,7 +319,7 @@ var/global/list/obj/item/device/pda/PDAs = list() dat += "" else @@ -328,7 +328,7 @@ var/global/list/obj/item/device/pda/PDAs = list() dat += "

Security Functions

" dat += "" else dat += "" @@ -343,10 +343,12 @@ var/global/list/obj/item/device/pda/PDAs = list() dat += "

Utilities

" dat += "
    " if (cartridge) + if(cartridge.access_multibots) + dat += "
  • Bots Access
  • " if (cartridge.access_janitor) dat += "
  • Custodial Locator
  • " - if(istype(cartridge.radio, /obj/item/radio/integrated/cleanbot)) - dat += "
  • Cleanbot Access
  • " + if(cartridge.access_cleanbots) + dat += "
  • Cleanbot Access
  • " if (istype(cartridge.radio, /obj/item/radio/integrated/signal)) dat += "
  • Signaler System
  • " if (cartridge.access_newscaster) diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm index 9f9b4164c3e..12cf2d1f3bb 100644 --- a/code/game/objects/items/devices/PDA/cart.dm +++ b/code/game/objects/items/devices/PDA/cart.dm @@ -23,6 +23,11 @@ var/access_status_display = 0 var/access_quartermaster = 0 var/access_hydroponics = 0 + var/access_secbots = 0 + var/access_medbots = 0 + var/access_floorbots = 0 + var/access_cleanbots = 0 + var/access_multibots = 0 var/mode = null var/menu var/datum/data/record/active1 = null //General @@ -39,6 +44,7 @@ name = "\improper Power-ON cartridge" icon_state = "cart-e" access_engine = 1 + access_floorbots = 1 /obj/item/weapon/cartridge/engineering/New() ..() @@ -48,6 +54,7 @@ name = "\improper BreatheDeep cartridge" icon_state = "cart-a" access_atmos = 1 + access_floorbots = 1 /obj/item/weapon/cartridge/atmos/New() ..() @@ -57,6 +64,7 @@ name = "\improper Med-U cartridge" icon_state = "cart-m" access_medical = 1 + access_medbots = 1 /obj/item/weapon/cartridge/medical/New() ..() @@ -66,6 +74,7 @@ name = "\improper ChemWhiz cartridge" icon_state = "cart-chem" access_reagent_scanner = 1 + access_medbots = 1 /obj/item/weapon/cartridge/chemistry/New() ..() @@ -75,6 +84,7 @@ name = "\improper R.O.B.U.S.T. cartridge" icon_state = "cart-s" access_security = 1 + access_secbots = 1 /obj/item/weapon/cartridge/security/New() ..() @@ -86,6 +96,7 @@ access_security = 1 access_medical = 1 access_manifest = 1 + access_secbots = 1 /obj/item/weapon/cartridge/detective/New() ..() @@ -96,6 +107,7 @@ desc = "The ultimate in clean-room design." icon_state = "cart-j" access_janitor = 1 + access_cleanbots = 1 /obj/item/weapon/cartridge/janitor/New() ..() @@ -171,6 +183,7 @@ access_quartermaster = 1 access_janitor = 1 access_security = 1 + access_newscaster = 1 /obj/item/weapon/cartridge/hop/New() ..() @@ -182,6 +195,7 @@ access_manifest = 1 access_status_display = 1 access_security = 1 + access_medbots = 1 /obj/item/weapon/cartridge/hos/New() ..() @@ -194,6 +208,7 @@ access_status_display = 1 access_engine = 1 access_atmos = 1 + access_floorbots = 1 /obj/item/weapon/cartridge/ce/New() ..() @@ -206,6 +221,7 @@ access_status_display = 1 access_reagent_scanner = 1 access_medical = 1 + access_medbots = 1 /obj/item/weapon/cartridge/cmo/New() ..() @@ -225,7 +241,7 @@ /obj/item/weapon/cartridge/captain name = "\improper Value-PAK cartridge" - desc = "Now with 200% more value!" + desc = "Now with 250% more value!" icon_state = "cart-c" access_manifest = 1 access_engine = 1 @@ -234,10 +250,12 @@ access_reagent_scanner = 1 access_status_display = 1 access_atmos = 1 + access_newscaster = 1 + access_multibots = 1 /obj/item/weapon/cartridge/captain/New() ..() - radio = new /obj/item/radio/integrated/beepsky(src) + radio = new /obj/item/radio/integrated/multi(src) /obj/item/weapon/cartridge/syndicate name = "\improper Detomatix cartridge" @@ -346,7 +364,7 @@ return menu -/obj/item/weapon/cartridge/proc/generate_menu() +/obj/item/weapon/cartridge/proc/generate_menu(mob/user) switch(mode) if(40) //signaller menu = "

    Remote Signaling System

    " @@ -689,7 +707,7 @@ Code: menu += "

    Located Cleanbots:

    " ldat = null - for (var/obj/machinery/bot/cleanbot/B in world) + for (var/obj/machinery/bot/cleanbot/B in SSbot.processing) var/turf/bl = get_turf(B) if(bl) @@ -732,10 +750,23 @@ Code: if(!current) menu += "
    ERROR : NO CHANNEL FOUND
    " return + var/i = 1 for(var/datum/feed_message/msg in current.messages) menu +="-[msg.body]
    \[Story by [msg.author]\]
    " + menu +="[msg.comments.len] comment[msg.comments.len > 1 ? "s" : ""]
    " + if(msg.img) + user << browse_rsc(msg.img, "tmp_photo[i].png") + menu +="
    " + i++ + for(var/datum/feed_comment/comment in msg.comments) + menu +="[comment.body]
    [comment.author] [comment.time_stamp]
    " menu += "
    Post Message" + if (54) // Beepsky, Medibot, Floorbot, and Cleanbot access + menu = "

    Multi-Bot Interlink

    " + var/obj/item/radio/integrated/multi/SC = radio + bot_control(SC) + /obj/item/weapon/cartridge/Topic(href, href_list) ..() @@ -825,5 +856,5 @@ Code: - generate_menu() + generate_menu(usr) print_to_host(menu) diff --git a/code/game/objects/items/devices/PDA/radio.dm b/code/game/objects/items/devices/PDA/radio.dm index 27e2b1613af..368bacc2bd1 100644 --- a/code/game/objects/items/devices/PDA/radio.dm +++ b/code/game/objects/items/devices/PDA/radio.dm @@ -8,7 +8,6 @@ var/obj/machinery/bot/active // the active bot; if null, show bot list var/list/botstatus // the status signal sent by the bot var/bot_type //The type of bot it is. - var/bot_filter //Determines which radio filter to use. var/control_freq = 1447 @@ -19,9 +18,8 @@ ..() if (istype(loc.loc, /obj/item/device/pda)) hostpda = loc.loc - if (bot_filter) - spawn(5) - add_to_radio(bot_filter) + spawn(5) + add_to_radio() /obj/item/radio/integrated/Destroy() if(radio_controller) @@ -30,7 +28,6 @@ /obj/item/radio/integrated/proc/post_signal(var/freq, var/key, var/value, var/key2, var/value2, var/key3, var/value3,var/key4, var/value4, s_filter) - //world << "Post: [freq]: [key]=[value], [key2]=[value2]" var/datum/radio_frequency/frequency = radio_controller.return_frequency(freq) if(!frequency) @@ -63,13 +60,14 @@ /obj/item/radio/integrated/receive_signal(datum/signal/signal) /*var/obj/item/device/pda/P = src.loc - world << "recvd:[P] : [signal.source]" for(var/d in signal.data) world << "- [d] = [signal.data[d]]" */ + if(signal.data["sect"] != ZLEVEL_STATION) //Only detect bots on the station! (Getting the current Z-level is too costly) + return - if (signal.data["type"] == bot_type) + if (signal.data["type"] & bot_type) if(!botlist) botlist = new() @@ -88,44 +86,43 @@ if("control") active = locate(href_list["bot"]) - post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) + post_signal(control_freq, "command", "bot_status", "active", active) if("scanbots") // find all bots botlist = null - post_signal(control_freq, "command", "bot_status", s_filter = bot_filter) + post_signal(control_freq, "command", "bot_status") if("botlist") active = null if("stop", "go") - post_signal(control_freq, "command", href_list["op"], "active", active, s_filter = bot_filter) - post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) + post_signal(control_freq, "command", href_list["op"], "active", active) + post_signal(control_freq, "command", "bot_status", "active", active) if("summon") - post_signal(control_freq, "command", "summon", "active", active, "target", get_turf(PDA) , "useraccess", PDA.GetAccess(), s_filter = bot_filter) - post_signal(control_freq, "command", "bot_status", "active", active, s_filter = bot_filter) + post_signal(control_freq, "command", "summon", "active", active, "target", get_turf(PDA) , "useraccess", PDA.GetAccess()) + post_signal(control_freq, "command", "bot_status", "active", active) PDA.cartridge.unlock() -/obj/item/radio/integrated/proc/add_to_radio(bot_filter) //Master filter control for bots. Must be placed in the bot's local New() to support map spawned bots. +/obj/item/radio/integrated/proc/add_to_radio() if(radio_controller) - radio_controller.add_object(src, control_freq, filter = bot_filter) + radio_controller.add_object(src, control_freq) /obj/item/radio/integrated/beepsky - bot_filter = RADIO_SECBOT bot_type = SEC_BOT /obj/item/radio/integrated/medbot - bot_filter = RADIO_MEDBOT bot_type = MED_BOT /obj/item/radio/integrated/floorbot - bot_filter = RADIO_FLOORBOT bot_type = FLOOR_BOT /obj/item/radio/integrated/cleanbot - bot_filter = RADIO_CLEANBOT bot_type = CLEAN_BOT +/obj/item/radio/integrated/multi + bot_type = SEC_BOT|CLEAN_BOT|MED_BOT|FLOOR_BOT + /obj/item/radio/integrated/mule //var/list/botlist = null // list of bots @@ -141,7 +138,7 @@ ..() spawn(5) if(radio_controller) - radio_controller.add_object(src, control_freq, filter = RADIO_MULEBOT) + radio_controller.add_object(src, control_freq) radio_controller.add_object(src, beacon_freq, filter = RADIO_NAVBEACONS) spawn(10) post_signal(beacon_freq, "findbeacon", "delivery", s_filter = RADIO_NAVBEACONS) @@ -203,28 +200,28 @@ active = null if("unload") - post_signal(control_freq, cmd, "unload", s_filter = RADIO_MULEBOT) + post_signal(control_freq, cmd, "unload") if("setdest") if(beacons) var/dest = input("Select Bot Destination", "Mulebot [active.suffix] Interlink", active.destination) as null|anything in beacons if(dest) - post_signal(control_freq, cmd, "target", "destination", dest, s_filter = RADIO_MULEBOT) + post_signal(control_freq, cmd, "target", "destination", dest) if("retoff") - post_signal(control_freq, cmd, "autoret", "value", 0, s_filter = RADIO_MULEBOT) + post_signal(control_freq, cmd, "autoret", "value", 0) if("reton") - post_signal(control_freq, cmd, "autoret", "value", 1, s_filter = RADIO_MULEBOT) + post_signal(control_freq, cmd, "autoret", "value", 1) if("pickoff") - post_signal(control_freq, cmd, "autopick", "value", 0, s_filter = RADIO_MULEBOT) + post_signal(control_freq, cmd, "autopick", "value", 0) if("pickon") - post_signal(control_freq, cmd, "autopick", "value", 1, s_filter = RADIO_MULEBOT) + post_signal(control_freq, cmd, "autopick", "value", 1) if("stop", "go", "home") - post_signal(control_freq, cmd, href_list["op"], s_filter = RADIO_MULEBOT) + post_signal(control_freq, cmd, href_list["op"]) - post_signal(control_freq, cmd, "bot_status", s_filter = RADIO_MULEBOT) + post_signal(control_freq, cmd, "bot_status") PDA.cartridge.unlock() diff --git a/html/changelogs/Gun_Hog-PDA-Upgrade.yml b/html/changelogs/Gun_Hog-PDA-Upgrade.yml new file mode 100644 index 00000000000..a50a2ca3248 --- /dev/null +++ b/html/changelogs/Gun_Hog-PDA-Upgrade.yml @@ -0,0 +1,38 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# spellcheck (typo fixes) +# experiment +# tgs (TG-ported fixes?) +################################# + +# Your name. +author: Gun Hog + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Thinktronic Systems, LTD. has increased the Value of the Value-PAK PDA cartridge! Standard issue for Captain PDAs, it can now access security bots, medibots, cleanbots, and floorbots ALL AT ONCE! In addition, it can also connect to your station's Newscaster network at NO EXTRA CHARGE! As a Thank you for our contract with them, they have thrown in Newscaster access for the HumanResources9001 cartridge, Heads of Personnel rejoice!" + - tweak: "The Newscaster app has also gotten a free upgrade which allows it to display images and comments inside of posts!" + - bugfix: "Nanotrasen has concurrently released a patch for bots which will allow off-station bots to properly patrol." From 029b2550f53648b99d017b1f7200af14fbafdeef Mon Sep 17 00:00:00 2001 From: GunHog Date: Wed, 15 Apr 2015 11:15:01 -0500 Subject: [PATCH 4/4] Makes it slightly harder for a medibot to get stuck. --- code/game/machinery/bots/bots.dm | 2 +- code/game/machinery/bots/medbot.dm | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/code/game/machinery/bots/bots.dm b/code/game/machinery/bots/bots.dm index 46336d8b9ee..c0b32b5d4d8 100644 --- a/code/game/machinery/bots/bots.dm +++ b/code/game/machinery/bots/bots.dm @@ -67,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 diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm index 917f21dc7b7..04be70bdf3c 100644 --- a/code/game/machinery/bots/medbot.dm +++ b/code/game/machinery/bots/medbot.dm @@ -122,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." @@ -269,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)) @@ -304,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)) @@ -332,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)