mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-26 01:52:15 +00:00
Adds IFF beacons to ships, allowing people to change the ship name or obfuscate it. (#14471)
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "engines_control.tmpl", "[connected.name] Engines Control", 390, 530)
|
||||
ui = new(user, src, ui_key, "engines_control.tmpl", "[connected.get_real_name()] Engines Control", 390, 530)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "helm.tmpl", "[connected.name] Helm Control", 565, 545)
|
||||
ui = new(user, src, ui_key, "helm.tmpl", "[connected.get_real_name()] Helm Control", 565, 545)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
@@ -284,7 +284,7 @@
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "nav.tmpl", "[connected.name] Navigation Screen", 380, 530)
|
||||
ui = new(user, src, ui_key, "nav.tmpl", "[connected.get_real_name()] Navigation Screen", 380, 530)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
@@ -5,21 +5,26 @@
|
||||
light_color = LIGHT_COLOR_CYAN
|
||||
extra_view = 4
|
||||
var/obj/machinery/shipsensors/sensors
|
||||
var/obj/machinery/iff_beacon/identification
|
||||
circuit = /obj/item/circuitboard/ship/sensors
|
||||
|
||||
/obj/machinery/computer/ship/sensors/attempt_hook_up(var/obj/effect/overmap/visitable/sector)
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
find_sensors()
|
||||
find_sensors_and_iff()
|
||||
|
||||
/obj/machinery/computer/ship/sensors/proc/find_sensors()
|
||||
/obj/machinery/computer/ship/sensors/proc/find_sensors_and_iff()
|
||||
if(!linked)
|
||||
return
|
||||
for(var/obj/machinery/shipsensors/S in SSmachinery.machinery)
|
||||
if(linked.check_ownership(S))
|
||||
sensors = S
|
||||
break
|
||||
for(var/obj/machinery/iff_beacon/IB in SSmachinery.machinery)
|
||||
if(linked.check_ownership(IB))
|
||||
identification = IB
|
||||
break
|
||||
|
||||
/obj/machinery/computer/ship/sensors/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if(!linked)
|
||||
@@ -72,10 +77,25 @@
|
||||
data["status"] = "MISSING"
|
||||
data["range"] = "N/A"
|
||||
data["on"] = 0
|
||||
|
||||
if(identification)
|
||||
data["id_on"] = identification.use_power
|
||||
if(identification.disabled)
|
||||
data["id_status"] = "ERROR"
|
||||
else if(!identification.use_power)
|
||||
data["id_status"] = "NOT TRANSMITTING"
|
||||
else
|
||||
data["id_status"] = "TRANSMITTING"
|
||||
data["id_class"] = linked.class
|
||||
data["id_name"] = linked.designation
|
||||
data["can_change_class"] = identification.can_change_class
|
||||
data["can_change_name"] = identification.can_change_name
|
||||
else
|
||||
data["id_status"] = "NOBEACON" //Should not really happen.
|
||||
|
||||
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "shipsensors.tmpl", "[linked.name] Sensors Control", 600, 530, src)
|
||||
ui = new(user, src, ui_key, "shipsensors.tmpl", "[linked.get_real_name()] Sensors Control", 600, 530, src)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
@@ -93,7 +113,7 @@
|
||||
return TOPIC_REFRESH
|
||||
|
||||
if (href_list["link"])
|
||||
find_sensors()
|
||||
find_sensors_and_iff()
|
||||
return TOPIC_REFRESH
|
||||
|
||||
if(sensors)
|
||||
@@ -108,6 +128,39 @@
|
||||
sensors.toggle()
|
||||
return TOPIC_REFRESH
|
||||
|
||||
if(identification)
|
||||
if(href_list["toggle_id"])
|
||||
identification.toggle()
|
||||
return TOPIC_REFRESH
|
||||
|
||||
if(href_list["change_ship_class"])
|
||||
if(!identification.use_power)
|
||||
to_chat(usr, SPAN_WARNING("You cannot do this while the IFF is off!"))
|
||||
return
|
||||
var/new_class = input("Insert a new ship class. 4 letters maximum.", "IFF Management") as text|null
|
||||
new_class = sanitizeSafe(new_class, 5)
|
||||
new_class = uppertext(new_class)
|
||||
if(use_check_and_message(usr))
|
||||
return
|
||||
linked.set_new_class(new_class)
|
||||
playsound(src, 'sound/machines/twobeep.ogg', 50)
|
||||
visible_message(SPAN_NOTICE("\The [src] beeps, <i>\"IFF change to ship class registered.\"</i>"))
|
||||
return TOPIC_REFRESH
|
||||
|
||||
if(href_list["change_ship_name"])
|
||||
if(!identification.use_power)
|
||||
to_chat(usr, SPAN_WARNING("You cannot do this while the IFF is off!"))
|
||||
return
|
||||
var/new_name = input("Insert a new ship name. 24 letters maximum.", "IFF Management") as text|null
|
||||
new_name = sanitizeSafe(new_name, 24)
|
||||
new_name = capitalize(new_name)
|
||||
if(use_check_and_message(usr))
|
||||
return
|
||||
linked.set_new_designation(new_name)
|
||||
playsound(src, 'sound/machines/twobeep.ogg', 50)
|
||||
visible_message(SPAN_NOTICE("\The [src] beeps, <i>\"IFF change to ship designation registered.\"</i>"))
|
||||
return TOPIC_REFRESH
|
||||
|
||||
if (href_list["scan"])
|
||||
var/obj/effect/overmap/O = locate(href_list["scan"])
|
||||
if(istype(O) && !QDELETED(O) && (O in view(7,linked)))
|
||||
|
||||
@@ -106,6 +106,7 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
|
||||
|
||||
/obj/machinery/computer/ship/sensors/Destroy()
|
||||
sensors = null
|
||||
identification = null
|
||||
if(LAZYLEN(viewers))
|
||||
for(var/datum/weakref/W in viewers)
|
||||
var/M = W.resolve()
|
||||
|
||||
74
code/modules/overmap/ships/identification.dm
Normal file
74
code/modules/overmap/ships/identification.dm
Normal file
@@ -0,0 +1,74 @@
|
||||
/obj/machinery/iff_beacon
|
||||
name = "IFF transponder" //This object handles ship identification on sensors.
|
||||
desc = "A complex set of various bluespace and subspace arrays that transmit a ship's identification tags."
|
||||
icon = 'icons/obj/machines/telecomms.dmi'
|
||||
icon_state = "ntnet"
|
||||
idle_power_usage = 500
|
||||
var/datum/wires/iff/wires
|
||||
var/disabled = FALSE
|
||||
var/obfuscating = FALSE
|
||||
var/can_change_class = TRUE
|
||||
var/can_change_name = TRUE
|
||||
|
||||
/obj/machinery/iff_beacon/Initialize()
|
||||
..()
|
||||
wires = new(src)
|
||||
return INITIALIZE_HINT_LATELOAD
|
||||
|
||||
/obj/machinery/iff_beacon/LateInitialize()
|
||||
if(current_map.use_overmap && !linked)
|
||||
var/my_sector = map_sectors["[z]"]
|
||||
if (istype(my_sector, /obj/effect/overmap/visitable))
|
||||
attempt_hook_up(my_sector)
|
||||
|
||||
/obj/machinery/iff_beacon/attackby(obj/item/O, mob/user)
|
||||
if(default_deconstruction_screwdriver(user, O))
|
||||
return TRUE
|
||||
|
||||
if(panel_open)
|
||||
if(O.ismultitool() || O.iswirecutter())
|
||||
if(panel_open)
|
||||
wires.Interact(user)
|
||||
else
|
||||
to_chat(user, SPAN_WARNING("\The [src]'s wires aren't exposed."))
|
||||
return TRUE
|
||||
..()
|
||||
|
||||
/obj/machinery/iff_beacon/proc/toggle()
|
||||
if(disabled)
|
||||
return // No turning on if broken.
|
||||
if(!use_power) //need some juice to kickstart
|
||||
use_power_oneoff(idle_power_usage*5)
|
||||
update_use_power(!use_power)
|
||||
if(use_power) //We are online now. Back to displaying real name.
|
||||
linked.update_obfuscated(FALSE)
|
||||
obfuscating = FALSE
|
||||
else
|
||||
linked.update_obfuscated(TRUE)
|
||||
obfuscating = TRUE
|
||||
|
||||
/obj/machinery/iff_beacon/proc/disable()
|
||||
update_use_power(POWER_USE_OFF)
|
||||
obfuscating = TRUE
|
||||
disabled = TRUE
|
||||
linked.update_obfuscated(TRUE)
|
||||
|
||||
/obj/machinery/iff_beacon/proc/enable()
|
||||
disabled = FALSE
|
||||
toggle()
|
||||
|
||||
/obj/machinery/iff_beacon/update_icon()
|
||||
icon_state = initial(icon_state)
|
||||
cut_overlays()
|
||||
if(panel_open)
|
||||
icon_state += "_o"
|
||||
if(!operable() || !use_power)
|
||||
icon_state += "_off"
|
||||
|
||||
/obj/machinery/iff_beacon/horizon
|
||||
can_change_class = FALSE
|
||||
can_change_name = FALSE
|
||||
|
||||
/obj/machinery/iff_beacon/name_change
|
||||
can_change_name = TRUE
|
||||
can_change_class = FALSE
|
||||
@@ -14,6 +14,7 @@ var/const/OVERMAP_SPEED_CONSTANT = (1 SECOND)
|
||||
name = "generic ship"
|
||||
desc = "Space faring vessel."
|
||||
icon_state = "ship"
|
||||
obfuscated_name = "unidentified vessel"
|
||||
var/moving_state = "ship_moving"
|
||||
|
||||
var/vessel_mass = 10000 //tonnes, arbitrary number, affects acceleration provided by engines
|
||||
|
||||
Reference in New Issue
Block a user