More work done on Telecomms:

▫ Signals can now be rejected by Subspace broadcasters through a specific data[] parameter.
▫ Improved the log browser.
▫ Log browsers and telecommunication monitors no longer require access to use. You do need access to delete logs, however.
▫ Intercoms need power to work. They don't drain power, they just need a constant flow of equipment power. As such, that offline intercom sprite's now finally being put to use.


Scripting language:

▫ Sorry about all the files; they're all necessary! It's important to notice that the basic structure of the scripting language code is not mine; I cannibalized the base structure from some obscure BYOND project. It's pretty well documented, and I'd say easier to browse through than atmos. Here's the basic deal:

A compiler datum manages the relationships between the three main subsystems of a scripting language: the Scanner, the Parser, and the Interpreter. The Scanner splits raw text into token datums that the Parser can read. The Parser transforms the otherwise random bits and strings into ordered AST Trees and nodes for the Interpreter to read. The interpreter actually executes the code and handles scope/functions/code blocks.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3193 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
vageyenaman@gmail.com
2012-02-25 22:51:31 +00:00
parent 341393bd81
commit b5f8eaf8a9
34 changed files with 5461 additions and 1979 deletions
-1
View File
@@ -3,7 +3,6 @@
desc = "Dance my monkeys! DANCE!!!"
icon_state = "electropack0"
var/code = 2
var/on = 0
var/e_pads = 0.0
g_amt = 2500
m_amt = 10000
+64 -5
View File
@@ -10,6 +10,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
icon_state = "walkietalkie"
item_state = "walkietalkie"
var
on = 1 // 0 for off
last_transmission
frequency = 1459 //common chat
traitor_frequency = 0 //tune to frequency to unlock traitor supplies
@@ -55,6 +56,11 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
if(radio_controller)
initialize()
// If intercom: do a local power check loop
if(istype(src, /obj/item/device/radio/intercom))
spawn(5)
checkpower()
/obj/item/device/radio/initialize()
if(freerange)
if(frequency < 1200 || frequency > 1600)
@@ -74,6 +80,9 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
interact(user)
/obj/item/device/radio/proc/interact(mob/user as mob)
if(!on)
return
var/dat = {"
<html><head><title>[src]</title></head><body><TT>
Microphone: [broadcasting ? "<A href='byond://?src=\ref[src];talk=0'>Engaged</A>" : "<A href='byond://?src=\ref[src];talk=1'>Disengaged</A>"]<BR>
@@ -111,10 +120,31 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
Speaker: <A href='byond://?src=\ref[src];ch_name=[chan_name];listen=[!list]'>[list ? "Engaged" : "Disengaged"]</A><BR>
"}
/obj/item/device/radio/proc/checkpower()
// Simple loop, checks for power. Strictly for intercoms
while(src)
if(!src.loc)
on = 0
var/area/A = src.loc.loc
if(!A || !isarea(A) || !A.master)
on = 0
else
on = A.master.powered(EQUIP) // set "on" to the power status
if(!on)
icon_state = "intercom-p"
else
icon_state = "intercom"
sleep(30)
/obj/item/device/radio/Topic(href, href_list)
//..()
if (usr.stat)
if (usr.stat || !on)
return
if (!(issilicon(usr) || (usr.contents.Find(src) || ( in_range(src, usr) && istype(loc, /turf) ))))
usr << browse(null, "window=radio")
return
@@ -125,6 +155,24 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
if(A && target)
A.ai_actual_track(target)
return
else if (href_list["faketrack"])
var/mob/target = locate(href_list["track"])
var/mob/living/silicon/ai/A = locate(href_list["track2"])
if(A && target)
A:cameraFollow = target
A << text("Now tracking [] on camera.", target.name)
if (usr.machine == null)
usr.machine = usr
while (usr:cameraFollow == target)
usr << "Target is not on or near any active cameras on the station. We'll check again in 5 seconds (unless you use the cancel-camera verb)."
sleep(40)
continue
return
else if (href_list["freq"])
var/new_frequency = (frequency + text2num(href_list["freq"]))
if (!freerange || (frequency < 1200 || frequency > 1600))
@@ -185,6 +233,9 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
/obj/item/device/radio/talk_into(mob/M as mob, message, channel)
if(!on) return // the device has to be on
if(GLOBAL_RADIO_TYPE == 1) // NEW RADIO SYSTEMS: By Doohl
/* Quick introduction:
@@ -292,7 +343,10 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
"connection" = connection, // the radio connection to use
"radio" = src, // stores the radio used for transmission
"slow" = 0, // how much to sleep() before broadcasting - simulates net lag
"traffic" = 0 // dictates the total traffic sum that the signal went through
"traffic" = 0, // dictates the total traffic sum that the signal went through
"type" = 0, // determines what type of radio input it is: normal broadcast
"server" = null, // the last server to log this signal
"reject" = 0 // if nonzero, the signal will not be accepted by any broadcasting machinery
)
signal.frequency = connection.frequency // Quick frequency set
@@ -340,7 +394,10 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
"connection" = connection, // the radio connection to use
"radio" = src, // stores the radio used for transmission
"slow" = 0,
"traffic" = 0
"traffic" = 0,
"type" = 0,
"server" = null,
"reject" = 0
)
signal.frequency = connection.frequency // Quick frequency set
@@ -351,7 +408,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
sleep(rand(10,25)) // wait a little...
if(signal.data["done"])
del(signal) // delete the signal - we're done here.
// we're done here.
return
// Oh my god; the comms are down or something because the signal hasn't been broadcasted yet.
@@ -566,6 +623,8 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
*/
if (!(wires & WIRE_RECEIVE))
return
if (!on)
return
if (!freq) //recieved on main frequency
if (!listening)
return
@@ -599,7 +658,7 @@ var/GLOBAL_RADIO_TYPE = 1 // radio type to use
/* Instead, let's individually search potential containers for mobs! More verbose but a LOT more efficient and less laggy */
// Check gamehelpers.dm for the proc definition:
return get_mobs_in_view(1, src)
return get_mobs_in_view(3, src)
/obj/item/device/radio/examine()
set src in view()