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 intcrewIndexprotected static PathFindingOptionsPATH_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 booleancanDoCustomEntityAction(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other)protected booleancheckActionPathFree(CoordI2 otherPosition)voidcreate(UUID uuid, AbstractEntityDef entityDef, int entityDefIdx, UUID parentCompositeEntity)Central initialization of non-transient fields (usually on server side).voidenableDefaultAutomationHandlers()StringgetAutomationActionLabel()List<String>getAutomationHandlers()intgetCrewIndex()List<String>getEnabledAutomationHandlers()Deque<AutomationAction>getServerAutomationActions()intgetServerLastAutomationExecuted()Map<String,Object>getSharedAutomationState()List<StorageItem>getStorage()intgetStorageAmount()intgetStorageCapacity()doublegetStoredMass()booleanisAutomationBusy()booleanisAutomationEnabled()booleanisAutomationPaused()booleanisInitialInventoryGranted()booleanisMoveFirst(HasPosition2 other, boolean objectExtraRequiresMoveToPosition)booleanisStorageAdding()booleanisStorageEjecting()booleanisStorageTaking()booleanisStorageTransferring()voidlocalInit(AbstractEntityDef entityDef)Local initialization of transient fieldsbooleanonClientAction(ClientEntityAction clientAction, AbstractCompositeEntity targetCompositeEntity, AbstractEntity targetEntity)Client side: Callback if the player selected an actionvoidonClientDamage(double oldHealth)Client side: Called when the entity took damagevoidonClientDrawEntityAction(List<RenderingBo> renderingBo, String action, boolean pending, CoordI2 subTileOffset)Client side: Draws a certain action the entity is executingvoidonClientSelectedPointToEntity(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other, int modifiers, List<ClientEntityAction> outClientActions)Client side: Callback when this entity is selected and cursor is pointing to another entityvoidonServerActionMessage(GameActionMessage message, UUID sender, GameSession gameSession)Server side: Callback after a message has been received for this entity.voidonServerDamage(GameSession gameSession, double oldHealth)Server side: Called when the entity took damagevoidonServerTurnPass0(GameSession gameSession)Server side: Executes code on every server turn, main pass 1 of 2.voidserverTranslateEntityPass1(Edge2 rotation, CoordI2 posSrc, CoordI2 origDim, AbstractCompositeEntity parent, GameSession gameSession)Server side: Postprocesses rotation of the parent composite entity.voidsetAutomationActionLabel(String automationActionLabel)voidsetAutomationEnabled(boolean automationEnabled)voidsetCrewIndex(int crewIndex)voidsetInitialInventoryGranted(boolean initialInventoryGranted)voidsetServerLastAutomationExecuted(int serverLastAutomationExecuted)voidsetStorage(List<StorageItem> storage)voidsetStorageAmount(int storageAmount)voidsetStorageCapacity(int storageCapacity)voidsetStoredMass(double storedMass)intstorageAdd(int entityDefIdx, int amount)voidstorageEject()voidstorageEjectSingle(int entityDefIdx, int amount)voidstorageExplode()intstorageTake(int entityDefIdx, int amount)intstorageTransfer(StorageProviderEntity destination, int entityDefIdx, int amount)voidupdate(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:AbstractEntityCentral initialization of non-transient fields (usually on server side). Is only called once in the whole life cycle of an entity.- Overrides:
createin classPhysicalEntity
-
localInit
public void localInit(AbstractEntityDef entityDef)
Description copied from class:AbstractEntityLocal initialization of transient fields- Overrides:
localInitin classPhysicalEntity
-
update
public void update(AbstractEntity other)
Description copied from class:AbstractEntityIncremental update of non-transient fields (usually transferred from server)- Overrides:
updatein classPhysicalEntity
-
onClientSelectedPointToEntity
public void onClientSelectedPointToEntity(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other, int modifiers, List<ClientEntityAction> outClientActions)
Description copied from class:AbstractEntityClient side: Callback when this entity is selected and cursor is pointing to another entity- Overrides:
onClientSelectedPointToEntityin classPhysicalEntity
-
onClientAction
public boolean onClientAction(ClientEntityAction clientAction, AbstractCompositeEntity targetCompositeEntity, AbstractEntity targetEntity)
Description copied from class:AbstractEntityClient side: Callback if the player selected an action- Overrides:
onClientActionin classPhysicalEntity
-
onClientDrawEntityAction
public void onClientDrawEntityAction(List<RenderingBo> renderingBo, String action, boolean pending, CoordI2 subTileOffset)
Description copied from class:PhysicalEntityClient side: Draws a certain action the entity is executing- Overrides:
onClientDrawEntityActionin classPhysicalEntity
-
onClientDamage
public void onClientDamage(double oldHealth)
Description copied from class:PhysicalEntityClient side: Called when the entity took damage- Overrides:
onClientDamagein classPhysicalEntity
-
onServerActionMessage
public void onServerActionMessage(GameActionMessage message, UUID sender, GameSession gameSession)
Description copied from class:AbstractEntityServer 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:
onServerActionMessagein classPhysicalEntity
-
onServerTurnPass0
public void onServerTurnPass0(GameSession gameSession)
Description copied from class:AbstractEntityServer side: Executes code on every server turn, main pass 1 of 2. Executed after composite entities pass 0- Overrides:
onServerTurnPass0in classPhysicalEntity
-
onServerDamage
public void onServerDamage(GameSession gameSession, double oldHealth)
Description copied from class:PhysicalEntityServer side: Called when the entity took damage- Overrides:
onServerDamagein classPhysicalEntity
-
serverTranslateEntityPass1
public void serverTranslateEntityPass1(Edge2 rotation, CoordI2 posSrc, CoordI2 origDim, AbstractCompositeEntity parent, GameSession gameSession)
Description copied from class:AbstractEntityServer 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:
serverTranslateEntityPass1in classPhysicalEntity
-
canDoCustomEntityAction
public boolean canDoCustomEntityAction(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other)
-
isMoveFirst
public boolean isMoveFirst(HasPosition2 other, boolean objectExtraRequiresMoveToPosition)
-
enableDefaultAutomationHandlers
public void enableDefaultAutomationHandlers()
- Specified by:
enableDefaultAutomationHandlersin interfaceAutomationEntity
-
checkActionPathFree
protected boolean checkActionPathFree(CoordI2 otherPosition)
-
storageAdd
public int storageAdd(int entityDefIdx, int amount)- Specified by:
storageAddin interfaceStorageProviderEntity
-
storageTake
public int storageTake(int entityDefIdx, int amount)- Specified by:
storageTakein interfaceStorageProviderEntity
-
storageTransfer
public int storageTransfer(StorageProviderEntity destination, int entityDefIdx, int amount)
- Specified by:
storageTransferin interfaceStorageProviderEntity
-
storageEject
public void storageEject()
- Specified by:
storageEjectin interfaceStorageProviderEntity
-
storageEjectSingle
public void storageEjectSingle(int entityDefIdx, int amount)- Specified by:
storageEjectSinglein interfaceStorageProviderEntity
-
storageExplode
public void storageExplode()
- Specified by:
storageExplodein interfaceStorageProviderEntity
-
getCrewIndex
public int getCrewIndex()
-
setCrewIndex
public void setCrewIndex(int crewIndex)
-
isAutomationPaused
public boolean isAutomationPaused()
- Specified by:
isAutomationPausedin interfaceAutomationEntity
-
isAutomationBusy
public boolean isAutomationBusy()
- Specified by:
isAutomationBusyin interfaceAutomationEntity
-
getServerAutomationActions
public Deque<AutomationAction> getServerAutomationActions()
- Specified by:
getServerAutomationActionsin interfaceAutomationEntity
-
getAutomationHandlers
public List<String> getAutomationHandlers()
- Specified by:
getAutomationHandlersin interfaceAutomationEntity
-
getEnabledAutomationHandlers
public List<String> getEnabledAutomationHandlers()
- Specified by:
getEnabledAutomationHandlersin interfaceAutomationEntity
-
getServerLastAutomationExecuted
public int getServerLastAutomationExecuted()
- Specified by:
getServerLastAutomationExecutedin interfaceAutomationEntity
-
getAutomationActionLabel
public String getAutomationActionLabel()
- Specified by:
getAutomationActionLabelin interfaceAutomationEntity
-
setAutomationActionLabel
public void setAutomationActionLabel(String automationActionLabel)
- Specified by:
setAutomationActionLabelin interfaceAutomationEntity
-
setServerLastAutomationExecuted
public void setServerLastAutomationExecuted(int serverLastAutomationExecuted)
- Specified by:
setServerLastAutomationExecutedin interfaceAutomationEntity
-
isAutomationEnabled
public boolean isAutomationEnabled()
- Specified by:
isAutomationEnabledin interfaceAutomationEntity
-
setAutomationEnabled
public void setAutomationEnabled(boolean automationEnabled)
- Specified by:
setAutomationEnabledin interfaceAutomationEntity
-
isStorageAdding
public boolean isStorageAdding()
- Specified by:
isStorageAddingin interfaceStorageProviderEntity
-
isStorageTaking
public boolean isStorageTaking()
- Specified by:
isStorageTakingin interfaceStorageProviderEntity
-
isStorageTransferring
public boolean isStorageTransferring()
- Specified by:
isStorageTransferringin interfaceStorageProviderEntity
-
isStorageEjecting
public boolean isStorageEjecting()
- Specified by:
isStorageEjectingin interfaceStorageProviderEntity
-
getStorage
public List<StorageItem> getStorage()
- Specified by:
getStoragein interfaceStorageProviderEntity
-
setStorage
public void setStorage(List<StorageItem> storage)
- Specified by:
setStoragein interfaceStorageProviderEntity
-
getStorageAmount
public int getStorageAmount()
- Specified by:
getStorageAmountin interfaceStorageProviderEntity
-
setStorageAmount
public void setStorageAmount(int storageAmount)
- Specified by:
setStorageAmountin interfaceStorageProviderEntity
-
getStorageCapacity
public int getStorageCapacity()
- Specified by:
getStorageCapacityin interfaceStorageProviderEntity
-
setStorageCapacity
public void setStorageCapacity(int storageCapacity)
- Specified by:
setStorageCapacityin interfaceStorageProviderEntity
-
getSharedAutomationState
public Map<String,Object> getSharedAutomationState()
- Specified by:
getSharedAutomationStatein interfaceAutomationEntity
-
getStoredMass
public double getStoredMass()
- Specified by:
getStoredMassin interfaceStorageProviderEntity
-
setStoredMass
public void setStoredMass(double storedMass)
- Specified by:
setStoredMassin interfaceStorageProviderEntity
-
isInitialInventoryGranted
public boolean isInitialInventoryGranted()
-
setInitialInventoryGranted
public void setInitialInventoryGranted(boolean initialInventoryGranted)
-
-