Skip to content

Commit

Permalink
Added language argument to broadcast()
Browse files Browse the repository at this point in the history
Can be any of HUMAN, MONKEY, ALIEN, ROBOT, SLIME or DRONE.
  • Loading branch information
Donkie committed Sep 26, 2014
1 parent 7be2bdf commit 34a3d63
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions code/modules/scripting/Implementations/Telecomms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,30 @@
interpreter.SetVar("$sign" , signal)
interpreter.SetVar("$pass" , !(signal.data["reject"])) // if the signal isn't rejected, pass = 1; if the signal IS rejected, pass = 0

//Language bitflags
interpreter.SetVar("HUMAN" , HUMAN)
interpreter.SetVar("MONKEY" , MONKEY)
interpreter.SetVar("ALIEN" , ALIEN)
interpreter.SetVar("ROBOT" , ROBOT)
interpreter.SetVar("SLIME" , SLIME)
interpreter.SetVar("DRONE" , DRONE)


/*
Telecomms procs
*/

/*
-> Send another signal to a server
@format: broadcast(content, frequency, source, job)
@format: broadcast(content, frequency, source, job, lang)
@param content: Message to broadcast
@param frequency: Frequency to broadcast to
@param source: The name of the source you wish to imitate. Must be stored in stored_names list.
@param job: The name of the job.
@param job: The name of the job.
@param lang: Target language.
*/
interpreter.SetProc("broadcast", "tcombroadcast", signal, list("message", "freq", "source", "job"))
interpreter.SetProc("broadcast", "tcombroadcast", signal, list("message", "freq", "source", "job", "lang"))

/*
-> Send a code signal.
Expand Down Expand Up @@ -251,7 +260,7 @@ datum/signal
lastsignalers.Add("[time] <B>:</B> [S.id] sent a signal command, which was triggered by NTSL.<B>:</B> [format_frequency(freq)]/[code]")


proc/tcombroadcast(var/message, var/freq, var/source, var/job)
proc/tcombroadcast(var/message, var/freq, var/source, var/job, var/lang)

var/datum/signal/newsign = new
var/obj/machinery/telecomms/server/S = data["server"]
Expand All @@ -274,13 +283,16 @@ datum/signal
if(!job)
job = "Unknown"

if(!lang || lang <= 0)// || !(lang && !(lang & (lang - 1)))) //This last piece of code checks to make sure only one bit is set.
lang = HUMAN

//SAY REWRITE RELATED CODE.
//This code is a little hacky, but it *should* work. Even though it'll result in a virtual speaker referencing another virtual speaker. vOv
var/atom/movable/virtualspeaker/virt = PoolOrNew(/atom/movable/virtualspeaker,null)
virt.name = source
virt.job = job
virt.faketrack = 1
virt.languages = HUMAN
virt.languages = lang
//END SAY REWRITE RELATED CODE.

newsign.data["mob"] = virt
Expand Down

0 comments on commit 34a3d63

Please sign in to comment.