Class WorldRuntime
A WorldRuntime is the engine-level view of one running world. It deliberately models
JVMud concepts directly: places are linked locations, entities are contained by exactly one
immediate location, and movement is a containment update optionally driven by a place-to-place
link. LPC objects can adapt into this model, but legacy LP driver terms are not required here.
Instances are identity-oriented. A Place or Entity must have been created by
this runtime before it can be used as a location, link endpoint, movement target, or inventory
container.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a visible link from one place to another.Creates or replaces a link from one place to another for a normalized action string.voidconnectBothWays(Place first, String firstAction, Place second, String secondAction) Creates two visible links that connect the supplied places in opposite directions.contentsOf(Location location) Returns the entities immediately contained by a location.createEntity(String id, String displayName, Location initialLocation, Capability... capabilities) Creates an entity at an initial location.createPlace(String id, String displayName) Creates a place that can contain entities and act as a link endpoint.Returns a known entity by id, ornullif the id does not name an entity.findLocation(String id) Finds a place or entity by id, returningnullwhen no matching location exists.Returns the link for an action from a place, ornullwhen no such link exists.Returns the currently registered outbound links from a place in insertion order.locationOf(Entity entity) Returns the immediate location of an entity, ornullif it has not been located.voidMoves an entity into a known destination location.Returns the currently registered mudlib boundary, or an empty boundary if none is present.Returns a known place by id, ornullif the id does not name a place.Returns the containing place for an entity, walking through entity containers as needed.voidregisterMudlibBoundary(MudlibBoundary mudlibBoundary) Registers the mudlib boundary metadata used by higher-level engine and compiler adapters.booleanremoveEntity(String id) Removes a known entity from this world runtime.Returns the deterministic scheduler associated with this world.voidsetTranslucent(Entity entity, boolean translucent) Sets whether light and other ambient perception can pass through an entity container.booleantranslucent(Entity entity) Returns whether light and other ambient perception can pass through an entity container.booleanMoves an entity across the link selected by an action from its containing place.world()Returns the world metadata for this runtime.
-
Constructor Details
-
WorldRuntime
Creates a new runtime for a single world.- Parameters:
world- the world metadata owned by this runtime
-
-
Method Details
-
world
Returns the world metadata for this runtime. -
scheduler
Returns the deterministic scheduler associated with this world. -
mudlibBoundary
Returns the currently registered mudlib boundary, or an empty boundary if none is present. -
registerMudlibBoundary
Registers the mudlib boundary metadata used by higher-level engine and compiler adapters.- Parameters:
mudlibBoundary- boundary declarations read from JVMud-native mudlib configuration
-
createPlace
Creates a place that can contain entities and act as a link endpoint.- Parameters:
id- stable world-local identifierdisplayName- player-facing or admin-facing label- Returns:
- the created place
- Throws:
IllegalArgumentException- if any known place or entity already has the same id
-
createEntity
public Entity createEntity(String id, String displayName, Location initialLocation, Capability... capabilities) Creates an entity at an initial location.Every entity is immediately located. The initial location may be a place or another entity, but it must already belong to this runtime.
- Parameters:
id- stable world-local identifierdisplayName- player-facing or admin-facing labelinitialLocation- known place or entity that will contain the new entitycapabilities- optional engine-level capabilities- Returns:
- the created entity
-
findLocation
-
place
-
entity
-
translucent
Returns whether light and other ambient perception can pass through an entity container. -
setTranslucent
Sets whether light and other ambient perception can pass through an entity container. -
removeEntity
Removes a known entity from this world runtime.Any entities contained by the removed entity are removed first so the world never retains locations whose container no longer exists.
- Returns:
trueif an entity with the supplied id was present and removed
-
locationOf
-
contentsOf
Returns the entities immediately contained by a location.- Throws:
IllegalArgumentException- if the location was not created by this runtime
-
connect
-
connect
Creates or replaces a link from one place to another for a normalized action string.- Parameters:
origin- known place where traversal beginsaction- command/action that selects the linkdestination- known place reached by traversalvisible- whether the link should be visible to ordinary perception- Returns:
- the created link
-
connectBothWays
-
linkFrom
-
linksFrom
-
placeOf
-
traverse
-
move
-