Class:Vessel
Extends: adventurejs.Atom
Defined in: adventure/assets/Vessel.js, line 5
More info: Vessels
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.
- Index
- Methods
- Properties
Index
Methods:
- addSubstance
- addVolume
- empty
- Inherited from Atom getClassInheritance
- getSubstance
- getVolume
- Inherited from Atom hasClass
- mixwith
- Inherited from Atom Overrides from Atom set
- setVolume
- subtractVolume
Properties:
- can_drain
- Inherited from Atom game
- is.known
- is.seen
- know_contents_with_parent
- Inherited from Atom Name
- see_contents_with_parent
Methods Collapse 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.
addVolume
addVolume(volume)
Defined in: adventure/assets/Vessel.js, line 412
Parameters:
-
volume
number
The volume to add to the vessel.
empty
empty() → {number}
Defined in: adventure/assets/Vessel.js, line 374
Returns:
number
getClassInheritance
getClassInheritance() → {Array}
Defined in: adventure/Atom.js, line 168
Inherited from: adventurejs.Atom#getClassInheritance
Returns:
Array
getSubstance
getSubstance() → {number}
Defined in: adventure/assets/Vessel.js, line 453
Returns:
number
getVolume
getVolume() → {number}
Defined in: adventure/assets/Vessel.js, line 387
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.
Returns:
Boolean
mixwith
mixwith(substance_id)
Defined in: adventure/assets/Vessel.js, line 465
Parameters:
-
substance_id
String
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.
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.
subtractVolume
subtractVolume(volume)
Defined in: adventure/assets/Vessel.js, line 480
Parameters:
-
volume
number
The volume to subtract from the vessel.
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
this.game
.
is.known
is.known :Boolean
Defined in: adventure/assets/Vessel.js, line 116
Default value: false
Nested property of Is
is.seen
is.seen :Boolean
Defined in: adventure/assets/Vessel.js, line 130
Default value: false
Nested property of Is
know_contents_with_parent
know_contents_with_parent :Boolean
Defined in: adventure/assets/Vessel.js, line 62
Default value: true
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
see_contents_with_parent
see_contents_with_parent :Boolean
Defined in: adventure/assets/Vessel.js, line 89
Default value: true
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
.