forked from Baystation12/Baystation12
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] Legion narrations now broadcast over telecomms
- Loading branch information
1 parent
2355871
commit 03906a8
Showing
5 changed files
with
140 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "_globals.dm" | ||
#include "legion_beacon.dm" | ||
#include "legion_broadcaster.dm" | ||
#include "legion_hivebot.dm" | ||
#include "legion_mob.dm" | ||
#include "legion_narrate.dm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Because telecoms code is dumb and hardcoded to require an origin mob and radio. This will just exist inside things that are broadcasting legion messages across a radio net. | ||
/mob/legion_broadcaster | ||
name = "legion" | ||
|
||
/// Broadcaster radio this mob uses. Created during init. | ||
var/obj/item/device/radio/broadcaster | ||
|
||
/// List of frequencies this device will broadcast on. | ||
var/list/frequencies = list() | ||
|
||
/// List of default frequencies the device will use if no tcomms servers are found. | ||
var/static/list/default_frequencies = list( | ||
PUB_FREQ, | ||
HAIL_FREQ | ||
) | ||
|
||
|
||
/mob/legion_broadcaster/Initialize() | ||
. = ..() | ||
broadcaster = new(src) | ||
broadcaster.SetName("legion broadcaster") | ||
broadcaster.power_usage = FALSE | ||
broadcaster.listening = FALSE | ||
broadcaster.on = TRUE | ||
resync_frequencies() | ||
|
||
|
||
/mob/legion_broadcaster/Destroy() | ||
QDEL_NULL(broadcaster) | ||
frequencies.Cut() | ||
return ..() | ||
|
||
|
||
/mob/legion_broadcaster/SetName(new_name) | ||
name = new_name | ||
real_name = new_name | ||
|
||
|
||
/mob/legion_broadcaster/proc/resync_frequencies() | ||
frequencies.Cut() | ||
|
||
for (var/obj/machinery/telecomms/server in telecomms_list) | ||
if (!AreConnectedZLevels(get_z(src), get_z(server))) | ||
continue | ||
frequencies |= server.freq_listening | ||
|
||
if (!length(frequencies)) | ||
frequencies = default_frequencies | ||
|
||
|
||
/mob/legion_broadcaster/proc/legion_broadcast(origin, message) | ||
SetName(origin) | ||
for (var/frequency in frequencies) | ||
broadcaster.set_frequency(frequency) | ||
do_message(message) | ||
SetName("") | ||
|
||
|
||
/mob/legion_broadcaster/proc/do_message(message) | ||
set waitfor = FALSE | ||
broadcaster.talk_into(src, message, null, null, all_languages["Noise"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters