Package megamek.common.interfaces
Interface ForceAssignable
- All Superinterfaces:
BTObject,InGameObject
- All Known Implementing Classes:
AbstractBuildingEntity,Aero,AeroSpaceFighter,AlphaStrikeElement,BattleArmor,BattlefieldSupportAsset,BipedMek,BuildingEntity,CombatVehicleEscapePod,ConvFighter,ConvInfantry,Dropship,EjectedCrew,Entity,EscapePods,FighterSquadron,FixedWingSupport,Formation,GunEmplacement,HandheldWeapon,Infantry,Jumpship,LandAirMek,LargeSupportTank,Mek,MekWarrior,MekWithArms,MobileStructure,ProtoMek,QuadMek,QuadVee,SBFFormation,SmallCraft,SpaceStation,SuperHeavyTank,SupportTank,SupportVTOL,Tank,TeleMissile,TripodMek,VTOL,Warship
This interface represents all GameObjects that can be assigned to a force in MM. These are at the least Entity and
AlphaStrikeElement but might at some point include BFUnits, SBFFormations or ACS Combat Teams.
The purpose of this interface is to disentangle Force and Entity and facilitate other types of games than TW.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<AlphaStrikeElement> filterToAlphaStrikeElementList(List<ForceAssignable> forceAssignableList) Deprecated, for removal: This API element is subject to removal in a future version.filterToEntityList(List<ForceAssignable> forceAssignableList) Filters the given list of ForceAssignable, keeping only those that are an Entity and returns a new list of those Entities.intReturns a String representation of the force hierarchy this entity belongs to.default booleanvoidsetForceId(int newId) Sets the unique id of the force this ForceAssignable belongs to.voidsetForceString(String newForceString) Sets the force string, seegetForceString().Methods inherited from interface megamek.common.units.BTObject
generalName, getFluffImage, getIcon, hasAerodyneSpheroidDistinction, isAero, isAerodyne, isAerospace, isAerospaceFighter, isAerospaceSV, isBattleArmor, isBattlefieldSupportAsset, isBattleMek, isCarryableObject, isCombatVehicle, isConventionalFighter, isConventionalInfantry, isDropShip, isFighter, isFixedWingSupport, isGround, isHandheldWeapon, isIndustrialMek, isInfantry, isJumpShip, isLargeAerospace, isMek, isObjectiveMarker, isProtoMek, isQuadMek, isSingleUnit, isSmallCraft, isSpaceStation, isSpheroid, isSupportVehicle, isTripodMek, isUnitGroup, isVehicle, isWarShip, specificNameMethods inherited from interface megamek.common.game.InGameObject
countForStrengthSum, getId, getOwnerId, getStrength, hasOwner, setId, setOwnerId
-
Method Details
-
getForceString
String getForceString()Returns a String representation of the force hierarchy this entity belongs to. The String contains all forces from top to bottom separated by backslash with no backslash at beginning or end. Each force is followed by a unique id separated by the vertical bar. E.g.
Regiment|1||Battalion B|11||Alpha Company|18||Battle Lance II|112
If this is not empty, the server will attempt to reconstruct the force hierarchy when it receives this entity and will empty the string. This should be used for loading/saving MULs or transfer from other sources that don't have access to the current MM game's forces, such as MekHQ or the Force Generators. At all other times, forceId should be used instead and this should return an empty string.- Returns:
- The string representation of this ForceAssignable's force
-
setForceString
Sets the force string, seegetForceString().- Parameters:
newForceString- The new force string
-
getForceId
int getForceId()- Returns:
- The unique id of the force this ForceAssignable belongs to.
-
setForceId
void setForceId(int newId) Sets the unique id of the force this ForceAssignable belongs to.- Parameters:
newId- the id of the new force to assign this ForceAssignable to.
-
partOfForce
default boolean partOfForce()- Returns:
- True when this ForceAssignable is part of any force. This tests only the assigned force id.
-
filterToEntityList
Filters the given list of ForceAssignable, keeping only those that are an Entity and returns a new list of those Entities.- Parameters:
forceAssignableList- The list of ForceAssignable to filter- Returns:
- A filtered list of all Entities in the given list
-
filterToAlphaStrikeElementList
@Deprecated(since="0.51.0", forRemoval=true) static List<AlphaStrikeElement> filterToAlphaStrikeElementList(List<ForceAssignable> forceAssignableList) Deprecated, for removal: This API element is subject to removal in a future version.Filters the given list of ForceAssignable, keeping only those that are an AlphaStrikeElement and returns a new list of those AlphaStrikeElements.- Parameters:
forceAssignableList- The list of ForceAssignable to filter- Returns:
- A filtered list of all AlphaStrikeElements in the given list
-