Package name.moore.kevin.ze.game.verbs
Class distribute
java.lang.Object
name.moore.kevin.ze.game.verbs.distribute
Move power from the output of an engine to the associated parts according to
the distribution component.
A common usage is new distribute(id).set( Map... ).getEnergy().allocate();
or if the distribution isn't being changed new distribute(id).getEnergy().allocate();
components used
- distribution = rw
- health = r
- spec = r
- physical = r
- accumulator = w
- Author:
- Kevin Moore
<dev@kevin.moore.name>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptiondistribute(com.simsilica.es.EntityId vehicle)The constructor anticipates the parameter as the EntityId of something like a ship, but passing the id of a single engine is also possible. -
Method Summary
Modifier and TypeMethodDescriptionorg.jscience.physics.amount.Amount<javax.measure.quantity.Energy>allocate()The end of the chain, returns any unused energy.get()End of chain, returns the current vehicles distribution scheme.Sum the available energy from the engines (though we only expect one) ready for distribution.Set a distribution scheme, optional.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
m
private com.simsilica.es.EntityId m -
output
private org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> output
-
-
Constructor Details
-
distribute
public distribute(com.simsilica.es.EntityId vehicle)The constructor anticipates the parameter as the EntityId of something like a ship, but passing the id of a single engine is also possible.- Parameters:
vehicle-
-
-
Method Details
-
set
Set a distribution scheme, optional.- Parameters:
distvalues-- Returns:
-
get
End of chain, returns the current vehicles distribution scheme.- Returns:
-
getEnergy
Sum the available energy from the engines (though we only expect one) ready for distribution. SetsoutputWithout the inefficiency calculation this is a lovely simple stream calc. But since we can't split a stream calculation its 3 blocks.
- Returns:
-
allocate
public org.jscience.physics.amount.Amount<javax.measure.quantity.Energy> allocate()The end of the chain, returns any unused energy.- Returns:
-