Class PhysicalEntity
- java.lang.Object
-
- de.extio.spacecraft.shared.model.entity.AbstractEntity
-
- de.extio.spacecraft.shared.model.entity.builtin.live.PhysicalEntity
-
- All Implemented Interfaces:
HasPosition2,HasPositionAndDimension2
- Direct Known Subclasses:
AbstractMeshEntity,CrewEntity,FloorEntity,ImageSurfaceEntity,LootContainer,StructureEntity
public abstract class PhysicalEntity extends AbstractEntity
Physical entities represent everything that has a form, e.g. doors, weapons, crew, ...
-
-
Field Summary
Fields Modifier and Type Field Description protected Queue<ClientEntityAction>clientEntityActionQueueprotected intclientPoseAnimationprotected CoordI2clientPoseTilesetPositionprotected booleanenabledprotected StringentityActionprotected StringentityActionPendingprotected intentityActionPendingTurnprotected UUIDentityActionPlayerprotected CompositeAndEntityIdentityActionTargetprotected CoordI2entityActionTargetCoordprotected doublehealthprotected UUIDloggedInEntityprotected booleanonDamageDestroyImmediatelyprotected booleanonDamageSplitprotected intonDamageSplitThresholdprotected PathFindingEntitySupportpathFindingEntitySupport-
Fields inherited from class de.extio.spacecraft.shared.model.entity.AbstractEntity
LOGGER, serverRestrictedEntities, serverRestrictedEntitySurfaceBo
-
-
Constructor Summary
Constructors Constructor Description PhysicalEntity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate(UUID uuid, AbstractEntityDef entityDef, int entityDefIdx, UUID parentCompositeEntity)Central initialization of non-transient fields (usually on server side).protected voidenableEntity(boolean enable)Server side: Called when the enabled state changedStringgetEntityAction()StringgetEntityActionPending()CompositeAndEntityIdgetEntityActionTarget()CoordI2getEntityActionTargetCoord()doublegetHealth()UUIDgetLoggedInEntity()intgetOnDamageSplitThreshold()PathFindingEntitySupportgetPathFindingEntitySupport()CoordI2getSubTileOffset()CoordI2getTilesetPosition()voidhandleEnabledState(GameSession gameSession)Server side: Handles changing the enabled state of this entitybooleanisEnabled()booleanisOnDamageDestroyImmediately()booleanisOnDamageSplit()booleanisOperational()Returns whether the entity is ready to execute actionsvoidlocalCopy(AbstractEntity other)Local copy of transient fieldsvoidlocalInit(AbstractEntityDef entityDef)Local initialization of transient fieldsvoidnextClientEntityAction(boolean newActions)booleanonClientAction(ClientEntityAction clientAction, AbstractCompositeEntity targetCompositeEntity, AbstractEntity targetEntity)Client side: Callback if the player selected an actionvoidonClientActionMessage(GameActionMessage message)Client side: Callback after a message has been received for this entityClientConsoleComplexControlActiononClientComplexConsoleControlEvent(boolean controlsActive, int button, CoordI2 normalizedCoordinate)Client side: Called when the user interacted with the entity consolevoidonClientComplexConsoleControlEvent(Event event)Client side: Called when the user interacted with the entity consolevoidonClientDamage(double oldHealth)Client side: Called when the entity took damagevoidonClientDrawConsoleControls(boolean controlsActive, List<ClientConsoleControlSet> consoleControls)Client side: Draws controls on the entity consolevoidonClientDrawEntity(List<RenderingBo> renderingBo)Client side: Draws this entityvoidonClientDrawEntityAction(List<RenderingBo> renderingBo, String action, boolean pending, CoordI2 subTileOffset)Client side: Draws a certain action the entity is executingvoidonClientDrawEntityActions(List<RenderingBo> renderingBo)Client side: Draws general effects that are related to actions the entity is executingvoidonClientFrame(boolean selected)Client side: Callback on each frame for general logicStringonClientGenerateEntityDetails()Client side: Returns details about this entity.voidonClientSelectedPointToEntity(AbstractCompositeEntity otherCompositeEntity, AbstractEntity other, int modifiers, List<ClientEntityAction> outClientActions)Client side: Callback when this entity is selected and cursor is pointing to another entityvoidonClientSelectedPointToNoClientEntityAction(int modifiers)Client side: Callback when this entity is selected and onClientSelectedPointToEntity + onClientSelectedPointToWorldPos did not set any possible actionvoidonServerActionMessage(GameActionMessage message, UUID sender, GameSession gameSession)Server side: Callback after a message has been received for this entity.voidonServerConsoleControlEvent(GameSession gameSession, UUID sender, String controlId, Object payload)Server side: Called when the user interacted with a control in the entity consolevoidonServerDamage(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.voidonServerTurnPass1(GameSession gameSession)Server side: Executes code on every server turn, main pass 2 of 2.voidserverAbortEntityAction(GameSession gameSession, boolean publishAsPendingAction)Server side: Aborts the current action the entity is executingdoubleserverCalculateEmEmission(GameSession gameSession)Server side: Calculates the EM emission of this entityvoidserverSetEntityAction(String qualifier, CompositeAndEntityId target, CoordI2 targetCoord, boolean abortFirst, boolean forceNeedsOperator, boolean ignoreNeedsOperator, boolean deferActionMessage, UUID playerId, GameSession gameSession)Server side: Sets an action the entity is executingprotected voidserverSplitOnDamage(GameSession gameSession)Server side: Executes splitting an entity away from the current parent to a separate composite entity after taking heavy damage.voidserverTranslateEntityPass1(Edge2 rotation, CoordI2 posSrc, CoordI2 origDim, AbstractCompositeEntity parent, GameSession gameSession)Server side: Postprocesses rotation of the parent composite entity.voidsetClientActions(List<ClientEntityAction> clientActions)voidsetEnabled(boolean enabled)voidsetHealth(double health)Sets the health of this entity.voidsetLoggedInEntity(UUID loggedInEntity)voidsetOnDamageDestroyImmediately(boolean onDamageDestroyImmediately)voidsetOnDamageSplit(boolean onDamageSplit)voidsetOnDamageSplitThreshold(int onDamageSplitThreshold)voidupdate(AbstractEntity other)Incremental update of non-transient fields (usually transferred from server)-
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
-
-
-
-
Field Detail
-
health
protected double health
-
entityAction
protected String entityAction
-
entityActionTarget
protected CompositeAndEntityId entityActionTarget
-
entityActionTargetCoord
protected CoordI2 entityActionTargetCoord
-
entityActionPending
protected String entityActionPending
-
entityActionPendingTurn
protected int entityActionPendingTurn
-
entityActionPlayer
protected UUID entityActionPlayer
-
loggedInEntity
protected UUID loggedInEntity
-
enabled
protected boolean enabled
-
pathFindingEntitySupport
protected PathFindingEntitySupport pathFindingEntitySupport
-
onDamageDestroyImmediately
protected transient boolean onDamageDestroyImmediately
-
onDamageSplit
protected transient boolean onDamageSplit
-
onDamageSplitThreshold
protected transient int onDamageSplitThreshold
-
clientEntityActionQueue
protected transient Queue<ClientEntityAction> clientEntityActionQueue
-
clientPoseAnimation
protected transient int clientPoseAnimation
-
clientPoseTilesetPosition
protected transient CoordI2 clientPoseTilesetPosition
-
-
Method Detail
-
setHealth
public void setHealth(double health)
Sets the health of this entity. Setting health 0.0 means the entity has been destroyed
-
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 classAbstractEntity
-
localInit
public void localInit(AbstractEntityDef entityDef)
Description copied from class:AbstractEntityLocal initialization of transient fields- Overrides:
localInitin classAbstractEntity
-
localCopy
public void localCopy(AbstractEntity other)
Description copied from class:AbstractEntityLocal copy of transient fields- Overrides:
localCopyin classAbstractEntity
-
update
public void update(AbstractEntity other)
Description copied from class:AbstractEntityIncremental update of non-transient fields (usually transferred from server)- Overrides:
updatein classAbstractEntity
-
onClientFrame
public void onClientFrame(boolean selected)
Description copied from class:AbstractEntityClient side: Callback on each frame for general logic- Overrides:
onClientFramein classAbstractEntity
-
onClientDrawEntity
public void onClientDrawEntity(List<RenderingBo> renderingBo)
Description copied from class:AbstractEntityClient side: Draws this entity- Overrides:
onClientDrawEntityin classAbstractEntity
-
onClientDrawEntityActions
public void onClientDrawEntityActions(List<RenderingBo> renderingBo)
Client side: Draws general effects that are related to actions the entity is executing
-
onClientDrawEntityAction
public void onClientDrawEntityAction(List<RenderingBo> renderingBo, String action, boolean pending, CoordI2 subTileOffset)
Client side: Draws a certain action the entity is executing
-
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 classAbstractEntity
-
onClientSelectedPointToNoClientEntityAction
public void onClientSelectedPointToNoClientEntityAction(int modifiers)
Description copied from class:AbstractEntityClient side: Callback when this entity is selected and onClientSelectedPointToEntity + onClientSelectedPointToWorldPos did not set any possible action- Overrides:
onClientSelectedPointToNoClientEntityActionin classAbstractEntity
-
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 classAbstractEntity
-
onClientActionMessage
public void onClientActionMessage(GameActionMessage message)
Description copied from class:AbstractEntityClient side: Callback after a message has been received for this entity- Overrides:
onClientActionMessagein classAbstractEntity
-
onClientGenerateEntityDetails
public String onClientGenerateEntityDetails()
Description copied from class:AbstractEntityClient side: Returns details about this entity. These details are text-only and are shown on the left in the entity details view after selecting an entity.- Overrides:
onClientGenerateEntityDetailsin classAbstractEntity
-
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 classAbstractEntity
-
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 classAbstractEntity
-
handleEnabledState
public void handleEnabledState(GameSession gameSession)
Server side: Handles changing the enabled state of this entity
-
enableEntity
protected void enableEntity(boolean enable)
Server side: Called when the enabled state changed
-
onServerTurnPass1
public void onServerTurnPass1(GameSession gameSession)
Description copied from class:AbstractEntityServer side: Executes code on every server turn, main pass 2 of 2. Executed right after onServerTurnPass0 executed for all entities and before composite entities pass 1- Overrides:
onServerTurnPass1in classAbstractEntity
-
getTilesetPosition
public CoordI2 getTilesetPosition()
- Overrides:
getTilesetPositionin classAbstractEntity
-
onClientDamage
public void onClientDamage(double oldHealth)
Client side: Called when the entity took damage
-
onServerDamage
public void onServerDamage(GameSession gameSession, double oldHealth)
Server side: Called when the entity took damage
-
setClientActions
public void setClientActions(List<ClientEntityAction> clientActions)
- Overrides:
setClientActionsin classAbstractEntity
-
isOperational
public boolean isOperational()
Returns whether the entity is ready to execute actions
-
onClientDrawConsoleControls
public void onClientDrawConsoleControls(boolean controlsActive, List<ClientConsoleControlSet> consoleControls)Client side: Draws controls on the entity console
-
onClientComplexConsoleControlEvent
public ClientConsoleComplexControlAction onClientComplexConsoleControlEvent(boolean controlsActive, int button, CoordI2 normalizedCoordinate)
Client side: Called when the user interacted with the entity console
-
onClientComplexConsoleControlEvent
public void onClientComplexConsoleControlEvent(Event event)
Client side: Called when the user interacted with the entity console
-
onServerConsoleControlEvent
public void onServerConsoleControlEvent(GameSession gameSession, UUID sender, String controlId, Object payload)
Server side: Called when the user interacted with a control in the entity console
-
nextClientEntityAction
public void nextClientEntityAction(boolean newActions)
-
serverSetEntityAction
public void serverSetEntityAction(String qualifier, CompositeAndEntityId target, CoordI2 targetCoord, boolean abortFirst, boolean forceNeedsOperator, boolean ignoreNeedsOperator, boolean deferActionMessage, UUID playerId, GameSession gameSession)
Server side: Sets an action the entity is executing
-
serverAbortEntityAction
public void serverAbortEntityAction(GameSession gameSession, boolean publishAsPendingAction)
Server side: Aborts the current action the entity is executing
-
serverSplitOnDamage
protected void serverSplitOnDamage(GameSession gameSession)
Server side: Executes splitting an entity away from the current parent to a separate composite entity after taking heavy damage. This is an optional feature that needs to be enabled in entity def
-
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 classAbstractEntity
-
serverCalculateEmEmission
public double serverCalculateEmEmission(GameSession gameSession)
Server side: Calculates the EM emission of this entity
-
getHealth
public double getHealth()
-
getSubTileOffset
public CoordI2 getSubTileOffset()
-
getEntityAction
public String getEntityAction()
-
getEntityActionTarget
public CompositeAndEntityId getEntityActionTarget()
-
getEntityActionTargetCoord
public CoordI2 getEntityActionTargetCoord()
-
getEntityActionPending
public String getEntityActionPending()
-
getLoggedInEntity
public UUID getLoggedInEntity()
-
setLoggedInEntity
public void setLoggedInEntity(UUID loggedInEntity)
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean enabled)
-
getPathFindingEntitySupport
public PathFindingEntitySupport getPathFindingEntitySupport()
-
isOnDamageDestroyImmediately
public boolean isOnDamageDestroyImmediately()
-
setOnDamageDestroyImmediately
public void setOnDamageDestroyImmediately(boolean onDamageDestroyImmediately)
-
isOnDamageSplit
public boolean isOnDamageSplit()
-
setOnDamageSplit
public void setOnDamageSplit(boolean onDamageSplit)
-
getOnDamageSplitThreshold
public int getOnDamageSplitThreshold()
-
setOnDamageSplitThreshold
public void setOnDamageSplitThreshold(int onDamageSplitThreshold)
-
-