mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-20 15:12:19 +00:00
* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.
* this is probably important
* Remove cascade disabling SSgarbage
* Fixed a bug where dust() did not qdel the target mob
* Misc fixes
* Fix decals surviving break-to-plating
* Subsystem flag tweaks
* Apparently subsystems are new'd before config is.
* Fix paper icons
* Speculative fix for insane lag
* Better machinery stat
* Make organs not use SSoverlay
* Misc bugfixes & tweaks
* Nightmode fixes
* Changelog for SMC
* Port /tg/'s improved MC crash handling
* Add some more SS Recover() procs
* supply_controller -> SScargo
* More New() -> Initialize()
* pAI and robot construction overlays
* Fix cargo unit tests
* Merge the DMM Suite's atom/New() into atoms_init
* Lighting pre-baking
* Lighting initialization logging
* Fix some bad SS init orders
* Fix SSlighting logging; rename Processes to MC
* Speculative fix for insane GC lag
* Prebaked openturf/icon_smooth & fix lighting prebake
* SS init status; SSatoms LATEQDEL
* Fix bug with MC init stat panel
* Fix parallax
* Misc
* Ignore SS_NO_DISPLAY during init
* apparently this is important
* REEEEEE
* Image GC fixes; broadcaster radio-new sanity
* RCON Cleanup
* Move pAI recruiter into subsystem
* Move global solars list into sun subsystem
* Make chickens not use a global
* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup
* Speed up space init a little
* Fix bad timer flags on floor drying
* Subsystem panic-restart verb for mins
* Explosion speedup
* Minor subsystem & MC logging tweaks
* SSopenturf improvements
* Make pipenet actually initialize (whoops)
* Minor tweaks
* Implement lighting rounding
* comments are hard okay
* Minor lattice tweaks
* Fix some timer issues & better closet init
* Timer sanity
* Request console tweaks + Storage init sanity
* Minor SSmachiner RCON improvements
* Further reduce world-start timer count
* Standardize subsystem logging
* Garbage hard delete profiling from /tg/
* Timer hang detection & recovery
* Log machines that sleep in process() and fuck up SSmachinery
* Fix an issue with external airlocks sleeping in process()
* Failsafe logging
* Minor tweaks
* Revert "Request console tweaks + Storage init sanity"
This reverts commit 98d3579e35.
* Re-implement RC changes
* Fix SQL FT saving
* Fix SSmachinery sleep in disposals
* Minor SS tweaks
* Paper fixes
* Blood drying fixes
* Merge gameticker and SSticker
* Minor global list init cleanup
* Lagcheck biogenerator & bags
* Tweak SScargo init order; RIG Initialize()
* Caching tweaks
* Remove rogue comma
* Initialize fixes
* Lighting destroy cleanup
* Fix emagging airlocks
* Initial SSicon implementation
* Tweaks & Fixes
* Fire + Air alarm queued icon updates
* Overlays + Queued icon cleanup
* Runtime & background fixes
* Kill some meaningless set statements
* Kill some image qdels
* Bump up lighting rounding val
* Fix adv. scanner destroy runtimes
* Remove unneeded icon update limiting
* Move icon smoothing into helpers
* Show a warning if DM 510 compiles without memory leak hack enabled
* Re-organize subsystems & MC defines a little
* Airlock SFX
* Log of Changes
* Make SSicon_update disable itself when not doing anything
* Fix respawn verb runtime when used early in server-init
* Add more information to MC's stat_entry()
* Replace direct refernces to gcDestroyed with QDEL* macros
* plant_controller -> SSplants
* More plant tweaks
* Add more humor to changelog
* Move parallax globals into SSparallax
* Lighting responsiveness tweaks
* Fix parallax init order & better MC init panel stat
* Make mobs GC
* More overlays + Remove intercom spawn()
* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.
* Update changelog
* Mob GC tweaks
* Del() cleanup
* Fix insomniac ZAS connection edges
* Minor pAI cleanup
* Convert more things to SSoverlay; fix duplicated overlay in field gens
* SM Bluespace turf tweaks
* Update SSgarbage debug globals list
* Human-type qdel tweaks
* Subsystem suspension; stat_entry improvements
* SQL Statistics cleanup
* Fix runtimes with ambrosia
* More disable() -> suspend(); fix nightmode again
* Human qdel fix; minor tweaks
* Update turbolift to work with StonedMC
* Make lifts use timers instead of a subsystem
* Make SSassets start earlier
* Convert the radio controller into a subsystem
* Fix some missing CHECK_TICKs in asteroid generation
* MC stat tweaks; make shouldnt_see a typecache
* Kill some redundant debug-controller entries
* radio_controller -> SSradio
* Better SSgarbage hard-del logging from /tg/ upstream
* Logging tweaks + GELF
* Misc client caching improvements
* Slime SSoverlay
* Oven icon fixes
* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.
* Holder tweaks + Welding tool Initialize()
* Fix some bad subsystem logging
* Fix suit cooling units spawning without cells
* Starlight tweaks
* Gibber infinite gib fix
* More SSoverlay stuff
* Make crates use CUT_OVERLAY_IN
* Make SSarrivals suspend instead of disable
* Make openturf use split/phased tick checks
* Speculative fix for unwet timer runtimes
* Blood overlay tweaks/fixes
* Update crusher to play nice with SMC + SSoverlay
* Openturf improvements and fixes
* Minor turbolift tweaks
* Lighting performance improvements + ChangeTurf tweaks
* this is probably important
* Fix wall weld noises on changeturf
* More ChangeTurf tweaks
* Explosion tweaks
* Pre-game lobby tweaks
* Openturf tweaks
* Prevent admins from starting the game before init finishes
* Fix Travis
* Kill an unused var
* Fix ChangeTurf runtimes on openturfs
* Fixes
* Browser datum fixes, asset caching
* Update changelog
* Changelog
* Lobby tweaks
* Ticker tweaks; kill ticker var
* Further lobby tweaks
* Cascade tweaks
* air_master -> SSair
* Reduce overhead from radio autosay
* alarm_manager -> SSalarm
* bomb_processor -> SSexplosives
* corp_regs -> SSlaw
* ZAS overlay fixes
* Small wall icon optimization
* Fix effects master
* Assembly tweaks
* Megavend fixes
* Shuttle fixes
* Camera alert performance improvements
* Fix some world.log spam from lighting overlays
* Fix some Initialize() procs
* Openspace responsiveness tweaks
* Make HE pipes animate through openturfs
* Kill a spawn
275 lines
8.8 KiB
Plaintext
275 lines
8.8 KiB
Plaintext
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
|
|
|
|
|
/* --- Traffic Control Scripting Language --- */
|
|
// Nanotrasen TCS Language - Made by Doohl
|
|
|
|
/n_Interpreter/TCS_Interpreter
|
|
var/datum/TCS_Compiler/Compiler
|
|
|
|
HandleError(runtimeError/e)
|
|
Compiler.Holder.add_entry(e.ToString(), "Execution Error")
|
|
|
|
/datum/TCS_Compiler
|
|
var/n_Interpreter/TCS_Interpreter/interpreter
|
|
var/obj/machinery/telecomms/server/Holder // the server that is running the code
|
|
var/ready = 1 // 1 if ready to run code
|
|
|
|
/* -- Compile a raw block of text -- */
|
|
|
|
proc/Compile(code as message)
|
|
var/n_scriptOptions/nS_Options/options = new()
|
|
var/n_Scanner/nS_Scanner/scanner = new(code, options)
|
|
var/list/tokens = scanner.Scan()
|
|
var/n_Parser/nS_Parser/parser = new(tokens, options)
|
|
var/node/BlockDefinition/GlobalBlock/program = parser.Parse()
|
|
|
|
var/list/returnerrors = list()
|
|
|
|
returnerrors += scanner.errors
|
|
returnerrors += parser.errors
|
|
|
|
if(returnerrors.len)
|
|
return returnerrors
|
|
|
|
interpreter = new(program)
|
|
interpreter.persist = 1
|
|
interpreter.Compiler= src
|
|
|
|
return returnerrors
|
|
|
|
/* -- Execute the compiled code -- */
|
|
|
|
proc/Run(var/datum/signal/signal)
|
|
|
|
if(!ready)
|
|
return
|
|
|
|
if(!interpreter)
|
|
return
|
|
|
|
interpreter.container = src
|
|
|
|
interpreter.SetVar("PI" , 3.141592653) // value of pi
|
|
interpreter.SetVar("E" , 2.718281828) // value of e
|
|
interpreter.SetVar("SQURT2" , 1.414213562) // value of the square root of 2
|
|
interpreter.SetVar("FALSE" , 0) // boolean shortcut to 0
|
|
interpreter.SetVar("TRUE" , 1) // boolean shortcut to 1
|
|
|
|
interpreter.SetVar("NORTH" , NORTH) // NORTH (1)
|
|
interpreter.SetVar("SOUTH" , SOUTH) // SOUTH (2)
|
|
interpreter.SetVar("EAST" , EAST) // EAST (4)
|
|
interpreter.SetVar("WEST" , WEST) // WEST (8)
|
|
|
|
// Channel macros
|
|
interpreter.SetVar("$common", PUB_FREQ)
|
|
interpreter.SetVar("$science", SCI_FREQ)
|
|
interpreter.SetVar("$command", COMM_FREQ)
|
|
interpreter.SetVar("$medical", MED_FREQ)
|
|
interpreter.SetVar("$engineering",ENG_FREQ)
|
|
interpreter.SetVar("$security", SEC_FREQ)
|
|
interpreter.SetVar("$supply", SUP_FREQ)
|
|
|
|
// Signal data
|
|
|
|
interpreter.SetVar("$content", signal.data["message"])
|
|
interpreter.SetVar("$freq" , signal.frequency)
|
|
interpreter.SetVar("$source" , signal.data["name"])
|
|
interpreter.SetVar("$job" , signal.data["job"])
|
|
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
|
|
|
|
// Set up the script procs
|
|
|
|
/*
|
|
-> Send another signal to a server
|
|
@format: broadcast(content, frequency, source, job)
|
|
|
|
@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.
|
|
*/
|
|
interpreter.SetProc("broadcast", "tcombroadcast", signal, list("message", "freq", "source", "job"))
|
|
|
|
/*
|
|
-> Store a value permanently to the server machine (not the actual game hosting machine, the ingame machine)
|
|
@format: mem(address, value)
|
|
|
|
@param address: The memory address (string index) to store a value to
|
|
@param value: The value to store to the memory address
|
|
*/
|
|
interpreter.SetProc("mem", "mem", signal, list("address", "value"))
|
|
|
|
/*
|
|
-> Delay code for a given amount of deciseconds
|
|
@format: sleep(time)
|
|
|
|
@param time: time to sleep in deciseconds (1/10th second)
|
|
*/
|
|
interpreter.SetProc("sleep", /proc/delay)
|
|
|
|
/*
|
|
-> Replaces a string with another string
|
|
@format: replace(string, substring, replacestring)
|
|
|
|
@param string: the string to search for substrings (best used with $content$ constant)
|
|
@param substring: the substring to search for
|
|
@param replacestring: the string to replace the substring with
|
|
|
|
*/
|
|
interpreter.SetProc("replace", /proc/string_replacetext)
|
|
|
|
/*
|
|
-> Locates an element/substring inside of a list or string
|
|
@format: find(haystack, needle, start = 1, end = 0)
|
|
|
|
@param haystack: the container to search
|
|
@param needle: the element to search for
|
|
@param start: the position to start in
|
|
@param end: the position to end in
|
|
|
|
*/
|
|
interpreter.SetProc("find", /proc/smartfind)
|
|
|
|
/*
|
|
-> Finds the length of a string or list
|
|
@format: length(container)
|
|
|
|
@param container: the list or container to measure
|
|
|
|
*/
|
|
interpreter.SetProc("length", /proc/smartlength)
|
|
|
|
/* -- Clone functions, carried from default BYOND procs --- */
|
|
|
|
// vector namespace
|
|
interpreter.SetProc("vector", /proc/n_list)
|
|
interpreter.SetProc("at", /proc/n_listpos)
|
|
interpreter.SetProc("copy", /proc/n_listcopy)
|
|
interpreter.SetProc("push_back", /proc/n_listadd)
|
|
interpreter.SetProc("remove", /proc/n_listremove)
|
|
interpreter.SetProc("cut", /proc/n_listcut)
|
|
interpreter.SetProc("swap", /proc/n_listswap)
|
|
interpreter.SetProc("insert", /proc/n_listinsert)
|
|
|
|
interpreter.SetProc("pick", /proc/n_pick)
|
|
interpreter.SetProc("prob", /proc/prob_chance)
|
|
interpreter.SetProc("substr", /proc/docopytext)
|
|
|
|
// Donkie~
|
|
// Strings
|
|
interpreter.SetProc("lower", /proc/n_lower)
|
|
interpreter.SetProc("upper", /proc/n_upper)
|
|
interpreter.SetProc("explode", /proc/string_explode)
|
|
interpreter.SetProc("repeat", /proc/n_repeat)
|
|
interpreter.SetProc("reverse", /proc/n_reverse)
|
|
interpreter.SetProc("tonum", /proc/n_str2num)
|
|
|
|
// Numbers
|
|
interpreter.SetProc("tostring", /proc/n_num2str)
|
|
interpreter.SetProc("sqrt", /proc/n_sqrt)
|
|
interpreter.SetProc("abs", /proc/n_abs)
|
|
interpreter.SetProc("floor", /proc/n_floor)
|
|
interpreter.SetProc("ceil", /proc/n_ceil)
|
|
interpreter.SetProc("round", /proc/n_round)
|
|
interpreter.SetProc("clamp", /proc/n_clamp)
|
|
interpreter.SetProc("inrange", /proc/n_inrange)
|
|
// End of Donkie~
|
|
|
|
|
|
// Run the compiled code
|
|
interpreter.Run()
|
|
|
|
// Backwards-apply variables onto signal data
|
|
/* sanitize EVERYTHING. fucking players can't be trusted with SHIT */
|
|
|
|
signal.data["message"] = interpreter.GetVar("$content")
|
|
signal.frequency = interpreter.GetVar("$freq")
|
|
|
|
var/setname = ""
|
|
var/obj/machinery/telecomms/server/S = signal.data["server"]
|
|
if(interpreter.GetVar("$source") in S.stored_names)
|
|
setname = interpreter.GetVar("$source")
|
|
else
|
|
setname = "<i>[interpreter.GetVar("$source")]</i>"
|
|
|
|
if(signal.data["name"] != setname)
|
|
signal.data["realname"] = setname
|
|
signal.data["name"] = setname
|
|
signal.data["job"] = interpreter.GetVar("$job")
|
|
signal.data["reject"] = !(interpreter.GetVar("$pass")) // set reject to the opposite of $pass
|
|
|
|
// If the message is invalid, just don't broadcast it!
|
|
if(signal.data["message"] == "" || !signal.data["message"])
|
|
signal.data["reject"] = 1
|
|
|
|
/* -- Actual language proc code -- */
|
|
|
|
datum/signal
|
|
|
|
proc/mem(var/address, var/value)
|
|
|
|
if(istext(address))
|
|
var/obj/machinery/telecomms/server/S = data["server"]
|
|
|
|
if(!value && value != 0)
|
|
return S.memory[address]
|
|
|
|
else
|
|
S.memory[address] = value
|
|
|
|
|
|
proc/tcombroadcast(var/message, var/freq, var/source, var/job)
|
|
|
|
var/datum/signal/newsign = new
|
|
var/obj/machinery/telecomms/server/S = data["server"]
|
|
var/obj/item/device/radio/hradio = S.server_radio
|
|
|
|
if(!hradio)
|
|
error("[src] has no radio.")
|
|
return
|
|
|
|
if((!message || message == "") && message != 0)
|
|
message = "*beep*"
|
|
if(!source)
|
|
source = "[html_encode(uppertext(S.id))]"
|
|
hradio = new // sets the hradio as a radio intercom
|
|
if(!freq)
|
|
freq = PUB_FREQ
|
|
if(findtext(num2text(freq), ".")) // if the frequency has been set as a decimal
|
|
freq *= 10 // shift the decimal one place
|
|
|
|
if(!job)
|
|
job = "?"
|
|
|
|
newsign.data["mob"] = null
|
|
newsign.data["mobtype"] = /mob/living/carbon/human
|
|
if(source in S.stored_names)
|
|
newsign.data["name"] = source
|
|
else
|
|
newsign.data["name"] = "<i>[html_encode(uppertext(source))]</i>"
|
|
newsign.data["realname"] = newsign.data["name"]
|
|
newsign.data["job"] = job
|
|
newsign.data["compression"] = 0
|
|
newsign.data["message"] = message
|
|
newsign.data["type"] = 2 // artificial broadcast
|
|
if(!isnum(freq))
|
|
freq = text2num(freq)
|
|
newsign.frequency = freq
|
|
|
|
var/datum/radio_frequency/connection = SSradio.return_frequency(freq)
|
|
newsign.data["connection"] = connection
|
|
|
|
|
|
newsign.data["radio"] = hradio
|
|
newsign.data["vmessage"] = message
|
|
newsign.data["vname"] = source
|
|
newsign.data["vmask"] = 0
|
|
newsign.data["level"] = list()
|
|
|
|
var/pass = S.relay_information(newsign, "/obj/machinery/telecomms/hub")
|
|
if(!pass)
|
|
S.relay_information(newsign, "/obj/machinery/telecomms/broadcaster") // send this simple message to broadcasters
|
|
|