Class RuntimeContext
This context owns engine function registration, object lifecycle tracking, and include resolution configuration so the compiler and runtime no longer depend on global singletons.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRuntimeContext(IncludeResolver includeResolver) RuntimeContext(IncludeResolver includeResolver, EfunRegistry efunRegistry) -
Method Summary
Modifier and TypeMethodDescriptionintappendMudlibText(String path, Object text) voidbindEntityAlias(Object object, Object namespace, Object alias) voidbindPlayerSession(String sessionId, String remoteAddress, Consumer<String> sessionOutputSink) voidbindSession(String sessionId, Object persona, String remoteAddress, Consumer<String> sessionOutputSink) voidbindSession(String sessionId, Object persona, String remoteAddress, Consumer<String> sessionOutputSink, MudlibProjection mudlibProjection) intcancelDeferredCallback(String methodName) booleancapturedSessionInputNoEcho(Object persona) voidcaptureSessionInput(String methodName, boolean noEcho, Object... extraArgs) Captures the next line of interactive session input for the current output persona.voidclearCommandActions(Object actor) voidvoidcloneObject(String sourcePath) voidconfigureCommandAliases(Object aliases) Installs driver-level command aliases used before LPC action lookup.intcopyMudlibText(String source, String destination) intcreateMudlibDirectory(String path) intdbClose(int handle) Closes a JVMud database handle.intOpens a configured JDBC database connection and returns a JVMud database handle.intOpens a JDBC database connection with mudlib-supplied credentials.dbError(int handle) Returns the last JDBC error for a JVMud database handle, or LPC false when clear.Escapes a string for interpolation into mudlib-generated SQL.intExecutes SQL for a JVMud database handle and returns the handle on success.dbFetch(int handle) Fetches one row from a JVMud database handle's current result cursor.Returns the currently open JVMud database handles.deliverCapturedSessionInput(Object persona, String line) Delivers one line to a pendinginput_to()callback while preserving that pending state for runtime queries made during the callback.voiddestructObject(Object object) voiddisableEntityCommands(Object object) dispatchCommand(Object actor, String commandLine) voidemitPerceivable(Object emitter, Object value) voidemitPerceivableAt(Object location, Object value) voidemitPerceivableExcept(Object emitter, Object value, Object excluded) voidenableEntityCommands(Object object) engineFunctionName(String mudlibName) intentityCommandsEnabled(Object object) intentityHasAlias(Object object, Object namespace) booleanentityTranslucent(Object object) environment(Object object) findEntityAlias(Object namespace, Object alias) firstInventory(Object container) booleanhasCapturedSessionInput(Object persona) booleanhasObjectMethod(Object target, String methodName, int arity) Reports whether a generated LPC object exposes a public method with the requested arity.inheritedPrograms(Object object) Returns the LPC program path and transitive inherited program paths for a generated LPC object.invokeEfun(String name, int arity, Object[] args) Invokes a mudlib-visible function through the active compatibility boundary.invokeObject(Object target, String methodName, Object... args) invokeOptionalObject(Object target, String methodName, Object... args) booleanisDestroyedObject(Object object) booleanisInteractive(Object user) Returns true when the supplied LPC object is currently bound to an active JVMud session.listMudlibPaths(String path, int flags) Lists mudlib-rooted paths using an LP-style flag word.loadOrGetObject(String name) lpcObjectForSession(String sessionId) Returns the LPC object projection currently attached to a host session, when one exists.voidmoveObject(Object object, Object destination) nextInventory(Object object) intnotifyCommandFailure(Object message) Records the command failure text to display when no command action accepts the line.objects()personaRecordForProjection(Object persona) playerRecordForSession(String sessionId) voidvoidpushCurrentObject(Object object) intqueryIpNumber(Object persona) readMudlibText(String path) booleanrebindSessionLpcObject(Object newObject, Object oldObject) Rebinds an existing host session from one LPC object projection to another.voidregisterEfun(Efun efun) voidregisterInMemoryObjectSource(String objectPath, String source, String displayPath) Registers source text for an in-memory LPC object that may later serve as a global helper.voidregisterObject(String name, Object object) Binds an engine object to a mudlib object path.voidregisterVerb(String verb) voidregisterVerb(String verb, boolean prefixMatch) Registers a pending LPC command action for the active command actor.voidrememberActionMethod(String methodName) intremoveCommandActions(Object actor, Object handler) Removes command actions owned by a handler from one actor's current command table.intremoveMudlibDirectory(String path) intremoveMudlibText(String path) intrenameMudlibText(String source, String destination) resolveEfun(String name, int arity) resolveEngineEfun(String name, int arity) Resolves an engine efun without consulting mudlib compatibility functions.intvoidrunWithCurrentObject(Object object, Runnable action) intvoidscheduleDeferredCallback(String methodName, int delaySeconds, Object... args) voidscheduleRecurringTick(int enabled, int intervalSeconds) sessionRecord(String sessionId) voidsetEntityTranslucent(Object object, boolean translucent) voidsetIncludeResolver(IncludeResolver includeResolver) intsetLight(int delta) voidsetLPCObjectStateRestorer(BiFunction<String, Object, Integer> lpcObjectStateRestorer) voidsetLPCObjectStateSaver(BiFunction<String, Object, Integer> lpcObjectStateSaver) voidsetMfunObjectPath(String mfunObjectPath) Deprecated.voidsetMudlibBoundary(MudlibBoundary mudlibBoundary) Sets active mudlib boundary metadata for generated-code helpers and compatibility lookup.voidsetMudlibDirectoryCreator(Function<String, Integer> mudlibDirectoryCreator) voidsetMudlibDirectoryRemover(Function<String, Integer> mudlibDirectoryRemover) voidsetMudlibPathLister(BiFunction<String, Integer, Object> mudlibPathLister) Sets the host callback used by file-listing efuns to enumerate mudlib-rooted paths.voidsetMudlibTextAppender(BiFunction<String, Object, Integer> mudlibTextAppender) voidsetMudlibTextCopier(BiFunction<String, String, Integer> mudlibTextCopier) voidsetMudlibTextReader(Function<String, Object> mudlibTextReader) voidsetMudlibTextRemover(Function<String, Integer> mudlibTextRemover) voidsetMudlibTextRenamer(BiFunction<String, String, Integer> mudlibTextRenamer) voidsetObjectDestructionRequestedHandler(Function<Object, Object> objectDestructionRequestedHandler) voidsetObjectFactory(Function<String, Object> objectFactory) voidsetObjectLoader(Function<String, Object> objectLoader) voidsetOutputSink(Consumer<String> outputSink) voidsetPlayerTransferHandler(BiFunction<Object, String, Integer> playerTransferHandler) voidsetScheduler(WorldScheduler scheduler) voidsetTimedRuntimeErrorHandler(RuntimeContext.TimedRuntimeErrorHandler timedRuntimeErrorHandler) voidtouchPersona(Object persona) inttransferCurrentPlayerToGame(String gameId) voidunbindSession(String sessionId) users()Returns mudlib-facing interactive personas that are in normal command mode.<T> TwithCommandActor(Object actor, Supplier<T> action) <T> TwithCurrentObject(Object object, Supplier<T> action) <T> TwithScopedCommandRegistration(Supplier<T> action) voidWrites text to the current execution recipient, or to the transcript in detached contexts.voidwriteToLpcObject(Object target, Object value) Writes text only to the target object's bound session.booleanwriteToPersona(PersonaId personaId, Object value) Writes engine gameplay text to the bound Session for one Persona.booleanwriteToPlayer(PlayerId playerId, Object value) Writes engine control-plane text to all active Sessions for one Player.booleanwriteToSession(SessionId sessionId, Object value) Writes engine control-plane or transport text to one bound Session.
-
Constructor Details
-
RuntimeContext
-
RuntimeContext
-
-
Method Details
-
includeResolver
-
setIncludeResolver
-
efunRegistry
-
newPreprocessor
-
registerEfun
-
setObjectFactory
-
setObjectLoader
-
setMudlibTextReader
-
setMudlibPathLister
Sets the host callback used by file-listing efuns to enumerate mudlib-rooted paths. -
setMudlibTextAppender
-
setMudlibTextRemover
-
setMudlibTextCopier
-
setMudlibTextRenamer
-
setMudlibDirectoryCreator
-
setMudlibDirectoryRemover
-
setPlayerTransferHandler
-
setLPCObjectStateSaver
-
setLPCObjectStateRestorer
-
setTimedRuntimeErrorHandler
public void setTimedRuntimeErrorHandler(RuntimeContext.TimedRuntimeErrorHandler timedRuntimeErrorHandler) -
setObjectDestructionRequestedHandler
-
registerInMemoryObjectSource
Registers source text for an in-memory LPC object that may later serve as a global helper.Host APIs such as
LPCRuntime.loadSource(...)can compile an LPC object without writing a corresponding.cfile. Declaration-backed global lookup still needs source text to recover function signatures, so those hosts register the source here under the object's normalized mudlib path. -
setMfunObjectPath
Deprecated.usesetMudlibBoundary(MudlibBoundary)withMudlibBoundary.compatibilityGlobalObjectPath()metadata.Sets the JVMud compatibility global object path used by older callers. -
setMudlibBoundary
Sets active mudlib boundary metadata for generated-code helpers and compatibility lookup. -
engineFunctionName
-
setScheduler
-
setOutputSink
-
write
Writes text to the current execution recipient, or to the transcript in detached contexts. -
writeToLpcObject
Writes text only to the target object's bound session.Unlike
write(Object), this targeted write deliberately does not fall back to the ambient output transcript when the target is not interactive. If that target is later bound to a Session, JVMud flushes the pending text to the target's own output sink. -
writeToSession
-
writeToPlayer
-
writeToPersona
-
emitPerceivable
-
emitPerceivableExcept
-
emitPerceivableAt
-
outputTranscript
-
clearOutputTranscript
public void clearOutputTranscript() -
resolveEfun
-
resolveEngineEfun
-
invokeEfun
Invokes a mudlib-visible function through the active compatibility boundary.Mudlib globals normally shadow engine efuns. When the mudlib profile declares a direct efun alias and the call carries a first-class callable, the alias is allowed to reach the engine before a string-typed mudlib wrapper can coerce the callable into display text. This models LDMud-style simulated efun wrappers that forward closure replacements to driver efuns.
-
registerObject
Binds an engine object to a mudlib object path.An object has one canonical mudlib path for APIs such as
file_name(). Rebinding removes the object's previous canonical path, and replacing an existing path clears the old occupant's reverse lookup. This lets a mudlib-created object serve a requested missing source path without retaining its temporary clone id as the canonical identity. -
getObject
-
loadOrGetObject
-
objectsView
-
objects
-
objectId
-
inheritedPrograms
Returns the LPC program path and transitive inherited program paths for a generated LPC object.JVMud exposes this as the backing data for LPMud
inherit_listcompatibility. Generated bytecode exposes inherited compiler metadata through a synthetic method. The object registry supplies the object's own program path. Host objects and older generated classes that do not expose the method are treated as having no LPC inherits rather than failing runtime execution. -
isDestroyedObject
-
cloneObject
-
users
Returns mudlib-facing interactive personas that are in normal command mode.Login controllers waiting for their own
input_to()callbacks are still bound to the socket for input delivery, but legacyusers()output should not count them as logged-in players. Gameplay objects that are temporarily waiting on another object's input callback, such as a pager command, remain visible. -
isInteractive
Returns true when the supplied LPC object is currently bound to an active JVMud session. -
bindPlayerSession
-
bindSession
-
bindSession
-
rebindSessionLpcObject
Rebinds an existing host session from one LPC object projection to another.This models legacy driver handoff operations such as RealmsMUD's use of
exec: the network session, output sink, Player record, and connection metadata stay in place while the mudlib-facing interactive object changes from a login object to a player object. -
unbindSession
-
sessionRecord
-
lpcObjectForSession
-
playerRecordForSession
-
personaRecordForProjection
-
captureSessionInput
Captures the next line of interactive session input for the current output persona.The line is delivered to
methodNameon the current LPC object. Any supplied extra arguments are appended after the typed line, matching legacyinput_to()callback shapes such asinput_to("method", flags, arg1, arg2). -
hasCapturedSessionInput
-
capturedSessionInputNoEcho
-
deliverCapturedSessionInput
-
queryIdle
-
queryIpNumber
-
readMudlibText
-
listMudlibPaths
-
appendMudlibText
-
removeMudlibText
-
copyMudlibText
-
renameMudlibText
-
createMudlibDirectory
-
removeMudlibDirectory
-
transferCurrentPlayerToGame
-
dbConnect
Opens a configured JDBC database connection and returns a JVMud database handle. -
dbConnect
-
dbExec
Executes SQL for a JVMud database handle and returns the handle on success. -
dbFetch
Fetches one row from a JVMud database handle's current result cursor. -
dbError
Returns the last JDBC error for a JVMud database handle, or LPC false when clear. -
dbClose
public int dbClose(int handle) Closes a JVMud database handle. -
dbHandles
-
dbEscape
-
saveCurrentLPCObjectState
-
restoreCurrentLPCObjectState
-
touchPersona
-
invokeObject
-
invokeOptionalObject
-
hasObjectMethod
Reports whether a generated LPC object exposes a public method with the requested arity.Runtime callable values use this to decide whether a quoted function reference names a method on its lexical object or should fall through to a global efun alias.
- Parameters:
target- generated LPC object to inspectmethodName- LPC method namearity- number of arguments expected by the caller- Returns:
truewhen the object can receive that method call
-
moveObject
-
environment
-
present
-
bindEntityAlias
-
findEntityAlias
-
entityHasAlias
-
enableEntityCommands
-
disableEntityCommands
-
entityCommandsEnabled
-
setEntityTranslucent
-
entityTranslucent
-
firstInventory
-
nextInventory
-
destructObject
-
scheduleDeferredCallback
-
cancelDeferredCallback
-
scheduleRecurringTick
public void scheduleRecurringTick(int enabled, int intervalSeconds) -
currentObject
-
previousObject
-
currentCommandActor
-
currentCommandVerb
-
configureCommandAliases
Installs driver-level command aliases used before LPC action lookup.LDMud mudlibs commonly configure
H_MODIFY_COMMANDwith mappings such as([ "n": "north" ]). JVMud keeps that compatibility at the runtime command boundary: the first word is rewritten before registeredadd_actionverbs are selected, andquery_verb()sees the expanded verb. -
notifyCommandFailure
Records the command failure text to display when no command action accepts the line.Legacy mudlibs use
notify_fail()inside an action that returns false. JVMud stores the latest message for the active dispatch and writes it only after all candidate actions have declined the command. -
pushCurrentObject
-
popCurrentObject
public void popCurrentObject() -
withCurrentObject
-
runWithCurrentObject
-
withCommandActor
-
rememberActionMethod
-
registerVerb
-
registerVerb
Registers a pending LPC command action for the active command actor.Agent-owned actions may be declared while an LPC object is initializing, before any command is being dispatched. In that persistent case, the action is bound to the current LPC object itself so it remains available after initialization. Scoped interaction registrations, such as location-specific
init()actions, still require the command actor supplied by the refresh pass. -
clearCommandActions
-
removeCommandActions
Removes command actions owned by a handler from one actor's current command table.This backs compatibility
remove_action()calls used by temporary selectors and conversations. The mudlib names the actor whose command table should be edited; JVMud uses the current LPC object as the owning action handler. -
clearPendingActionMethods
public void clearPendingActionMethods() -
withScopedCommandRegistration
-
dispatchCommand
-
setLight
public int setLight(int delta)
-
setMudlibBoundary(MudlibBoundary)withMudlibBoundary.compatibilityGlobalObjectPath()metadata.