Class CrewEntity
- java.lang.Object
-
- de.extio.spacecraft.shared.model.entity.AbstractEntity
-
- de.extio.spacecraft.shared.model.entity.builtin.live.PhysicalEntity
-
- de.extio.spacecraft.shared.model.entity.builtin.live.CrewEntity
-
- All Implemented Interfaces:
AutomationEntity
,StorageProviderEntity
,HasPosition2
,HasPositionAndDimension2
public class CrewEntity extends PhysicalEntity implements AutomationEntity, StorageProviderEntity
Base class for crew members
-
-
Field Summary
Fields Modifier and Type Field Description protected int
crewIndex
protected static PathFindingOptions
PATH_FINDING_OPTIONS_IGNORE_MOVEABLES
-
Fields inherited from class de.extio.spacecraft.shared.model.entity.builtin.live.PhysicalEntity
clientEntityActionQueue, clientPoseAnimation, clientPoseTilesetPosition, enabled, entityAction, entityActionPending, entityActionPendingTurn, entityActionPlayer, entityActionTarget, entityActionTargetCoord, health, loggedInEntity, onDamageDestroyImmediately, onDamageSplit, onDamageSplitThreshold, pathFindingEntitySupport
-
Fields inherited from class de.extio.spacecraft.shared.model.entity.AbstractEntity
LOGGER, serverRestrictedEntities, serverRestrictedEntitySurfaceBo
-
-
Constructor Summary
Constructors Constructor Description CrewEntity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canDoCustomEntityAction(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other)
protected boolean
checkActionPathFree(CoordI2 otherPosition)
void
create(UUID uuid, AbstractEntityDef entityDef, int entityDefIdx, UUID parentCompositeEntity)
Central initialization of non-transient fields (usually on server side).void
enableDefaultAutomationHandlers()
String
getAutomationActionLabel()
List<String>
getAutomationHandlers()
int
getCrewIndex()
List<String>
getEnabledAutomationHandlers()
Deque<AutomationAction>
getServerAutomationActions()
int
getServerLastAutomationExecuted()
Map<String,Object>
getSharedAutomationState()
List<StorageItem>
getStorage()
int
getStorageAmount()
int
getStorageCapacity()
double
getStoredMass()
boolean
isAutomationBusy()
boolean
isAutomationEnabled()
boolean
isAutomationPaused()
boolean
isInitialInventoryGranted()
boolean
isMoveFirst(HasPosition2 other, boolean objectExtraRequiresMoveToPosition)
boolean
isStorageAdding()
boolean
isStorageEjecting()
boolean
isStorageTaking()
boolean
isStorageTransferring()
void
localInit(AbstractEntityDef entityDef)
Local initialization of transient fieldsboolean
onClientAction(ClientEntityAction clientAction, AbstractCompositeEntity targetCompositeEntity, AbstractEntity targetEntity)
Client side: Callback if the player selected an actionvoid
onClientDamage(double oldHealth)
Client side: Called when the entity took damagevoid
onClientDrawEntityAction(List<RenderingBo> renderingBo, String action, boolean pending, CoordI2 subTileOffset)
Client side: Draws a certain action the entity is executingvoid
onClientSelectedPointToEntity(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other, int modifiers, List<ClientEntityAction> outClientActions)
Client side: Callback when this entity is selected and cursor is pointing to another entityvoid
onServerActionMessage(GameActionMessage message, UUID sender, GameSession gameSession)
Server side: Callback after a message has been received for this entity.void
onServerDamage(GameSession gameSession, double oldHealth)
Server side: Called when the entity took damagevoid
onServerTurnPass0(GameSession gameSession)
Server side: Executes code on every server turn, main pass 1 of 2.void
serverTranslateEntityPass1(Edge2 rotation, CoordI2 posSrc, CoordI2 origDim, AbstractCompositeEntity parent, GameSession gameSession)
Server side: Postprocesses rotation of the parent composite entity.void
setAutomationActionLabel(String automationActionLabel)
void
setAutomationEnabled(boolean automationEnabled)
void
setCrewIndex(int crewIndex)
void
setInitialInventoryGranted(boolean initialInventoryGranted)
void
setServerLastAutomationExecuted(int serverLastAutomationExecuted)
void
setStorage(List<StorageItem> storage)
void
setStorageAmount(int storageAmount)
void
setStorageCapacity(int storageCapacity)
void
setStoredMass(double storedMass)
int
storageAdd(int entityDefIdx, int amount)
void
storageEject()
void
storageEjectSingle(int entityDefIdx, int amount)
void
storageExplode()
int
storageTake(int entityDefIdx, int amount)
int
storageTransfer(StorageProviderEntity destination, int entityDefIdx, int amount)
void
update(AbstractEntity other)
Incremental update of non-transient fields (usually transferred from server)-
Methods inherited from class de.extio.spacecraft.shared.model.entity.builtin.live.PhysicalEntity
enableEntity, getEntityAction, getEntityActionPending, getEntityActionTarget, getEntityActionTargetCoord, getHealth, getLoggedInEntity, getOnDamageSplitThreshold, getPathFindingEntitySupport, getSubTileOffset, getTilesetPosition, handleEnabledState, isEnabled, isOnDamageDestroyImmediately, isOnDamageSplit, isOperational, localCopy, nextClientEntityAction, onClientActionMessage, onClientComplexConsoleControlEvent, onClientComplexConsoleControlEvent, onClientDrawConsoleControls, onClientDrawEntity, onClientDrawEntityActions, onClientFrame, onClientGenerateEntityDetails, onClientSelectedPointToNoClientEntityAction, onServerConsoleControlEvent, onServerTurnPass1, serverAbortEntityAction, serverCalculateEmEmission, serverSetEntityAction, serverSplitOnDamage, setClientActions, setEnabled, setHealth, setLoggedInEntity, setOnDamageDestroyImmediately, setOnDamageSplit, setOnDamageSplitThreshold
-
Methods inherited from class de.extio.spacecraft.shared.model.entity.AbstractEntity
createClientDrawTileImageBo, getDimension, getEntityDef, getEntityDefUUID, getEntityLayer, getEntityManager, getOrientation, getParentCompositeEntity, getPosition, getServerRestrictedEntities, getServerRestrictEntitiesLastUpdate, getServerRestrictEntitiesWalls, getTileset, getUuid, isDirty, isLocalInit, onClientSelectedPointToWorldPos, onServerTurnPass2PostComposites, serverCleanupRestrictedEntities, serverPrepareRestrictedEntities, serverRestrictEntity, serverTranslateEntityPass0, setDirty, setEntityDef, setEntityManager, setLocalInit, setOrientation, setParentCompositeEntity, setPosition, setServerRestrictedEntities, setServerRestrictEntitiesLastUpdate, setServerRestrictEntitiesWalls, setUuid
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.extio.spacecraft.shared.model.entity.builtin.live.StorageProviderEntity
getEntityDef, getParentCompositeEntity, getStorageAmount, getStorageAmount, getUuid, hasInStock, hasInStock, storageTake
-
-
-
-
Field Detail
-
PATH_FINDING_OPTIONS_IGNORE_MOVEABLES
protected static PathFindingOptions PATH_FINDING_OPTIONS_IGNORE_MOVEABLES
-
crewIndex
protected int crewIndex
-
-
Method Detail
-
create
public void create(UUID uuid, AbstractEntityDef entityDef, int entityDefIdx, UUID parentCompositeEntity)
Description copied from class:AbstractEntity
Central initialization of non-transient fields (usually on server side). Is only called once in the whole life cycle of an entity.- Overrides:
create
in classPhysicalEntity
-
localInit
public void localInit(AbstractEntityDef entityDef)
Description copied from class:AbstractEntity
Local initialization of transient fields- Overrides:
localInit
in classPhysicalEntity
-
update
public void update(AbstractEntity other)
Description copied from class:AbstractEntity
Incremental update of non-transient fields (usually transferred from server)- Overrides:
update
in classPhysicalEntity
-
onClientSelectedPointToEntity
public void onClientSelectedPointToEntity(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other, int modifiers, List<ClientEntityAction> outClientActions)
Description copied from class:AbstractEntity
Client side: Callback when this entity is selected and cursor is pointing to another entity- Overrides:
onClientSelectedPointToEntity
in classPhysicalEntity
-
onClientAction
public boolean onClientAction(ClientEntityAction clientAction, AbstractCompositeEntity targetCompositeEntity, AbstractEntity targetEntity)
Description copied from class:AbstractEntity
Client side: Callback if the player selected an action- Overrides:
onClientAction
in classPhysicalEntity
-
onClientDrawEntityAction
public void onClientDrawEntityAction(List<RenderingBo> renderingBo, String action, boolean pending, CoordI2 subTileOffset)
Description copied from class:PhysicalEntity
Client side: Draws a certain action the entity is executing- Overrides:
onClientDrawEntityAction
in classPhysicalEntity
-
onClientDamage
public void onClientDamage(double oldHealth)
Description copied from class:PhysicalEntity
Client side: Called when the entity took damage- Overrides:
onClientDamage
in classPhysicalEntity
-
onServerActionMessage
public void onServerActionMessage(GameActionMessage message, UUID sender, GameSession gameSession)
Description copied from class:AbstractEntity
Server side: Callback after a message has been received for this entity. Sender is either the player id of the sender on client side or null if the message was sent internally on server side- Overrides:
onServerActionMessage
in classPhysicalEntity
-
onServerTurnPass0
public void onServerTurnPass0(GameSession gameSession)
Description copied from class:AbstractEntity
Server side: Executes code on every server turn, main pass 1 of 2. Executed after composite entities pass 0- Overrides:
onServerTurnPass0
in classPhysicalEntity
-
onServerDamage
public void onServerDamage(GameSession gameSession, double oldHealth)
Description copied from class:PhysicalEntity
Server side: Called when the entity took damage- Overrides:
onServerDamage
in classPhysicalEntity
-
serverTranslateEntityPass1
public void serverTranslateEntityPass1(Edge2 rotation, CoordI2 posSrc, CoordI2 origDim, AbstractCompositeEntity parent, GameSession gameSession)
Description copied from class:AbstractEntity
Server side: Postprocesses rotation of the parent composite entity. This also means that this entity is now at a different position in the tile grid- Overrides:
serverTranslateEntityPass1
in classPhysicalEntity
-
canDoCustomEntityAction
public boolean canDoCustomEntityAction(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other)
-
isMoveFirst
public boolean isMoveFirst(HasPosition2 other, boolean objectExtraRequiresMoveToPosition)
-
enableDefaultAutomationHandlers
public void enableDefaultAutomationHandlers()
- Specified by:
enableDefaultAutomationHandlers
in interfaceAutomationEntity
-
checkActionPathFree
protected boolean checkActionPathFree(CoordI2 otherPosition)
-
storageAdd
public int storageAdd(int entityDefIdx, int amount)
- Specified by:
storageAdd
in interfaceStorageProviderEntity
-
storageTake
public int storageTake(int entityDefIdx, int amount)
- Specified by:
storageTake
in interfaceStorageProviderEntity
-
storageTransfer
public int storageTransfer(StorageProviderEntity destination, int entityDefIdx, int amount)
- Specified by:
storageTransfer
in interfaceStorageProviderEntity
-
storageEject
public void storageEject()
- Specified by:
storageEject
in interfaceStorageProviderEntity
-
storageEjectSingle
public void storageEjectSingle(int entityDefIdx, int amount)
- Specified by:
storageEjectSingle
in interfaceStorageProviderEntity
-
storageExplode
public void storageExplode()
- Specified by:
storageExplode
in interfaceStorageProviderEntity
-
getCrewIndex
public int getCrewIndex()
-
setCrewIndex
public void setCrewIndex(int crewIndex)
-
isAutomationPaused
public boolean isAutomationPaused()
- Specified by:
isAutomationPaused
in interfaceAutomationEntity
-
isAutomationBusy
public boolean isAutomationBusy()
- Specified by:
isAutomationBusy
in interfaceAutomationEntity
-
getServerAutomationActions
public Deque<AutomationAction> getServerAutomationActions()
- Specified by:
getServerAutomationActions
in interfaceAutomationEntity
-
getAutomationHandlers
public List<String> getAutomationHandlers()
- Specified by:
getAutomationHandlers
in interfaceAutomationEntity
-
getEnabledAutomationHandlers
public List<String> getEnabledAutomationHandlers()
- Specified by:
getEnabledAutomationHandlers
in interfaceAutomationEntity
-
getServerLastAutomationExecuted
public int getServerLastAutomationExecuted()
- Specified by:
getServerLastAutomationExecuted
in interfaceAutomationEntity
-
getAutomationActionLabel
public String getAutomationActionLabel()
- Specified by:
getAutomationActionLabel
in interfaceAutomationEntity
-
setAutomationActionLabel
public void setAutomationActionLabel(String automationActionLabel)
- Specified by:
setAutomationActionLabel
in interfaceAutomationEntity
-
setServerLastAutomationExecuted
public void setServerLastAutomationExecuted(int serverLastAutomationExecuted)
- Specified by:
setServerLastAutomationExecuted
in interfaceAutomationEntity
-
isAutomationEnabled
public boolean isAutomationEnabled()
- Specified by:
isAutomationEnabled
in interfaceAutomationEntity
-
setAutomationEnabled
public void setAutomationEnabled(boolean automationEnabled)
- Specified by:
setAutomationEnabled
in interfaceAutomationEntity
-
isStorageAdding
public boolean isStorageAdding()
- Specified by:
isStorageAdding
in interfaceStorageProviderEntity
-
isStorageTaking
public boolean isStorageTaking()
- Specified by:
isStorageTaking
in interfaceStorageProviderEntity
-
isStorageTransferring
public boolean isStorageTransferring()
- Specified by:
isStorageTransferring
in interfaceStorageProviderEntity
-
isStorageEjecting
public boolean isStorageEjecting()
- Specified by:
isStorageEjecting
in interfaceStorageProviderEntity
-
getStorage
public List<StorageItem> getStorage()
- Specified by:
getStorage
in interfaceStorageProviderEntity
-
setStorage
public void setStorage(List<StorageItem> storage)
- Specified by:
setStorage
in interfaceStorageProviderEntity
-
getStorageAmount
public int getStorageAmount()
- Specified by:
getStorageAmount
in interfaceStorageProviderEntity
-
setStorageAmount
public void setStorageAmount(int storageAmount)
- Specified by:
setStorageAmount
in interfaceStorageProviderEntity
-
getStorageCapacity
public int getStorageCapacity()
- Specified by:
getStorageCapacity
in interfaceStorageProviderEntity
-
setStorageCapacity
public void setStorageCapacity(int storageCapacity)
- Specified by:
setStorageCapacity
in interfaceStorageProviderEntity
-
getSharedAutomationState
public Map<String,Object> getSharedAutomationState()
- Specified by:
getSharedAutomationState
in interfaceAutomationEntity
-
getStoredMass
public double getStoredMass()
- Specified by:
getStoredMass
in interfaceStorageProviderEntity
-
setStoredMass
public void setStoredMass(double storedMass)
- Specified by:
setStoredMass
in interfaceStorageProviderEntity
-
isInitialInventoryGranted
public boolean isInitialInventoryGranted()
-
setInitialInventoryGranted
public void setInitialInventoryGranted(boolean initialInventoryGranted)
-
-