Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0

Class:Vessel

Extends: adventurejs.Atom

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

More info: Vessels

Framework class

Vessel is a special class that adds the ability to contain substances to Tangible Assets. Vessels must exist within Aspects, which exist within Tangibles. In other words, Tangible.Aspect.Vessel, or as a practical example: sink.aspects.in.vessel.

Example:

MyGame.createAsset({
  class: "Bowl",
  name: "stone bowl",
  place: { on: "blood stained shrine" },
  descriptions:{look:"It's a stained, chipped stone bowl. ",}
  in:
  {
    vessel: {
      maxvolume: 500,
      volume: 350,
      substance_id: "viscous fluid",
    },
  },
});

To learn more, see how to use Substances.

Private Constructor:

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

Parameters:

  • game_name String
    Name of top level game instance that is scoped to window.
  • name String
    Instance name.
Inherited Overrides

Index

Methods:

Properties:

Methods Collapse all  |  Expand all

addSubstance(volume, substance_id)

Defined in: adventure/assets/Vessel.js, line 355

Parameters:

  • volume number
    The volume to add to the vessel.
  • substance_id String
    The id of a substance to add to the vessel.
addSubstance tries to add specified volume of substance. If vessel already contains another substance, will try to mixwith.
addVolume(volume)

Defined in: adventure/assets/Vessel.js, line 339

Parameters:

  • volume number
    The volume to add to the vessel.
addVolume is called to raise the vessel's volume by a specified amount.
empty() → {number}

Defined in: adventure/assets/Vessel.js, line 301

empty sets the volume of this vessel to 0.

Returns:

number
getClassInheritance() → {Array}

Defined in: adventure/Atom.js, line 150

Inherited from: adventurejs.Atom#getClassInheritance

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

Returns:

Array
getSubstance() → {number}

Defined in: adventure/assets/Vessel.js, line 380

getSubstance is called to get the substance of this vessel.

Returns:

number
getVolume() → {number}

Defined in: adventure/assets/Vessel.js, line 314

getVolume is called to get the current volume of this vessel. Takes into consideration whether vessel is emitting.

Returns:

number
hasClass(prop) → {Boolean}

Defined in: adventure/Atom.js, line 130

Inherited from: adventurejs.Atom#hasClass

Parameters:

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

Returns:

Boolean
mixwith(substance_id)

Defined in: adventure/assets/Vessel.js, line 392

Parameters:

  • substance_id String
mixwith checks for a substance mixwith.
set(props) → {Object}

Defined in: adventure/Atom.js, line 118

Overrides from: adventurejs.Atom#set

Parameters:

  • props Object
    A generic object containing properties to copy to the Object instance.
Provides a chainable shortcut method for setting a number of properties on the instance.

Returns:

Object Returns the instance the method is called on (useful for chaining calls.)
setVolume(volume)

Defined in: adventure/assets/Vessel.js, line 327

Parameters:

  • volume number
    The volume to set the vessel to.
setVolume is called to set a vessel to a specified volume.
subtractVolume(volume)

Defined in: adventure/assets/Vessel.js, line 407

Parameters:

  • volume number
    The volume to subtract from the vessel.
subtractVolume is called to reduce the vessel's volume by a specified amount.

Properties  | 

can_drain :Getter

Defined in: adventure/assets/Vessel.js, line 135

Default value: false

game :Getter

Defined in: adventure/Atom.js, line 109

Inherited from: adventurejs.Atom#game

Returns the top level game object. Use this.game.
know_with_parent :Boolean

Defined in: adventure/assets/Vessel.js, line 61

Default value: false

Substance vessels are not automatically made known with their parent. For example, picture a sealed oil can with unidentified contents: the can will become known as soon as the player enters a room with it; but the can's contents should not become known until the player opens it. Set this to true if you want a vessel to become known with its parent, for example: water in a drinking glass might be immediately apparent.
known :Boolean

Defined in: adventure/assets/Vessel.js, line 75

Default value: false

The knowability of substance vessels is indepenent from the vessel's parent asset. For example, picture a sealed oil can with unidentified contents: the can will become known as soon as the player enters a room with it; but the can's contents should not become known until the player opens it.
Name :String

Defined in: adventure/Atom.js, line 96

Inherited from: adventurejs.Atom#Name

Name returns the name of the class instance with the first character uppercased.