Adventure.js Docs Downloads
Score: 0 Moves: 0

Class: Tangible

Extends: adventurejs.Matter

Defined in: adventure/assets/Tangible.js, line 5

How to: UseTangibles

Public Constructor:

MyGame.createAsset({ "class":"Tangible", "name":"foo", [...] })

Tangible is the base class for all Assets with physical properties in the game world, with the exception of Substances. All of the properties of Tangible are inherited by all of its subclasses, and most subclasses don't define new properties. Most subclasses are essentially convenience methods that set a group of properties particular to a type of object. In theory, an instance of almost any subclass could be made to behave like an instance of almost any other subclass, simply by setting the right properties. This provides the flexibility to mix and match properties to construct game assets with customized behaviors.

For example, Chair defines something you can sit on, and Bed defines something you can lie on, but perhaps you want to make something like a divan, that you can sit on and lie on. You could create a Chair and set asset.can_put.on.player_can_lie property to true.

MyGame.createAsset({
  class: "Chair",
  name: "divan",
  descriptions: {look:"A comfortable looking fainting couch. ",),
  can_put:
  {
    on: { player_can_lie: true }
  }
});
This is a simple example of customizing an object, but hopefully it gives you an idea of how flexible the Tangible class is. Alternatively if you wanted to extensively customize your divan, you could define your own Divan class to extend Furniture.

Private Constructor:

var foo = new adventurejs.Tangible(game_name, name)

Though all in-game glasses use a standard constructor method under the hood, it's unlikely that you'd need to call it directly. To create an instance of the Tangible class, it must be defined in a game file as a generic object. That object will be used at runtime to construct a new game class instance, which will be validated and initialized before adding it to the Game. See above for the public constructor, or see Game#createAsset to learn more.

Parameters:

  • game_name String
    The name of the top level game object.
  • name String
    A name for the object, to be serialized and used as ID.
Inherited Overrides
IndexMethodsProperties

Index

Methods:

Properties:

Methods Collapse all  |  Expand all

$is(property, asset)

Defined in: adventure/assets/tangible/$is.js, line 6

Overrides from: adventurejs.Matter#$is

Todos: Leaving open the possibility for other params.

Parameters:

  • property String
  • asset Object
$is() is a convenience method for authors that provides an easy way to test for various conditions.
  • assetA.$is("in", assetB)
    accepts any preposition, asking, is this asset in that aspect of that asset?
  • assetA.$is("nested in", assetB)
    nested in, specific to character classes, asking, is this asset nested in that asset?
  • assetA.$is("closed")
    asking, is this asset closed?
  • assetA.$is("locked")
    asking, is this asset locked?
  • assetA.$is("plugged")
    asking, is this asset plugged?
  • assetA.$is("sealed")
    asking, is this asset sealed?
  • assetA.$is("held", assetB)
    asking, is this asset held by that asset, as in a bannister held by player?
  • assetA.$is("holding", assetB)
    asking, is this asset holding that asset, as in player holding a rope?
  • assetA.$is("worn")
    asking, is this asset being worn?
  • assetA.$is("zipped")
    asking, is this asset zipped?
  • assetA.$is("open")
    asking, is this asset open?
  • assetA.$is("unlocked")
    asking, is this asset unlocked?
  • assetA.$is("unplugged")
    asking, is this asset unplugged?
  • assetA.$is("unsealed")
    asking, is this asset unsealed?
$moveTo(aspect, asset)

Defined in: adventure/assets/tangible/$moveTo.js, line 6

Parameters:

  • aspect String
  • asset Object
$moveTo is an author shortcut that is similar to moveTo but which bypasses onMoveThatToThis, avoiding the consequences of any verb event hooks.
addAssetAt() → {Array}

Defined in: adventure/assets/tangible/addAssetAt.js, line 6

Add specified asset id to the contents of specified aspect on this asset. Returns contents if aspect exists, or null.

Returns:

Array
addWordsToLookup(allTheWords, typeOfWord)

Defined in: adventure/asset/addWordsToLookup.js, line 6

Inherited from: adventurejs.Asset#addWordsToLookup

Parameters:

  • allTheWords Array
  • typeOfWord String
addWordsToLookup() takes words associated with this asset and adds them to the global lookup table.
aliases()

Defined in: adventure/Asset.js, line 951

Inherited from: adventurejs.Asset#aliases

aliases() is a collection of method names that are meant for authors to use. Since they don't exist on all classes, we set up these aliases so that, if authors call them on classes they're not applicable to, they will politely return null instead of throwing a "not a function" error.
areAnscestorsClosed() → {Boolean}

Defined in: adventure/assets/tangible/areAnscestorsClosed.js, line 6

Checks to see if this asset's containing parent(s) is closed. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can interact with a nested object.

Returns:

Boolean
areAnscestorsKnown() → {Boolean}

Defined in: adventure/assets/tangible/areAnscestorsKnown.js, line 6

Checks to see if this asset and its containing parent(s) are known to player. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can "see" a nested object.

Returns:

Boolean
areAnscestorsOpen() → {Boolean}

Defined in: adventure/assets/tangible/areAnscestorsOpen.js, line 6

Checks to see if this asset's containing parent(s) is open. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can interact with a nested object.

Returns:

Boolean
areAnscestorsUnknown(nestlevel) → {Boolean}

Defined in: adventure/assets/tangible/areAnscestorsUnknown.js, line 6

Parameters:

  • nestlevel int
Checks to see if this asset or its containing parent(s) are unknown to player. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can "see" a nested object.

Returns:

Boolean
canBePlacedInAspectOfAsset(aspect, asset) → {Boolean}

Defined in: adventure/assets/tangible/canBePlacedInAspectOfAsset.js, line 6

Parameters:

  • aspect String
  • asset Object
Check whether this asset can be placed within the specified aspect of the specified asset. This takes into account the with_assets and with_classes properties.

Returns:

Boolean
canContainAnySubstance() → {Boolean}

Defined in: adventure/assets/tangible/canContainAnySubstance.js, line 6

Determine whether asset can contain any substance.

Returns:

Boolean
canContainAssetAt(object) → {Boolean}

Defined in: adventure/assets/tangible/canContainAssetAt.js, line 6

Parameters:

  • object Object
Check whether this asset can be attached to specified other asset.

Returns:

Boolean
canPlayerNest(aspect) → {Boolean}

Defined in: adventure/assets/tangible/canPlayerNest.js, line 9

Parameters:

  • aspect String
    A Tangible Aspect ID.
Ask if player can nest in an aspect of this asset.

Returns:

Boolean
canPlayerReachThatFromThis(object) → {Boolean}

Defined in: adventure/assets/tangible/canPlayerReachThatFromThis.js, line 6

Parameters:

  • object Object
Check whether that asset can be reached by player when nested in this asset.

Returns:

Boolean
canSetVerbState(verb) → {Boolean}

Defined in: adventure/asset/canSetVerbState.js, line 6

Inherited from: adventurejs.Asset#canSetVerbState

Parameters:

  • verb String
canSetVerbState is a method to check whether the specified verb can set state on this asset. Assumes that asset.is.direct_object_of_verb[verb].enabled is true

Returns:

Boolean
destroy()

Defined in: adventure/assets/Tangible.js, line 2151

Overrides from: adventurejs.Matter#destroy

Todos: What else needs to happen on destroy?

Remove this asset from the world before calling superclass.destroy.
didDoVerbs(verbs) → {Boolean}

Defined in: adventure/asset/didDoVerbs.js, line 6

Inherited from: adventurejs.Asset#didDoVerbs

Parameters:

  • verbs Array
didDoVerbs check whether any of the specified verbs has ever been applied to the asset as a direct object. This is a convenience method that relies on asset.DOVdidDo()

Returns:

Boolean
didIoVerbs(verbs) → {Boolean}

Defined in: adventure/asset/didIoVerbs.js, line 6

Inherited from: adventurejs.Asset#didIoVerbs

Parameters:

  • verbs Array
didIoVerbs check whether any of the specified verbs has ever been applied to the asset as an indirect object. This is a convenience method that relies on asset.IOVdidDo()

Returns:

Boolean
doesContainAnyAsset() → {Boolean}

Defined in: adventure/assets/tangible/doesContainAnyAsset.js, line 6

Check whether this asset contains any assets.

Returns:

Boolean
doesContainAnyAssetAt(aspect) → {Boolean}

Defined in: adventure/assets/tangible/doesContainAnyAssetAt.js, line 6

Parameters:

  • aspect String
Check whether this asset contains any assets.

Returns:

Boolean
doesContainAnySubstance() → {Boolean}

Defined in: adventure/assets/tangible/doesContainAnySubstance.js, line 6

Check whether this asset contains any substance.

Returns:

Boolean
doesContainAnySubstanceAt(aspect) → {Boolean}

Defined in: adventure/assets/tangible/doesContainAnySubstanceAt.js, line 6

Parameters:

  • aspect String
Check whether this asset contains any substance at specified aspect.

Returns:

Boolean
doesContainAsset(id) → {String}

Defined in: adventure/assets/tangible/doesContainAsset.js, line 6

Parameters:

  • id String
Check whether this asset contains the specified asset.

Returns:

String
doesContainAssetAt(id, aspect) → {Boolean}

Defined in: adventure/assets/tangible/doesContainAssetAt.js, line 6

Parameters:

  • id String
  • aspect String
Check whether this asset contains the specified asset at the specified aspect.

Returns:

Boolean
doesContainSubstance(id) → {String}

Defined in: adventure/assets/tangible/doesContainSubstance.js, line 6

Parameters:

  • id String
Check whether this asset contains the specified substance.

Returns:

String
doesContainSubstanceAt(id, aspect) → {Boolean}

Defined in: adventure/assets/tangible/doesContainSubstanceAt.js, line 6

Parameters:

  • id String
  • aspect String
Check whether this asset contains the specified substance.

Returns:

Boolean
DOVallowOnce(verb) → {Boolean}

Defined in: adventure/asset/DOVallowOnce.js, line 6

Inherited from: adventurejs.Asset#DOVallowOnce

Parameters:

  • verb String
DOVallowOnce is a method to check whether this asset is subscribed to allow the specified verb to act on it as a direct object only once.

Returns:

Boolean
DOVallowWithAnything(verb) → {Boolean}

Defined in: adventure/asset/DOVallowWithAnything.js, line 6

Inherited from: adventurejs.Asset#DOVallowWithAnything

Parameters:

  • verb String
DOVallowWithAnything is a method to check whether this asset is subscribed to act as a direct object with the specified verb without any direct object.

Returns:

Boolean
DOVallowWithAsset(verb, asset) → {Boolean}

Defined in: adventure/asset/DOVallowWithAsset.js, line 6

Inherited from: adventurejs.Asset#DOVallowWithAsset

Parameters:

  • verb String
  • asset Object
DOVallowWithAsset is a method to check whether this asset is subscribed to act as a direct object with the specified verb and indirect object.

Returns:

Boolean
DOVallowWithNothing(verb) → {Boolean}

Defined in: adventure/asset/DOVallowWithNothing.js, line 6

Inherited from: adventurejs.Asset#DOVallowWithNothing

Parameters:

  • verb String
DOVallowWithNothing is a method to check whether this asset is subscribed to act as a direct object with the specified verb without any indirect object. For example, "plug in computer" where when an outlet is implied but not defined.

Returns:

Boolean
DOVdidDo(verb) → {Boolean}

Defined in: adventure/asset/DOVdidDo.js, line 6

Inherited from: adventurejs.Asset#DOVdidDo

Parameters:

  • verb String
DOVdidDo is a method to check whether this asset was already used as a direct objecb by the specified verb.

_didDo is an alias meant for authors.

Returns:

Boolean
DOVdidDoCount(verb) → {Int}

Defined in: adventure/asset/DOVdidDoCount.js, line 6

Inherited from: adventurejs.Asset#DOVdidDoCount

Parameters:

  • verb String
DOVdidDoCount is a method to get a count of times this asset was used as a direct object by the specified verb.

_doCount is an alias meant for authors.

Returns:

Int
DOVdidTry(verb) → {Boolean}

Defined in: adventure/asset/DOVdidTry.js, line 6

Inherited from: adventurejs.Asset#DOVdidTry

Parameters:

  • verb String
DOVdidTry is a method to check whether it was attempted to use this asset as a direct object by the specified verb.

_didTry is an alias meant for authors.

Returns:

Boolean
DOVdidTryCount(verb) → {Boolean}

Defined in: adventure/asset/DOVdidTryCount.js, line 6

Inherited from: adventurejs.Asset#DOVdidTryCount

Parameters:

  • verb String
DOVdidTryCount is a method to get a count of times it was tried to use this asset as a direct object by the specified verb.

_tryCount is an alias meant for authors.

Returns:

Boolean
DOVgetConnectionCount(verb) → {Int}

Defined in: adventure/asset/DOVgetConnectionCount.js, line 6

Inherited from: adventurejs.Asset#DOVgetConnectionCount

Parameters:

  • verb String
    The name of a verb.
Return this.is.direct_object_of_verb[verb].with_params.connections.length

Returns:

Int
DOVgetConnections(verb) → {Array}

Defined in: adventure/asset/DOVgetConnections.js, line 6

Inherited from: adventurejs.Asset#DOVgetConnections

Parameters:

  • verb String
    The name of a verb.
Return this.is.direct_object_of_verb[verb].with_params.connections

Returns:

Array
DOVgetMaxConnections(verb) → {Int}

Defined in: adventure/asset/DOVgetMaxConnections.js, line 6

Inherited from: adventurejs.Asset#DOVgetMaxConnections

Parameters:

  • verb String
    The name of a verb.
Return this.is.direct_object_of_verb[verb].with_params.max_connections

Returns:

Int
DOVhasIndirectObjects(verb) → {Boolean}

Defined in: adventure/asset/DOVhasIndirectObjects.js, line 6

Inherited from: adventurejs.Asset#DOVhasIndirectObjects

Parameters:

  • verb String
DOVhasIndirectObjects is a method to check whether this asset has any particular indirect objects specified by the author for use with the specified verb.

Returns:

Boolean
DOVhasMaxConnections(verb) → {Boolean}

Defined in: adventure/asset/DOVhasMaxConnections.js, line 6

Inherited from: adventurejs.Asset#DOVhasMaxConnections

Parameters:

  • verb String
    The name of a verb.
Get whether the DOV has maximum connections.

Returns:

Boolean
DOVincrementDoCount(verb)

Defined in: adventure/asset/DOVincrementDoCount.js, line 6

Inherited from: adventurejs.Asset#DOVincrementDoCount

Parameters:

  • verb String
DOVincrementDoCount is a method to increment the number of times the specified verb has acted on this asset as a direct object.
DOVincrementTryCount(verb)

Defined in: adventure/asset/DOVincrementTryCount.js, line 6

Inherited from: adventurejs.Asset#DOVincrementTryCount

Parameters:

  • verb String
DOVincrementTryCount is a method to increment the number of times the specified verb has been tried on this asset as a direct object.
DOVisConnectedToAnything(verb) → {Boolean}

Defined in: adventure/asset/DOVisConnectedToAnything.js, line 6

Inherited from: adventurejs.Asset#DOVisConnectedToAnything

Parameters:

  • verb String
    The name of a verb.
Check whether this asset is currently connected to anything directly by a verb such as plugIn or tie. For example, if this asset is a computer plugged into an outlet, this method would return true.

Returns:

Boolean
DOVisConnectedToAsset(verb, asset) → {Boolean}

Defined in: adventure/asset/DOVisConnectedToAsset.js, line 6

Inherited from: adventurejs.Asset#DOVisConnectedToAsset

Parameters:

  • verb String
    The name of the verb to test.
  • asset Object | String
    A game asset or asset id to test.
Check whether this asset is currently connected as a direct object to the specified indirect object by the specified verb. For example, in the case of a computer plugged into an outlet, the computer would be the direct object, and calling this method on it would return true.

Returns:

Boolean
DOVisConnectedToNothing(verb) → {Boolean}

Defined in: adventure/asset/DOVisConnectedToNothing.js, line 6

Inherited from: adventurejs.Asset#DOVisConnectedToNothing

Parameters:

  • verb String
    The name of a verb.
Check whether this asset is currently connected as an indirect object to nothing by the specified verb. For example, in the case of a computer that can be plugged in, an author might prefer not to create a specific outlet into which to plug the computer. For that case we allow 'plug in computer', and store a null value to asset.is.direct_object_of_verb.plugIn.with_params.connections to represent the computer's plugged in state.

Returns:

Boolean
DOVsetConnection(verb, asset)

Defined in: adventure/asset/DOVsetConnection.js, line 6

Inherited from: adventurejs.Asset#DOVsetConnection

Parameters:

  • verb String
  • asset Object
Set asset's direct verb param connection to specified indirect object.
DOVsetWithAsset(verb, asset) → {Boolean}

Defined in: adventure/asset/DOVsetWithAsset.js, line 6

Inherited from: adventurejs.Asset#DOVsetWithAsset

Parameters:

  • verb String
  • asset Object
DOVsetWithAsset is used to specify another asset that can be used as an indirect object with this asset as direct object. For example, if this asset is a locking chest, chest.DOVsetWithAsset('unlock', 'gold key') would add the gold key as an indirect object of the chest.

Returns:

Boolean
DOVsetWithClass(verb, clas) → {Boolean}

Defined in: adventure/asset/DOVsetWithClass.js, line 6

Inherited from: adventurejs.Asset#DOVsetWithClass

Parameters:

  • verb String
  • clas String
DOVsetWithClass is a method to add an indirect object class to asset.is.direct_object_of_verb[verb].with_classes.

Returns:

Boolean
DOVunsetConnection(verb, asset)

Defined in: adventure/asset/DOVunsetConnection.js, line 6

Inherited from: adventurejs.Asset#DOVunsetConnection

Parameters:

  • verb String
  • asset Object
Unset asset's direct verb param connection to specified indirect object.
event_hooks()

Defined in: adventure/assets/Tangible.js, line 1498

Overrides from: adventurejs.Matter#event_hooks

Todos: move all this!

Allow authors to insert custom logic on a per-asset basis, when specified assets react to being manipulated by verbs. To use, create a key/value pair for each asset you wish to insert logic for, where the key is the name of the other asset and the value is an anonymous function, as in this example:
MyGame.createAsset({
  class: "Bicycle",// THIS asset to be nested to
  name: "bicycle",
  event_hooks: {
    onNestThatToThis: {
      "Mighty Hero": function(params){ // THAT asset to be nested 
        MyGame.prependToNextPrint("You wobble a bit getting on the bike. ");
        MyGame.appendToNextPrint("Success! ");
      }
    },
  },
});
This example only adds some text to the output for the turn, but overrides can be used to add any kind of logic. Here's are some of the reactions that can be overriden:
  • onMoveThatToThis - when that asset is moved to this asset
  • onRemoveThisFromThat - when this asset is removed from that asset
  • onRemoveThatFromThis - when that asset is removed from this asset
  • onMoveThisToThat - when this asset is moved to that asset
  • onNestThatToThis - when that character is nested to this asset
  • onNestThisToThat - when this character is nested to that asset
  • onUnnestThatFromThis - when that character is unnested from this asset
  • onUnnestThisFromThat - when this character is unnested from that asset
  • onSubtractSubstanceFromThis - when a substance is subtracted from this asset
  • onAddSubstanceToThis - when a substance is added to this asset
  • onDestroyThis - when this asset is removed from the game
  • onChangeMoisture - when this asset is moistened
  • onChangeTemperature - when this asset is subjected to a change in temperature
  • onChangeGravity - when this asset is subjected to a change in gravity
  • onTieThisToThat - when this asset is tied to that asset
  • onTieThatToThis - when that asset is tied to this asset
  • onUntieThisFromThat - when this asset is untied from that asset
  • onUntieThatFromThis - when that asset is untied from this asset
  • onTurnThis - when this asset is turned
  • onTurnThisWithThat - when this asset is turned with that asset
  • onTurnThatWithThis - when that asset is turned with this asset
  • onLetGoThis - when player lets go of this asset
  • onHoldThis - when player holds this asset
  • onDrinkThis - when this asset is drunk
  • onDrinkFromThis - when this asset is drunk from
  • get(property, qualifier)

    Defined in: adventure/assets/tangible/$get.js, line 6

    Parameters:

    • property String
    • qualifier String
    Utility function that provides an easy way for authors to test for various conditions.
    • all - list things anywhere in this
    • behind - list things behind this
    • in - list things in this
    • on - list things on this
    • under - list things under this
    • attached - list things attached to this
    getAllContents() → {Array}

    Defined in: adventure/assets/tangible/getAllContents.js, line 6

    Returns an array of all content in any location

    Returns:

    Array
    getAllNestedContents() → {Array}

    Defined in: adventure/assets/tangible/getAllNestedContents.js, line 6

    Get list of other assets nested within this one.

    Returns:

    Array
    getAncestorId() → {String}

    Defined in: adventure/assets/tangible/getAncestorId.js, line 6

    Get the ID of this asset's topmost parent, excluding Room.

    Returns:

    String
    getAnySubstanceThisContains() → {String}

    Defined in: adventure/assets/tangible/getAnySubstanceThisContains.js, line 6

    Get the substance, if any, contained in this asset.

    Returns:

    String
    getAspectAt(aspect) → {Object|Null}

    Defined in: adventure/assets/tangible/getAspectAt.js, line 6

    Parameters:

    • aspect string
      The aspect to get.
    Get aspect at specified preposition.

    Returns:

    Object | Null
    getAspectWithVessel() → {String}

    Defined in: adventure/assets/tangible/getAspectWithVessel.js, line 6

    Get this asset's substance location. This is somewhat ambiguous because in theory an asset can have multiple substance locations but in practice we clearly prefer 'in'.

    Returns:

    String
    getClosedAnscestors() → {Array}

    Defined in: adventure/assets/tangible/getClosedAnscestors.js, line 6

    Get a list of this asset's containing parent(s) that are closed. Takes into account nesting doll situations and looks all the way up the chain. Useful for determining whether a player can interact with a nested object.

    Returns:

    Array
    getContentsAt() → {Array}

    Defined in: adventure/assets/tangible/getContentsAt.js, line 6

    Returns an array of all content in the specified aspect.

    Returns:

    Array
    getCountOfListableContentsAt(where) → {int}

    Defined in: adventure/assets/tangible/getCountOfListableContentsAt.js, line 6

    Parameters:

    • where String
    Get a count of assets within this asset that are listable in this asset's description, for example when player examines this.

    Returns:

    int
    getDescription(description) → {String}

    Defined in: adventure/asset/getDescription.js, line 6

    Inherited from: adventurejs.Asset#getDescription

    Parameters:

    • description String
    Get a description, such as "look in book", where "in" has been defined as a key at asset.descriptions.in. "look" is always the default description.

    Returns:

    String
    getIndirectDescription(indirect_aspect, indirect_asset, direct_aspect) → {String}

    Defined in: adventure/asset/getIndirectDescription.js, line 6

    Inherited from: adventurejs.Asset#getIndirectDescription

    Parameters:

    • indirect_aspect String
    • indirect_asset Object
    • direct_aspect String
    Get indirect description, such as "look at this through magnifying glass", where "through magnifying glass" is a key at asset.descriptions["through magnifying glass"].description "look" is always the default direct object description.

    Returns:

    String
    getInheritance() → {Array}

    Defined in: adventure/Atom.js, line 238

    Inherited from: adventurejs.Atom#getInheritance

    getInheritance is a utility method to get an asset's inheritance chain. Returns a list of class names from high to low.

    Returns:

    Array
    getListableContents() → {Array}

    Defined in: adventure/assets/tangible/getListableContents.js, line 6

    Get an array of assets within this asset that are listable in this asset's description, for example when player examines this.

    Returns:

    Array
    getNestedInstancesOfClass(instanceClass) → {Array}

    Defined in: adventure/assets/tangible/getNestedInstancesOfClass.js, line 6

    Parameters:

    • instanceClass String
    Find instances of specified class within this asset, for example find all coins within a purse. Returns an array of asset IDs.

    Returns:

    Array
    getOpenOrClosed() → {Array}

    Defined in: adventure/assets/tangible/getOpenOrClosed.js, line 6

    Print a string representing open / closed state of this asset.

    Returns:

    Array
    getPlaceAspect() → {Object|null}

    Defined in: adventure/assets/tangible/getPlaceAspect.js, line 6

    Returns the aspect object of this asset's parent asset or null.

    Returns:

    Object | null
    getPlaceAspectId() → {String}

    Defined in: adventure/assets/tangible/getPlacePreposition.js, line 6

    Returns the aspect id of this asset's parent asset, or a blank string.

    Returns:

    String
    getPlaceAsset() → {Object|Boolean}

    Defined in: adventure/assets/tangible/getPlaceAsset.js, line 6

    Get the object of this asset's parent asset.

    Returns:

    Object | Boolean
    getPlaceAssetId() → {String}

    Defined in: adventure/assets/tangible/getPlaceAssetId.js, line 6

    Returns the ID of asset's parent or a blank string.

    Returns:

    String
    getPrintableListOfContents(params) → {String}

    Defined in: adventure/assets/tangible/getPrintableListOfContents.js, line 6

    Parameters:

    • params Object
    Get a printable list of assets within all Aspects of this asset, for example to append to asset description when player inputs "examine this". Returns a string.

    Returns:

    String
    getProperty(prop) → {Boolean}

    Defined in: adventure/Atom.js, line 184

    Inherited from: adventurejs.Atom#getProperty

    Parameters:

    • prop String
      Name of the property to test for. Can include dot notation.
    A method to get a deep property without throwing an error. Allows for getting deep properties, ie "foo.bar.baz". Returns false if property doesn't exist, so beware of if(false === foo.bar.baz) comparisons.

    Returns:

    Boolean
    getRoomAsset() → {String}

    Defined in: adventure/assets/tangible/getRoomAsset.js, line 6

    Get the asset of the room this asset is in.

    Returns:

    String
    getRoomId() → {String}

    Defined in: adventure/assets/tangible/getRoomId.js, line 6

    Get the ID of the room this asset is in.

    Returns:

    String
    getRopesThatBlockTravel() → {Array}

    Defined in: adventure/assets/tangible/getRopesThatBlockTravel.js, line 6

    Check if player is holding a rope, or tied by a rope, that is tied at the other end, preventing player from leaving room. Return a list of assets that meet this qualification.

    Returns:

    Array
    getSubstanceAt() → {String}

    Defined in: adventure/assets/tangible/getSubstanceAt.js, line 6

    Get the substance, if any, contained in this asset.

    Returns:

    String
    getThingThisIsTiedToPlayerBy() → {Object}

    Defined in: adventure/assets/tangible/getThingThisIsTiedToPlayerBy.js, line 6

    Assuming this asset is tied to the player asset by means of a third thing, get that third thing. Returns an asset object.

    Returns:

    Object
    getTiedThingsThatDragOnTravel() → {Array}

    Defined in: adventure/assets/tangible/getTiedThingsThatDragOnTravel.js, line 6

    Check if player is holding a rope, or tied by a rope, that is tied at the other end to an asset that can travel with player. Return a list of assets that meet this qualification.

    Returns:

    Array
    getVesselAt(aspect) → {Object|Null}

    Defined in: adventure/assets/tangible/getVesselAt.js, line 6

    Parameters:

    • aspect string
      The aspect to check.
    Get substance container at specified preposition.

    Returns:

    Object | Null
    getYBottom() → {Float}

    Defined in: adventure/assets/tangible/getYBottom.js, line 6

    Get this asset's global bottom y based on its y and height, which may be negative.

    Returns:

    Float
    getYRange() → {Object}

    Defined in: adventure/assets/tangible/getYRange.js, line 6

    Get this asset's bottom y and top y based on its y and height, which may be negative.

    Returns:

    Object
    getYTop() → {Float}

    Defined in: adventure/assets/tangible/getYTop.js, line 6

    Get this asset's global top y based on its y and height.

    Returns:

    Float
    has()

    Defined in: adventure/asset/_has.js, line 7

    Inherited from: adventurejs.Asset#has

    has is an alias to asset.isIn() that reverses the direct and indirect objects, to test whether that asset is in this asset.
    if( MyGame.$('crown').$has('jewel') ){ // do stuff }
    
    hasAspectAt(aspect) → {Boolean}

    Defined in: adventure/assets/tangible/hasAspectAt.js, line 6

    Parameters:

    • aspect String
    Determine whether asset has an aspect at specified preposition.

    Returns:

    Boolean
    hasClass(prop) → {Boolean}

    Defined in: adventure/Atom.js, line 216

    Inherited from: adventurejs.Atom#hasClass

    Parameters:

    • prop String
      Name of the classe to test for.
    A method to test whether the Atom is an instance of a given class.

    Returns:

    Boolean
    hasContentsAtAspect(aspect) → {Boolean}

    Defined in: adventure/assets/tangible/hasContentsAtAspect.js, line 6

    Parameters:

    • aspect String
    Determine whether asset has contents at the specified aspect.

    Returns:

    Boolean
    hasDescription(description) → {String|Boolean}

    Defined in: adventure/asset/hasDescription.js, line 6

    Inherited from: adventurejs.Asset#hasDescription

    Parameters:

    • description String
    See if asset has a description for an aspect, such as "look in book", where "in" has been defined as a key at asset.descriptions.in. "look" is always the default description.

    Returns:

    String | Boolean
    hasEventHook(hook, asset_name) → {Boolean}

    Defined in: adventure/asset/hasEventHook.js, line 6

    Inherited from: adventurejs.Asset#hasEventHook

    Parameters:

    • hook string
    • asset_name string
      We use asset.name here instead of asset.id to make life slightly easier for authors. Asset IDs are formed from asset names, but generally we don't expect authors to be aware of IDs. Hooks will only be defined by authors, so let them use asset.name as their identifier. We do however make an effort to see if an id has been passed instead of a name.
    Check if this asset has an event_hooks for a given verb; additionally check if the asset has an event_hooks for a specific asset in combination with the verb. This check is also performed redundantly too in tryEventHook.js.

    Returns:

    Boolean
    hasIndirectDescription(indirect_aspect, indirect_asset, direct_aspect) → {String|Boolean}

    Defined in: adventure/asset/hasIndirectDescription.js, line 6

    Inherited from: adventurejs.Asset#hasIndirectDescription

    Parameters:

    • indirect_aspect String
    • indirect_asset Object
    • direct_aspect String
    Determine whether asset has an indirect description, such as "look at this through magnifying glass", where "through magnifying glass" becomes a key at asset.descriptions["through magnifying glass"]. "look" is always the default direct object description.

    Returns:

    String | Boolean
    hasListableContents() → {Boolean}

    Defined in: adventure/assets/tangible/hasListableContents.js, line 6

    Todos: transparent containers

    Check whether this asset has any listable contents.

    Returns:

    Boolean
    hasPlace() → {Boolean}

    Defined in: adventure/assets/tangible/hasPlace.js, line 6

    Determine whether asset has a place.

    Returns:

    Boolean
    hasProperty(prop) → {Boolean}

    Defined in: adventure/Atom.js, line 148

    Inherited from: adventurejs.Atom#hasProperty

    Parameters:

    • prop String
      Name of the property to test for. Can include dot notation.
    A method to test whether the Atom has a given property. Allows for testing deep properties, ie "foo.bar.baz". For stupid and unaccountable reasons Ivan has decided to code adventurejs entirely in Javascript ES5, so we don't have the nicety of optional chaining introduced in ES6. This method fills in for optional chaining until we someday upgrade to ES6.

    Returns:

    Boolean
    hasPropertyOnAspectAt() → {Boolean}

    Defined in: adventure/assets/tangible/hasPropertyOnAspectAt.js, line 6

    Determine whether asset has specified property on specified aspect. Useful for testing whether properties exist before trying to assign to them.

    Returns:

    Boolean
    hasRopesThatBlockTravel() → {Boolean}

    Defined in: adventure/assets/tangible/hasRopesThatBlockTravel.js, line 6

    Determine if player is holding or tied by any ropes that block travel to other rooms.

    Returns:

    Boolean
    hasTiedThingsThatDragOnTravel() → {Boolean}

    Defined in: adventure/assets/tangible/hasTiedThingsThatDragOnTravel.js, line 6

    Check if player is holding a rope, or tied by a rope, that is tied at the other end to an asset that can travel with player. Returns a boolean indicating whether any asset meets this qualification.

    Returns:

    Boolean
    hasVessel() → {Boolean}

    Defined in: adventure/assets/tangible/hasVessel.js, line 6

    Determine whether asset has any aspect with a vessel.

    Returns:

    Boolean
    hasVesselAtAspect(aspect) → {Boolean}

    Defined in: adventure/assets/tangible/hasVesselAtAspect.js, line 6

    Parameters:

    • aspect String
    Determine whether asset has substance at an aspect at specified preposition.

    Returns:

    Boolean
    incrementDoVerbCount(verb, index)

    Defined in: adventure/asset/incrementDoVerbCount.js, line 6

    Inherited from: adventurejs.Asset#incrementDoVerbCount

    Parameters:

    • verb String
    • index Int
    incrementDoVerbCount takes a verb and an index and updates this asset's count of the number of times the verb has acted upon it.
    incrementTryVerbCount(verb, index)

    Defined in: adventure/asset/incrementTryVerbCount.js, line 6

    Inherited from: adventurejs.Asset#incrementTryVerbCount

    Parameters:

    • verb String
    • index Int
    incrementTryVerbCount takes a verb and an index and updates this asset's count of the number of times the verb has attempted upon it.
    initialize(game) → {Boolean}

    Defined in: adventure/assets/Tangible.js, line 2122

    Overrides from: adventurejs.Matter#initialize

    Parameters:

    • game Object
    Inherited from superclass Asset. Tangible adds initialization methods that are used for all Tangible assets, including:
    • link related objects
    • register parts

    Returns:

    Boolean
    IOVallowOnce(verb) → {Boolean}

    Defined in: adventure/asset/IOVallowOnce.js, line 6

    Inherited from: adventurejs.Asset#IOVallowOnce

    Parameters:

    • verb String
    IOVallowOnce is a method to check whether this asset is subscribed to allow the specified verb to act on it as an indirect object only once.

    Returns:

    Boolean
    IOVallowWithAnything(verb) → {Boolean}

    Defined in: adventure/asset/IOVallowWithAnything.js, line 6

    Inherited from: adventurejs.Asset#IOVallowWithAnything

    Parameters:

    • verb String
    IOVallowWithAnything is a method to check whether this asset is subscribed to act as an indirect object with the specified verb and any direct object.

    Returns:

    Boolean
    IOVallowWithAsset(verb, asset) → {Boolean}

    Defined in: adventure/asset/IOVallowWithAsset.js, line 6

    Inherited from: adventurejs.Asset#IOVallowWithAsset

    Parameters:

    • verb String
    • asset Object
    IOVallowWithAsset is a method to check whether this asset is subscribed to act as an indirect object with the specified verb and direct object.

    Returns:

    Boolean
    IOVallowWithNothing(verb) → {Boolean}

    Defined in: adventure/asset/IOVallowWithNothing.js, line 6

    Inherited from: adventurejs.Asset#IOVallowWithNothing

    Parameters:

    • verb String
    IOVallowWithNothing is a method to check whether this asset is subscribed to act as an indirect object with the specified verb without any direct object. Unlikely to happen but provided for completionism.

    Returns:

    Boolean
    IOVdidDo(verb) → {Boolean}

    Defined in: adventure/asset/IOVdidDo.js, line 6

    Inherited from: adventurejs.Asset#IOVdidDo

    Parameters:

    • verb String
    IOVdidDo is a method to check whether this asset was already used as an indirect objecb by the specified verb.

    _iDidDo is an alias meant for authors.

    Returns:

    Boolean
    IOVdidDoCount(verb) → {Int}

    Defined in: adventure/asset/IOVdidDoCount.js, line 6

    Inherited from: adventurejs.Asset#IOVdidDoCount

    Parameters:

    • verb String
    IOVdidDoCount is a method to get a count of times this asset was used as an indirect object by the specified verb.

    _iDoCount is an alias meant for authors.

    Returns:

    Int
    IOVdidTry(verb) → {Boolean}

    Defined in: adventure/asset/IOVdidTry.js, line 6

    Inherited from: adventurejs.Asset#IOVdidTry

    Parameters:

    • verb String
    IOVdidTry is a method to check whether it was attempted to use this asset as an indirect object by the specified verb.

    _iDidTry is an alias meant for authors.

    Returns:

    Boolean
    IOVdidTryCount(verb) → {Boolean}

    Defined in: adventure/asset/IOVdidTryCount.js, line 6

    Inherited from: adventurejs.Asset#IOVdidTryCount

    Parameters:

    • verb String
    IOVdidTryCount is a method to get a count of times it was attempted to use this asset as an indirect object by the specified verb.

    _iTryCount is an alias meant for authors.

    Returns:

    Boolean
    IOVgetConnectionCount(verb) → {Int}

    Defined in: adventure/asset/IOVgetConnectionCount.js, line 6

    Inherited from: adventurejs.Asset#IOVgetConnectionCount

    Parameters:

    • verb String
      The name of a verb.
    Return this.is.indirect_object_of_verb[verb].with_params.connections.length

    Returns:

    Int
    IOVgetConnections(verb) → {Array}

    Defined in: adventure/asset/IOVgetConnections.js, line 6

    Inherited from: adventurejs.Asset#IOVgetConnections

    Parameters:

    • verb String
      The name of a verb.
    Return this.is.indirect_object_of_verb[verb].with_params.connections

    Returns:

    Array
    IOVgetMaxConnections(verb) → {Int}

    Defined in: adventure/asset/IOVgetMaxConnections.js, line 6

    Inherited from: adventurejs.Asset#IOVgetMaxConnections

    Parameters:

    • verb String
      The name of a verb.
    Return this.is.indirect_object_of_verb[verb].with_params.max_connections

    Returns:

    Int
    IOVhasDirectObjects(verb) → {Boolean}

    Defined in: adventure/asset/IOVhasDirectObjects.js, line 6

    Inherited from: adventurejs.Asset#IOVhasDirectObjects

    Parameters:

    • verb String
    IOVhasDirectObjects is a method to check whether this asset has any particular direct objects specified by the author for use with the specified verb.

    Returns:

    Boolean
    IOVhasMaxConnections(verb) → {Boolean}

    Defined in: adventure/asset/IOVhasMaxConnections.js, line 6

    Inherited from: adventurejs.Asset#IOVhasMaxConnections

    Parameters:

    • verb String
      The name of a verb.
    Get whether the IOV has maximum connections.

    Returns:

    Boolean
    IOVincrementDoCount(verb)

    Defined in: adventure/asset/IOVincrementDoCount.js, line 6

    Inherited from: adventurejs.Asset#IOVincrementDoCount

    Parameters:

    • verb String
    IOVincrementDoCount is a method to increment the number of times the specified verb has acted on this asset as an indirect object.
    IOVincrementTryCount(verb)

    Defined in: adventure/asset/IOVincrementTryCount.js, line 6

    Inherited from: adventurejs.Asset#IOVincrementTryCount

    Parameters:

    • verb String
    IOVincrementTryCount is a method to increment the number of times the specified verb has been tried on this asset as an indirect object.
    IOVisConnectedToAnything(verb) → {Boolean}

    Defined in: adventure/asset/IOVisConnectedToAnything.js, line 6

    Inherited from: adventurejs.Asset#IOVisConnectedToAnything

    Parameters:

    • verb String
      The name of a verb.
    Check whether this asset is currently connected to anything indirectly by a verb such as plugIn or tie. For example, if this asset is an outlet with a computer plugged into it, this method would return true.

    Returns:

    Boolean
    IOVisConnectedToAsset(verb, asset) → {Boolean}

    Defined in: adventure/asset/IOVisConnectedToAsset.js, line 6

    Inherited from: adventurejs.Asset#IOVisConnectedToAsset

    Parameters:

    • verb String
      The name of the verb to test.
    • asset Object | String
      A game asset or asset id to test.
    Check whether this asset is currently connected as an indirect object to the specified direct object by the specified verb. For example, in the case of a computer plugged into an outlet, the outlet would be the indirect object, and calling this method on it would return true.

    Returns:

    Boolean
    IOVisConnectedToNothing(verb) → {Boolean}

    Defined in: adventure/asset/IOVisConnectedToNothing.js, line 6

    Inherited from: adventurejs.Asset#IOVisConnectedToNothing

    Parameters:

    • verb String
      The name of a verb.
    Check whether this asset is currently connected as an indirect object to nothing by the specified verb. (This seems like an unlikely situation as of this writing, but is offered for completion with DOVisConnectedToNothing which does have at least one use case.)

    Returns:

    Boolean
    IOVsetConnection(verb, asset)

    Defined in: adventure/asset/IOVsetConnection.js, line 6

    Inherited from: adventurejs.Asset#IOVsetConnection

    Parameters:

    • verb String
    • asset Object
    Set asset's indirect verb param connection to specified direct object.
    IOVsetWithAsset(verb, asset) → {Boolean}

    Defined in: adventure/asset/IOVsetWithAsset.js, line 6

    Inherited from: adventurejs.Asset#IOVsetWithAsset

    Parameters:

    • verb String
    • asset Object
    IOVsetWithAsset is used to specify another asset that can be used as a direct object with this asset as indirect object. For example, if this asset is a gold key, gold_key.IOVsetWithAsset('unlock', 'chest') would add the chest as a direct object of the gold key.

    Returns:

    Boolean
    IOVsetWithClass(verb, clas) → {Boolean}

    Defined in: adventure/asset/IOVsetWithClass.js, line 6

    Inherited from: adventurejs.Asset#IOVsetWithClass

    Parameters:

    • verb String
    • clas String
    IOVsetWithClass is a method to add a direct object class to asset.is.indirect_object_of_verb[verb].with_classes.

    Returns:

    Boolean
    IOVunsetConnection(verb, asset)

    Defined in: adventure/asset/IOVunsetConnection.js, line 6

    Inherited from: adventurejs.Asset#IOVunsetConnection

    Parameters:

    • verb String
    • asset Object
    Unset asset's indirect verb param connection to specified direct object.
    isDOV(verb) → {Boolean}

    Defined in: adventure/asset/isDOV.js, line 6

    Inherited from: adventurejs.Asset#isDOV

    Parameters:

    • verb String
    isDOV is a method to check whether this asset is subscribed to allow the specified verb to act on it as a direct object.

    Returns:

    Boolean
    isIn(asset)

    Defined in: adventure/assets/tangible/$isIn.js, line 7

    Parameters:

    • asset Object | String
      Can be string or object.
    isIn tests whether one asset is in (any aspect of) another asset.
    if( MyGame.$('jewel').$isIn('crown') ){ // do stuff }
    
    isIOV(verb) → {Boolean}

    Defined in: adventure/asset/isIOV.js, line 6

    Inherited from: adventurejs.Asset#isIOV

    Parameters:

    • verb String
    isIOV is a method to check whether this asset is subscribed to allow the specified verb to act on it as an indirect object.

    Returns:

    Boolean