-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

@@ -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()