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

Class: SubstanceMixer

Extends: adventurejs.Atom

Defined in: adventure/SubstanceMixer.js, line 6

Todos: Solid+liquid->slurry.

Framework class

Public Constructor:

var mixer = new adventurejs.SubstanceMixer( this.game.game_name )

SubstanceMixer is a special internal class that is instantiated whenever Substances are mixed together from two (or in theory, more) sources. For instance, if player pours a glass full of liquid into a bowl that also contains liquid, we make a new SubstanceMixer to handle the interaction. This is true even if both Vessels contain the same Substance. SubstanceMixer handles:

  • temperature conversion, if SubstancesContainers are at different temperatures
  • volume operations - comparing available volume in source and destination, removing part or all from source as needed
  • mixwith handling, if two Substances are set to mix with each other to form a third Substance
  • overflow of the target container if needed

Example:


Private Constructor:

var foo = new adventurejs.SubstanceMixer(game_name)

Parameters:

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

Methods Collapse all  |  Expand all

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
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
mix() → {boolean}

Defined in: adventure/SubstanceMixer.js, line 260

Mix two substances. This function acts upon the source / target objects, and saves its results to the SubstanceMixer object for reference by the caller.

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.)

Properties  | 

can_drain_target :Boolean

Defined in: adventure/SubstanceMixer.js, line 232

Default value: false

can_drain_target is used to indicate that the target vessel can be drained.
can_overflow_target :Boolean

Defined in: adventure/SubstanceMixer.js, line 249

Default value: false

can_overflow_target overrides did_overflow_target if it's true. It's used by fill verb, the idea being that, while an automated emitter might overflow a target, a person consciously filling a vessel would not.
did_displace_substance :Boolean

Defined in: adventure/SubstanceMixer.js, line 223

Default value: false

did_displace_substance is used if no mixwiths are provided. Source substance will simply displace target substance.
did_fill_target :Boolean

Defined in: adventure/SubstanceMixer.js, line 208

Default value: false

did_fill_target is used to indicate that the target vessel was filled by the source substance.
did_mix_substances :Boolean

Defined in: adventure/SubstanceMixer.js, line 216

Default value: false

did_mix_substances
did_overflow_target :Boolean

Defined in: adventure/SubstanceMixer.js, line 240

Default value: false

did_overflow_target may be set to true if the source is an emitter that emits a greater volume than the target can hold.
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.
output_substance_asset :Object|null

Defined in: adventure/SubstanceMixer.js, line 184

Default value: null

output_substance_asset is the asset of the substance that results from mixing (which may just be the source substance).
output_substance_id :String

Defined in: adventure/SubstanceMixer.js, line 192

Default value: ""

output_substance_id is the id of the substance asset that is that results from mixing, ie 'sand' or 'water'.
source_aspect :String

Defined in: adventure/SubstanceMixer.js, line 66

Default value: ""

source_aspect is the asset aspect that contains the source substance.
source_asset :Object|null

Defined in: adventure/SubstanceMixer.js, line 59

Default value: null

source_asset is an asset with a vessel that contains the source substance.
source_input :String

Defined in: adventure/SubstanceMixer.js, line 50

Default value: ""

source_input might be an asset id or a tri-part asset:aspect:substance id string. We're prepared to handle either to get an asset, or receive an asset object directly.
source_split :Array|String|null

Defined in: adventure/SubstanceMixer.js, line 95

Default value: null

source_split is used to store the provided source_input if it is a tri-part string.
source_substance_asset :Object|null

Defined in: adventure/SubstanceMixer.js, line 81

Default value: null

source_substance_asset is the asset of the substance that is contained.
source_substance_id :String

Defined in: adventure/SubstanceMixer.js, line 88

Default value: ""

source_substance_id is the id of the substance asset that is contained, ie 'sand' or 'water'.
source_vessel :Object|null

Defined in: adventure/SubstanceMixer.js, line 74

Default value: null

source_vessel is a reference to the Vessel object in the source asset.
source_volume :int

Defined in: adventure/SubstanceMixer.js, line 102

Default value: 0

source_volume is the volume of the substance in the source vessel.
source_volume_used :int

Defined in: adventure/SubstanceMixer.js, line 109

Default value: 0

source_volume_used stores the volume of the source substance that has been used.
target_already_full :Boolean

Defined in: adventure/SubstanceMixer.js, line 200

Default value: false

target_already_full is used to indicate that the target vessel is already full.
target_aspect :String

Defined in: adventure/SubstanceMixer.js, line 132

Default value: ""

target_aspect is the asset aspect which will receive the source substance.
target_asset :Object|null

Defined in: adventure/SubstanceMixer.js, line 125

Default value: null

target_asset is an asset with a vessel that receives the source substance.
target_freevolume :float

Defined in: adventure/SubstanceMixer.js, line 177

Default value: 0.0

target_freevolume is the free volume of the substance in the target vessel.
target_input :String

Defined in: adventure/SubstanceMixer.js, line 116

Default value: ""

target_input might be an asset id or a tri-part asset:aspect:substance id string. We're prepared to handle either to get an asset, or receive an asset object directly.
target_split :Array|String|null

Defined in: adventure/SubstanceMixer.js, line 163

Default value: null

target_split is used to store the provided target_input if it is a tri-part string.
target_substance_asset :Object|null

Defined in: adventure/SubstanceMixer.js, line 147

Default value: null

target_substance_asset is the asset of the substance that is contained by the target asset.
target_substance_id :String

Defined in: adventure/SubstanceMixer.js, line 155

Default value: ""

target_substance_id is the id of the substance asset that is contained in the target asset, ie 'sand' or 'water'.
target_vessel :Object|null

Defined in: adventure/SubstanceMixer.js, line 140

Default value: null

target_vessel is a reference to the Vessel object in the target asset.
target_volume :float

Defined in: adventure/SubstanceMixer.js, line 170

Default value: 0.0

target_volume is the volume of the substance in the target vessel.