mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
* Basic Vore Implementation for #1 Adds vore sounds, bellies, vore procs, all types of vore except macro/micro as that is not implemented yet. Also adds a few type2type methods and a text method that we had before. * Ending linebreaks * More crlf * Globalize two lists * Removed interface type
63 lines
1.7 KiB
Plaintext
63 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/args=null)
|
|
try
|
|
if(!callon || !procname)
|
|
error("attempt_vr: Invalid obj/proc: [callon]/[procname]")
|
|
return 0
|
|
|
|
var/result = call(callon,procname)(arglist(args))
|
|
|
|
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]")
|
|
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/args=null)
|
|
try
|
|
var/hook_path = text2path("/hook/[hook]")
|
|
if(!hook_path)
|
|
error("hook_vr: Invalid hook '/hook/[hook]' called.")
|
|
return 0
|
|
|
|
var/caller = new hook_path
|
|
var/status = 1
|
|
for(var/P in typesof("[hook_path]/proc"))
|
|
if(!call(caller, P)(arglist(args)))
|
|
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]")
|