mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 15:42:35 +00:00
This drastcly is meant to rework DM and Daemon code to allow further expansion and replacement of custom engine with JavaScript language based engine. Daemon PR - Aurorastation/ByondInterpretedLanguage#7 Forums topic for discussion - https://forums.aurorastation.org/topic/14570-ntsl2-and-its-future/ Superseeds #8817
27 lines
779 B
Plaintext
27 lines
779 B
Plaintext
/*
|
|
Datum representing program state on deamon and exposing apropriate procs to DM.
|
|
*/
|
|
/datum/ntsl2_program/
|
|
var/id = 0
|
|
var/name = "Base NTSL2++ program"
|
|
var/list/ready_tasks = list()
|
|
|
|
|
|
/datum/ntsl2_program/New()
|
|
..()
|
|
|
|
/datum/ntsl2_program/proc/is_ready()
|
|
return !!id
|
|
|
|
/datum/ntsl2_program/proc/kill()
|
|
if(is_ready())
|
|
SSntsl2.send_task("remove", list(id = id))
|
|
SSntsl2.handle_termination(src)
|
|
qdel(src)
|
|
|
|
/datum/ntsl2_program/proc/execute(var/script, var/mob/user)
|
|
if(!is_ready())
|
|
ready_tasks += CALLBACK(src, .proc/execute, script, user)
|
|
return FALSE // We are not ready to run code
|
|
log_ntsl("[user.name]/[user.key] uploaded script to [src] : [script]", SEVERITY_NOTICE, user.ckey)
|
|
return SSntsl2.send_task("execute", list(id = id, code = script), program = src) |