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 intDEFAULT_SPACESHIP_DIMENSION_MAX_Xstatic intDEFAULT_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 doublecalculateVMax()Calculates the speed limit for this compositeCoordI2compressDimension()Compresses the dimension of this composite.voidcreate(UUID uuid, CoordI2 position, CoordI2 dimension)Called upon initial creation of this composite entity.voiddamageWave(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.voidexcludeDynamicSerializationPropertiesPermanentStorage(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()intgetCrewSlots()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.Area2getExtendedViewport()List<CoordI2>getShieldedHullbreaches()intgetShipSlotIndex()Area2getViewport()booleanisInGame()protected booleankillCondition(GameSession gameSession)Server side: Checks if the SpaceCraft has been killedvoidlocalInit(EntityManager entityManager)Local initialization of transient fields.voidonClientActionMessage(GameActionMessage message)Client side: Callback when a GameActionMessage has been received that is addressed to this compositevoidonClientDraw(List<RenderingBo> renderingBo)Client side: Draw effects related to this composite entity.protected voidonServerHullBreach(CoordI2 position, int change, GameSession gameSession)Server side: Additional logic on tiles with a hull breachprotected voidonServerSpaceCraftKilled(GameSession gameSession, boolean initial)Server side: Called every turn when the spacecraft has been killedvoidonServerTurnPass0(GameSession gameSession)Server side: Called every turn to contain any logic related to this entitiy.voidresetFieldsForPermanentStorage()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.voidsetCrewControlByEntity(Map<UUID,UUID> crewControlByEntity)voidsetCrewControlByPlayer(Map<UUID,List<UUID>> crewControlByPlayer)voidsetCrewSlots(int slots)voidsetDynamicSerializationProperties(Map<String,Object> properties)This is the counterpart of getDynamicSerializationProperties(), see the description there.voidsetExtendedViewport(Area2 extendedViewport)voidsetInGame(boolean inGame)voidsetShieldedHullbreaches(List<CoordI2> shieldedHullbreaches)voidsetShipSlotIndex(int shipSlotIndex)voidsetViewport(Area2 viewport)voidupdate(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:AbstractCompositeEntityCalled 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:
createin classSpaceCraft
-
localInit
public void localInit(EntityManager entityManager)
Description copied from class:AbstractCompositeEntityLocal initialization of transient fields. See also create() and update()- Overrides:
localInitin classSpaceCraft
-
update
public void update(AbstractCompositeEntity other)
Description copied from class:AbstractCompositeEntityUpdates non-transient fields (i.e. when receiving an entity update from server or copying a composite entity)- Overrides:
updatein classSpaceCraft
-
getDynamicSerializationProperties
public Map<String,Object> getDynamicSerializationProperties(boolean incremental, UUID recipient)
Description copied from class:AbstractCompositeEntityDynamic 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:
getDynamicSerializationPropertiesin classSpaceCraft
-
setDynamicSerializationProperties
public void setDynamicSerializationProperties(Map<String,Object> properties)
Description copied from class:AbstractCompositeEntityThis is the counterpart of getDynamicSerializationProperties(), see the description there.- Overrides:
setDynamicSerializationPropertiesin classSpaceCraft
-
resetFieldsForPermanentStorage
public void resetFieldsForPermanentStorage()
Description copied from class:AbstractCompositeEntityThis 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:
resetFieldsForPermanentStoragein classSpaceCraft
-
excludeDynamicSerializationPropertiesPermanentStorage
public void excludeDynamicSerializationPropertiesPermanentStorage(Map<String,Object> dynamicSerializationProperties)
Description copied from class:AbstractCompositeEntityThis method provide the possibility to reset certain dynamic properties that are relevant at runtime but not relevant for storing it permanently to disk.- Overrides:
excludeDynamicSerializationPropertiesPermanentStoragein classAbstractCompositeEntity
-
onClientDraw
public void onClientDraw(List<RenderingBo> renderingBo)
Description copied from class:AbstractCompositeEntityClient side: Draw effects related to this composite entity. All entities are already drawn separately by the game core.- Overrides:
onClientDrawin classSpaceCraft
-
onClientActionMessage
public void onClientActionMessage(GameActionMessage message)
Description copied from class:AbstractCompositeEntityClient side: Callback when a GameActionMessage has been received that is addressed to this composite- Overrides:
onClientActionMessagein classAbstractCompositeEntity
-
compressDimension
public CoordI2 compressDimension()
Description copied from class:AbstractCompositeEntityCompresses the dimension of this composite. A compressed composite has no unoccupied space around it's borders.- Overrides:
compressDimensionin classSpaceCraft
-
onServerTurnPass0
public void onServerTurnPass0(GameSession gameSession)
Description copied from class:AbstractCompositeEntityServer 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:
onServerTurnPass0in classSpaceCraft
-
killCondition
protected boolean killCondition(GameSession gameSession)
Description copied from class:SpaceCraftServer side: Checks if the SpaceCraft has been killed- Overrides:
killConditionin classSpaceCraft
-
onServerSpaceCraftKilled
protected void onServerSpaceCraftKilled(GameSession gameSession, boolean initial)
Description copied from class:SpaceCraftServer side: Called every turn when the spacecraft has been killed- Overrides:
onServerSpaceCraftKilledin classSpaceCraft
-
onServerHullBreach
protected void onServerHullBreach(CoordI2 position, int change, GameSession gameSession)
Description copied from class:SpaceCraftServer side: Additional logic on tiles with a hull breach- Overrides:
onServerHullBreachin classSpaceCraft
-
calculateVMax
public double calculateVMax()
Description copied from class:AbstractCompositeEntityCalculates the speed limit for this composite- Overrides:
calculateVMaxin classAbstractCompositeEntity
-
damageWave
public void damageWave(GameSession gameSession, DamageWaveOptions damageWaveOptions, List<AbstractEntity> damagedEntities)
Description copied from class:AbstractCompositeEntityDistributes 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:
damageWavein 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)
-
-