Class SpaceShip
- java.lang.Object
-
- de.extio.spacecraft.shared.model.entity.AbstractCompositeEntity
-
- de.extio.spacecraft.shared.model.entity.builtin.composite.SpaceCraft
-
- de.extio.spacecraft.shared.model.entity.builtin.composite.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.extio.spacecraft.shared.model.entity.AbstractCompositeEntity
AbstractCompositeEntity.CollisionCalculationResult, AbstractCompositeEntity.DefaultDamageWaveDamageHandler
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_SPACESHIP_DIMENSION_MAX_X
static int
DEFAULT_SPACESHIP_DIMENSION_MAX_Y
-
Fields inherited from class de.extio.spacecraft.shared.model.entity.builtin.composite.SpaceCraft
crewTilesetName, dead, emEmission, GREEN_HIGHLIGHT, operators, RED_HIGHLIGHT, restrictedHullEntityDefName, restrictedWallEntityDefName, serverEntityGroupsCache, serverLastAttacked, serverLastAttackedBy, shareCode, shipClassName, team, thumbnail, thumbnailVersion
-
Fields inherited from class de.extio.spacecraft.shared.model.entity.AbstractCompositeEntity
accelerationVector, DAMAGE_COLORS, DAMAGE_CONSUMER_BOTH, DAMAGE_CONSUMER_ENTITY, DAMAGE_CONSUMER_SHIELD, DAMAGEWAVE_DIRECTIONS, dimension, dirty, entityManager, fields, fresh, lastMovement, LOGGER, meshes, position, positionDirty, precisePosition, prevPosition, prevVelocityVector, ROTATE_COLLISION_COLOR, splitEntityGroups, sumMassCached, sumMassCachedTurn, uuid, velocityVector, VMAX_M_LB, VMAX_M_UB, VMAX_VEL_MAX, VMAX_VEL_MIN, VMAX_VEL_VAR
-
-
Constructor Summary
Constructors Constructor Description SpaceShip()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
calculateVMax()
Calculates the speed limit for this compositeCoordI2
compressDimension()
Compresses the dimension of this composite.void
create(UUID uuid, CoordI2 position, CoordI2 dimension)
Called upon initial creation of this composite entity.void
damageWave(GameSession gameSession, DamageWaveOptions damageWaveOptions, List<AbstractEntity> damagedEntities)
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.void
excludeDynamicSerializationPropertiesPermanentStorage(Map<String,Object> dynamicSerializationProperties)
This method provide the possibility to reset certain dynamic properties that are relevant at runtime but not relevant for storing it permanently to disk.Map<UUID,UUID>
getCrewControlByEntity()
Map<UUID,List<UUID>>
getCrewControlByPlayer()
int
getCrewSlots()
Map<String,Object>
getDynamicSerializationProperties(boolean incremental, UUID recipient)
Dynamic serialization properties are created when transferring data from server to client (or vice versa) as well as when persisting a composite to disk.Area2
getExtendedViewport()
List<CoordI2>
getShieldedHullbreaches()
int
getShipSlotIndex()
Area2
getViewport()
boolean
isInGame()
protected boolean
killCondition(GameSession gameSession)
Server side: Checks if the SpaceCraft has been killedvoid
localInit(EntityManager entityManager)
Local initialization of transient fields.void
onClientActionMessage(GameActionMessage message)
Client side: Callback when a GameActionMessage has been received that is addressed to this compositevoid
onClientDraw(List<RenderingBo> renderingBo)
Client side: Draw effects related to this composite entity.protected void
onServerHullBreach(CoordI2 position, int change, GameSession gameSession)
Server side: Additional logic on tiles with a hull breachprotected void
onServerSpaceCraftKilled(GameSession gameSession, boolean initial)
Server side: Called every turn when the spacecraft has been killedvoid
onServerTurnPass0(GameSession gameSession)
Server side: Called every turn to contain any logic related to this entitiy.void
resetFieldsForPermanentStorage()
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.void
setCrewControlByEntity(Map<UUID,UUID> crewControlByEntity)
void
setCrewControlByPlayer(Map<UUID,List<UUID>> crewControlByPlayer)
void
setCrewSlots(int slots)
void
setDynamicSerializationProperties(Map<String,Object> properties)
This is the counterpart of getDynamicSerializationProperties(), see the description there.void
setExtendedViewport(Area2 extendedViewport)
void
setInGame(boolean inGame)
void
setShieldedHullbreaches(List<CoordI2> shieldedHullbreaches)
void
setShipSlotIndex(int shipSlotIndex)
void
setViewport(Area2 viewport)
void
update(AbstractCompositeEntity other)
Updates non-transient fields (i.e.-
Methods inherited from class de.extio.spacecraft.shared.model.entity.builtin.composite.SpaceCraft
getCrewTilesetName, getDynamicSerializationPropertiesForSeparateTransfer, getEmEmission, getOperators, getRestrictedHullEntityDefName, getRestrictedHullEntityDefName, getRestrictedWallEntityDefName, getRestrictedWallEntityDefName, getServerEntityGroupsCache, getServerLastAttacked, getServerLastAttackedBy, getShareCode, getShipClassName, getTeam, getThumbnail, getThumbnailVersion, isDead, localCopy, onServerCollision, onServerTurnPass1, onServerTurnPass2, rotate, serverHullBreach, setCrewTilesetName, setDead, setEmEmission, setOperators, setRestrictedHullEntityDefName, setRestrictedWallEntityDefName, setServerLastAttacked, setServerLastAttackedBy, setShareCode, setShipClassName, setTeam, setThumbnail, setThumbnailVersion
-
Methods inherited from class de.extio.spacecraft.shared.model.entity.AbstractCompositeEntity
accelerate, calculateCollision, getAccelerationVector, getAnimationOffset, getCompositeEntityFactoryClassName, getDimension, getEntityManager, getEntityNetworkConsolesCache, getFields, getLastEdited, getLastRotation, getLastRotationDirection, getMeshes, getPosition, getPrecisePosition, getPrevPosition, getSceneTag, getServerFieldsLastPublished, getServerLastInViewPort, getServerMeshesLastPublished, getServerScannedBy, getUuid, getVelocityVector, handleMove, handleMoveApply, includeInSpatialIndex2ResultSet, isDirty, isFresh, isInSpatialIndex2ResultSet, isLocalInit, isPositionDirty, isRemoved, isShadowed, isSplitEntityGroups, onClientFrame, onRemove, onServerActionMessage, priorityCalculateCollision, resetStatic, restoreFieldsFromPermanentStorage, setAccelerationVector, setCompositeEntityFactoryClassName, setDimension, setDirty, setEntityManager, setFresh, setLastEdited, setPosition, setPositionDirty, setPrecisePosition, setPrevPosition, setSceneTag, setServerFieldsLastPublished, setServerMeshesLastPublished, setShadowed, setSplitEntityGroups, setUuid, setVelocityVector, splitEntityGroups, sumMass
-
-
-
-
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
-
-
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 classSpaceCraft
-
localInit
public void localInit(EntityManager entityManager)
Description copied from class:AbstractCompositeEntity
Local initialization of transient fields. See also create() and update()- Overrides:
localInit
in classSpaceCraft
-
update
public void update(AbstractCompositeEntity other)
Description copied from class:AbstractCompositeEntity
Updates non-transient fields (i.e. when receiving an entity update from server or copying a composite entity)- Overrides:
update
in classSpaceCraft
-
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 classSpaceCraft
-
setDynamicSerializationProperties
public void setDynamicSerializationProperties(Map<String,Object> properties)
Description copied from class:AbstractCompositeEntity
This is the counterpart of getDynamicSerializationProperties(), see the description there.- Overrides:
setDynamicSerializationProperties
in classSpaceCraft
-
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 classSpaceCraft
-
excludeDynamicSerializationPropertiesPermanentStorage
public void excludeDynamicSerializationPropertiesPermanentStorage(Map<String,Object> dynamicSerializationProperties)
Description copied from class:AbstractCompositeEntity
This method provide the possibility to reset certain dynamic properties that are relevant at runtime but not relevant for storing it permanently to disk.- Overrides:
excludeDynamicSerializationPropertiesPermanentStorage
in classAbstractCompositeEntity
-
onClientDraw
public void onClientDraw(List<RenderingBo> renderingBo)
Description copied from class:AbstractCompositeEntity
Client side: Draw effects related to this composite entity. All entities are already drawn separately by the game core.- Overrides:
onClientDraw
in classSpaceCraft
-
onClientActionMessage
public void onClientActionMessage(GameActionMessage message)
Description copied from class:AbstractCompositeEntity
Client side: Callback when a GameActionMessage has been received that is addressed to this composite- Overrides:
onClientActionMessage
in classAbstractCompositeEntity
-
compressDimension
public CoordI2 compressDimension()
Description copied from class:AbstractCompositeEntity
Compresses the dimension of this composite. A compressed composite has no unoccupied space around it's borders.- Overrides:
compressDimension
in classSpaceCraft
-
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 classSpaceCraft
-
killCondition
protected boolean killCondition(GameSession gameSession)
Description copied from class:SpaceCraft
Server side: Checks if the SpaceCraft has been killed- Overrides:
killCondition
in classSpaceCraft
-
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 classSpaceCraft
-
onServerHullBreach
protected void onServerHullBreach(CoordI2 position, int change, GameSession gameSession)
Description copied from class:SpaceCraft
Server side: Additional logic on tiles with a hull breach- Overrides:
onServerHullBreach
in classSpaceCraft
-
calculateVMax
public double calculateVMax()
Description copied from class:AbstractCompositeEntity
Calculates the speed limit for this composite- Overrides:
calculateVMax
in classAbstractCompositeEntity
-
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 classAbstractCompositeEntity
-
setCrewControlByPlayer
public void setCrewControlByPlayer(Map<UUID,List<UUID>> crewControlByPlayer)
-
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)
-
-