Class SpaceShip

  • All Implemented Interfaces:
    HasAttackerInfo, HasServerEntityGroupsCache, HasPosition2, HasPositionAndDimension2, SpatialIndex2Capable
    Direct Known Subclasses:
    SpaceStation

    public class SpaceShip
    extends SpaceCraft
    SpaceShip is the class of your choice for ships manned by players.
    When to use which type:
    * SpaceCraft: Ships controlled by AI, cannot spawn on a player slot in a game session
    * SpaceShip: Ships controlled by players or AI, can spawn on a player slot in a game session (but only needs to if players join the ship)
    * SpaceStation: Specialization of SpaceShip for stationary stations. Less restrictions in ship editor but other than that similar to SpaceShip
    • Field Detail

      • DEFAULT_SPACESHIP_DIMENSION_MAX_X

        public static final int DEFAULT_SPACESHIP_DIMENSION_MAX_X
        See Also:
        Constant Field Values
      • DEFAULT_SPACESHIP_DIMENSION_MAX_Y

        public static final int DEFAULT_SPACESHIP_DIMENSION_MAX_Y
        See Also:
        Constant Field Values
    • Constructor Detail

      • SpaceShip

        public SpaceShip()
    • Method Detail

      • create

        public void create​(UUID uuid,
                           CoordI2 position,
                           CoordI2 dimension)
        Description copied from class: AbstractCompositeEntity
        Called upon initial creation of this composite entity. This method is not called locally (i.e. when the composite has been transferred from server to client), so only initialize non-transient fields here. See also localInit()
        Overrides:
        create in class SpaceCraft
      • getDynamicSerializationProperties

        public Map<String,​Object> getDynamicSerializationProperties​(boolean incremental,
                                                                          UUID recipient)
        Description copied from class: AbstractCompositeEntity
        Dynamic serialization properties are created when transferring data from server to client (or vice versa) as well as when persisting a composite to disk. These properties provide a way to implement complex serialization logic (i.e. views) and to distinguish between incremental and full updates.
        Overrides:
        getDynamicSerializationProperties in class SpaceCraft
      • resetFieldsForPermanentStorage

        public void resetFieldsForPermanentStorage()
        Description copied from class: AbstractCompositeEntity
        This method provide the possibility to reset certain non-transient fields that are relevant at runtime but not relevant for storing it permanently to disk.
        Overrides:
        resetFieldsForPermanentStorage in class SpaceCraft
      • onServerTurnPass0

        public void onServerTurnPass0​(GameSession gameSession)
        Description copied from class: AbstractCompositeEntity
        Server side: Called every turn to contain any logic related to this entitiy. Pass0 is called at the beginning of the cycle before entity callbacks have been called.
        Overrides:
        onServerTurnPass0 in class SpaceCraft
      • killCondition

        protected boolean killCondition​(GameSession gameSession)
        Description copied from class: SpaceCraft
        Server side: Checks if the SpaceCraft has been killed
        Overrides:
        killCondition in class SpaceCraft
      • onServerSpaceCraftKilled

        protected void onServerSpaceCraftKilled​(GameSession gameSession,
                                                boolean initial)
        Description copied from class: SpaceCraft
        Server side: Called every turn when the spacecraft has been killed
        Overrides:
        onServerSpaceCraftKilled in class SpaceCraft
      • damageWave

        public void damageWave​(GameSession gameSession,
                               DamageWaveOptions damageWaveOptions,
                               List<AbstractEntity> damagedEntities)
        Description copied from class: AbstractCompositeEntity
        Distributes incoming damage on entities.
        There are certain aspects relevant for the calculation:
        * A tiles consists of several layered entities
        * An entity only absorbs a certain amount of damage (plateaus), which is also dependent on the weapon
        * A tile can be protected by shields
        * Also shields have plateaus
        * Damage that is not absorbed propagates to nearby tiles
        * Damage cannot propagate through some tiles in certain directions, i.e. walls, unless the entity is destroyed
        * Propagated damage is dampened
        * Damage handlers for tiles are pluggable
        Overrides:
        damageWave in class AbstractCompositeEntity
      • getCrewControlByPlayer

        public Map<UUID,​List<UUID>> getCrewControlByPlayer()
      • setCrewControlByPlayer

        public void setCrewControlByPlayer​(Map<UUID,​List<UUID>> crewControlByPlayer)
      • getCrewControlByEntity

        public Map<UUID,​UUID> getCrewControlByEntity()
      • setCrewControlByEntity

        public void setCrewControlByEntity​(Map<UUID,​UUID> crewControlByEntity)
      • getCrewSlots

        public int getCrewSlots()
      • setCrewSlots

        public void setCrewSlots​(int slots)
      • isInGame

        public boolean isInGame()
      • setInGame

        public void setInGame​(boolean inGame)
      • getShipSlotIndex

        public int getShipSlotIndex()
      • setShipSlotIndex

        public void setShipSlotIndex​(int shipSlotIndex)
      • getViewport

        public Area2 getViewport()
      • setViewport

        public void setViewport​(Area2 viewport)
      • getExtendedViewport

        public Area2 getExtendedViewport()
      • setExtendedViewport

        public void setExtendedViewport​(Area2 extendedViewport)
      • getShieldedHullbreaches

        public List<CoordI2> getShieldedHullbreaches()
      • setShieldedHullbreaches

        public void setShieldedHullbreaches​(List<CoordI2> shieldedHullbreaches)