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

Extends: adventurejs.Atom

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

More info: Vessels

Framework class

Description

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
addSubstance(volume, substance_id)

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

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
addVolume(volume)

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

Parameters:

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

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

empty sets the volume of this vessel to 0.

Returns:

number
getClassInheritance
getClassInheritance() → {Array}

Defined in: adventure/Atom.js, line 168

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

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

getSubstance is called to get the substance of this vessel.

Returns:

number
getVolume
getVolume() → {number}

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

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

Returns:

number
hasClass
hasClass(prop) → {Boolean}

Defined in: adventure/Atom.js, line 148

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
mixwith(substance_id)

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

Parameters:

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

Defined in: adventure/Atom.js, line 136

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
setVolume(volume)

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

Parameters:

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

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

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
can_drain :Getter

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

Default value: false

game
game :Getter

Defined in: adventure/Atom.js, line 115

Inherited from: adventurejs.Atom#game

Returns the top level game object. Use this.game.
is.known
is.known :Boolean

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

Default value: false

Nested property of Is

The knowability of substance vessels is independent 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. However, players store their own awareness of objects. Setting a vessel.is_known makes it globally known to all characters.
is.seen
is.seen :Boolean

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

Default value: false

Nested property of Is

The visibility of substance vessels is independent from the vessel's parent asset. For example, picture a sealed oil can with unidentified contents: the can will become seen as soon as the player enters a room with it; but the can's contents should not become seen until the player opens it. However, players store their own awareness of objects. Setting a vessel.is_seen makes it globally known to all characters.
know_contents_with_parent
know_contents_with_parent :Boolean

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

Default value: true

Vessels contain substances. Vessels aren't self-contained things; they are nested inside Aspects of Assets. For example, picture a chalice full of holy water. The chalice is the Asset; "in" is the Aspect; nested in the Aspect is a Vessel, which actually contains the holy water.

For example: chalice.aspects.in.vessel.substance_id = "holy_water".

When a player comes to know an asset they will automatically know its vessel. In the example of the chalice, the player might see the chalice and will be able to see what's inside of it. This can be overridden on individual assets by setting their know_contents_with_parent to false.

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.

oilcan.aspects.in.vessel.know_contents_with_parent = false.
Name
Name :String

Defined in: adventure/Atom.js, line 102

Inherited from: adventurejs.Atom#Name

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

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

Default value: true

Vessels contain substances. Vessels aren't self-contained things; they are nested inside Aspects of Assets. For example, picture a chalice full of holy water. The chalice is the Asset; "in" is the Aspect; nested in the Aspect is a Vessel, which actually contains the holy water.

For example: chalice.aspects.in.vessel.substance_id = "holy_water".

When a player comes to see an asset they will automatically see its vessel. In the example of the chalice, the player might see the chalice and will be able to see what's inside of it. This can be overridden on individual assets by setting their know_contents_with_parent to false.

For example, picture a sealed oil can with unidentified contents: the can will become seen as soon as the player enters a room with it; but the can's contents should not become seen until the player opens it.

oilcan.aspects.in.vessel.see_contents_with_parent = false.