Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for empty lists of frequencies. #5898

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions code/controllers/subsystem/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Frequency range: 1200 to 1600
Radiochat range: 1441 to 1489 (most devices refuse to be tune to other frequency, even during mapmaking)
*/

#define UNIVERSAL_FREQ 1

#define MIN_FREE_FREQ 1201 // -------------------------------------------------

//Misc channels
Expand Down Expand Up @@ -327,11 +329,11 @@ SUBSYSTEM_DEF(radio)
if(length(extra_zs))
target_zs += extra_zs
for(var/obj/structure/machinery/telecomms/T as anything in tcomm_machines_ground)
if(!length(T.freq_listening) || (frequency in T.freq_listening))
if((UNIVERSAL_FREQ in T.freq_listening) || (frequency in T.freq_listening))
target_zs += SSmapping.levels_by_trait(ZTRAIT_GROUND)
break
for(var/obj/structure/machinery/telecomms/T as anything in tcomm_machines_almayer)
if(!length(T.freq_listening) || (frequency in T.freq_listening))
if((UNIVERSAL_FREQ in T.freq_listening) || (frequency in T.freq_listening))
target_zs += SSmapping.levels_by_trait(ZTRAIT_MARINE_MAIN_SHIP)
target_zs += SSmapping.levels_by_trait(ZTRAIT_RESERVED)
break
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/telecomms/presets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
toggle_state(user) // just flip dat switch

/obj/structure/machinery/telecomms/relay/preset/tower/all
freq_listening = list()
freq_listening = list(UNIVERSAL_FREQ)

/obj/structure/machinery/telecomms/relay/preset/tower/faction
name = "UPP telecommunications relay"
Expand Down Expand Up @@ -268,7 +268,7 @@ GLOBAL_LIST_EMPTY(all_static_telecomms_towers)
return
var/choice = tgui_input_list(user, "What do you wish to do?", "TC-3T comms tower", list("Wipe communication frequencies", "Add your faction's frequencies"))
if(choice == "Wipe communication frequencies")
freq_listening = null
freq_listening.Cut()
to_chat(user, SPAN_NOTICE("You wipe the preexisting frequencies from \the [src]."))
return
else if(choice == "Add your faction's frequencies")
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/telecomms/telecomunications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GLOBAL_LIST_EMPTY_TYPED(telecomms_list, /obj/structure/machinery/telecomms)
var/traffic = 0 // value increases as traffic increases
var/netspeed = 5 // how much traffic to lose per tick (50 gigabytes/second * netspeed)
var/list/autolinkers = list() // list of text/number values to link with
var/list/freq_listening = list() // list of frequencies to tune into: if none, will listen to all
var/list/freq_listening = list(UNIVERSAL_FREQ) // list of frequencies to tune into: if universal frequency is included, will listen to all
var/machinetype = 0 // just a hacky way of preventing alike machines from pairing
var/delay = 10 // how many process() ticks to delay per heat
var/long_range_link = 0 // Can you link it across Z levels or on the otherside of the map? (Relay & Hub)
Expand Down
Loading