Class AbstractEntity

    • Field Detail

      • LOGGER

        protected static final org.apache.logging.log4j.Logger LOGGER
    • Constructor Detail

      • AbstractEntity

        public AbstractEntity()
    • Method Detail

      • create

        public void create​(UUID uuid,
                           AbstractEntityDef entityDef,
                           int entityDefIdx,
                           UUID parentCompositeEntity)
        Central initialization of non-transient fields (usually on server side). Is only called once in the whole life cycle of an entity.
      • localInit

        public void localInit​(AbstractEntityDef entityDef)
        Local initialization of transient fields
      • localCopy

        public void localCopy​(AbstractEntity other)
        Local copy of transient fields
      • update

        public void update​(AbstractEntity other)
        Incremental update of non-transient fields (usually transferred from server)
      • onClientFrame

        public void onClientFrame​(boolean selected)
        Client side: Callback on each frame for general logic
      • onClientDrawEntity

        public void onClientDrawEntity​(List<RenderingBo> renderingBo)
        Client side: Draws this entity
      • onClientSelectedPointToEntity

        public void onClientSelectedPointToEntity​(AbstractCompositeEntity otherCompositeEntity,
                                                  AbstractEntity other,
                                                  int modifiers,
                                                  List<ClientEntityAction> outClientActions)
        Client side: Callback when this entity is selected and cursor is pointing to another entity
      • onClientSelectedPointToWorldPos

        public void onClientSelectedPointToWorldPos​(CoordI2 worldPos,
                                                    List<CompositeAndEntityId> atPosition,
                                                    int modifiers,
                                                    List<ClientEntityAction> outClientActions)
        Client side: Callback when this entity is selected and cursor is pointing to an empty tile in the game world
      • onClientSelectedPointToNoClientEntityAction

        public void onClientSelectedPointToNoClientEntityAction​(int modifiers)
        Client side: Callback when this entity is selected and onClientSelectedPointToEntity + onClientSelectedPointToWorldPos did not set any possible action
      • onClientActionMessage

        public void onClientActionMessage​(GameActionMessage message)
        Client side: Callback after a message has been received for this entity
      • onClientGenerateEntityDetails

        public String onClientGenerateEntityDetails()
        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.
      • onServerActionMessage

        public void onServerActionMessage​(GameActionMessage message,
                                          UUID sender,
                                          GameSession gameSession)
        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
      • onServerTurnPass0

        public void onServerTurnPass0​(GameSession gameSession)
        Server side: Executes code on every server turn, main pass 1 of 2. Executed after composite entities pass 0
      • onServerTurnPass1

        public void onServerTurnPass1​(GameSession gameSession)
        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
      • onServerTurnPass2PostComposites

        public void onServerTurnPass2PostComposites​(GameSession gameSession)
        Server side: Executes code on every server turn, postprocessing pass after composite entity pass 2. It is highly recommended to not change the main business state here but only do calculations based on that state
      • serverTranslateEntityPass1

        public void serverTranslateEntityPass1​(Edge2 rotation,
                                               CoordI2 posSrc,
                                               CoordI2 origDim,
                                               AbstractCompositeEntity parent,
                                               GameSession gameSession)
        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
      • serverRestrictEntity

        public boolean serverRestrictEntity​(UUID recipient,
                                            AbstractCompositeEntity parent,
                                            GameSession gameSession)
        Server side: Checks whether this entity should be restricted to the player recipient, i.e. details about this entity (state, ...) are sent to this player or not. See also RestrictedEntitySurface
      • serverPrepareRestrictedEntities

        public void serverPrepareRestrictedEntities​(UUID recipient,
                                                    AbstractCompositeEntity parent,
                                                    GameSession gameSession)
        Server side: Prepares RestrictedEntity instances to be presented instead of this entity to a player. See also RestrictedEntitySurface
      • serverCleanupRestrictedEntities

        public void serverCleanupRestrictedEntities​(AbstractCompositeEntity parent,
                                                    GameSession gameSession)
        Server side: Cleans up restricted entity surfaces. See also See also RestrictedEntitySurface
      • createClientDrawTileImageBo

        protected DrawTileImageBo createClientDrawTileImageBo()
        Client side: Creates and sets up a DrawTileImageBo rendering business object to render this entity on a tile
      • getEntityDef

        public int getEntityDef()
      • setEntityDef

        public void setEntityDef​(int entityDef)
      • getEntityDefUUID

        public UUID getEntityDefUUID()
      • setPosition

        public void setPosition​(CoordI2 position)
        Use this method for initial entity placement after EntityManager::create, but never update position after the initial EntityManager::put. This will break 2D index! Use EntityManager::move instead.
      • getOrientation

        public Edge2 getOrientation()
      • setOrientation

        public void setOrientation​(Edge2 orientation)
      • getUuid

        public UUID getUuid()
      • setUuid

        public void setUuid​(UUID uuid)
      • getParentCompositeEntity

        public UUID getParentCompositeEntity()
      • setParentCompositeEntity

        public void setParentCompositeEntity​(UUID parentCompositeEntity)
      • getTileset

        public int getTileset()
      • getTilesetPosition

        public CoordI2 getTilesetPosition()
      • setDirty

        public void setDirty​(boolean dirty)
      • isDirty

        public boolean isDirty()
      • setEntityManager

        public void setEntityManager​(EntityManager entityManager)
      • isLocalInit

        public boolean isLocalInit()
      • setLocalInit

        public void setLocalInit​(boolean localInit)
      • getServerRestrictEntitiesLastUpdate

        public int getServerRestrictEntitiesLastUpdate()
      • setServerRestrictEntitiesLastUpdate

        public void setServerRestrictEntitiesLastUpdate​(int serverRestrictedEntityLastUpdate)
      • getServerRestrictEntitiesWalls

        public int getServerRestrictEntitiesWalls()
      • setServerRestrictEntitiesWalls

        public void setServerRestrictEntitiesWalls​(int serverRestrictEntitiesWalls)
      • setServerRestrictedEntities

        public void setServerRestrictedEntities​(Map<UUID,​List<AbstractEntity>> serverRestrictedEntities)