Skip to content

Commit

Permalink
Fix for empty lists of frequences.
Browse files Browse the repository at this point in the history
  • Loading branch information
Segrain committed Mar 7, 2024
1 parent 9cc6358 commit b7385c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
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

0 comments on commit b7385c1

Please sign in to comment.