diff --git a/_maps/map_files/Aetherwhisp/Aetherwhisp1.dmm b/_maps/map_files/Aetherwhisp/Aetherwhisp1.dmm
index 79bd410f527..1054a76110d 100644
--- a/_maps/map_files/Aetherwhisp/Aetherwhisp1.dmm
+++ b/_maps/map_files/Aetherwhisp/Aetherwhisp1.dmm
@@ -2446,9 +2446,8 @@
/obj/structure/plasticflaps/opaque,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Kitchen"
+ location = "Kitchen";
+ name = "navigation beacon (Kitchen Delivery)"
},
/obj/machinery/door/window/northleft{
dir = 8;
@@ -4033,9 +4032,8 @@
},
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Bar"
+ location = "Bar";
+ name = "navigation beacon (Bar Delivery)"
},
/turf/open/floor/wood,
/area/crew_quarters/bar)
@@ -4781,9 +4779,8 @@
},
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Security"
+ location = "Security";
+ name = "navigation beacon (Security Delivery)"
},
/turf/open/floor/plating,
/area/maintenance/department/medical)
@@ -11087,9 +11084,8 @@
"hll" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Medbay"
+ location = "Medbay";
+ name = "navigation beacon (Medbay Delivery)"
},
/turf/open/floor/carpet/ship/blue,
/area/medical/medbay/lobby)
@@ -30500,9 +30496,8 @@
"tYz" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Engineering"
+ location = "Engineering";
+ name = "navigation beacon (Engineering Delivery)"
},
/obj/structure/plasticflaps/opaque,
/obj/machinery/door/window/eastleft{
diff --git a/_maps/map_files/Aetherwhisp/Aetherwhisp2.dmm b/_maps/map_files/Aetherwhisp/Aetherwhisp2.dmm
index 48aa1a2dda1..469faaf707d 100644
--- a/_maps/map_files/Aetherwhisp/Aetherwhisp2.dmm
+++ b/_maps/map_files/Aetherwhisp/Aetherwhisp2.dmm
@@ -4151,9 +4151,8 @@
"cLa" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Bridge"
+ location = "Bridge";
+ name = "navigation beacon (Bridge Delivery)"
},
/turf/open/floor/carpet/ship,
/area/hallway/nsv/deck2/forward)
@@ -10647,8 +10646,6 @@
/obj/effect/turf_decal/bot,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 8;
- freq = 1400;
location = "QM #2"
},
/mob/living/simple_animal/bot/mulebot{
@@ -12281,9 +12278,8 @@
},
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Munitions"
+ location = "Munitions";
+ name = "navigation beacon (Munitions Delivery)"
},
/turf/open/floor/plating,
/area/maintenance/nsv/bridge)
@@ -27936,9 +27932,8 @@
"sUe" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Science"
+ location = "Science";
+ name = "navigation beacon (Science Delivery)"
},
/turf/open/floor/carpet/ship/purple_carpet,
/area/science/computer_lab)
diff --git a/_maps/map_files/Atlas/atlas.dmm b/_maps/map_files/Atlas/atlas.dmm
index 2b739264fde..22e469cec16 100644
--- a/_maps/map_files/Atlas/atlas.dmm
+++ b/_maps/map_files/Atlas/atlas.dmm
@@ -2842,8 +2842,6 @@
},
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 8;
- freq = 1400;
location = "QM #2"
},
/mob/living/simple_animal/bot/mulebot{
@@ -9046,9 +9044,8 @@
/obj/structure/disposalpipe/segment,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Munitions"
+ location = "Munitions";
+ name = "navigation beacon (Munitions Delivery)"
},
/turf/open/floor/monotile/steel,
/area/nsv/weapons)
diff --git a/_maps/map_files/Atlas/atlas2.dmm b/_maps/map_files/Atlas/atlas2.dmm
index 2254431c648..23b4d62a41d 100644
--- a/_maps/map_files/Atlas/atlas2.dmm
+++ b/_maps/map_files/Atlas/atlas2.dmm
@@ -567,9 +567,8 @@
/obj/structure/disposalpipe/segment,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Service"
+ location = "Service";
+ name = "navigation beacon (Service Delivery)"
},
/turf/open/floor/monotile/steel,
/area/crew_quarters/bar/mess_hall)
@@ -2906,9 +2905,8 @@
},
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Medbay"
+ location = "Medbay";
+ name = "navigation beacon (Medbay Delivery)"
},
/turf/open/floor/durasteel/alt,
/area/medical/medbay)
diff --git a/_maps/map_files/Galactica/Galactica1.dmm b/_maps/map_files/Galactica/Galactica1.dmm
index 0cc8182c59e..bfef22b2e14 100644
--- a/_maps/map_files/Galactica/Galactica1.dmm
+++ b/_maps/map_files/Galactica/Galactica1.dmm
@@ -6655,9 +6655,8 @@
/obj/structure/lattice/catwalk/over/ship,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
- location = "Engineering Lobby"
+ location = "Engineering Lobby";
+ name = "navigation beacon (Engineering Lobby Delivery)"
},
/turf/open/floor/engine,
/area/hallway/nsv/deck1/frame1/central)
diff --git a/_maps/map_files/Galactica/Galactica2.dmm b/_maps/map_files/Galactica/Galactica2.dmm
index fd5092ac60c..cfce0a8fa1d 100644
--- a/_maps/map_files/Galactica/Galactica2.dmm
+++ b/_maps/map_files/Galactica/Galactica2.dmm
@@ -7499,9 +7499,8 @@
/obj/structure/disposalpipe/segment,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
- location = "Prison"
+ location = "Prison";
+ name = "navigation beacon (Prison Delivery)"
},
/turf/open/floor/monotile/dark,
/area/hallway/nsv/deck2/primary)
@@ -11839,9 +11838,8 @@
/obj/structure/plasticflaps/opaque,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
- location = "Hydroponics"
+ location = "Hydroponics";
+ name = "navigation beacon (Hydroponics Delivery)"
},
/turf/open/floor/plating,
/area/hydroponics)
@@ -23134,9 +23132,8 @@
/obj/effect/turf_decal/tile/ship/full/blue,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
- location = "Munitions"
+ location = "Munitions";
+ name = "navigation beacon (Munitions Delivery)"
},
/turf/open/floor/monotile/steel,
/area/hallway/nsv/deck2/primary)
@@ -32635,9 +32632,8 @@
"ryx" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
- location = "Medbay"
+ location = "Medbay";
+ name = "navigation beacon (Medbay Delivery)"
},
/obj/structure/plasticflaps/opaque,
/turf/open/floor/plating,
@@ -34888,9 +34884,8 @@
/obj/structure/plasticflaps/opaque,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=1";
- dir = 8;
- freq = 1400;
- location = "Science"
+ location = "Science";
+ name = "navigation beacon (Science Delivery)"
},
/turf/open/floor/plating,
/area/science/nsv/astronomy)
@@ -37751,9 +37746,8 @@
/obj/structure/plasticflaps/opaque,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=1";
- dir = 8;
- freq = 1400;
- location = "Bar"
+ location = "Bar";
+ name = "navigation beacon (Bar Delivery)"
},
/turf/open/floor/plating,
/area/crew_quarters/bar{
@@ -39498,9 +39492,8 @@
},
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
- location = "Kitchen"
+ location = "Kitchen";
+ name = "navigation beacon (Kitchen Delivery)"
},
/turf/open/floor/monotile/dark,
/area/crew_quarters/bar{
diff --git a/_maps/map_files/Snake/snake_lower.dmm b/_maps/map_files/Snake/snake_lower.dmm
index ed77b25244c..ab27b693873 100644
--- a/_maps/map_files/Snake/snake_lower.dmm
+++ b/_maps/map_files/Snake/snake_lower.dmm
@@ -1069,8 +1069,6 @@
/obj/structure/disposalpipe/segment,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
location = "Security";
name = "Delivery Security"
},
@@ -2764,8 +2762,6 @@
"jW" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
location = "Engineering";
name = "Delivery Engineering"
},
@@ -7784,8 +7780,6 @@
"BI" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=1";
- dir = 1;
- freq = 1400;
location = "KItchen";
name = "Delivery Kitchen"
},
@@ -10872,8 +10866,6 @@
/obj/structure/disposalpipe/segment,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=";
- dir = 4;
- freq = 1400;
location = "Medbay";
name = "Delivery Medbay"
},
@@ -13387,7 +13379,6 @@
},
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=1";
- freq = 1400;
location = "Munitions";
name = "Delivery Munitions"
},
@@ -14680,8 +14671,6 @@
"YU" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 4;
- freq = 1400;
location = "Bar";
name = "Delivery Bar"
},
diff --git a/_maps/map_files/Snake/snake_upper.dmm b/_maps/map_files/Snake/snake_upper.dmm
index b973f11a1e0..526d1ec8dfc 100644
--- a/_maps/map_files/Snake/snake_upper.dmm
+++ b/_maps/map_files/Snake/snake_upper.dmm
@@ -1401,7 +1401,6 @@
/obj/structure/disposalpipe/segment,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=1";
- freq = 1400;
location = "Hangar";
name = "Delivery Hangar"
},
diff --git a/_maps/map_files/Tycoon/Tycoon2.dmm b/_maps/map_files/Tycoon/Tycoon2.dmm
index 4d6b484ecc3..ec4330aac16 100644
--- a/_maps/map_files/Tycoon/Tycoon2.dmm
+++ b/_maps/map_files/Tycoon/Tycoon2.dmm
@@ -7097,9 +7097,8 @@
/obj/effect/turf_decal/bot,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Engineering"
+ location = "Engineering";
+ name = "navigation beacon (Engineering Delivery)"
},
/turf/open/floor/monotile/dark,
/area/engine/break_room)
@@ -40267,8 +40266,8 @@
/obj/effect/turf_decal/bot,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=1";
- freq = 1400;
- location = "Research Division"
+ location = "Research Division";
+ name = "navigation beacon (Research Delivery)"
},
/turf/open/floor/monotile/dark,
/area/science)
@@ -40858,9 +40857,8 @@
/obj/effect/turf_decal/bot,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 8;
- freq = 1400;
- location = "Munitions"
+ location = "Munitions";
+ name = "navigation beacon (Munitions Delivery)"
},
/obj/machinery/door/window/brigdoor/westright{
req_access_txt = "69"
@@ -42824,9 +42822,8 @@
"gIQ" = (
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 8;
- freq = 1400;
- location = "Security"
+ location = "Security";
+ name = "navigation beacon (Security Delivery)"
},
/obj/effect/turf_decal/bot,
/obj/machinery/door/window/brigdoor/westright{
@@ -43393,9 +43390,8 @@
/obj/effect/turf_decal/bot,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=1";
- dir = 1;
- freq = 1400;
- location = "Kitchen"
+ location = "Kitchen";
+ name = "navigation beacon (Kitchen Delivery)"
},
/obj/machinery/door/window/eastright{
dir = 1;
@@ -46732,9 +46728,8 @@
/obj/effect/turf_decal/bot,
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=4";
- dir = 4;
- freq = 1400;
- location = "Medbay"
+ location = "Medbay";
+ name = "navigation beacon (Medbay Delivery)"
},
/turf/open/floor/monotile/light,
/area/medical/medbay/lobby)
@@ -49137,8 +49132,6 @@
},
/obj/machinery/navbeacon{
codes_txt = "delivery;dir=8";
- dir = 8;
- freq = 1400;
location = "QM #2"
},
/mob/living/simple_animal/bot/mulebot{
diff --git a/code/__DEFINES/radio.dm b/code/__DEFINES/radio.dm
index adce3cc051d..de64aa18d8b 100644
--- a/code/__DEFINES/radio.dm
+++ b/code/__DEFINES/radio.dm
@@ -99,7 +99,7 @@
// This represents 1/8th of the available spectrum.
#define FREQ_ATMOS_STORAGE 1441
-#define FREQ_NAV_BEACON 1445
+// #define FREQ_NAV_BEACON 1445 - NSV13 - Removed during the Murder of Navbeacons
#define FREQ_AI_PRIVATE 1447 //! AI private comms frequency, magenta
#define FREQ_PRESSURE_PLATE 1447
#define FREQ_AIRLOCK_CONTROL 1449
diff --git a/code/__DEFINES/robots.dm b/code/__DEFINES/robots.dm
index cee927d5466..744bbdc0c3f 100644
--- a/code/__DEFINES/robots.dm
+++ b/code/__DEFINES/robots.dm
@@ -50,3 +50,11 @@
#define ASSEMBLY_THIRD_STEP 2
#define ASSEMBLY_FOURTH_STEP 3
#define ASSEMBLY_FIFTH_STEP 4
+
+//NSV13 - Start - Navbeacon Refactor
+//bot navigation beacon defines
+#define NAVBEACON_PATROL_MODE "patrol"
+#define NAVBEACON_PATROL_NEXT "next_patrol"
+#define NAVBEACON_DELIVERY_MODE "delivery"
+#define NAVBEACON_DELIVERY_DIRECTION "dir"
+//NSV13 - End
diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm
index 05204158fe6..20f5882b93b 100644
--- a/code/game/machinery/navbeacon.dm
+++ b/code/game/machinery/navbeacon.dm
@@ -4,7 +4,7 @@
/obj/machinery/navbeacon
icon = 'icons/obj/objects.dmi'
- icon_state = "navbeacon0-f"
+ icon_state = "navbeacon0" //NSV13 - Navbeacon Refactor
name = "navigation beacon"
desc = "A radio beacon used for bot navigation."
level = 1 // underfloor
@@ -12,32 +12,37 @@
max_integrity = 500
armor = list("melee" = 70, "bullet" = 70, "laser" = 70, "energy" = 70, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80, "stamina" = 0)
- var/open = FALSE // true if cover is open
- var/locked = TRUE // true if controls are locked
- var/freq = FREQ_NAV_BEACON
- 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"
+ //NSV13 - Start
+ circuit = /obj/item/circuitboard/machine/navbeacon
+ /// true if controls are locked
+ var/controls_locked = TRUE
+ /// true if cover is locked
+ var/cover_locked = TRUE
+ /// location response text
+ var/location = ""
+ /// original location name, to allow resets
+ var/original_location = ""
+ /// associative list of transponder codes
+ var/list/codes
+ /// codes as set on map: "tag1;tag2" or "tag1=value;tag2=value"
+ var/codes_txt = ""
var/obj/structure/overmap/linked //NSV13 - DIFFERENCE BETWEEN CODEBASE
+ //NSV13 - Stop
req_one_access = list(ACCESS_ENGINE, ACCESS_ROBOTICS)
/obj/machinery/navbeacon/Initialize(mapload)
. = ..()
+ original_location = location //NSV13 - Navbeacon Refactor
set_codes()
var/turf/T = loc
hide(T.intact)
- if(codes?["patrol"])
- if(!GLOB.navbeacons["[z]"])
- GLOB.navbeacons["[z]"] = list()
- GLOB.navbeacons["[z]"] += src //Register with the patrol list!
- if(codes?["delivery"])
- GLOB.deliverybeacons += src
- GLOB.deliverybeacontags += location
+ //NSV13 - Start - Navbeacon Refactor
+ glob_lists_register(init=TRUE)
- return INITIALIZE_HINT_LATELOAD //NSV13 start - Overmap ship compatibility
+ return INITIALIZE_HINT_LATELOAD
/obj/machinery/navbeacon/LateInitialize()
has_overmap()
@@ -54,10 +59,9 @@
/obj/machinery/navbeacon/Destroy()
if (linked.beacons_in_ship)
- linked.beacons_in_ship -= src //NSV13 end
- if (GLOB.navbeacons["[z]"])
- GLOB.navbeacons["[z]"] -= src //Remove from beacon list, if in one.
- GLOB.deliverybeacons -= src
+ linked.beacons_in_ship -= src
+ glob_lists_deregister()
+ //NSV13 - Navbeacon Refactor - Stop
return ..()
/obj/machinery/navbeacon/onTransitZ(old_z, new_z)
@@ -67,24 +71,81 @@
GLOB.navbeacons["[new_z]"] += src
..()
-// set the transponder codes assoc list from codes_txt
+//NSV13 - Navbeacon Refactor - Start
+/obj/machinery/navbeacon/on_construction(mob/user)
+ var/turf/our_turf = loc
+ if(!isfloorturf(our_turf))
+ return
+ var/turf/open/floor/floor = our_turf
+ floor.remove_tile(null, silent = TRUE, make_tile = TRUE)
+
+
+///Set the transponder codes assoc list from codes_txt during initialization, or during reset
/obj/machinery/navbeacon/proc/set_codes()
+ codes = list()
if(!codes_txt)
return
- codes = new()
-
- var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons
+ var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons
- for(var/e in entries)
- var/index = findtext(e, "=") // format is "key=value"
+ for(var/entry in entries)
+ var/index = findtext(entry, "=") // format is "key=value"
if(index)
- var/key = copytext(e, 1, index)
- var/val = copytext(e, index + length(e[index]))
+ var/key = copytext(entry, 1, index)
+ var/val = copytext(entry, index + length(entry[index]))
codes[key] = val
else
- codes[e] = "1"
+ codes[entry] = "[TRUE]"
+
+//NSV13 - Navbeacon Refactor - Start
+///Removes the nav beacon from the global beacon lists
+/obj/machinery/navbeacon/proc/glob_lists_deregister()
+ if (GLOB.navbeacons["[z]"])
+ GLOB.navbeacons["[z]"] -= src //Remove from beacon list, if in one.
+ GLOB.deliverybeacons -= src
+ GLOB.deliverybeacontags -= location
+
+///Registers the navbeacon to the global beacon lists
+/obj/machinery/navbeacon/proc/glob_lists_register(var/init=FALSE)
+ if(!init)
+ glob_lists_deregister()
+ if(codes?[NAVBEACON_PATROL_MODE])
+ if(!GLOB.navbeacons["[z]"])
+ GLOB.navbeacons["[z]"] = list()
+ GLOB.navbeacons["[z]"] += src //Register with the patrol list!
+ if(codes?[NAVBEACON_DELIVERY_MODE])
+ GLOB.deliverybeacons += src
+ GLOB.deliverybeacontags += location
+
+/obj/machinery/navbeacon/crowbar_act(mob/living/user, obj/item/I)
+ if(default_deconstruction_crowbar(I))
+ return TRUE
+
+/obj/machinery/navbeacon/screwdriver_act(mob/living/user, obj/item/tool)
+ if(!panel_open && cover_locked)
+ balloon_alert(user, "hatch locked!")
+ return TRUE
+ return default_deconstruction_screwdriver(user, "navbeacon1","navbeacon0",tool)
+
+/obj/machinery/navbeacon/attackby(obj/item/attacking_item, mob/user, params)
+ var/turf/our_turf = loc
+ if(our_turf.intact)
+ return // prevent intraction when T-scanner revealed
+
+ if(attacking_item.GetID())
+ if(!panel_open)
+ if (allowed(user))
+ controls_locked = !controls_locked
+ balloon_alert(user, "controls [controls_locked ? "locked" : "unlocked"]")
+ SStgui.update_uis(src)
+ else
+ balloon_alert(user, "access denied")
+ else
+ balloon_alert(user, "panel open!")
+ return
+ return ..()
+//NSV13 - Navbeacon Refactor - Stop
// called when turf state changes
// hide the object if turf is intact
@@ -92,141 +153,106 @@
invisibility = intact ? INVISIBILITY_MAXIMUM : 0
update_icon()
-// update the icon_state
-/obj/machinery/navbeacon/update_icon()
- var/state="navbeacon[open]"
-
- if(invisibility)
- icon_state = "[state]-f" // if invisible, set icon to faded version
- // in case revealed by T-scanner
- else
- icon_state = "[state]"
-
-/obj/machinery/navbeacon/attackby(obj/item/I, mob/user, params)
- var/turf/T = loc
- if(T.intact)
- return // prevent intraction when T-scanner revealed
-
- if(I.tool_behaviour == TOOL_SCREWDRIVER)
- open = !open
-
- user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "You [open ? "open" : "close"] the beacon's cover.")
-
- update_icon()
-
- else if (istype(I, /obj/item/card/id) || istype(I, /obj/item/modular_computer/tablet))
- if(open)
- if (src.allowed(user))
- src.locked = !src.locked
- to_chat(user, "Controls are now [src.locked ? "locked" : "unlocked"].")
- else
- to_chat(user, "Access denied.")
- updateDialog()
- else
- to_chat(user, "You must open the cover first!")
- else
- return ..()
/obj/machinery/navbeacon/attack_ai(mob/user)
- interact(user, 1)
+ interact(user) //NSV13 - Navbeacon Refactor
/obj/machinery/navbeacon/attack_paw()
return
-/obj/machinery/navbeacon/ui_interact(mob/user)
+//NSV13 - Navbeacon Refactor - Start
+/obj/machinery/navbeacon/ui_interact(mob/user, datum/tgui/ui)
. = ..()
- var/ai = isAI(user)
- var/turf/T = loc
- if(T.intact)
- return // prevent intraction when T-scanner revealed
-
- if(!open && !ai) // can't alter controls if not open, unless you're an AI
- to_chat(user, "The beacon's control cover is closed!")
- return
+ var/turf/our_turf = loc
+ if(our_turf.intact)
+ return // prevent intraction when T-scanner revealed
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "NavBeacon")
+ ui.set_autoupdate(FALSE)
+ ui.open()
- var/t
+/obj/machinery/navbeacon/ui_data(mob/user)
+ var/list/data = list()
+ var/list/controls = list()
- if(locked && !ai)
- t = {"Navigation Beacon
-(swipe card to unlock controls)
-Location: [location ? location : "(none)"]
-Transponder Codes:"}
+ controls["location"] = location
+ controls["patrol_enabled"] = codes[NAVBEACON_PATROL_MODE] ? TRUE : FALSE
+ controls["patrol_next"] = codes[NAVBEACON_PATROL_NEXT]
+ controls["delivery_enabled"] = codes[NAVBEACON_DELIVERY_MODE] ? TRUE : FALSE
+ controls["delivery_direction"] = dir2text(text2num(codes[NAVBEACON_DELIVERY_DIRECTION]))
+ controls["cover_locked"] = cover_locked
- for(var/key in codes)
- t += "- [key] ... [codes[key]]"
- t+= "
"
+ data["locked"] = controls_locked
+ data["siliconUser"] = issilicon(user)
+ data["controls"] = controls
- else
+ return data
- t = {"Navigation Beacon
-(swipe card to lock controls)
+/obj/machinery/navbeacon/ui_static_data(mob/user)
+ var/list/data = list()
+ var/list/static_controls = list()
+ var/static/list/direction_options = list("none", dir2text(EAST), dir2text(NORTH), dir2text(SOUTH), dir2text(WEST))
-
-Location: [location ? location : "None"]
-Transponder Codes:"}
+ static_controls["direction_options"] = direction_options
+ static_controls["has_codes"] = codes_txt ? TRUE : FALSE
- for(var/key in codes)
- t += "- [key] ... [codes[key]]"
- t += " Edit"
- t += " Delete
"
- t += " Add New
"
- t+= "
"
+ data["static_controls"] = static_controls
+ return data
- var/datum/browser/popup = new(user, "navbeacon", "Navigation Beacon", 300, 400)
- popup.set_content(t)
- popup.open()
- return
-
-/obj/machinery/navbeacon/Topic(href, href_list)
- if(..())
+/obj/machinery/navbeacon/ui_act(action, params)
+ . = ..()
+ if(.)
return
- if(open && !locked)
- usr.set_machine(src)
+ if(action == "lock" && allowed(usr))
+ controls_locked = !controls_locked
+ return TRUE
- if(href_list["locedit"])
- var/newloc = stripped_input(usr, "Enter New Location", "Navigation Beacon", location)
- if(newloc)
- location = newloc
- updateDialog()
-
- else if(href_list["edit"])
- var/codekey = href_list["code"]
-
- var/newkey = stripped_input(usr, "Enter Transponder Code Key", "Navigation Beacon", codekey)
- if(!newkey)
- return
-
- var/codeval = codes[codekey]
- var/newval = stripped_input(usr, "Enter Transponder Code Value", "Navigation Beacon", codeval)
- if(!newval)
- newval = codekey
- return
-
- codes.Remove(codekey)
- codes[newkey] = newval
-
- updateDialog()
-
- else if(href_list["delete"])
- var/codekey = href_list["code"]
- codes.Remove(codekey)
- updateDialog()
-
- else if(href_list["add"])
+ if(controls_locked && !issilicon(usr))
+ return
- var/newkey = stripped_input(usr, "Enter New Transponder Code Key", "Navigation Beacon")
- if(!newkey)
+ switch(action)
+ if("reset_codes")
+ glob_lists_deregister()
+ location = original_location
+ set_codes()
+ glob_lists_register() //NSV13 - Navbeacon Refactor
+ return TRUE
+ if("toggle_cover")
+ cover_locked = !cover_locked
+ return TRUE
+ if("toggle_patrol")
+ toggle_code(NAVBEACON_PATROL_MODE)
+ return TRUE
+ if("toggle_delivery")
+ toggle_code(NAVBEACON_DELIVERY_MODE)
+ return TRUE
+ if("set_location")
+ var/input_text = tgui_input_text(usr, "Enter the beacon's location tag", "Beacon Location", location, 20)
+ if (!input_text || location == input_text)
return
-
- var/newval = stripped_input(usr, "Enter New Transponder Code Value", "Navigation Beacon")
- if(!newval)
- newval = "1"
+ glob_lists_deregister()
+ location = input_text
+ glob_lists_register() //NSV13 - Navbeacon Refactor
+ return TRUE
+ if("set_patrol_next")
+ var/next_patrol = codes[NAVBEACON_PATROL_NEXT]
+ var/input_text = tgui_input_text(usr, "Enter the tag of the next patrol location", "Beacon Location", next_patrol, 20)
+ if (!input_text || location == input_text)
return
+ codes[NAVBEACON_PATROL_NEXT] = input_text
+ return TRUE
+ if("set_delivery_direction")
+ codes[NAVBEACON_DELIVERY_DIRECTION] = "[text2dir(params["direction"])]"
+ return TRUE
+
+///Adds or removes a specific code
+/obj/machinery/navbeacon/proc/toggle_code(code)
+ if(codes[code])
+ codes.Remove(code)
+ else
+ codes[code]="[TRUE]"
+ glob_lists_register()
+//NSV13 - Navbeacon Refactor - Stop
- if(!codes)
- codes = new()
-
- codes[newkey] = newval
-
- updateDialog()
diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index cfe451c1b4f..bd1966eb996 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -83,7 +83,7 @@
var/nearest_beacon // the nearest beacon's tag
var/turf/nearest_beacon_loc // the nearest beacon's location
- var/beacon_freq = FREQ_NAV_BEACON
+ //var/beacon_freq = FREQ_NAV_BEACON //NSV13 - Navbeacon Refactor - Removed
var/model = "" //The type of bot it is.
var/bot_type = 0 //The type of bot it is, for radio control.
var/data_hud_type = DATA_HUD_DIAGNOSTIC_BASIC //The type of data HUD the bot uses. Diagnostic by default.
@@ -716,24 +716,24 @@ Pass a positive integer as an argument to override a bot's default speed.
/mob/living/simple_animal/bot/proc/get_next_patrol_target()
// search the beacon list for the next target in the list.
for(var/obj/machinery/navbeacon/NB in get_overmap().beacons_in_ship) //NSV13 - Navbeacons are in the Overmap Ship
- if(NB.codes["next_patrol"] != null) //NSV13
+ if(NB.codes[NAVBEACON_PATROL_NEXT] != null) //NSV13
if(NB.location == next_destination) //Does the Beacon location text match the destination?
destination = new_destination //We now know the name of where we want to go.
patrol_target = NB.loc //Get its location and set it as the target.
original_patrol = NB.loc
- next_destination = NB.codes["next_patrol"] //Also get the name of the next beacon in line.
+ next_destination = NB.codes[NAVBEACON_PATROL_NEXT] //Also get the name of the next beacon in line. //NSV13 - Navbeacon Refactor
return TRUE
/mob/living/simple_animal/bot/proc/find_nearest_beacon()
for(var/obj/machinery/navbeacon/NB in get_overmap().beacons_in_ship) //NSV13 - Navbeacons are in the Overmap Ship
- if(NB.codes["next_patrol"] != null) //NSV13
+ if(NB.codes[NAVBEACON_PATROL_NEXT] != null) //NSV13
var/dist = get_dist(src, NB)
if(nearest_beacon) //Loop though the beacon net to find the true closest beacon.
//Ignore the beacon if were are located on it.
if(dist>1 && dist 1) //Begin the search, save this one for comparison on the next loop.
diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm
index 72e94e6866e..33606e23b4c 100644
--- a/code/modules/mob/living/simple_animal/bot/mulebot.dm
+++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm
@@ -796,7 +796,11 @@
// the we will navigate there
destination = new_destination
target = NB.loc
- var/direction = NB.dir // this will be the load/unload dir
+ //NSV13 - Navbeacon Refactor - Start
+ var/direction = NB.codes[NAVBEACON_DELIVERY_DIRECTION] // this will be the load/unload dir
+ if(!direction)
+ direction = NB.dir // fallback
+ //NSV13 - Navbeacon Refactor - Stop
if(direction)
loaddir = text2num(direction)
else
diff --git a/code/modules/research/techweb/all_nodes.dm b/code/modules/research/techweb/all_nodes.dm
index ab3e4df771d..1d2ae16efcf 100644
--- a/code/modules/research/techweb/all_nodes.dm
+++ b/code/modules/research/techweb/all_nodes.dm
@@ -408,7 +408,7 @@
display_name = "Basic Robotics Research"
description = "Programmable machines that make our lives lazier."
prereq_ids = list("base")
- design_ids = list("paicard")
+ design_ids = list("paicard","botnavbeacon") //NSV13 - Navbeacon Refactoring
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000
diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm
index 82906e0dbf3..63bc1b28a81 100644
--- a/code/modules/shuttle/on_move.dm
+++ b/code/modules/shuttle/on_move.dm
@@ -319,11 +319,11 @@ All ShuttleMove procs go here
. = ..()
var/turf/T = loc
hide(T.intact)
- if(codes["patrol"])
+ if(codes[NAVBEACON_PATROL_MODE]) //NSV13 - Navbeacon refactor
if(!GLOB.navbeacons["[z]"])
GLOB.navbeacons["[z]"] = list()
GLOB.navbeacons["[z]"] += src //Register with the patrol list!
- if(codes["delivery"])
+ if(codes[NAVBEACON_DELIVERY_MODE]) //NSV13 - Navbeacon refactor
GLOB.deliverybeacons += src
GLOB.deliverybeacontags += location
diff --git a/nsv13/code/game/objects/items/nsv_circuitboards.dm b/nsv13/code/game/objects/items/nsv_circuitboards.dm
index 334fd8913af..4465dee6c6d 100644
--- a/nsv13/code/game/objects/items/nsv_circuitboards.dm
+++ b/nsv13/code/game/objects/items/nsv_circuitboards.dm
@@ -438,3 +438,9 @@
/obj/item/stock_parts/manipulator = 1,
/obj/item/stack/sheet/glass = 1)
needs_anchored = FALSE
+
+/obj/item/circuitboard/machine/navbeacon
+ name = "Bot Navigational Beacon"
+ icon_state = "science"
+ build_path = /obj/machinery/navbeacon
+ req_components = list()
diff --git a/nsv13/code/modules/research/designs/nsv_circuitboard_designs.dm b/nsv13/code/modules/research/designs/nsv_circuitboard_designs.dm
index 8fe4b72c03a..fe3d9edd61b 100644
--- a/nsv13/code/modules/research/designs/nsv_circuitboard_designs.dm
+++ b/nsv13/code/modules/research/designs/nsv_circuitboard_designs.dm
@@ -121,3 +121,12 @@
build_path = /obj/item/circuitboard/machine/coffeemaker
category = list("Misc. Machinery")
departmental_flags = DEPARTMENTAL_FLAG_SERVICE | DEPARTMENTAL_FLAG_ENGINEERING | DEPARTMENTAL_FLAG_SCIENCE
+
+/datum/design/board/navbeacon
+ name = "Machine Design (Bot Navigational Beacon)"
+ desc = "The circuit board for a beacon that aids bot navigation."
+ id = "botnavbeacon"
+ build_type = IMPRINTER
+ build_path = /obj/item/circuitboard/machine/navbeacon
+ category = list ("Research Machinery")
+ departmental_flags = DEPARTMENTAL_FLAG_SCIENCE | DEPARTMENTAL_FLAG_ENGINEERING
diff --git a/tgui/packages/tgui/interfaces/NavBeacon.tsx b/tgui/packages/tgui/interfaces/NavBeacon.tsx
new file mode 100644
index 00000000000..b7bdd30b5e2
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/NavBeacon.tsx
@@ -0,0 +1,144 @@
+import { useBackend } from '../backend';
+import { Box, Button, Dropdown, LabeledList, Section, Stack } from '../components';
+import { Window } from '../layouts';
+import { InterfaceLockNoticeBox } from './common/InterfaceLockNoticeBox';
+import { BooleanLike } from '../../common/react';
+
+export type Data = {
+ locked: BooleanLike;
+ siliconUser: BooleanLike;
+ controls: NavBeaconControl;
+ static_controls: NavBeaconStaticControl;
+};
+
+export type NavBeaconControl = {
+ location: String;
+ patrol_enabled: BooleanLike;
+ patrol_next: String;
+ delivery_enabled: BooleanLike;
+ delivery_direction: String;
+ cover_locked: BooleanLike;
+};
+
+export type DisabledProps = {
+ disabled: BooleanLike;
+};
+
+export type NavBeaconStaticControl = {
+ direction_options: String[];
+ has_codes: BooleanLike;
+};
+
+export const NavBeacon = (props, context) => {
+ const { act, data } = useBackend(context);
+ return (
+
+
+
+
+
+ );
+};
+
+export const NavBeaconContent = (props, context) => {
+ const { act, data } = useBackend(context);
+ const { controls, static_controls } = data;
+ const disabled = data.locked && !data.siliconUser;
+ return (
+
+
+
+
+
+ );
+};
+
+export const NavBeaconControlSection = (props: DisabledProps, context) => {
+ const { act, data } = useBackend(context);
+ const { controls, static_controls } = data;
+ return (
+
+
+
+
+
+ act('toggle_patrol')}
+ />
+
+
+
+
+ act('toggle_delivery')}
+ />
+
+
+
+ act('set_delivery_direction', {
+ direction: value,
+ })}
+ />
+
+
+
+ );
+};
+
+export const NavBeaconMaintenanceSection = (props: DisabledProps, context) => {
+ const { act, data } = useBackend(context);
+ const { controls, static_controls } = data;
+ return (
+
+
+
+ {!!static_controls.has_codes && (
+
+
+ act('toggle_cover')}
+ />
+
+
+
+ );
+};