Refactor telecomms to send messages to logically adjacent zlevels

This commit is contained in:
Aronai Sieyes
2020-04-11 12:56:57 -04:00
parent dcf88640ee
commit 65cfc5bd39
15 changed files with 598 additions and 211 deletions

View File

@@ -505,7 +505,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
//If we're announcing their arrival
if(announce)
AnnounceArrival(new_character, new_character.mind.assigned_role)
AnnounceArrival(new_character, new_character.mind.assigned_role, "Common", new_character.z)
log_admin("[admin] has spawned [player_key]'s character [new_character.real_name].")
message_admins("[admin] has spawned [player_key]'s character [new_character.real_name].", 1)

View File

@@ -413,18 +413,19 @@
//Grab some data from the character prefs for use in random news procs.
AnnounceArrival(character, rank, join_message)
AnnounceArrival(character, rank, join_message, announce_channel, character.z)
else
AnnounceCyborg(character, rank, join_message)
AnnounceCyborg(character, rank, join_message, announce_channel, character.z)
qdel(src)
/mob/new_player/proc/AnnounceCyborg(var/mob/living/character, var/rank, var/join_message)
/mob/new_player/proc/AnnounceCyborg(var/mob/living/character, var/rank, var/join_message, var/channel, var/zlevel)
if (ticker.current_state == GAME_STATE_PLAYING)
var/list/zlevels = zlevel ? using_map.get_map_levels(zlevel, TRUE) : null
if(character.mind.role_alt_title)
rank = character.mind.role_alt_title
// can't use their name here, since cyborg namepicking is done post-spawn, so we'll just say "A new Cyborg has arrived"/"A new Android has arrived"/etc.
global_announcer.autosay("A new[rank ? " [rank]" : " visitor" ] [join_message ? join_message : "has arrived on the station"].", "Arrivals Announcement Computer")
global_announcer.autosay("A new[rank ? " [rank]" : " visitor" ] [join_message ? join_message : "has arrived on the station"].", "Arrivals Announcement Computer", channel, zlevels)
/mob/new_player/proc/LateChoices()
var/name = client.prefs.be_random_name ? "friend" : client.prefs.real_name

View File

@@ -79,20 +79,25 @@ var/global/ntnet_card_uid = 1
return 0
if(holder2)
var/turf/T = get_turf(holder2)
if(!istype(T)) //no reception in nullspace
var/holderz = get_z(holder2)
if(!holderz) //no reception in nullspace
return 0
if(T.z in using_map.station_levels)
// Computer is on station. Low/High signal depending on what type of network card you have
if(long_range)
return 2
else
return 1
if(T.z in using_map.contact_levels) //not on station, but close enough for radio signal to travel
if(long_range) // Computer is not on station, but it has upgraded network card. Low signal.
return 1
return 0 // Computer is not on station and does not have upgraded network card. No signal.
var/list/zlevels_in_range = using_map.get_map_levels(holderz, long_range)
var/best = 0
for(var/relay in ntnet_global.relays)
var/obj/machinery/ntnet_relay/R = relay
//Relay is down
if(!R.operable())
continue
//We're on the same z
if(R.z == holderz)
best = 2
break // No point in going further
//Not on the same z but within range anyway
if(R.z in zlevels_in_range)
best = 1
return best
return 0 // No computer!
/obj/item/weapon/computer_hardware/network_card/Destroy()
if(holder2 && (holder2.network_card == src))