-Added a new button to NTSL's IDE which will clear the server's memory.

-Changed the broadcast function using a precreated human. The human would still be existing and a new one was created for every use of the broadcast. Garbage collecting it was almost impossible and deleting it everytime a broadcast is made would be laggy so I modified the broadcast code to not need a mob reference.
-Added some checks in the events.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5477 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2013-01-06 06:55:52 +00:00
parent bc56419710
commit f614122778
6 changed files with 100 additions and 28 deletions

View File

@@ -236,6 +236,8 @@
var/foundAlready = 0 // don't infect someone that already has the virus
var/turf/T = get_turf(H)
if(!T)
continue
if(T.z != 1)
continue
for(var/datum/disease/D in H.viruses)
@@ -305,6 +307,8 @@
*/
for(var/mob/living/carbon/human/H in living_mob_list)
var/turf/T = get_turf(H)
if(!T)
continue
if(T.z != 1)
continue
if(istype(H,/mob/living/carbon/human))
@@ -320,6 +324,8 @@
domutcheck(H,null,1)
for(var/mob/living/carbon/monkey/M in living_mob_list)
var/turf/T = get_turf(M)
if(!T)
continue
if(T.z != 1)
continue
M.apply_effect((rand(15,75)),IRRADIATE,0)

View File

@@ -286,7 +286,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
if (R.client && !(R.client.prefs.toggles & CHAT_RADIO)) //Adminning with 80 people on can be fun when you're trying to talk and all you can hear is radios.
continue
if(istype(M, /mob/new_player)) // we don't want new players to hear messages. rare but generates runtimes.
if(istype(R, /mob/new_player)) // we don't want new players to hear messages. rare but generates runtimes.
continue
@@ -297,10 +297,10 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
// --- Can understand the speech ---
if (R.say_understands(M))
if (!M || R.say_understands(M))
// - Not human or wearing a voice mask -
if (!ishuman(M) || vmask)
if (!M || !ishuman(M) || vmask)
heard_masked += R
// - Human and not wearing voice mask -
@@ -371,7 +371,11 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
// --- Filter the message; place it in quotes apply a verb ---
var/quotedmsg = M.say_quote(message)
var/quotedmsg = null
if(M)
quotedmsg = M.say_quote(message)
else
quotedmsg = "says, \"[message]\""
// --- This following recording is intended for research and feedback in the use of department radio channels ---
@@ -447,7 +451,7 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
// Does not display message; displayes the mob's voice_message (ie "chimpers")
if (length(heard_voice))
var/rendered = "[part_a][vname][part_b][M.voice_message][part_c]"
var/rendered = "[part_a][vname][part_b][vmessage][part_c]"
for (var/mob/R in heard_voice)
aitrack = "<a href='byond://?src=\ref[radio];track2=\ref[R];track=\ref[M]'>"
@@ -464,7 +468,11 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
// Displays garbled message (ie "f*c* **u, **i*er!")
if (length(heard_garbled))
quotedmsg = M.say_quote(stars(message))
if(M)
quotedmsg = M.say_quote(stars(message))
else
quotedmsg = stars(quotedmsg)
var/rendered = "[part_a][vname][part_b][quotedmsg][part_c]"
for (var/mob/R in heard_garbled)
@@ -482,8 +490,12 @@ var/message_delay = 0 // To make sure restarting the recentmessages list is kept
/* --- Complete gibberish. Usually happens when there's a compressed message --- */
if (length(heard_gibberish))
quotedmsg = M.say_quote(Gibberish(message, compression + 50))
var/rendered = "[part_a][Gibberish(M.real_name, compression + 50)][part_b][quotedmsg][part_c]"
if(M)
quotedmsg = M.say_quote(Gibberish(message, compression + 50))
else
quotedmsg = Gibberish(quotedmsg, compression + 50)
var/rendered = "[part_a][Gibberish(name, compression + 50)][part_b][quotedmsg][part_c]"
for (var/mob/R in heard_gibberish)
aitrack = "<a href='byond://?src=\ref[radio];track2=\ref[R];track=\ref[M]'>"

View File

@@ -518,11 +518,13 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
var/salt = "null" // encryption salt: ie "123comsat"
// would add up to md5("password123comsat")
var/language = "human"
var/obj/item/device/radio/headset/server_radio = null
/obj/machinery/telecomms/server/New()
..()
Compiler = new()
Compiler.Holder = src
server_radio = new()
/obj/machinery/telecomms/server/receive_information(datum/signal/signal, obj/machinery/telecomms/machine_from)

View File

@@ -183,4 +183,29 @@ client/verb/tcsrevert()
src << output("<font color = red>Failed to revert: Unable to locate machine.</font color>", "tcserror")
client/verb/tcsclearmem()
set hidden = 1
if(mob.machine || issilicon(mob))
if((istype(mob.machine, /obj/machinery/computer/telecomms/traffic) && mob.machine in view(1, mob)) || (issilicon(mob) && istype(mob.machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
if(Machine.editingcode != mob)
return
if(Machine.SelectedServer)
var/obj/machinery/telecomms/server/Server = Machine.SelectedServer
Server.memory = list() // clear the memory
// Show results
src << output(null, "tcserror")
src << output("<font color = blue>Server memory cleared!</font color>", "tcserror")
for(var/mob/M in Machine.viewingcode)
if(M.client)
M << output("<font color = blue>Server memory cleared!</font color>", "tcserror")
else
src << output(null, "tcserror")
src << output("<font color = red>Failed to clear memory: Unable to locate server machine.</font color>", "tcserror")
else
src << output(null, "tcserror")
src << output("<font color = red>Failed to clear memory: Unable to locate machine.</font color>", "tcserror")
else
src << output(null, "tcserror")
src << output("<font color = red>Failed to clear memory: Unable to locate machine.</font color>", "tcserror")

View File

@@ -222,10 +222,13 @@ datum/signal
proc/tcombroadcast(var/message, var/freq, var/source, var/job)
var/mob/living/carbon/human/H = new
var/datum/signal/newsign = new
var/obj/machinery/telecomms/server/S = data["server"]
var/obj/item/device/radio/hradio
var/obj/item/device/radio/hradio = S.server_radio
if(!hradio)
error("[src] has no radio.")
return
if((!message || message == "") && message != 0)
message = "*beep*"
@@ -240,8 +243,8 @@ datum/signal
if(!job)
job = "?"
newsign.data["mob"] = H
newsign.data["mobtype"] = H.type
newsign.data["mob"] = null
newsign.data["mobtype"] = /mob/living/carbon/human
if(source in S.stored_names)
newsign.data["name"] = source
else
@@ -258,14 +261,10 @@ datum/signal
var/datum/radio_frequency/connection = radio_controller.return_frequency(freq)
newsign.data["connection"] = connection
// The radio is a radio headset!
if(!hradio)
hradio = new /obj/item/device/radio/headset
newsign.data["radio"] = hradio
newsign.data["vmessage"] = H.voice_message
newsign.data["vname"] = H.voice_name
newsign.data["vmessage"] = message
newsign.data["vname"] = source
newsign.data["vmask"] = 0
newsign.data["level"] = list()

View File

@@ -532,7 +532,7 @@ window "Telecomms IDE"
elem "Telecomms IDE"
type = MAIN
pos = 281,0
size = 652x582
size = 569x582
anchor1 = none
anchor2 = none
font-family = ""
@@ -568,10 +568,38 @@ window "Telecomms IDE"
macro = ""
menu = ""
on-close = "exittcs"
elem "button5"
type = BUTTON
pos = 209,464
size = 70x20
anchor1 = 37,80
anchor2 = 49,83
font-family = ""
font-size = 0
font-style = ""
text-color = #000000
background-color = none
is-visible = true
is-disabled = false
is-transparent = false
is-default = false
border = none
drop-zone = false
right-click = false
saved-params = "is-checked"
on-size = ""
text = "Clear Memory"
image = ""
command = "tcsclearmem"
is-flat = false
stretch = false
is-checked = false
group = ""
button-type = pushbutton
elem "button4"
type = BUTTON
pos = 180,464
size = 60x20
pos = 157,464
size = 52x20
anchor1 = 28,80
anchor2 = 37,83
font-family = ""
@@ -598,8 +626,8 @@ window "Telecomms IDE"
button-type = pushbutton
elem "button3"
type = BUTTON
pos = 120,464
size = 60x20
pos = 105,464
size = 52x20
anchor1 = 18,80
anchor2 = 28,83
font-family = ""
@@ -627,7 +655,7 @@ window "Telecomms IDE"
elem "tcserror"
type = OUTPUT
pos = 0,488
size = 648x94
size = 566x94
anchor1 = 0,84
anchor2 = 99,100
font-family = "sans-serif"
@@ -652,8 +680,8 @@ window "Telecomms IDE"
image = ""
elem "button2"
type = BUTTON
pos = 60,464
size = 60x20
pos = 53,464
size = 52x20
anchor1 = 9,80
anchor2 = 18,83
font-family = ""
@@ -681,7 +709,7 @@ window "Telecomms IDE"
elem "button1"
type = BUTTON
pos = 0,464
size = 60x20
size = 53x20
anchor1 = 0,80
anchor2 = 9,83
font-family = ""
@@ -709,7 +737,7 @@ window "Telecomms IDE"
elem "tcscode"
type = INPUT
pos = 0,0
size = 652x464
size = 569x464
anchor1 = 0,0
anchor2 = 100,80
font-family = "Courier"