mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-06-05 05:24:36 +01:00
3735a31e05
* selection target * ugh * fix deadmin * larger * fix paper icons * those are inverted * don't miss that * fix all * point transfer * add nostrip flag to items * un.... teppi * . * end life proc after qdel * this could be null in very rare cases * this has a lot of sleeps, someday should be refactored and check for qdeleted * needs to be an object * qdel check this * use the rsc properly * wtf? * . * fix narrate * . * push * inform user, null it * . * can be null * fix maint lurkers * . * spans * . * fix that too * urg * fix distillery * don't wrap them * needs usr * Update cash_register.dm * quick hook cleanup * lots of fixes * . * clean that up for reasons
64 lines
1.7 KiB
Plaintext
64 lines
1.7 KiB
Plaintext
/*
|
|
This file is for jamming single-line procs into Polaris procs.
|
|
It will prevent runtimes and allow their code to run if VOREStation's fails.
|
|
It will also log when we mess up our code rather than making it vague.
|
|
|
|
Call it at the top of a stock proc with...
|
|
|
|
if(attempt_vr(object,proc to call,args)) return
|
|
|
|
...if you are replacing an entire proc.
|
|
|
|
The proc you're attemping should return nonzero values on success.
|
|
*/
|
|
|
|
/proc/attempt_vr(callon, procname, list/arguments=null)
|
|
try
|
|
if(!callon || !procname)
|
|
error("attempt_vr: Invalid obj/proc: [callon]/[procname]")
|
|
return 0
|
|
|
|
var/result = call(callon,procname)(arglist(arguments))
|
|
|
|
return result
|
|
|
|
catch(var/exception/e)
|
|
error("attempt_vr runtimed when calling [procname] on [callon].")
|
|
error("attempt_vr catch: [e] on [e.file]:[e.line]")
|
|
log_runtime(e)
|
|
return 0
|
|
|
|
/*
|
|
This is the _vr version of calling hooks.
|
|
It's meant to have different messages, and also the try/catch block.
|
|
For when you want hooks and want to know when you ruin everything,
|
|
vs when Polaris ruins everything.
|
|
|
|
Call it at the top of a stock proc with...
|
|
|
|
if(hook_vr(proc,args)) return
|
|
|
|
...if you are replacing an entire proc.
|
|
|
|
The hooks you're calling should return nonzero values on success.
|
|
*/
|
|
/proc/hook_vr(hook, list/arguments=null)
|
|
try
|
|
var/hook_path = text2path("/hook/[hook]")
|
|
if(!hook_path)
|
|
error("hook_vr: Invalid hook '/hook/[hook]' called.")
|
|
return 0
|
|
|
|
var/hook_instance = new hook_path
|
|
var/status = 1
|
|
for(var/P in typesof("[hook_path]/proc"))
|
|
if(!call(hook_instance, P)(arglist(arguments)))
|
|
error("hook_vr: Hook '[P]' failed or runtimed.")
|
|
status = 0
|
|
|
|
return status
|
|
|
|
catch(var/exception/e)
|
|
error("hook_vr itself failed or runtimed. Exception below.")
|
|
error("hook_vr catch: [e] on [e.file]:[e.line]")
|