Package de.extio.spacecraft.shared.bo
Interface MeshManager
-
public interface MeshManager
Manages all meshes (Energy, Shield, O2, Network, ...) of a composite entity You can access the corresponding bean implementation via EngineFacade::getBusinessObject / ServerFacade::getBusinessObject
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
excludeDynamicSerializationPropertiesPermanentStorage(Map<String,Object> dynamicSerializationProperties)
Needed for the mesh manager to work.void
getDynamicSerializationProperties(boolean incremental, UUID recipient, Map<UUID,Mesh> meshes, AbstractCompositeEntity parent, Map<String,Object> result)
Needed for the mesh manager to work.Mesh
getMeshData(AbstractCompositeEntity parent, UUID type)
Returns the mesh of a specific type.Mesh
getMeshData(UUID parentCompositeId, UUID type)
Returns the mesh of a specific type.MeshLane
getMeshLane(Mesh meshData, int laneIdx)
Returns a specific lane of a specific mesh type.MeshLane
getMeshLane(AbstractCompositeEntity parent, UUID type, int laneIdx)
Returns a specific lane of a specific mesh type.MeshLane
getMeshLane(UUID parentCompositeId, UUID type, int laneIdx)
Returns a specific lane of a specific mesh type.void
init(AbstractCompositeEntity compositeEntity, boolean fillBuffers)
Init mesh - one time actionvoid
reorganize(AbstractCompositeEntity compositeEntity)
Reorganizes mesh - usefull for space ship editor.void
setDynamicSerializationProperty(Map.Entry<String,Object> property, Map<UUID,Mesh> meshes)
Needed for the mesh manager to work.void
supply(UUID meshConsumerId, AbstractCompositeEntity compositeEntity, UUID type, Function<Double,Double> callback)
Supplies mesh containing consumer meshConsumerId with resources.void
supply(UUID meshConsumerId, UUID compositeEntityId, UUID type, Function<Double,Double> callback)
Supplies mesh containing consumer meshConsumerId with resources.double
take(UUID meshConsumerId, AbstractCompositeEntity compositeEntity, UUID type, boolean simulate, double amount, Consumer<Double> callback)
Take amount of type from mesh buffer, initiated by an entity.double
take(UUID meshConsumerId, UUID compositeEntityId, UUID type, boolean simulate, double amount, Consumer<Double> callback)
Take amount of type from mesh buffer, initiated by an entity.double
takeImmediately(MeshLane lane, double amount)
Take amount of type from a particular mesh lane buffer immediately.void
updateStage0(AbstractCompositeEntity compositeEntity)
Updates mesh.void
updateStage1(AbstractCompositeEntity compositeEntity)
Updates mesh.
-
-
-
Method Detail
-
getMeshData
Mesh getMeshData(UUID parentCompositeId, UUID type)
Returns the mesh of a specific type. See MeshBuiltinTypes
-
getMeshData
Mesh getMeshData(AbstractCompositeEntity parent, UUID type)
Returns the mesh of a specific type. See MeshBuiltinTypes
-
getMeshLane
MeshLane getMeshLane(UUID parentCompositeId, UUID type, int laneIdx)
Returns a specific lane of a specific mesh type. See MeshBuiltinTypes
-
getMeshLane
MeshLane getMeshLane(AbstractCompositeEntity parent, UUID type, int laneIdx)
Returns a specific lane of a specific mesh type. See MeshBuiltinTypes
-
getMeshLane
MeshLane getMeshLane(Mesh meshData, int laneIdx)
Returns a specific lane of a specific mesh type. See MeshBuiltinTypes
-
getDynamicSerializationProperties
void getDynamicSerializationProperties(boolean incremental, UUID recipient, Map<UUID,Mesh> meshes, AbstractCompositeEntity parent, Map<String,Object> result)
Needed for the mesh manager to work. Already called by AbstractCompositeEntity
-
setDynamicSerializationProperty
void setDynamicSerializationProperty(Map.Entry<String,Object> property, Map<UUID,Mesh> meshes)
Needed for the mesh manager to work. Already called by AbstractCompositeEntity
-
excludeDynamicSerializationPropertiesPermanentStorage
void excludeDynamicSerializationPropertiesPermanentStorage(Map<String,Object> dynamicSerializationProperties)
Needed for the mesh manager to work. Already called by AbstractCompositeEntity
-
init
void init(AbstractCompositeEntity compositeEntity, boolean fillBuffers)
Init mesh - one time action
-
updateStage0
void updateStage0(AbstractCompositeEntity compositeEntity)
Updates mesh. Invoked at the beginning of the overall process. Managed by game core.
-
updateStage1
void updateStage1(AbstractCompositeEntity compositeEntity)
Updates mesh. Invoked at the end of the overall process. Managed by game core.
-
take
double take(UUID meshConsumerId, AbstractCompositeEntity compositeEntity, UUID type, boolean simulate, double amount, Consumer<Double> callback)
Take amount of type from mesh buffer, initiated by an entity. See also MeshBuiltinTypes- Parameters:
simulate
- If simulate is true, only calculate what would be taken but don't actually take it.- Returns:
- Callback Consumer
is invoked if not simulating. Callback argument is the granted amount. If simulate is true, the amount is returned as return value. If simulate is false, the return value is always 0 and callback is mandatory.
-
take
double take(UUID meshConsumerId, UUID compositeEntityId, UUID type, boolean simulate, double amount, Consumer<Double> callback)
Take amount of type from mesh buffer, initiated by an entity. See also MeshBuiltinTypes- Parameters:
simulate
- If simulate is true, only calculate what would be taken but don't actually take it.- Returns:
- Callback Consumer
is invoked if not simulating. Callback argument is the granted amount. If simulate is true, the amount is returned as return value. If simulate is false, the return value is always 0 and callback is mandatory.
-
takeImmediately
double takeImmediately(MeshLane lane, double amount)
Take amount of type from a particular mesh lane buffer immediately.- Returns:
- The amount that have been taken.
-
supply
void supply(UUID meshConsumerId, AbstractCompositeEntity compositeEntity, UUID type, Function<Double,Double> callback)
Supplies mesh containing consumer meshConsumerId with resources. If mesh is not able to provide sufficient resources for base or action amounts, callback will be invoked, passing the amount of resource needed. It has to return the amount granted. Callback may be invoked multiple times. See also MeshBuiltinTypes
-
supply
void supply(UUID meshConsumerId, UUID compositeEntityId, UUID type, Function<Double,Double> callback)
Supplies mesh containing consumer meshConsumerId with resources. If mesh is not able to provide sufficient resources for base or action amounts, callback will be invoked, passing the amount of resource needed. It has to return the amount granted. Callback may be invoked multiple times. See also MeshBuiltinTypes
-
reorganize
void reorganize(AbstractCompositeEntity compositeEntity)
Reorganizes mesh - usefull for space ship editor. Reorganize reconnects all nearby mesh entities
-
-