Class PhysicalEntity

    • Field Detail

      • health

        protected double health
      • entityAction

        protected String entityAction
      • entityActionTargetCoord

        protected CoordI2 entityActionTargetCoord
      • entityActionPending

        protected String entityActionPending
      • entityActionPendingTurn

        protected int entityActionPendingTurn
      • entityActionPlayer

        protected UUID entityActionPlayer
      • loggedInEntity

        protected UUID loggedInEntity
      • enabled

        protected boolean enabled
      • onDamageDestroyImmediately

        protected transient boolean onDamageDestroyImmediately
      • onDamageSplit

        protected transient boolean onDamageSplit
      • onDamageSplitThreshold

        protected transient int onDamageSplitThreshold
      • clientPoseAnimation

        protected transient int clientPoseAnimation
      • clientPoseTilesetPosition

        protected transient CoordI2 clientPoseTilesetPosition
    • Constructor Detail

      • PhysicalEntity

        public PhysicalEntity()
    • 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: 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 class AbstractEntity
      • onClientFrame

        public void onClientFrame​(boolean selected)
        Description copied from class: AbstractEntity
        Client side: Callback on each frame for general logic
        Overrides:
        onClientFrame in class AbstractEntity
      • 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
      • onClientSelectedPointToNoClientEntityAction

        public void onClientSelectedPointToNoClientEntityAction​(int modifiers)
        Description copied from class: AbstractEntity
        Client side: Callback when this entity is selected and onClientSelectedPointToEntity + onClientSelectedPointToWorldPos did not set any possible action
        Overrides:
        onClientSelectedPointToNoClientEntityAction in class AbstractEntity
      • onClientGenerateEntityDetails

        public String onClientGenerateEntityDetails()
        Description copied from class: AbstractEntity
        Client 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:
        onClientGenerateEntityDetails in class AbstractEntity
      • 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 class AbstractEntity
      • 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 class AbstractEntity
      • 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: AbstractEntity
        Server 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:
        onServerTurnPass1 in class AbstractEntity
      • 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
      • 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
      • 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()
      • 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)
      • 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)