Class SceneObject
- All Implemented Interfaces:
EntityContext
SceneObjectInfo with lazy LocationType
resolution and option-keyed interact.
Obtained through SceneObjects.query() — don't construct
directly. The facade owns the LocationType cache that backs
getType() repeats.
-
Method Summary
Modifier and TypeMethodDescriptionintChebyshev distance to the local player tile, orMAX_VALUEif the player isn't loaded.Right-click options.getType()Cached LocationType for this object.inthandle()booleanTrue if any option matchesoptioncase-insensitively.voidinteract(int optionIndex) Queue an action by 1-based right-click option index.voidinteract(int optionIndex, int unusedSubOption) Two-arg variant kept for pre-rewrite scripts.booleanQueue an action by option text.booleanisHidden()The snapshot only carries visible objects; this stub always returnsfalse.name()Display name.intplane()Plane / height level (0-3).raw()intThe loc id whose definition carries this object's name and right-click options, with the morphvarp ("multiloc") transform already applied by the producer.The producer resolves morphvarp transforms before publishing the snapshot and the result rides on the row asresolvedId(), so this is a no-op identity.introtation()How far this loc's model is turned, in quarter turns0..3, exactly as the producer published it.intshape()The scenery shape code as published on the wire, which says what kind of placement this loc is: a wall, a wall decoration, a ground decoration, a centrepiece and so on.inttileX()Absolute world tile X.inttileY()Absolute world tile Y.toString()inttypeId()The loc id the server sent.Methods inherited from interface EntityContext
distanceTo, distanceTo
-
Method Details
-
raw
-
handle
public int handle() -
typeId
public int typeId()The loc id the server sent. This is what identity and hardcoded id sets are keyed on, and what an interaction is addressed to — it is deliberately not the id whose definition carries the name, which isresolvedId(). -
resolvedId
public int resolvedId()The loc id whose definition carries this object's name and right-click options, with the morphvarp ("multiloc") transform already applied by the producer.Equal to
typeId()for a loc that does not morph, so it is always usable. For one that does — a Range, a bonfire, a bank chest, a construction hotspot, most instanced scenery — the server publishes a base id whose definition has an empty name and no options, and only this id resolves to the real thing. -
name
Display name. Prefers the pre-resolvedraw.namefrom the RPC (cheap, no defn fetch) and falls back to the LocationType when the producer didn't fill it in — which, since that LocationType is looked up onresolvedId(), is the real name even for a morph loc. -
tileX
public int tileX()Description copied from interface:EntityContextAbsolute world tile X.- Specified by:
tileXin interfaceEntityContext
-
tileY
public int tileY()Description copied from interface:EntityContextAbsolute world tile Y.- Specified by:
tileYin interfaceEntityContext
-
plane
public int plane()Description copied from interface:EntityContextPlane / height level (0-3).- Specified by:
planein interfaceEntityContext
-
rotation
public int rotation()How far this loc's model is turned, in quarter turns0..3, exactly as the producer published it.This is not a compass heading. It turns the loc away from its model's own default pose, and that pose is chosen per model, so the value is only meaningful when compared against another rotation of the same loc, or read together with
shape()to work out which tile edge a wall occupies.Inside an instance the chunk the tile was copied from may itself be rotated, by
SourceTile.rotation(); anything directional read from the source region has to account for both.- Returns:
0..3, orSceneObjectInfo.UNKNOWN_ROTATIONfor a row built without one
-
shape
public int shape()The scenery shape code as published on the wire, which says what kind of placement this loc is: a wall, a wall decoration, a ground decoration, a centrepiece and so on.- Returns:
- the shape code, or
SceneObjectInfo.UNKNOWN_SHAPEfor a row built without one
-
isHidden
public boolean isHidden()The snapshot only carries visible objects; this stub always returnsfalse. -
distanceToPlayer
public int distanceToPlayer()Chebyshev distance to the local player tile, orMAX_VALUEif the player isn't loaded. -
resolveTransform
The producer resolves morphvarp transforms before publishing the snapshot and the result rides on the row asresolvedId(), so this is a no-op identity. Kept so pre-rewrite scripts compile unchanged.That claim was aspirational until wire v20 and is now true:
getType(),name()andgetOptions()all resolve through the morph-resolved id. -
interact
public void interact(int optionIndex, int unusedSubOption) Two-arg variant kept for pre-rewrite scripts.unusedSubOptionis ignored — the option index encodes everything the action queue needs. Delegates tointeract(int). -
getType
Cached LocationType for this object. Resolved offresolvedId(), nevertypeId(): a morph loc's base definition has an empty name and no options, so looking up the base id is what made Ranges, bonfires, bank chests and construction hotspots invisible to every name- or option-based query.nullif lookup fails. -
getOptions
Right-click options. Prefers the pre-resolvedraw.optionsfrom the RPC; falls back toLocationType.options()when raw came back empty — and that LocationType is the morph-resolved one, so the options are the ones the player actually sees. -
hasOption
True if any option matchesoptioncase-insensitively. -
interact
public void interact(int optionIndex) Queue an action by 1-based right-click option index.- Throws:
IllegalArgumentException- foroptionIndexoutside [1, 6]
-
interact
Queue an action by option text. Returnsfalsewhen the option isn't on this object's menu (no action queued). -
toString
-