Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0

Class: Vessel

Extends: adventurejs.Atom

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

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

addVolume(volume)

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

Parameters:

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

Defined in: adventure/Atom.js, line 151

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
getVolume() → {number}

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

empty sets the volume of this vessel to 0.

Returns:

number
getVolume() → {number}

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

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 131

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
set(props) → {Object}

Defined in: adventure/Atom.js, line 119

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 303

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 331

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 111

Default value: false

game :Getter

Defined in: adventure/Atom.js, line 110

Inherited from: adventurejs.Atom#game

Returns the top level game object. Use this.game.
Name :String

Defined in: adventure/Atom.js, line 97

Inherited from: adventurejs.Atom#Name

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