From eb65ff2ed200840a7764077ff2d8f3d330d464b8 Mon Sep 17 00:00:00 2001 From: Leshana Date: Fri, 10 Mar 2017 20:26:33 -0500 Subject: [PATCH] Ports the new parts of https://github.com/Baystation12/Baystation12/pull/15298 back to Polaris * Changes navbeacons to no longer use radios (Doing so was slower and didn't really help anything) Note: var/freq remains for mapping compatibility until all maps are updated. * Fixes navbeacons to actually hide under flooring if you put plating over them. * Changed how navbeacons are mapped in. Don't use the picky "code_txt" variable, instead use appropriate subtype. * Made useful reusable subtypes so you don't have to code in a type for every. single. one. * Updated mulebot to use new navbeacon codes. * Re-activate patrolling! With the new navbeacons, bots with will_patrol can follow the patrol navbeacons. * Note: various "should_patrol" variables on each bot type unified under /mob/living/bot/var/will_patrol * Securitrons (beepsky) got an overhaul to the new patrol routing. * Note: BayStation replaced the snowflake handcuffs code with acutal handcuffs. Polaris handcuffs requiere a grab to work, so are more complicated. Kept our existing attack code. * Behavior procs reorganized to use better movement detection and just be more flexible. * Floorbot fixes & removal of bridgemode * Floorbot will now remove & replace broken floor tiles. * Floorbot will no longer decide its okay to pave over all of SPACE. * For the moment patching hull breaches is disabled, it is too laggy. * Sundry bugfixes to all bots * Use forceMove() instead of setting loc * Use "\The [X]" message strings. * Pass target to do_after() when doing something to a target. * Fixed events that were supposed to emag bots to now do so again. --- code/game/gamemodes/events.dm | 5 + code/game/machinery/navbeacon.dm | 130 +++++++++++------------- code/modules/events/ion_storm.dm | 6 ++ code/modules/mob/living/bot/bot.dm | 45 ++++++-- code/modules/mob/living/bot/cleanbot.dm | 11 +- code/modules/mob/living/bot/farmbot.dm | 6 +- code/modules/mob/living/bot/floorbot.dm | 83 +++++++++------ code/modules/mob/living/bot/mulebot.dm | 27 ++--- code/modules/mob/living/bot/secbot.dm | 109 +++++++++++++------- 9 files changed, 253 insertions(+), 169 deletions(-) diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm index 397651dce7..0169cd3f00 100644 --- a/code/game/gamemodes/events.dm +++ b/code/game/gamemodes/events.dm @@ -350,6 +350,11 @@ Would like to add a law like "Law x is _______" where x = a number, and _____ is M << "
" M.add_ion_law("THE STATION IS [who2pref] [who2]") + if(botEmagChance) + for(var/mob/living/bot/bot in machines) + if(prob(botEmagChance)) + bot.emag_act(1) + /* var/apcnum = 0 diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index fe5cac9c44..8700caf785 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -1,52 +1,45 @@ // Navigation beacon for AI robots // Functions as a transponder: looks for incoming signal matching -var/global/list/navbeacons // no I don't like putting this in, but it will do for now +var/global/list/navbeacons = list() // no I don't like putting this in, but it will do for now /obj/machinery/navbeacon icon = 'icons/obj/objects.dmi' icon_state = "navbeacon0-f" name = "navigation beacon" - desc = "A radio beacon used for bot navigation." + desc = "A beacon used for bot navigation." level = 1 // underfloor layer = 2.5 anchored = 1 var/open = 0 // true if cover is open var/locked = 1 // true if controls are locked - var/freq = 1445 // radio frequency + var/freq = null // DEPRECATED we don't use radios anymore! var/location = "" // location response text - var/list/codes // assoc. list of transponder codes - var/codes_txt = "" // codes as set on map: "tag1;tag2" or "tag1=value;tag2=value" + var/codes_txt // DEPRECATED codes as set on map: "tag1;tag2" or "tag1=value;tag2=value" + var/list/codes = list() // assoc. list of transponder codes req_access = list(access_engine) /obj/machinery/navbeacon/New() ..() - - set_codes() + set_codes_from_txt(codes_txt) + if(freq) + warning("[src] at [x],[y],[z] has deprecated var freq=[freq]. Replace it with proper type.") var/turf/T = loc hide(!T.is_plating()) - - // add beacon to MULE bot beacon list - if(freq == 1400) - if(!navbeacons) - navbeacons = new() - navbeacons += src - - - spawn(5) // must wait for map loading to finish - if(radio_controller) - radio_controller.add_object(src, freq, RADIO_NAVBEACONS) + navbeacons += src // set the transponder codes assoc list from codes_txt -/obj/machinery/navbeacon/proc/set_codes() +// DEPRECATED - This is kept only for compatibilty with old map files! Do not use this! +// Instead, you should replace the map instance with one of the appropriate navbeacon subtypes. +// See the bottom of this file for a list of subtypes, make your own examples if your map needs more +/obj/machinery/navbeacon/proc/set_codes_from_txt() if(!codes_txt) return + warning("[src] at [x],[y],[z] in [get_area(src)] is using the deprecated 'codes_txt' mapping method. Replace it with proper type.") - codes = new() - + codes = list() var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons - for(var/e in entries) var/index = findtext(e, "=") // format is "key=value" if(index) @@ -56,6 +49,8 @@ var/global/list/navbeacons // no I don't like putting this in, but it will do else codes[e] = "1" +/obj/machinery/navbeacon/hides_under_flooring() + return 1 // called when turf state changes // hide the object if turf is intact @@ -73,38 +68,6 @@ var/global/list/navbeacons // no I don't like putting this in, but it will do else icon_state = "[state]" - -// look for a signal of the form "findbeacon=X" -// where X is any -// or the location -// or one of the set transponder keys -// if found, return a signal -/obj/machinery/navbeacon/receive_signal(datum/signal/signal) - - var/request = signal.data["findbeacon"] - if(request && ((request in codes) || request == "any" || request == location)) - spawn(1) - post_signal() - -// return a signal giving location and transponder codes - -/obj/machinery/navbeacon/proc/post_signal() - - var/datum/radio_frequency/frequency = radio_controller.return_frequency(freq) - - if(!frequency) return - - var/datum/signal/signal = new() - signal.source = src - signal.transmission_method = 1 - signal.data["beacon"] = location - - for(var/key in codes) - signal.data[key] = codes[key] - - frequency.post_signal(src, signal, filter = RADIO_NAVBEACONS) - - /obj/machinery/navbeacon/attackby(var/obj/item/I, var/mob/user) var/turf/T = loc if(!T.is_plating()) @@ -117,7 +80,7 @@ var/global/list/navbeacons // no I don't like putting this in, but it will do updateicon() - else if(istype(I, /obj/item/weapon/card/id)||istype(I, /obj/item/device/pda)) + else if(I.GetID()) if(open) if(allowed(user)) locked = !locked @@ -153,8 +116,7 @@ var/global/list/navbeacons // no I don't like putting this in, but it will do if(locked && !ai) t = {"Navigation Beacon

-(swipe card to unlock controls)
-Frequency: [format_frequency(freq)]

+(swipe card to unlock controls)

Location: [location ? location : "(none)"]
Transponder Codes: