Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
DockEntity Class Reference

#include <DockEntity.h>

+ Inheritance diagram for DockEntity:
+ Collaboration diagram for DockEntity:

Instance Methods

(void) - clear
 
(BOOL) - allowsDocking
 
(void) - setAllowsDocking:
 
(BOOL) - disallowedDockingCollides
 
(void) - setDisallowedDockingCollides:
 
(NSUInteger) - countOfShipsInDockingQueue
 
(NSDictionary *) - dockingInstructionsForShip:
 
(NSString *) - canAcceptShipForDocking:
 
(BOOL) - shipIsInDockingCorridor:
 
(BOOL) - shipIsInDockingQueue:
 
(void) - abortDockingForShip:
 
(void) - abortAllDockings
 
(BOOL) - dockingCorridorIsEmpty
 
(void) - clearDockingCorridor
 
(void) - autoDockShipsOnApproach
 
(NSUInteger) - pruneAndCountShipsOnApproach
 
(void) - noteDockingForShip:
 
(BOOL) - allowsLaunching
 
(void) - setAllowsLaunching:
 
(NSUInteger) - countOfShipsInLaunchQueue
 
(NSUInteger) - countOfShipsInLaunchQueueWithPrimaryRole:
 
(BOOL) - allowsLaunchingOf:
 
(void) - launchShip:
 
(void) - addShipToLaunchQueue:withPriority:
 
(void) - setDimensionsAndCorridor:docking:ddc:
 
(Vector) - portUpVectorForShipsBoundingBox:
 
(BOOL) - isOffCentre
 
(void) - setVirtual
 
(void) - abortAllLaunches [implementation]
 
(void) - autoDockShipsInQueue: [implementation]
 
(void) - addShipToShipsOnApproach: [implementation]
 
(void) - pullInShipIfPermitted: [implementation]
 
(BOOL) - isDock [implementation]
 
(id) - initWithKey:definition: [implementation]
 
(void) - dealloc [implementation]
 
(void) - clearIdLocks: [implementation]
 
(void) - clearAllIdLocks [implementation]
 
(BOOL) - setUpShipFromDictionary: [implementation]
 
(void) - update: [implementation]
 
(void) - noteTakingDamage:from:type: [implementation]
 
(void) - takeEnergyDamage:from:becauseOf:weaponIdentifier: [implementation]
 
(void) - drawImmediate:translucent: [implementation]
 
(void) - getJSClass:andPrototype: [implementation]
 
(NSString *) - oo_jsClassName [implementation]
 
- Instance Methods inherited from ShipEntity
(void) - setStateMachine:
 
(void) - setAI:
 
(AI *) - getAI
 
(BOOL) - hasAutoAI
 
(BOOL) - hasNewAI
 
(void) - setShipScript:
 
(void) - removeScript
 
(OOScript *) - shipScript
 
(OOScript *) - shipAIScript
 
(OOTimeAbsolute- shipAIScriptWakeTime
 
(void) - setAIScriptWakeTime:
 
(double) - frustration
 
(void) - setLaunchDelay:
 
(void) - interpretAIMessage:
 
(GLfloat) - accuracy
 
(void) - setAccuracy:
 
(OOMesh *) - mesh
 
(void) - setMesh:
 
(BoundingBox) - totalBoundingBox
 
(Vector) - forwardVector
 
(Vector) - upVector
 
(Vector) - rightVector
 
(NSArray *) - subEntities
 
(NSUInteger) - subEntityCount
 
(BOOL) - hasSubEntity:
 
(NSEnumerator *) - subEntityEnumerator
 
(NSEnumerator *) - shipSubEntityEnumerator
 
(NSEnumerator *) - flasherEnumerator
 
(NSEnumerator *) - exhaustEnumerator
 
(ShipEntity *) - subEntityTakingDamage
 
(void) - setSubEntityTakingDamage:
 
(void) - clearSubEntities
 
(Quaternion) - subEntityRotationalVelocity
 
(void) - setSubEntityRotationalVelocity:
 
(NSString *) - serializeShipSubEntities
 
(void) - deserializeShipSubEntitiesFrom:
 
(NSUInteger) - maxShipSubEntities
 
(void) - setSubIdx:
 
(NSUInteger) - subIdx
 
(Octree *) - octree
 
(float) - volume
 
(GLfloat) - doesHitLine:v0:
 
(GLfloat) - doesHitLine:v0:v1:
 
(GLfloat) - doesHitLine:v0:withPosition:andIJK:i:j:
 
(BoundingBox) - findBoundingBoxRelativeToPosition:InVectors:i:j:
 
(HPVector) - absoluteTractorPosition
 
(void) - setIsBoulder:
 
(BOOL) - isBoulder
 
(BOOL) - isMinable
 
(BOOL) - countsAsKill
 
(void) - setUpEscorts
 
(void) - updateEscortFormation
 
(BOOL) - setUpFromDictionary:
 
(BOOL) - setUpSubEntities
 
(BOOL) - setUpOneStandardSubentity:asTurret:
 
(GLfloat) - frustumRadius
 
(NSString *) - shipDataKey
 
(NSString *) - shipDataKeyAutoRole
 
(void) - setShipDataKey:
 
(NSDictionary *) - shipInfoDictionary
 
(NSArray *) - getWeaponOffsetFrom:withKey:inMode:
 
(NSArray *) - aftWeaponOffset
 
(NSArray *) - forwardWeaponOffset
 
(NSArray *) - portWeaponOffset
 
(NSArray *) - starboardWeaponOffset
 
(BOOL) - hasAutoWeapons
 
(BOOL) - isFrangible
 
(BOOL) - suppressFlightNotifications
 
(void) - respondToAttackFrom:becauseOf:
 
(OOWeaponFacingSet- weaponFacings
 
(BOOL) - hasEquipmentItem:includeWeapons:whileLoading:
 
(BOOL) - hasEquipmentItem:
 
(NSUInteger) - countEquipmentItem:
 
(NSString *) - equipmentItemProviding:
 
(BOOL) - hasEquipmentItemProviding:
 
(BOOL) - hasAllEquipment:includeWeapons:whileLoading:
 
(BOOL) - hasAllEquipment:
 
(BOOL) - setWeaponMount:toWeapon:
 
(BOOL) - canAddEquipment:inContext:
 
(BOOL) - equipmentValidToAdd:inContext:
 
(BOOL) - equipmentValidToAdd:whileLoading:inContext:
 
(BOOL) - addEquipmentItem:inContext:
 
(BOOL) - addEquipmentItem:withValidation:inContext:
 
(BOOL) - hasHyperspaceMotor
 
(float) - hyperspaceSpinTime
 
(void) - setHyperspaceSpinTime:
 
(NSEnumerator *) - equipmentEnumerator
 
(NSUInteger) - equipmentCount
 
(void) - removeEquipmentItem:
 
(void) - removeAllEquipment
 
(OOEquipmentType *) - selectMissile
 
(OOCreditsQuantity- removeMissiles
 
(BOOL) - hasOneEquipmentItem:includeWeapons:whileLoading:
 
(BOOL) - hasOneEquipmentItem:includeMissiles:whileLoading:
 
(BOOL) - hasPrimaryWeapon:
 
(BOOL) - removeExternalStore:
 
(NSUInteger) - parcelCount
 
(NSUInteger) - passengerCount
 
(NSUInteger) - passengerCapacity
 
(NSUInteger) - missileCount
 
(NSUInteger) - missileCapacity
 
(NSUInteger) - extraCargo
 
(BOOL) - hasScoop
 
(BOOL) - hasFuelScoop
 
(BOOL) - hasCargoScoop
 
(BOOL) - hasECM
 
(BOOL) - hasCloakingDevice
 
(BOOL) - hasMilitaryScannerFilter
 
(BOOL) - hasMilitaryJammer
 
(BOOL) - hasExpandedCargoBay
 
(BOOL) - hasShieldBooster
 
(BOOL) - hasMilitaryShieldEnhancer
 
(BOOL) - hasHeatShield
 
(BOOL) - hasFuelInjection
 
(BOOL) - hasCascadeMine
 
(BOOL) - hasEscapePod
 
(BOOL) - hasDockingComputer
 
(BOOL) - hasGalacticHyperdrive
 
(float) - shieldBoostFactor
 
(float) - maxForwardShieldLevel
 
(float) - maxAftShieldLevel
 
(float) - shieldRechargeRate
 
(double) - maxHyperspaceDistance
 
(float) - afterburnerFactor
 
(float) - afterburnerRate
 
(void) - setAfterburnerFactor:
 
(void) - setAfterburnerRate:
 
(float) - maxThrust
 
(float) - thrust
 
(void) - setMaxThrust:
 
(void) - setMaxFlightPitch:
 
(void) - setMaxFlightSpeed:
 
(void) - setMaxFlightRoll:
 
(void) - setMaxFlightYaw:
 
(void) - setEnergyRechargeRate:
 
(void) - processBehaviour:
 
(void) - behaviour_stop_still:
 
(void) - behaviour_idle:
 
(void) - behaviour_tumble:
 
(void) - behaviour_tractored:
 
(void) - behaviour_track_target:
 
(void) - behaviour_intercept_target:
 
(void) - behaviour_attack_target:
 
(void) - behaviour_attack_slow_dogfight:
 
(void) - behaviour_evasive_action:
 
(void) - behaviour_attack_break_off_target:
 
(void) - behaviour_fly_to_target_six:
 
(void) - behaviour_attack_mining_target:
 
(void) - behaviour_attack_fly_to_target:
 
(void) - behaviour_attack_fly_from_target:
 
(void) - behaviour_running_defense:
 
(void) - behaviour_flee_target:
 
(void) - behaviour_attack_broadside:
 
(void) - behaviour_attack_broadside_left:
 
(void) - behaviour_attack_broadside_right:
 
(void) - behaviour_close_to_broadside_range:
 
(void) - behaviour_close_with_target:
 
(void) - behaviour_attack_broadside_target:leftside:
 
(void) - behaviour_attack_sniper:
 
(void) - behaviour_fly_range_from_destination:
 
(void) - behaviour_face_destination:
 
(void) - behaviour_land_on_planet:
 
(void) - behaviour_formation_form_up:
 
(void) - behaviour_fly_to_destination:
 
(void) - behaviour_fly_from_destination:
 
(void) - behaviour_avoid_collision:
 
(void) - behaviour_track_as_turret:
 
(void) - behaviour_fly_thru_navpoints:
 
(void) - behaviour_scripted_ai:
 
(float) - reactionTime
 
(void) - setReactionTime:
 
(HPVector) - calculateTargetPosition
 
(void) - startTrackingCurve
 
(void) - updateTrackingCurve
 
(void) - calculateTrackingCurve
 
(GLfloat *) - scannerDisplayColorForShip:otherShip:isHostile:flash:scannerDisplayColor1:scannerDisplayColor2:scannerDisplayColorH1:
 
(void) - setScannerDisplayColor1:
 
(void) - setScannerDisplayColor2:
 
(OOColor *) - scannerDisplayColor1
 
(OOColor *) - scannerDisplayColor2
 
(void) - setScannerDisplayColorHostile1:
 
(void) - setScannerDisplayColorHostile2:
 
(OOColor *) - scannerDisplayColorHostile1
 
(OOColor *) - scannerDisplayColorHostile2
 
(BOOL) - isCloaked
 
(void) - setCloaked:
 
(BOOL) - hasAutoCloak
 
(void) - setAutoCloak:
 
(void) - applyThrust:
 
(void) - applyAttitudeChanges:
 
(void) - avoidCollision
 
(void) - resumePostProximityAlert
 
(double) - messageTime
 
(void) - setMessageTime:
 
(OOShipGroup *) - group
 
(void) - setGroup:
 
(OOShipGroup *) - escortGroup
 
(void) - setEscortGroup:
 
(OOShipGroup *) - stationGroup
 
(BOOL) - hasEscorts
 
(NSEnumerator *) - escortEnumerator
 
(NSArray *) - escortArray
 
(uint8_t) - escortCount
 
(uint8_t) - pendingEscortCount
 
(void) - setPendingEscortCount:
 
(uint8_t) - maxEscortCount
 
(void) - setMaxEscortCount:
 
(NSUInteger) - turretCount
 
(NSString *) - name
 
(NSString *) - shipUniqueName
 
(NSString *) - shipClassName
 
(NSString *) - displayName
 
(NSString *) - scanDescription
 
(NSString *) - scanDescriptionForScripting
 
(void) - setName:
 
(void) - setShipUniqueName:
 
(void) - setShipClassName:
 
(void) - setDisplayName:
 
(void) - setScanDescription:
 
(NSString *) - identFromShip:
 
(BOOL) - hasRole:
 
(OORoleSet *) - roleSet
 
(void) - addRole:
 
(void) - addRole:withProbability:
 
(void) - removeRole:
 
(NSString *) - primaryRole
 
(void) - setPrimaryRole:
 
(BOOL) - hasPrimaryRole:
 
(BOOL) - isPolice
 
(BOOL) - isThargoid
 
(BOOL) - isTrader
 
(BOOL) - isPirate
 
(BOOL) - isMissile
 
(BOOL) - isMine
 
(BOOL) - isWeapon
 
(BOOL) - isEscort
 
(BOOL) - isShuttle
 
(BOOL) - isTurret
 
(BOOL) - isPirateVictim
 
(BOOL) - isExplicitlyUnpiloted
 
(BOOL) - isUnpiloted
 
(OOAlertCondition- alertCondition
 
(OOAlertCondition- realAlertCondition
 
(BOOL) - hasHostileTarget
 
(BOOL) - isHostileTo:
 
(NSUInteger) - defenseTargetCount
 
(NSArray *) - allDefenseTargets
 
(NSEnumerator *) - defenseTargetEnumerator
 
(void) - validateDefenseTargets
 
(BOOL) - addDefenseTarget:
 
(BOOL) - isDefenseTarget:
 
(void) - removeDefenseTarget:
 
(void) - removeAllDefenseTargets
 
(NSArray *) - collisionExceptions
 
(void) - addCollisionException:
 
(void) - removeCollisionException:
 
(BOOL) - collisionExceptedFor:
 
(GLfloat) - weaponRange
 
(void) - setWeaponRange:
 
(void) - setWeaponDataFromType:
 
(float) - energyRechargeRate
 
(float) - weaponRechargeRate
 
(void) - setWeaponRechargeRate:
 
(void) - setWeaponEnergy:
 
(OOWeaponFacing- currentWeaponFacing
 
(GLfloat) - scannerRange
 
(void) - setScannerRange:
 
(Vector) - reference
 
(void) - setReference:
 
(BOOL) - reportAIMessages
 
(void) - setReportAIMessages:
 
(void) - transitionToAegisNone
 
(OOPlanetEntity *) - findNearestPlanet
 
(Entity< OOStellarBody > *) - findNearestStellarBody
 
(OOPlanetEntity *) - findNearestPlanetExcludingMoons
 
(OOAegisStatus- checkForAegis
 
(void) - forceAegisCheck
 
(BOOL) - withinStationAegis
 
(void) - setLastAegisLock:
 
(OOSystemID- homeSystem
 
(OOSystemID- destinationSystem
 
(void) - setHomeSystem:
 
(void) - setDestinationSystem:
 
(NSArray *) - crew
 
(NSArray *) - crewForScripting
 
(void) - setCrew:
 
(void) - setSingleCrewWithRole:
 
(OOFuelQuantity- fuel
 
(void) - setFuel:
 
(OOFuelQuantity- fuelCapacity
 
(GLfloat) - fuelChargeRate
 
(void) - setRoll:
 
(void) - setRawRoll:
 
(void) - setPitch:
 
(void) - setYaw:
 
(void) - setThrust:
 
(void) - applySticks:
 
(void) - setThrustForDemo:
 
(void) - setBounty:
 
(void) - setBounty:withReason:
 
(void) - setBounty:withReasonAsString:
 
(OOCreditsQuantity- bounty
 
(int- legalStatus
 
(BOOL) - isTemplateCargoPod
 
(void) - setUpCargoType:
 
(void) - setCommodity:andAmount:
 
(void) - setCommodityForPod:andAmount:
 
(OOCommodityType- commodityType
 
(OOCargoQuantity- commodityAmount
 
(OOCargoQuantity- maxAvailableCargoSpace
 
(void) - setMaxAvailableCargoSpace:
 
(OOCargoQuantity- availableCargoSpace
 
(OOCargoQuantity- cargoQuantityOnBoard
 
(OOCargoType- cargoType
 
(NSArray *) - cargoListForScripting
 
(NSMutableArray *) - cargo
 
(void) - setCargo:
 
(BOOL) - addCargo:
 
(BOOL) - removeCargo:amount:
 
(BOOL) - showScoopMessage
 
(NSArray *) - passengerListForScripting
 
(NSArray *) - parcelListForScripting
 
(NSArray *) - contractListForScripting
 
(NSArray *) - equipmentListForScripting
 
(OOWeaponType- weaponTypeIDForFacing:strict:
 
(OOEquipmentType *) - weaponTypeForFacing:strict:
 
(NSArray *) - missilesList
 
(OOCargoFlag- cargoFlag
 
(void) - setCargoFlag:
 
(void) - setSpeed:
 
(double) - desiredSpeed
 
(void) - setDesiredSpeed:
 
(double) - desiredRange
 
(void) - setDesiredRange:
 
(double) - cruiseSpeed
 
(Vector) - thrustVector
 
(void) - setTotalVelocity:
 
(void) - increase_flight_speed:
 
(void) - decrease_flight_speed:
 
(void) - increase_flight_roll:
 
(void) - decrease_flight_roll:
 
(void) - increase_flight_pitch:
 
(void) - decrease_flight_pitch:
 
(void) - increase_flight_yaw:
 
(void) - decrease_flight_yaw:
 
(GLfloat) - flightRoll
 
(GLfloat) - flightPitch
 
(GLfloat) - flightYaw
 
(GLfloat) - flightSpeed
 
(GLfloat) - maxFlightPitch
 
(GLfloat) - maxFlightSpeed
 
(GLfloat) - maxFlightRoll
 
(GLfloat) - maxFlightYaw
 
(GLfloat) - speedFactor
 
(GLfloat) - temperature
 
(void) - setTemperature:
 
(GLfloat) - heatInsulation
 
(void) - setHeatInsulation:
 
(float) - randomEjectaTemperature
 
(float) - randomEjectaTemperatureWithMaxFactor:
 
(int- damage
 
(void) - dealEnergyDamage:atRange:withBias:
 
(void) - dealEnergyDamageWithinDesiredRange
 
(void) - dealMomentumWithinDesiredRange:
 
(void) - noteKilledBy:damageType:
 
(void) - getDestroyedBy:damageType:
 
(void) - becomeExplosion
 
(void) - becomeLargeExplosion:
 
(void) - becomeEnergyBlast
 
(void) - broadcastEnergyBlastImminent
 
(void) - setIsWreckage:
 
(BOOL) - showDamage
 
(Vector) - positionOffsetForAlignment:
 
(Vector) - positionOffsetForShipInRotationToAlignment
 
(void) - collectBountyFor:
 
(BoundingBox) - findSubentityBoundingBox
 
(Triangle) - absoluteIJKForSubentity
 
(GLfloat) - weaponRecoveryTime
 
(GLfloat) - laserHeatLevel
 
(GLfloat) - laserHeatLevelAft
 
(GLfloat) - laserHeatLevelForward
 
(GLfloat) - laserHeatLevelPort
 
(GLfloat) - laserHeatLevelStarboard
 
(GLfloat) - hullHeatLevel
 
(GLfloat) - entityPersonality
 
(GLint) - entityPersonalityInt
 
(void) - setEntityPersonalityInt:
 
(void) - setSuppressExplosion:
 
(void) - resetExhaustPlumes
 
(void) - removeExhaust:
 
(void) - removeFlasher:
 
(void) - checkScanner
 
(void) - checkScannerIgnoringUnpowered
 
(ShipEntity **) - scannedShips
 
(int- numberOfScannedShips
 
(Entity *) - foundTarget
 
(Entity *) - primaryAggressor
 
(Entity *) - lastEscortTarget
 
(Entity *) - thankedShip
 
(Entity *) - rememberedShip
 
(Entity *) - proximityAlert
 
(void) - setFoundTarget:
 
(void) - setPrimaryAggressor:
 
(void) - setLastEscortTarget:
 
(void) - setThankedShip:
 
(void) - setRememberedShip:
 
(void) - setProximityAlert:
 
(void) - setTargetStation:
 
(BOOL) - isValidTarget:
 
(void) - addTarget:
 
(void) - removeTarget:
 
(BOOL) - canStillTrackPrimaryTarget
 
(id) - primaryTarget
 
(id) - primaryTargetWithoutValidityCheck
 
(StationEntity *) - targetStation
 
(BOOL) - isFriendlyTo:
 
(ShipEntity *) - shipHitByLaser
 
(void) - noteLostTarget
 
(void) - noteLostTargetAndGoIdle
 
(void) - noteTargetDestroyed:
 
(OOBehaviour- behaviour
 
(void) - setBehaviour:
 
(void) - trackOntoTarget:withDForward:
 
(double) - ballTrackLeadingTarget:atTarget:
 
(GLfloat) - rollToMatchUp:rotating:
 
(GLfloat) - rangeToDestination
 
(double) - trackDestination:delta_t:
 
(void) - setCoordinate:
 
(HPVector) - coordinates
 
(HPVector) - destination
 
(HPVector) - distance_six:
 
(HPVector) - distance_twelve:withOffset:
 
(void) - setEvasiveJink:
 
(void) - evasiveAction:
 
(double) - trackPrimaryTarget:delta_t:
 
(double) - trackSideTarget:delta_t:
 
(double) - missileTrackPrimaryTarget:
 
(double) - rangeToPrimaryTarget
 
(double) - approachAspectToPrimaryTarget
 
(double) - rangeToSecondaryTarget:
 
(BOOL) - hasProximityAlertIgnoringTarget:
 
(GLfloat) - currentAimTolerance
 
(GLfloat) - lookingAtSunWithThresholdAngleCos:
 
(BOOL) - onTarget:withWeapon:
 
(OOTimeDelta- shotTime
 
(void) - resetShotTime
 
(BOOL) - fireMainWeapon:
 
(BOOL) - fireAftWeapon:
 
(BOOL) - firePortWeapon:
 
(BOOL) - fireStarboardWeapon:
 
(BOOL) - fireTurretCannon:
 
(void) - setLaserColor:
 
(void) - setExhaustEmissiveColor:
 
(OOColor *) - laserColor
 
(OOColor *) - exhaustEmissiveColor
 
(BOOL) - fireSubentityLaserShot:
 
(BOOL) - fireDirectLaserShot:
 
(BOOL) - fireDirectLaserDefensiveShot
 
(BOOL) - fireDirectLaserShotAt:
 
(NSArray *) - laserPortOffset:
 
(BOOL) - fireLaserShotInDirection:weaponIdentifier:
 
(void) - adjustMissedShots:
 
(int- missedShots
 
(void) - considerFiringMissile:
 
(Vector) - missileLaunchPosition
 
(ShipEntity *) - fireMissile
 
(ShipEntity *) - fireMissileWithIdentifier:andTarget:
 
(BOOL) - isMissileFlagSet
 
(void) - setIsMissileFlag:
 
(OOTimeDelta- missileLoadTime
 
(void) - setMissileLoadTime:
 
(void) - noticeECM
 
(BOOL) - fireECM
 
(BOOL) - cascadeIfAppropriateWithDamageAmount:cascadeOwner:
 
(BOOL) - activateCloakingDevice
 
(void) - deactivateCloakingDevice
 
(BOOL) - launchCascadeMine
 
(ShipEntity *) - launchEscapeCapsule
 
(OOCommodityType- dumpCargo
 
(ShipEntity *) - dumpCargoItem:
 
(OOCargoType- dumpItem:
 
(void) - manageCollisions
 
(BOOL) - collideWithShip:
 
(void) - adjustVelocity:
 
(void) - addImpactMoment:fraction:
 
(BOOL) - canScoop:
 
(void) - getTractoredBy:
 
(void) - scoopIn:
 
(void) - scoopUp:
 
(void) - scoopUpProcess:processEvents:processMessages:
 
(BOOL) - abandonShip
 
(void) - takeScrapeDamage:from:
 
(void) - takeHeatDamage:
 
(void) - enterDock:
 
(void) - leaveDock:
 
(void) - enterWormhole:
 
(void) - enterWormhole:replacing:
 
(void) - enterWitchspace
 
(void) - leaveWitchspace
 
(BOOL) - witchspaceLeavingEffects
 
(void) - markAsOffender:
 
(void) - markAsOffender:withReason:
 
(void) - switchLightsOn
 
(void) - switchLightsOff
 
(BOOL) - lightsActive
 
(void) - setDestination:
 
(void) - setEscortDestination:
 
(BOOL) - canAcceptEscort:
 
(BOOL) - acceptAsEscort:
 
(void) - deployEscorts
 
(void) - dockEscorts
 
(void) - setTargetToNearestFriendlyStation
 
(void) - setTargetToNearestStation
 
(void) - setTargetToSystemStation
 
(void) - landOnPlanet:
 
(void) - abortDocking
 
(NSDictionary *) - dockingInstructions
 
(void) - broadcastThargoidDestroyed
 
(void) - broadcastHitByLaserFrom:
 
(GLfloat) - sunGlareFilter
 
(void) - setSunGlareFilter:
 
(void) - sendExpandedMessage:toShip:
 
(void) - sendMessage:toShip:withUnpilotedOverride:
 
(void) - broadcastAIMessage:
 
(void) - broadcastMessage:withUnpilotedOverride:
 
(void) - setCommsMessageColor
 
(void) - receiveCommsMessage:from:
 
(void) - commsMessage:withUnpilotedOverride:
 
(BOOL) - markedForFines
 
(BOOL) - markForFines
 
(BOOL) - isMining
 
(void) - spawn:
 
(int- checkShipsInVicinityForWitchJumpExit
 
(BOOL) - trackCloseContacts
 
(void) - setTrackCloseContacts:
 
(void) - setHulk:
 
(BOOL) - isHulk
 
(OOJSScript *) - script
 
(NSDictionary *) - scriptInfo
 
(void) - overrideScriptInfo:
 
(BOOL) - scriptedMisjump
 
(void) - setScriptedMisjump:
 
(GLfloat) - scriptedMisjumpRange
 
(void) - setScriptedMisjumpRange:
 
(Entity *) - entityForShaderProperties
 
(void) - setDemoShip:
 
(BOOL) - isDemoShip
 
(void) - setDemoStartTime:
 
(void) - doScriptEvent:
 
(void) - doScriptEvent:withArgument:
 
(void) - doScriptEvent:withArgument:andArgument:
 
(void) - doScriptEvent:withArguments:
 
(void) - doScriptEvent:withArguments:count:
 
(void) - doScriptEvent:inContext:withArguments:count:
 
(void) - reactToAIMessage:context:
 
(void) - sendAIMessage:
 
(void) - doScriptEvent:andReactToAIMessage:
 
(void) - doScriptEvent:withArgument:andReactToAIMessage:
 
(id) - init [implementation]
 
(id) - initBypassForPlayer [implementation]
 
(NSString *) - repeatString:times: [implementation]
 
(BOOL) - setUpOneSubentity: [implementation]
 
(BOOL) - setUpOneFlasher: [implementation]
 
(NSString *) - descriptionComponents [implementation]
 
(NSString *) - shortDescriptionComponents [implementation]
 
(BoundingBox) - findBoundingBoxRelativeToPosition:InVectors:_i:_j: [implementation]
 
(void) - wasAddedToUniverse [implementation]
 
(void) - wasRemovedFromUniverse [implementation]
 
(NSString *) - beaconCode [implementation]
 
(void) - setBeaconCode: [implementation]
 
(NSString *) - beaconLabel [implementation]
 
(void) - setBeaconLabel: [implementation]
 
(BOOL) - isVisible [implementation]
 
(BOOL) - isBeacon [implementation]
 
(id< OOHUDBeaconIcon >) - beaconDrawable [implementation]
 
(Entity< OOBeaconEntity > *) - prevBeacon [implementation]
 
(Entity< OOBeaconEntity > *) - nextBeacon [implementation]
 
(void) - setPrevBeacon: [implementation]
 
(void) - setNextBeacon: [implementation]
 
(void) - setUpMixedEscorts [implementation]
 
(void) - setUpOneEscort:inGroup:withRole:atPosition:andCount: [implementation]
 
(OOScanClass- scanClass [implementation]
 
(BOOL) - canCollide [implementation]
 
(ShipEntity *) - doOctreesCollide [implementation]
 
(BOOL) - checkCloseCollisionWith: [implementation]
 
(void) - addSubentityToCollisionRadius: [implementation]
 
(ShipEntity *) - launchPodWithCrew: [implementation]
 
(BOOL) - validForAddToUniverse [implementation]
 
(void) - noteFrustration: [implementation]
 
(OOEquipmentType *) - generateMissileEquipmentTypeFrom: [implementation]
 
(OOEquipmentType *) - verifiedMissileTypeFromRole: [implementation]
 
(void) - drawDebugStuff [implementation]
 
(void) - drawSubEntityImmediate:translucent: [implementation]
 
(BOOL) - isJammingScanning [implementation]
 
(void) - addSubEntity: [implementation]
 
(void) - setOwner: [implementation]
 
(void) - orientationChanged [implementation]
 
(void) - applyRoll:andClimb: [implementation]
 
(void) - applyRoll:climb:andYaw: [implementation]
 
(OOShipGroup *) - rawEscortGroup [implementation]
 
(NSComparisonResult) - ComparePlanetsBySurfaceDistance [implementation]
 
(Entity< OOStellarBody > *) - lastAegisLock [implementation]
 
(void) - setStatus: [implementation]
 
(void) - rescaleBy: [implementation]
 
(void) - rescaleBy:writeToCache: [implementation]
 
(void) - releaseCargoPodsDebris [implementation]
 
(void) - subEntityDied: [implementation]
 
(void) - subEntityReallyDied: [implementation]
 
(NSComparisonResult) - compareBeaconCodeWith: [implementation]
 
(uint32_t) - randomSeedForShaders [implementation]
 
(void) - setShipHitByLaser: [implementation]
 
(BOOL) - fireWeapon:direction:range: [implementation]
 
(void) - throwSparks [implementation]
 
(Vector) - velocity [implementation]
 
(void) - suppressTargetLost [implementation]
 
(void) - refreshEscortPositions [implementation]
 
(HPVector) - coordinatesForEscortPosition: [implementation]
 
(void) - setTargetToNearestStationIncludingHostiles: [implementation]
 
(BoundingBox) - findBoundingBoxRelativeTo:InVectors:_i:_j: [implementation]
 
(void) - dumpSelfState [implementation]
 
(OOTimeAbsolute- getDemoStartTime [implementation]
 
(void) - doNothing [implementation]
 
(NSString *) - descriptionForObjDump [implementation]
 
(void) - setAITo:
 
(void) - setAIScript:
 
(void) - switchAITo:
 
(void) - scanForHostiles
 
(BOOL) - performHyperSpaceToSpecificSystem:
 
(void) - scanForNearestIncomingMissile
 
(void) - enterTargetWormhole
 
(void) - enterPlayerWormhole
 
(void) - wormholeEscorts
 
(void) - wormholeEntireGroup
 
(BOOL) - suggestEscortTo:
 
(void) - groupAttackTarget
 
(void) - performAttack
 
(void) - performCollect
 
(void) - performEscort
 
(void) - performFaceDestination
 
(void) - performFlee
 
(void) - performFlyToRangeFromDestination
 
(void) - performHold
 
(void) - performIdle
 
(void) - performIntercept
 
(void) - performLandOnPlanet
 
(void) - performMining
 
(void) - performScriptedAI
 
(void) - performScriptedAttackAI
 
(void) - performStop
 
(void) - performTumble
 
(void) - broadcastDistressMessage
 
(void) - broadcastDistressMessageWithDumping:
 
(void) - requestDockingCoordinates
 
(void) - recallDockingInstructions
 
(void) - performBuoyTumble [implementation]
 
(NSDictionary *) - savedShipDictionaryWithContext:
 
(void) - simplifyShipdata:andGetDeletes: [implementation]
 
(void) - checkFoundTarget [implementation]
 
(BOOL) - performHyperSpaceExitReplace: [implementation]
 
(BOOL) - performHyperSpaceExitReplace:toSystem: [implementation]
 
(void) - scanForNearestShipWithPredicate:parameter: [implementation]
 
(void) - scanForNearestShipWithNegatedPredicate:parameter: [implementation]
 
(void) - acceptDistressMessageFrom: [implementation]
 
(BOOL) - launchPatrol [implementation]
 
(BOOL) - inspHasSecondaryIdentityLine [implementation]
 
(NSString *) - inspSecondaryIdentityLine [implementation]
 
(NSString *) - inspDescription [implementation]
 
(NSString *) - inspTargetLine [implementation]
 
(BOOL) - inspCanBecomeTarget [implementation]
 
(void) - inspBecomeTarget [implementation]
 
(NSArray *) - subEntitiesForScript
 
(void) - setTargetForScript:
 
(BOOL) - isVisibleToScripts [implementation]
 
(NSArray *) - debugInspectorModules [implementation]
 
(void) - setStateTo: [implementation]
 
(void) - pauseAI: [implementation]
 
(void) - randomPauseAI: [implementation]
 
(void) - dropMessages: [implementation]
 
(void) - debugDumpPendingMessages [implementation]
 
(void) - setDestinationToCurrentLocation [implementation]
 
(void) - setDesiredRangeTo: [implementation]
 
(void) - setDesiredRangeForWaypoint [implementation]
 
(void) - setSpeedTo: [implementation]
 
(void) - setSpeedFactorTo: [implementation]
 
(void) - setSpeedToCruiseSpeed [implementation]
 
(void) - setThrustFactorTo: [implementation]
 
(void) - setTargetToPrimaryAggressor [implementation]
 
(void) - scanForNearestMerchantman [implementation]
 
(void) - scanForRandomMerchantman [implementation]
 
(void) - scanForLoot [implementation]
 
(void) - scanForRandomLoot [implementation]
 
(void) - setTargetToFoundTarget [implementation]
 
(void) - checkForFullHold [implementation]
 
(void) - getWitchspaceEntryCoordinates [implementation]
 
(void) - setDestinationFromCoordinates [implementation]
 
(void) - setCoordinatesFromPosition [implementation]
 
(void) - fightOrFleeMissile [implementation]
 
(void) - setCourseToPlanet [implementation]
 
(void) - setTakeOffFromPlanet [implementation]
 
(void) - landOnPlanet [implementation]
 
(void) - checkTargetLegalStatus [implementation]
 
(void) - checkOwnLegalStatus [implementation]
 
(void) - exitAIWithMessage: [implementation]
 
(void) - setDestinationToTarget [implementation]
 
(void) - setDestinationWithinTarget [implementation]
 
(void) - checkCourseToDestination [implementation]
 
(void) - checkAegis [implementation]
 
(void) - checkEnergy [implementation]
 
(void) - checkHeatInsulation [implementation]
 
(void) - scanForOffenders [implementation]
 
(void) - setCourseToWitchpoint [implementation]
 
(void) - setDestinationToWitchpoint [implementation]
 
(void) - setDestinationToStationBeacon [implementation]
 
(void) - performHyperSpaceExit [implementation]
 
(void) - performHyperSpaceExitWithoutReplacing [implementation]
 
(void) - wormholeGroup [implementation]
 
(void) - commsMessage: [implementation]
 
(void) - commsMessageByUnpiloted: [implementation]
 
(void) - ejectCargo [implementation]
 
(void) - scanForThargoid [implementation]
 
(void) - scanForNonThargoid [implementation]
 
(void) - thargonCheckMother [implementation]
 
(void) - becomeUncontrolledThargon [implementation]
 
(void) - checkDistanceTravelled [implementation]
 
(void) - fightOrFleeHostiles [implementation]
 
(void) - suggestEscort [implementation]
 
(void) - escortCheckMother [implementation]
 
(void) - checkGroupOddsVersusTarget [implementation]
 
(void) - scanForFormationLeader [implementation]
 
(void) - messageMother: [implementation]
 
(void) - setPlanetPatrolCoordinates [implementation]
 
(void) - setSunSkimStartCoordinates [implementation]
 
(void) - setSunSkimEndCoordinates [implementation]
 
(void) - setSunSkimExitCoordinates [implementation]
 
(void) - patrolReportIn [implementation]
 
(void) - checkForMotherStation [implementation]
 
(void) - sendTargetCommsMessage: [implementation]
 
(void) - markTargetForFines [implementation]
 
(void) - markTargetForOffence: [implementation]
 
(void) - storeTarget [implementation]
 
(void) - recallStoredTarget [implementation]
 
(void) - scanForRocks [implementation]
 
(void) - setDestinationToDockingAbort [implementation]
 
(void) - requestNewTarget [implementation]
 
(void) - rollD: [implementation]
 
(void) - scanForNearestShipWithPrimaryRole: [implementation]
 
(void) - scanForNearestShipHavingRole: [implementation]
 
(void) - scanForNearestShipWithAnyPrimaryRole: [implementation]
 
(void) - scanForNearestShipHavingAnyRole: [implementation]
 
(void) - scanForNearestShipWithScanClass: [implementation]
 
(void) - scanForNearestShipWithoutPrimaryRole: [implementation]
 
(void) - scanForNearestShipNotHavingRole: [implementation]
 
(void) - scanForNearestShipWithoutAnyPrimaryRole: [implementation]
 
(void) - scanForNearestShipNotHavingAnyRole: [implementation]
 
(void) - scanForNearestShipWithoutScanClass: [implementation]
 
(void) - setCoordinates: [implementation]
 
(void) - checkForNormalSpace [implementation]
 
(void) - setTargetToRandomStation [implementation]
 
(void) - setTargetToLastStation [implementation]
 
(void) - addFuel: [implementation]
 
(void) - scriptActionOnTarget: [implementation]
 
(void) - sendScriptMessage: [implementation]
 
(void) - ai_throwSparks [implementation]
 
(void) - explodeSelf [implementation]
 
(void) - ai_debugMessage: [implementation]
 
(void) - targetFirstBeaconWithCode: [implementation]
 
(void) - targetNextBeaconWithCode: [implementation]
 
(void) - setRacepointsFromTarget [implementation]
 
(void) - performFlyRacepoints [implementation]
 
(void) - addPrimaryAggressorAsDefenseTarget [implementation]
 
(void) - addFoundTargetAsDefenseTarget [implementation]
 
(void) - findNewDefenseTarget [implementation]
 
(void) - setDestinationToJinkPosition [implementation]
 
(void) - disengageAutopilot [implementation]
 
(void) - messageSelf: [implementation]
 
(void) - scanForNearestShipMatchingPredicate: [implementation]
 
(void) - safeScriptActionOnTarget: [implementation]
 
(ShipEntity *) - ejectShipOfType:
 
(ShipEntity *) - ejectShipOfRole:
 
(NSArray *) - spawnShipsWithRole:count:
 
(BOOL) - isShipWithSubEntityShip: [implementation]
 
- Instance Methods inherited from OOEntityWithDrawable
(OODrawable *) - drawable
 
(void) - setDrawable:
 
(double) - findCollisionRadius [implementation]
 
(NSSet *) - allTextures [implementation]
 
- Instance Methods inherited from Entity
(NSUInteger) - sessionID
 
(BOOL) - isShip
 
(BOOL) - isStation
 
(BOOL) - isSubEntity
 
(BOOL) - isPlayer
 
(BOOL) - isPlanet
 
(BOOL) - isSun
 
(BOOL) - isSunlit
 
(BOOL) - isStellarObject
 
(BOOL) - isSky
 
(BOOL) - isWormhole
 
(BOOL) - isEffect
 
(BOOL) - isVisualEffect
 
(BOOL) - isWaypoint
 
(void) - addToLinkedLists
 
(void) - removeFromLinkedLists
 
(void) - updateLinkedLists
 
(void) - warnAboutHostiles
 
(CollisionRegion *) - collisionRegion
 
(void) - setCollisionRegion:
 
(void) - setUniversalID:
 
(OOUniversalID- universalID
 
(BOOL) - throwingSparks
 
(void) - setThrowSparks:
 
(id) - owner
 
(ShipEntity *) - parentEntity
 
(ShipEntity *) - rootShipEntity
 
(void) - setPosition:
 
(void) - setPositionX:y:z:
 
(HPVector) - position
 
(Vector) - cameraRelativePosition
 
(GLfloat) - cameraRangeFront
 
(GLfloat) - cameraRangeBack
 
(void) - updateCameraRelativePosition
 
(Vector) - vectorTo:
 
(HPVector) - absolutePositionForSubentity
 
(HPVector) - absolutePositionForSubentityOffset:
 
(double) - zeroDistance
 
(double) - camZeroDistance
 
(NSComparisonResult) - compareZeroDistance:
 
(BoundingBox) - boundingBox
 
(GLfloat) - mass
 
(Quaternion) - orientation
 
(void) - setOrientation:
 
(Quaternion) - normalOrientation
 
(void) - setNormalOrientation:
 
(void) - setVelocity:
 
(double) - speed
 
(GLfloat) - distanceTravelled
 
(void) - setDistanceTravelled:
 
(OOEntityStatus- status
 
(void) - setScanClass:
 
(void) - setEnergy:
 
(GLfloat) - energy
 
(void) - setMaxEnergy:
 
(GLfloat) - maxEnergy
 
(void) - moveForward:
 
(OOMatrix) - rotationMatrix
 
(OOMatrix) - drawRotationMatrix
 
(OOMatrix) - transformationMatrix
 
(OOMatrix) - drawTransformationMatrix
 
(GLfloat) - collisionRadius
 
(void) - setCollisionRadius:
 
(NSMutableArray *) - collisionArray
 
(void) - applyVelocity:
 
(void) - dumpState
 
(BOOL) - isInSpace
 
(BOOL) - isImmuneToBreakPatternHide
 
(GLfloat) - universalTime
 
(GLfloat) - spawnTime
 
(GLfloat) - timeElapsedSinceSpawn
 
(void) - setAtmosphereFogging:
 
(OOColor *) - fogUniform
 
(NSString *) - descriptionForObjDumpBasic
 
(BOOL) - checkLinkedLists [implementation]
 
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
 
(Vector) - relativePosition [implementation]
 
(BOOL) - isBreakPattern
 
(void) - inspect [implementation]
 
(BOOL) - isECMBlast
 
(NSString *) - inspScanClassLine
 
(NSString *) - inspStatusLine
 
(NSString *) - inspRetainCountLine
 
(NSString *) - inspPositionLine
 
(NSString *) - inspVelocityLine
 
(NSString *) - inspOrientationLine
 
(NSString *) - inspEnergyLine
 
(NSString *) - inspOwnerLine
 
(NSString *) - inspBasicIdentityLine [implementation]
 
(BOOL) - isExhaust
 
(BOOL) - isFlasher
 
(void) - deleteJSSelf
 
(jsval) - oo_jsValueInContext: [implementation]
 
(BOOL) - isCascadeWeapon
 
(BOOL) - isPlayerLikeShip
 
(GLfloat) - clock [implementation]
 
(unsigned) - pseudoFixedD100 [implementation]
 
(unsigned) - pseudoFixedD256 [implementation]
 
(unsigned) - systemGovernment [implementation]
 
(unsigned) - systemEconomy [implementation]
 
(unsigned) - systemTechLevel [implementation]
 
(unsigned) - systemPopulation [implementation]
 
(unsigned) - systemProductivity [implementation]
 
- Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
 
(id) - weakRetain [implementation]
 
(void) - weakRefDied: [implementation]
 
- Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED
 
- Instance Methods inherited from <OOSubEntity>
- Instance Methods inherited from <OOBeaconEntity>

Private Attributes

NSMutableDictionary * shipsOnApproach
 
NSMutableArray * launchQueue
 
double last_launch_time
 
ShipEntityid_lock [MAX_DOCKING_STAGES]
 
Vector port_dimensions
 
double port_corridor
 
BOOL no_docking_while_launching
 
BOOL allow_launching
 
BOOL allow_docking
 
BOOL disallowed_docking_collides
 
BOOL virtual_dock
 

Additional Inherited Members

- Class Methods inherited from ShipEntity
(static BOOL) + IsBehaviourHostile [implementation]
 
(static float) + SurfaceDistanceSqaredV [implementation]
 
(static float) + SurfaceDistanceSqared [implementation]
 
(static BOOL) + AuthorityPredicate [implementation]
 
(id) + shipRestoredFromDictionary:useFallback:context:
 
- Public Attributes inherited from ShipEntity
OOTimeDelta shot_time
 
Vector v_forward
 
Vector v_up
 
Vector v_right
 
HPVector _destination
 
GLfloat desired_range
 
GLfloat desired_speed
 
GLfloat stick_roll
 
GLfloat stick_pitch
 
GLfloat stick_yaw
 
OOBehaviour behaviour
 
BoundingBox totalBoundingBox
 
- Public Attributes inherited from Entity
OOUniversalID universalID
 
unsigned isShip: 1
 
unsigned isStation: 1
 
unsigned isPlayer: 1
 
unsigned isWormhole: 1
 
unsigned isSubEntity: 1
 
unsigned hasMoved: 1
 
unsigned hasRotated: 1
 
unsigned hasCollided: 1
 
unsigned isSunlit: 1
 
unsigned collisionTestFilter: 2
 
unsigned throw_sparks: 1
 
unsigned isImmuneToBreakPatternHide: 1
 
unsigned isExplicitlyNotMainStation: 1
 
unsigned isVisualEffect: 1
 
OOScanClass scanClass
 
GLfloat zero_distance
 
GLfloat cam_zero_distance
 
GLfloat no_draw_distance
 
GLfloat collision_radius
 
HPVector position
 
Vector cameraRelativePosition
 
Quaternion orientation
 
OOColoratmosphereFogging
 
int zero_index
 
Entityx_previous
 
Entityx_next
 
Entityy_previous
 
Entityy_next
 
Entityz_previous
 
Entityz_next
 
Entitycollision_chain
 
OOUniversalID shadingEntityID
 
Entitycollider
 
CollisionRegioncollisionRegion
 
- Protected Attributes inherited from ShipEntity
NSDictionary * shipinfoDictionary
 
Quaternion subentityRotationalVelocity
 
OOJSScriptscript
 
OOJSScriptaiScript
 
OOTimeAbsolute aiScriptWakeTime
 
NSDictionary * dockingInstructions
 
OOColorlaser_color
 
OOColordefault_laser_color
 
OOColorexhaust_emissive_color
 
OOColorscanner_display_color1
 
OOColorscanner_display_color2
 
OOColorscanner_display_color_hostile1
 
OOColorscanner_display_color_hostile2
 
GLfloat maxFlightSpeed
 
GLfloat max_flight_roll
 
GLfloat max_flight_pitch
 
GLfloat max_flight_yaw
 
GLfloat cruiseSpeed
 
GLfloat max_thrust
 
GLfloat thrust
 
float hyperspaceMotorSpinTime
 
unsigned military_jammer_active: 1
 
unsigned docking_match_rotation: 1
 
unsigned pitching_over: 1
 
unsigned rolling_over: 1
 
unsigned reportAIMessages: 1
 
unsigned being_mined: 1
 
unsigned being_fined: 1
 
unsigned isHulk: 1
 
unsigned trackCloseContacts: 1
 
unsigned isNearPlanetSurface: 1
 
unsigned isFrangible: 1
 
unsigned cloaking_device_active: 1
 
unsigned cloakPassive: 1
 
unsigned cloakAutomatic: 1
 
unsigned canFragment: 1
 
unsigned isWreckage: 1
 
unsigned _showDamage: 1
 
unsigned suppressExplosion: 1
 
unsigned suppressAegisMessages: 1
 
unsigned isMissile: 1
 
unsigned _explicitlyUnpiloted: 1
 
unsigned hasScoopMessage: 1
 
unsigned scripted_misjump: 1
 
unsigned haveExecutedSpawnAction: 1
 
unsigned haveStartedJSAI: 1
 
unsigned noRocks: 1
 
unsigned _lightsActive: 1
 
GLfloat _scriptedMisjumpRange
 
GLfloat sunGlareFilter
 
OOFuelQuantity fuel
 
GLfloat fuel_accumulator
 
GLfloat afterburner_rate
 
GLfloat afterburner_speed_factor
 
OOCargoQuantity likely_cargo
 
OOCargoQuantity max_cargo
 
OOCargoQuantity extra_cargo
 
OOCargoQuantity equipment_weight
 
OOCargoType cargo_type
 
OOCargoFlag cargo_flag
 
OOCreditsQuantity bounty
 
GLfloat energy_recharge_rate
 
OOWeaponFacingSet weapon_facings
 
OOWeaponType forward_weapon_type
 
OOWeaponType aft_weapon_type
 
OOWeaponType port_weapon_type
 
OOWeaponType starboard_weapon_type
 
GLfloat weapon_damage
 
GLfloat weapon_damage_override
 
GLfloat weaponRange
 
OOWeaponFacing currentWeaponFacing
 
GLfloat weapon_energy_use
 
GLfloat weapon_temp
 
GLfloat weapon_shot_temperature
 
GLfloat forward_weapon_temp
 
GLfloat aft_weapon_temp
 
GLfloat port_weapon_temp
 
GLfloat starboard_weapon_temp
 
GLfloat scannerRange
 
unsigned missiles
 
unsigned max_missiles
 
NSString * _missileRole
 
OOTimeDelta missile_load_time
 
OOTimeAbsolute missile_launch_time
 
AIshipAI
 
NSString * name
 
NSString * shipUniqueName
 
NSString * shipClassName
 
NSString * displayName
 
NSString * scan_description
 
OORoleSetroleSet
 
NSString * primaryRole
 
NSArray * explosionType
 
Vector jink
 
HPVector coordinates
 
Vector reference
 
NSUInteger _subIdx
 
NSUInteger _maxShipSubIdx
 
double launch_time
 
double launch_delay
 
OOUniversalID planetForLanding
 
GLfloat frustration
 
GLfloat success_factor
 
int patrol_counter
 
NSMutableDictionary * previousCondition
 
float weapon_recharge_rate
 
int shot_counter
 
OOTimeAbsolute cargo_dump_time
 
OOTimeAbsolute last_shot_time
 
NSMutableArray * cargo
 
OOCommodityType commodity_type
 
OOCargoQuantity commodity_amount
 
GLfloat flightSpeed
 
GLfloat flightRoll
 
GLfloat flightPitch
 
GLfloat flightYaw
 
GLfloat accuracy
 
GLfloat pitch_tolerance
 
GLfloat aim_tolerance
 
int _missed_shots
 
OOAegisStatus aegis_status
 
OOSystemID home_system
 
OOSystemID destination_system
 
double messageTime
 
double next_spark_time
 
Vector collision_vector
 
GLfloat _scaleFactor
 
BOOL _multiplyWeapons
 
NSArray * forwardWeaponOffset
 
NSArray * aftWeaponOffset
 
NSArray * portWeaponOffset
 
NSArray * starboardWeaponOffset
 
NSArray * crew
 
NSMutableDictionary * closeContactsInfo
 
NSString * lastRadioMessage
 
Vector tractor_position
 
float ship_temperature
 
ShipEntityscanned_ships [MAX_SCAN_NUMBER+1]
 
GLfloat distance2_scanned_ships [MAX_SCAN_NUMBER+1]
 
unsigned n_scanned_ships
 
HPVector navpoints [32]
 
unsigned next_navpoint_index
 
unsigned number_of_navpoints
 
Octreeoctree
 
OOBehaviour debugLastBehaviour
 
uint16_t entity_personality
 
NSDictionary * scriptInfo
 
NSMutableArray * subEntities
 
OOEquipmentTypemissile_list [SHIPENTITY_MAX_MISSILES]
 
OOWeakReference_primaryTarget
 
OOWeakReference_primaryAggressor
 
OOWeakReference_targetStation
 
OOWeakReference_foundTarget
 
OOWeakReference_lastEscortTarget
 
OOWeakReference_thankedShip
 
OOWeakReference_rememberedShip
 
OOWeakReference_proximityAlert
 
float reactionTime
 
HPVector trackingCurvePositions [4]
 
OOTimeAbsolute trackingCurveTimes [4]
 
HPVector trackingCurveCoeffs [3]
 
- Protected Attributes inherited from Entity
HPVector lastPosition
 
Quaternion lastOrientation
 
GLfloat distanceTravelled
 
OOMatrix rotMatrix
 
Vector velocity
 
GLfloat energy
 
GLfloat maxEnergy
 
BoundingBox boundingBox
 
GLfloat mass
 
NSMutableArray * collidingEntities
 
OOTimeAbsolute spawnTime
 
struct JSObject * _jsSelf
 
- Protected Attributes inherited from OOWeakRefObject
OOWeakReferenceweakSelf
 

Detailed Description

Definition at line 31 of file DockEntity.h.

Method Documentation

◆ abortAllDockings

- (void) abortAllDockings

Definition at line 1 of file DockEntity.m.

97{
98 double playerExtraTime = 0;
99
101
102 NSNumber *idObj = nil;
103 foreach (idObj, [shipsOnApproach allKeys])
104 {
105 ShipEntity *ship = [UNIVERSE entityForUniversalID:[idObj unsignedIntValue]];
106 if ([ship isShip])
107 {
108 [ship sendAIMessage:@"DOCKING_ABORTED"];
109 [ship doScriptEvent:OOJSID("stationWithdrewDockingClearance")];
110 }
111 }
112 [shipsOnApproach removeAllObjects];
113
114 PlayerEntity *player = PLAYER;
115 StationEntity *station = (StationEntity*)[self parentEntity];
116 BOOL isDockingStation = (station == [player getTargetDockStation]) && ([station playerReservedDock] == self);
117 if (isDockingStation && [player status] == STATUS_IN_FLIGHT &&
118 [player getDockingClearanceStatus] >= DOCKING_CLEARANCE_STATUS_REQUESTED)
119 {
120 if (HPmagnitude2(HPvector_subtract([player position], [self absolutePositionForSubentity])) > 2250000) // within 1500m of the dock
121 {
122 [station sendExpandedMessage:@"[station-docking-clearance-abort-cancelled]" toShip:player];
123 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
124 [player doScriptEvent:OOJSID("stationWithdrewDockingClearance")];
125 }
126 else
127 {
128 playerExtraTime = 10; // when very close to the port, give the player a few seconds to react on the abort message.
129 int seconds = round(playerExtraTime);
130 [station sendExpandedMessage:OOExpandKey(@"station-docking-clearance-abort-cancelled-in-time", seconds) toShip:player];
131 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_TIMING_OUT];
132 }
133
134 }
135
136 // mark docking queue flight pattern as clear
137 [self clearAllIdLocks];
138
139 last_launch_time = [UNIVERSE getTime] + playerExtraTime;
140}
return nil
@ DOCKING_CLEARANCE_STATUS_REQUESTED
Definition OOTypes.h:170
#define PLAYER
NSMutableDictionary * shipsOnApproach
Definition DockEntity.h:34
double last_launch_time
Definition DockEntity.h:36
BOOL no_docking_while_launching
Definition DockEntity.h:44
HPVector absolutePositionForSubentity()
Definition Entity.m:669
unsigned isShip
Definition Entity.h:91
OOEntityStatus status()
Definition Entity.m:793
HPVector position
Definition Entity.h:112
ShipEntity * parentEntity()
Definition Entity.m:589
StationEntity * getTargetDockStation()
void setDockingClearanceStatus:(OODockingClearanceStatus newValue)
void doScriptEvent:(jsid message)
void sendExpandedMessage:toShip:(NSString *message_text,[toShip] ShipEntity *other_ship)
void sendAIMessage:(NSString *message)

◆ abortAllLaunches

- (void) abortAllLaunches
implementation

Definition at line 1 of file DockEntity.m.

144{
146 [launchQueue removeAllObjects];
147}

◆ abortDockingForShip:

- (void) abortDockingForShip: (ShipEntity *) ship

Definition at line 1 of file DockEntity.m.

589 :(ShipEntity *)ship
590{
591 OOUniversalID ship_id = [ship universalID];
592 NSNumber *shipID = [NSNumber numberWithUnsignedShort:ship_id];
593
594 if ([shipsOnApproach objectForKey:shipID])
595 {
596 [shipsOnApproach removeObjectForKey:shipID];
597 }
598
599 if ([ship isPlayer])
600 {
601 PlayerEntity* player = PLAYER;
602 if ([player status] == STATUS_IN_FLIGHT &&
603 [player getDockingClearanceStatus] >= DOCKING_CLEARANCE_STATUS_REQUESTED)
604 {
605 if (HPmagnitude2(HPvector_subtract([player position], [self absolutePositionForSubentity])) > 2250000) // within 1500m of the dock
606 {
607 [[self parentEntity] sendExpandedMessage:@"[station-docking-clearance-abort-cancelled]" toShip:player];
608 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
609 }
610 else
611 {
612 int seconds = 10; // when very close to the port, give the player a few seconds to react on the abort message.
613 [[self parentEntity] sendExpandedMessage:OOExpandKey(@"station-docking-clearance-abort-cancelled-in-time", seconds) toShip:player];
614 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_TIMING_OUT];
615 }
616 }
617 }
618
619 // clear any previously owned docking stages
620 [self clearIdLocks:ship];
621}
uint16_t OOUniversalID
Definition OOTypes.h:189
OOUniversalID universalID
Definition Entity.h:89
unsigned isPlayer
Definition Entity.h:93

◆ addShipToLaunchQueue:withPriority:

- (void) addShipToLaunchQueue: (ShipEntity *) ship
withPriority: (BOOL) priority 

Definition at line 1 of file DockEntity.m.

865 :(ShipEntity *)ship withPriority:(BOOL)priority
866{
867 [self pruneAndCountShipsOnApproach];
868
869 if (ship == nil) return;
870
871 if (launchQueue == nil)
872 {
873 launchQueue = [[NSMutableArray alloc] init]; // retained
874 }
875
876 [ship setStatus:STATUS_DOCKED];
877 if (priority)
878 {
879 [launchQueue insertObject:ship atIndex:0];
880 }
881 else
882 {
883 [launchQueue addObject:ship];
884 }
885}
NSMutableArray * launchQueue
Definition DockEntity.h:35
void setStatus:(OOEntityStatus stat)

◆ addShipToShipsOnApproach:

- (void) addShipToShipsOnApproach: (ShipEntity *) ship
implementation

Provided by category DockEntity(OOPrivate).

Definition at line 1 of file DockEntity.m.

445 :(ShipEntity *) ship
446{
447 int corridor_distance[] = { -1, 1, 3, 5, 7, 9, 11, 12, 12};
448 int corridor_offset[] = { 0, 0, 0, 0, 0, 0, 1, 3, 12};
449 /* Eric's improvements to the docking flight code seem to have
450 * made it safer to go quite a bit faster here. With the increased
451 * numbers of ships which might need to dock at the main station,
452 * faster docking will help avoid massive queues. Previous speed
453 * was mostly 48 - CIM: 27/8/2013*/
454 int corridor_speed[] = { 96, 96, 128, 128, 96, 128, 128, 256, 512}; // how fast to approach the next point
455 int corridor_range[] = { 24, 12, 6, 4, 4, 6, 15, 38, 96}; // how close you have to get to the target point
456 int corridor_rotate[] = { 1, 1, 1, 1, 0, 0, 0, 0, 0}; // whether to match the station rotation
457 int corridor_count = 9;
458 int corridor_final_approach = 3;
459
460 NSNumber *shipID = [NSNumber numberWithUnsignedShort:[ship universalID]];
461 StationEntity *station = (StationEntity *)[self parentEntity];
462
464 HPVector temp = (fabs(launchVector.x) < 0.8)? make_HPvector(1,0,0) : make_HPvector(0,1,0);
465 temp = HPcross_product(launchVector, temp); // 90 deg to launchVector & temp
466 HPVector rightVector = HPcross_product(launchVector, temp);
467 HPVector upVector = HPcross_product(launchVector, rightVector);
468
469 // will select a direction for offset based on the entity personality (was ship ID)
470 int offset_id = [ship entityPersonalityInt] & 0xf; // 16 point compass
471 double c = cos(offset_id * M_PI * ONE_EIGHTH);
472 double s = sin(offset_id * M_PI * ONE_EIGHTH);
473
474 // test if this points at the ship
475 HPVector point1 = [self absolutePositionForSubentity];
476 point1.x += launchVector.x * corridor_offset[corridor_count - 1];
477 point1.y += launchVector.x * corridor_offset[corridor_count - 1];
478 point1.z += launchVector.x * corridor_offset[corridor_count - 1];
479 HPVector alt1 = point1;
480 point1.x += c * upVector.x * corridor_offset[corridor_count - 1] + s * rightVector.x * corridor_offset[corridor_count - 1];
481 point1.y += c * upVector.y * corridor_offset[corridor_count - 1] + s * rightVector.y * corridor_offset[corridor_count - 1];
482 point1.z += c * upVector.z * corridor_offset[corridor_count - 1] + s * rightVector.z * corridor_offset[corridor_count - 1];
483 alt1.x -= c * upVector.x * corridor_offset[corridor_count - 1] + s * rightVector.x * corridor_offset[corridor_count - 1];
484 alt1.y -= c * upVector.y * corridor_offset[corridor_count - 1] + s * rightVector.y * corridor_offset[corridor_count - 1];
485 alt1.z -= c * upVector.z * corridor_offset[corridor_count - 1] + s * rightVector.z * corridor_offset[corridor_count - 1];
486 if (HPdistance2(alt1, ship->position) < HPdistance2(point1, ship->position))
487 {
488 s = -s;
489 c = -c; // turn 180 degrees
490 }
491
492 //
493 NSMutableArray *coordinatesStack = [NSMutableArray arrayWithCapacity: MAX_DOCKING_STAGES];
494 float port_depth = port_dimensions.z; // 250m deep standard port.
495
496 int i;
497 for (i = corridor_count - 1; i >= 0; i--)
498 {
499 NSMutableDictionary *nextCoords = [NSMutableDictionary dictionaryWithCapacity:3];
500 int offset = corridor_offset[i];
501 float corridor_length = port_depth * corridor_distance[i];
502
503 float rx = s * port_depth * offset;
504 float ry = c * port_depth * offset;
505 float rz = corridor_length;
506 // if there are many ships on approach, randomise coordinates a bit
507 if ((i == corridor_count - 1) && [self countOfShipsInDockingQueue])
508 {
509 /* This used to try to just space the ships further out
510 * along the 16 approach lanes - this had various problems
511 * with putting ship coordinates on top of each other
512 * and/or spacing them out all the way back to the
513 * witchpoint. Instead, use a few more bits of
514 * entityPersonalityInt to shuffle the holding coordinates
515 * a bit more. It still doesn't guarantee two ships won't
516 * want the same space, but it makes it considerably more
517 * unlikely - I dropped 100 docking ships into the aegis
518 * at once, and they all got allocated positions far
519 * enough from the others to avoid collisions or near
520 * misses - CIM: 27 May 2014 */
521
522 int offset_id2 = ([ship entityPersonalityInt] & 0xf0)>>4; // 16 point compass
523 int offset_id3 = ([ship entityPersonalityInt] & 0xf00)>>8; // 16 point step position
524 float c2 = cos(offset_id2 * M_PI * ONE_EIGHTH);
525 float s2 = sin(offset_id2 * M_PI * ONE_EIGHTH);
526 float ssize = MAX(port_depth,1500.0);
527 rx += c2 * ssize;
528 ry += s2 * ssize;
529 rz += ssize * ((float)offset_id3 / 4.0);
530
531// OOLog(@"docking.debug",@"Adjusted coordinates by %f x %f x %f",c2 * ssize,s2 * ssize,ssize * ((float)offset_id3 / 4.0));
532 }
533
534 // add the lenght inside the station to the corridor, except for the final position, inside the dock.
535 if (corridor_distance[i] > 0) corridor_length += port_corridor;
536
537 [nextCoords oo_setInteger:corridor_count - i forKey:@"docking_stage"];
538 [nextCoords oo_setFloat:rx forKey:@"rx"];
539 [nextCoords oo_setFloat:ry forKey:@"ry"];
540 [nextCoords oo_setFloat:rz forKey:@"rz"];
541 [nextCoords oo_setFloat:corridor_speed[i] forKey:@"speed"];
542 [nextCoords oo_setFloat:corridor_range[i] forKey:@"range"];
543
544 if (corridor_rotate[i])
545 {
546 [nextCoords setObject:@"YES" forKey:@"match_rotation"];
547 }
548
549 if (i == corridor_final_approach)
550 {
551 if (station == [UNIVERSE station])
552 {
553 [nextCoords setObject:@"[station-begin-final-aproach]" forKey:@"comms_message"];
554 }
555 else
556 {
557 [nextCoords setObject:@"[docking-begin-final-aproach]" forKey:@"comms_message"];
558 }
559 }
560
561 [coordinatesStack addObject:nextCoords];
562 }
563
564 [shipsOnApproach setObject:coordinatesStack forKey:shipID];
565
566
567 // COMM-CHATTER
568 if (station == [UNIVERSE station])
569 {
570 [station sendExpandedMessage:@"[station-welcome]" toShip:ship];
571 }
572 else
573 {
574 [station sendExpandedMessage:@"[docking-welcome]" toShip:ship];
575 }
576}
#define ONE_EIGHTH
#define MAX(A, B)
Definition OOMaths.h:114
#define M_PI
Definition OOMaths.h:73
HPVector HPvector_forward_from_quaternion(Quaternion quat)
Quaternion quaternion_multiply(Quaternion q1, Quaternion q2)
float y
float x
#define UNIVERSE
Definition Universe.h:833
double port_corridor
Definition DockEntity.h:42
NSUInteger countOfShipsInDockingQueue()
Definition DockEntity.m:660
Vector port_dimensions
Definition DockEntity.h:41
Quaternion orientation
Definition Entity.h:114
Vector upVector()
GLint entityPersonalityInt()
Vector rightVector()
voidpf uLong offset
Definition ioapi.h:140

◆ allowsDocking

- (BOOL) allowsDocking

Definition at line 1 of file DockEntity.m.

173{
174 return allow_docking;
175}
BOOL allow_docking
Definition DockEntity.h:46

◆ allowsLaunching

- (BOOL) allowsLaunching

Definition at line 1 of file DockEntity.m.

195{
196 return allow_launching;
197}
BOOL allow_launching
Definition DockEntity.h:45

◆ allowsLaunchingOf:

- (BOOL) allowsLaunchingOf: (ShipEntity *) ship

Definition at line 1 of file DockEntity.m.

952 :(ShipEntity *) ship
953{
954 if (![ship isShip]) return NO;
955
956 BoundingBox bb = [ship totalBoundingBox];
957 if ((port_dimensions.x < (bb.max.x - bb.min.x) || port_dimensions.y < (bb.max.y - bb.min.y)) &&
958 (port_dimensions.y < (bb.max.x - bb.min.x) || port_dimensions.x < (bb.max.y - bb.min.y)) && ![ship isPlayer])
959 {
960 return NO;
961 }
962
963 // callback to allow more complex filtering on accept/reject
964 JSContext *context = OOJSAcquireContext();
965 jsval rval = JSVAL_VOID;
966 jsval args[] = { OOJSValueFromNativeObject(context, ship) };
967 JSBool accept = YES;
968
969 BOOL OK = [[self script] callMethod:OOJSID("acceptLaunchingRequestFrom") inContext:context withArguments:args count:1 result:&rval];
970 if (OK) OK = JS_ValueToBoolean(context, rval, &accept);
971 if (!OK) accept = YES; // default to permreject
972 OOJSRelinquishContext(context);
973 if (!accept)
974 {
975 return NO;
976 }
977
978 return YES;
979}
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
OOINLINE JSContext * OOJSAcquireContext(void)
OOINLINE void OOJSRelinquishContext(JSContext *context)
BoundingBox totalBoundingBox
Definition ShipEntity.h:213

◆ autoDockShipsInQueue:

- (void) autoDockShipsInQueue: (NSMutableDictionary *) queue
implementation

Provided by category DockEntity(OOPrivate).

Definition at line 1 of file DockEntity.m.

150 :(NSMutableDictionary *)queue
151{
152 NSNumber *idObj = nil;
153 foreach (idObj, [queue allKeys])
154 {
155 ShipEntity *ship = [UNIVERSE entityForUniversalID:[idObj unsignedIntValue]];
156 if ([ship isShip])
157 {
158 [self pullInShipIfPermitted:ship];
159 }
160 }
161
162 [queue removeAllObjects];
163}

◆ autoDockShipsOnApproach

- (void) autoDockShipsOnApproach

Definition at line 1 of file DockEntity.m.

167{
168 [self autoDockShipsInQueue:shipsOnApproach];
169}

◆ canAcceptShipForDocking:

- (NSString *) canAcceptShipForDocking: (ShipEntity *) ship

Definition at line 1 of file DockEntity.m.

222 :(ShipEntity *) ship
223{
224 // First test permanent rejection reasons
225 if (!allow_docking)
226 {
227 return @"DOCK_CLOSED"; // could be temp or perm reject
228 }
229 BoundingBox bb = [ship totalBoundingBox];
230 if ((port_dimensions.x < (bb.max.x - bb.min.x) || port_dimensions.y < (bb.max.y - bb.min.y)) &&
231 (port_dimensions.y < (bb.max.x - bb.min.x) || port_dimensions.x < (bb.max.y - bb.min.y)))
232 {
233 return @"TOO_BIG_TO_DOCK";
234 }
235
236 // callback to allow more complex filtering on accept/reject
237 JSContext *context = OOJSAcquireContext();
238 jsval rval = JSVAL_VOID;
239 jsval args[] = { OOJSValueFromNativeObject(context, ship) };
240 JSBool accept = YES;
241
242 BOOL OK = [[self script] callMethod:OOJSID("acceptDockingRequestFrom") inContext:context withArguments:args count:1 result:&rval];
243 if (OK) OK = JS_ValueToBoolean(context, rval, &accept);
244 if (!OK) accept = YES; // default to permreject
245 OOJSRelinquishContext(context);
246
247 if (!accept)
248 {
249 return @"TOO_BIG_TO_DOCK";
250 }
251
252 // Second test temporary rejection reasons
254 {
255 return @"TRY_AGAIN_LATER";
256 }
257 // if there are pending launches, temporarily don't accept docking requests
259 {
260 return @"TRY_AGAIN_LATER";
261 }
262
263 return @"DOCKING_POSSIBLE";
264}
unsigned count

◆ clear

- (void) clear

Definition at line 1 of file DockEntity.m.

983{
984 [launchQueue removeAllObjects];
985 [shipsOnApproach removeAllObjects];
986}

◆ clearAllIdLocks

- (void) clearAllIdLocks
implementation

Provided by category DockEntity(OOPrivate).

Definition at line 1 of file DockEntity.m.

1222{
1223 int i;
1224 for (i = 1; i < MAX_DOCKING_STAGES; i++)
1225 {
1226 DESTROY(id_lock[i]);
1227 }
1228}
#define DESTROY(x)
Definition OOCocoa.h:77
#define MAX_DOCKING_STAGES
ShipEntity * id_lock[MAX_DOCKING_STAGES]
Definition DockEntity.h:39

◆ clearDockingCorridor

- (void) clearDockingCorridor

Definition at line 1 of file DockEntity.m.

1065{
1066 // check against all ships
1067 StationEntity *station = (StationEntity *)[self parentEntity];
1068 BOOL isClear = YES;
1069 int ent_count = UNIVERSE->n_entities;
1070 Entity **uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
1071 Entity *my_entities[ent_count];
1072 int i;
1073 int ship_count = 0;
1074
1075 for (i = 0; i < ent_count; i++)
1076 {
1077 if (uni_entities[i]->isShip)
1078 {
1079 my_entities[ship_count++] = [uni_entities[i] retain]; // retained
1080 }
1081 }
1082
1083 for (i = 0; i < ship_count; i++)
1084 {
1085 ShipEntity *ship = (ShipEntity*)my_entities[i];
1086 double d2 = HPdistance2([station position], [ship position]);
1087 if ((ship != station)&&(d2 < 25000000)&&([ship status] != STATUS_DOCKED)) // within 5km
1088 {
1089 HPVector ppos = [self absolutePositionForSubentity];
1090 float time_out = -15.00; // 15 secs
1091 do
1092 {
1093 isClear = YES;
1094 d2 = HPdistance2(ppos, ship->position);
1095 if (d2 < 4000000) // within 2km of the port entrance
1096 {
1097 Quaternion q1 = [station orientation];
1098 q1 = quaternion_multiply([self orientation], q1);
1099 //
1100 Vector v_out = vector_forward_from_quaternion(q1);
1101 Vector r_pos = make_vector(ship->position.x - ppos.x, ship->position.y - ppos.y, ship->position.z - ppos.z);
1102 if (r_pos.x||r_pos.y||r_pos.z)
1103 r_pos = vector_normal(r_pos);
1104 else
1105 r_pos.z = 1.0;
1106 //
1107 float vdp = dot_product(v_out, r_pos); //== cos of the angle between r_pos and v_out
1108 //
1109 if (vdp > 0.86f)
1110 {
1111 isClear = NO;
1112
1113 // okay it's in the way .. give it a wee nudge (0.25s)
1114 [ship update: 0.25];
1115 time_out += 0.25;
1116 }
1117 if (time_out > 0)
1118 {
1120 HPVector spos = ship->position;
1121 spos.x += 3000.0 * v1.x; spos.y += 3000.0 * v1.y; spos.z += 3000.0 * v1.z;
1122 [ship setPosition:spos]; // move 3km out of the way
1123 }
1124 }
1125 } while (!isClear);
1126 }
1127 }
1128
1129 for (i = 0; i < ship_count; i++)
1130 {
1131 [my_entities[i] release]; //released
1132 }
1133
1134}
Vector vector_forward_from_quaternion(Quaternion quat)
void setPosition:(HPVector posn)
Definition Entity.m:647
void update:(OOTimeDelta delta_t)

◆ clearIdLocks:

- (void) clearIdLocks: (ShipEntity *) ship
implementation

Provided by category DockEntity(OOPrivate).

Definition at line 1 of file DockEntity.m.

1208 :(ShipEntity *)ship
1209{
1210 int i;
1211 for (i = 1; i < MAX_DOCKING_STAGES; i++)
1212 {
1213 if (ship == nil || ship == [id_lock[i] weakRefUnderlyingObject])
1214 {
1215 DESTROY(id_lock[i]);
1216 }
1217 }
1218}

◆ countOfShipsInDockingQueue

- (NSUInteger) countOfShipsInDockingQueue

Definition at line 1 of file DockEntity.m.

661{
662 return [shipsOnApproach count];
663}

◆ countOfShipsInLaunchQueue

- (NSUInteger) countOfShipsInLaunchQueue

Definition at line 1 of file DockEntity.m.

667{
668 return [launchQueue count];
669}

◆ countOfShipsInLaunchQueueWithPrimaryRole:

- (NSUInteger) countOfShipsInLaunchQueueWithPrimaryRole: (NSString *) role

Definition at line 1 of file DockEntity.m.

940 :(NSString *)role
941{
942 NSUInteger count = 0;
943 ShipEntity *ship = nil;
944 foreach (ship, launchQueue)
945 {
946 if ([ship hasPrimaryRole:role]) count++;
947 }
948 return count;
949}

◆ dealloc

- (void) dealloc
implementation

Reimplemented from ShipEntity.

Definition at line 1 of file DockEntity.m.

1199{
1202 [self clearIdLocks:nil];
1203
1204 [super dealloc];
1205}

◆ disallowedDockingCollides

- (BOOL) disallowedDockingCollides

Definition at line 1 of file DockEntity.m.

189{
191}
BOOL disallowed_docking_collides
Definition DockEntity.h:47

◆ dockingCorridorIsEmpty

- (BOOL) dockingCorridorIsEmpty

Definition at line 1 of file DockEntity.m.

990{
991 double unitime = [UNIVERSE getTime];
992
994 {
995 // leave sufficient pause between launches
996 return NO;
997 }
998
999
1000 StationEntity *station = (StationEntity *)[self parentEntity];
1001 if ([station playerReservedDock] == self)
1002 {
1003 // player probably will not appreciate a ship launch right now
1004 return NO;
1005 }
1006
1007 // check against all ships
1008 BOOL isEmpty = YES;
1009 int ent_count = UNIVERSE->n_entities;
1010 Entity **uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
1011 Entity *my_entities[ent_count];
1012 int i;
1013 int ship_count = 0;
1014
1015 for (i = 0; i < ent_count; i++)
1016 {
1017 //on red alert, launch even if the player is trying block the corridor. Ignore cargopods or other small debris.
1018 if ([uni_entities[i] isShip] && ([station alertLevel] < STATION_ALERT_LEVEL_RED || ![uni_entities[i] isPlayer]) && [uni_entities[i] mass] > 1000)
1019 {
1020 my_entities[ship_count++] = [uni_entities[i] retain]; // retained
1021 }
1022 }
1023
1024 for (i = 0; (i < ship_count)&&(isEmpty); i++)
1025 {
1026 ShipEntity* ship = (ShipEntity*)my_entities[i];
1027 double d2 = HPdistance2([station position], [ship position]);
1028 if ((ship != station) && (d2 < 25000000)&&([ship status] != STATUS_DOCKED)) // within 5km
1029 {
1030 HPVector ppos = [self absolutePositionForSubentity];
1031 d2 = HPdistance2(ppos, ship->position);
1032 if (d2 < 4000000) // within 2km of the port entrance
1033 {
1034 Quaternion q1 = [station orientation];
1035 q1 = quaternion_multiply([self orientation], q1);
1036 //
1037 HPVector v_out = HPvector_forward_from_quaternion(q1);
1038 HPVector r_pos = make_HPvector(ship->position.x - ppos.x, ship->position.y - ppos.y, ship->position.z - ppos.z);
1039 if (r_pos.x||r_pos.y||r_pos.z)
1040 r_pos = HPvector_normal(r_pos);
1041 else
1042 r_pos.z = 1.0;
1043 //
1044 double vdp = HPdot_product(v_out, r_pos); //== cos of the angle between r_pos and v_out
1045 //
1046 if (vdp > 0.86)
1047 {
1048 isEmpty = NO;
1050 }
1051 }
1052 }
1053 }
1054
1055 for (i = 0; i < ship_count; i++)
1056 {
1057 [my_entities[i] release]; //released
1058 }
1059
1060 return isEmpty;
1061}
#define STATION_LAUNCH_RETRY_INTERVAL
@ STATION_ALERT_LEVEL_RED
#define STATION_DELAY_BETWEEN_LAUNCHES
GLfloat mass
Definition Entity.h:146

◆ dockingInstructionsForShip:

- (NSDictionary *) dockingInstructionsForShip: (ShipEntity *) ship

Guides a ship into the dock.

Possible results:

  • null
    if no result can be computed or the last control point is reached
  • Move to station (APPROACH)
    if ship is too far away
  • Move away from station (BACKOFF)
    if ship is too close
  • Move perpendicular to station/dock direction (APPROACH)
    if ship is approaching from wrong side of station
  • Abort (TRY AGAIN LATER)
    if something went wrong until here
  • Hold position (HOLD_POSITION)
    if coordinatesStack is empty or approach is not clear
  • Move to next control point (APPROACH_COORDINATES)
    if control point not within collision radius

Algorithm:

  1. If ship is not on approach list and beyond scanner range (25 km?), approach the station
  2. Add ship to approach list
  3. If ship is within distance of 1000 km between station's and ship's collision radius, move away from station
  4. If ship is approaching from behind, move to the side of the station (perpendicular on direction to station and launch vector)
  5. If ship is further away than 12000 km, approach the station

Now the ship is in the vicinity of the station in the correct hemispere. Let's guide them in.

  1. Get the coordinatesStack for this ship (the approach path?). If there is a problem, Ship shall hold position
  2. If next coordinates (control point) not yet within collision radius, move towards that position
  3. Remove control point from stack; get next control point
  4. If next 3 stages of approach are clear, move to next position
  5. otherwise hold position

TODO: Where is the detection that the ship has docked?

TODO: What are the magic number's units? Is it km (kilometers)?

Definition at line 1 of file DockEntity.m.

282 :(ShipEntity *)ship
283{
284 if (ship == nil) return nil;
285
286 OOUniversalID ship_id = [ship universalID];
287 NSNumber *shipID = [NSNumber numberWithUnsignedShort:ship_id];
288 StationEntity *station = (StationEntity *)[self parentEntity];
289
291 HPVector temp = (fabs(launchVector.x) < 0.8)? make_HPvector(1,0,0) : make_HPvector(0,1,0);
292 temp = HPcross_product(launchVector, temp); // 90 deg to launchVector & temp
293 HPVector vi = HPcross_product(launchVector, temp);
294 HPVector vj = HPcross_product(launchVector, vi);
295 HPVector vk = launchVector;
296
297 // check if this is a new ship on approach
298 //
299 if (![shipsOnApproach objectForKey:shipID])
300 {
301 HPVector delta = HPvector_subtract([ship position], [self absolutePositionForSubentity]);
302 float ship_distance = HPmagnitude(delta);
303
304 if (ship_distance > SCANNER_MAX_RANGE)
305 {
306 // too far away - don't claim a docking slot by not putting on approachlist for now.
307 return OOMakeDockingInstructions(station, [self absolutePositionForSubentity], [ship maxFlightSpeed], 10000, @"APPROACH", nil, NO, -1);
308 }
309
310 [self addShipToShipsOnApproach: ship];
311
312 if (ship_distance < 1000.0 + [station collisionRadius] + ship->collision_radius) // too close - back off
313 return OOMakeDockingInstructions(station, [self absolutePositionForSubentity], [ship maxFlightSpeed], 5000, @"BACK_OFF", nil, NO, -1);
314
315 float dot = HPdot_product(launchVector, delta);
316 if (dot < 0) // approaching from the wrong side of the station - construct a vector to the side of the station.
317 {
318 HPVector approachVector = HPcross_product(HPvector_normal(delta), launchVector);
319 approachVector = HPcross_product(launchVector, approachVector); // vector, 90 degr rotated from launchVector towards target.
320 return OOMakeDockingInstructions(station, OOHPVectorTowards([self absolutePositionForSubentity], approachVector, [station collisionRadius] + 5000) , [ship maxFlightSpeed], 1000, @"APPROACH", nil, NO, -1);
321 }
322
323 if (ship_distance > 12500.0)
324 {
325 // long way off - approach more closely
326 return OOMakeDockingInstructions(station, [self absolutePositionForSubentity], [ship maxFlightSpeed], 10000, @"APPROACH", nil, NO, -1);
327 }
328 }
329
330 if (![shipsOnApproach objectForKey:shipID])
331 {
332 // some error has occurred - log it, and send the try-again message
333 OOLogERR(@"station.issueDockingInstructions.failed", @"couldn't addShipToShipsOnApproach:%@ in %@, retrying later -- shipsOnApproach:\n%@", ship, self, shipsOnApproach);
334
335 return OOMakeDockingInstructions(station, [ship position], 200, 100, @"TRY_AGAIN_LATER", nil, NO, -1);
336 }
337
338
339 // shipsOnApproach now has an entry for the ship.
340 //
341 NSMutableArray* coordinatesStack = [shipsOnApproach objectForKey:shipID];
342
343 if ([coordinatesStack count] == 0)
344 {
345 OOLogERR(@"station.issueDockingInstructions.failed", @" -- coordinatesStack = %@", coordinatesStack);
346
347 return OOMakeDockingInstructions(station, [ship position], 0, 100, @"HOLD_POSITION", nil, NO, -1);
348 }
349
350 // get the docking information from the instructions
351 NSMutableDictionary *nextCoords = (NSMutableDictionary *)[coordinatesStack objectAtIndex:0];
352 int docking_stage = [nextCoords oo_intForKey:@"docking_stage"];
353 float speedAdvised = [nextCoords oo_floatForKey:@"speed"];
354 float rangeAdvised = [nextCoords oo_floatForKey:@"range"];
355
356 // calculate world coordinates from relative coordinates
357 HPVector rel_coords;
358 rel_coords.x = [nextCoords oo_doubleForKey:@"rx"];
359 rel_coords.y = [nextCoords oo_doubleForKey:@"ry"];
360 rel_coords.z = [nextCoords oo_doubleForKey:@"rz"];
361 HPVector coords = [self absolutePositionForSubentity];
362 coords.x += rel_coords.x * vi.x + rel_coords.y * vj.x + rel_coords.z * vk.x;
363 coords.y += rel_coords.x * vi.y + rel_coords.y * vj.y + rel_coords.z * vk.y;
364 coords.z += rel_coords.x * vi.z + rel_coords.y * vj.z + rel_coords.z * vk.z;
365
366 // check if the ship is at the control point
367 double max_allowed_range = 2.0f * rangeAdvised + ship->collision_radius; // maximum distance permitted from control point - twice advised range
368 HPVector delta = HPvector_subtract(ship->position, coords);
369
370 if (HPmagnitude2(delta) > max_allowed_range * max_allowed_range) // too far from the coordinates - do not remove them from the stack!
371 {
372 if ((docking_stage == 1) &&(HPmagnitude2(delta) < 1000000.0)) // 1km*1km
373 speedAdvised *= 0.5; // half speed
374
375 return OOMakeDockingInstructions(station, coords, speedAdvised, rangeAdvised, @"APPROACH_COORDINATES", nil, NO, docking_stage);
376 }
377
378 // else, reached the current coordinates okay..
379
380 // get the NEXT coordinates
381 nextCoords = (NSMutableDictionary *)[coordinatesStack oo_dictionaryAtIndex:1];
382 if (nextCoords == nil)
383 {
384 return nil;
385 }
386
387 docking_stage = [nextCoords oo_intForKey:@"docking_stage"];
388 speedAdvised = [nextCoords oo_floatForKey:@"speed"];
389 rangeAdvised = [nextCoords oo_floatForKey:@"range"];
390 BOOL match_rotation = [nextCoords oo_boolForKey:@"match_rotation"];
391 NSString *comms_message = [nextCoords oo_stringForKey:@"comms_message"];
392
393 if (comms_message)
394 {
395 [station sendExpandedMessage:comms_message toShip:ship];
396 }
397
398 // calculate world coordinates from relative coordinates
399 rel_coords.x = [nextCoords oo_doubleForKey:@"rx"];
400 rel_coords.y = [nextCoords oo_doubleForKey:@"ry"];
401 rel_coords.z = [nextCoords oo_doubleForKey:@"rz"];
402 coords = [self absolutePositionForSubentity];
403 coords.x += rel_coords.x * vi.x + rel_coords.y * vj.x + rel_coords.z * vk.x;
404 coords.y += rel_coords.x * vi.y + rel_coords.y * vj.y + rel_coords.z * vk.y;
405 coords.z += rel_coords.x * vi.z + rel_coords.y * vj.z + rel_coords.z * vk.z;
406
407 if([id_lock[docking_stage] weakRefUnderlyingObject] == nil &&
408 [id_lock[docking_stage + 1] weakRefUnderlyingObject] == nil &&
409 [id_lock[docking_stage + 2] weakRefUnderlyingObject] == nil) // check three stages ahead
410 {
411 // approach is clear - move to next position
412 //
413
414 // clear any previously owned docking stages
415 [self clearIdLocks:ship];
416
417 if (docking_stage > 1) // don't claim first docking stage
418 {
419 [id_lock[docking_stage] release];
420 id_lock[docking_stage] = [ship weakRetain]; // otherwise - claim this docking stage
421 }
422
423 //remove the previous stage from the stack
424 [coordinatesStack removeObjectAtIndex:0];
425
426 return OOMakeDockingInstructions(station, coords, speedAdvised, rangeAdvised, @"APPROACH_COORDINATES", nil, match_rotation, docking_stage);
427 }
428
429 // else, approach isn't clear - hold position..
430 //
431 [[ship getAI] message:@"HOLD_POSITION"];
432
433 if (![nextCoords objectForKey:@"hold_message_given"])
434 {
435 // COMM-CHATTER
436 [UNIVERSE clearPreviousMessage];
437 [self sendExpandedMessage: @"[station-hold-position]" toShip: ship];
438 [nextCoords setObject:@"YES" forKey:@"hold_message_given"];
439 }
440
441 return OOMakeDockingInstructions(station, ship->position, 0, 100, @"HOLD_POSITION", nil, NO, -1);
442}
#define SCANNER_MAX_RANGE
Definition Entity.h:51
#define OOLogERR(class, format,...)
Definition OOLogging.h:112
NSDictionary * OOMakeDockingInstructions(StationEntity *station, HPVector coords, float speed, float range, NSString *ai_message, NSString *comms_message, BOOL match_rotation, int docking_stage)
void message:(NSString *ms)
Definition AI.m:600
GLfloat collision_radius
Definition Entity.h:111
GLfloat collisionRadius()
Definition Entity.m:905
GLfloat maxFlightSpeed
Definition ShipEntity.h:239

◆ drawImmediate:translucent:

- (void) drawImmediate: (bool) immediate
translucent: (bool) translucent 
implementation

Reimplemented from ShipEntity.

Definition at line 1 of file DockEntity.m.

1290 :(bool)immediate translucent:(bool)translucent
1291{
1292 if (virtual_dock) // not drawn
1293 {
1294 return;
1295 }
1296 [super drawImmediate:immediate translucent:translucent];
1297}
BOOL virtual_dock
Definition DockEntity.h:48

◆ getJSClass:andPrototype:

- (void) getJSClass: (JSClass **) outClass
andPrototype: (JSObject **) outPrototype 
implementation

Reimplemented from ShipEntity.

Provided by category DockEntity(OOJavaScriptExtensions).

Definition at line 256 of file OOJSDock.m.

148 :(JSClass **)outClass andPrototype:(JSObject **)outPrototype
149{
150 *outClass = &sDockClass;
151 *outPrototype = sDockPrototype;
152}
static JSClass sDockClass
Definition OOJSDock.m:46
static JSObject * sDockPrototype
Definition OOJSDock.m:34

◆ initWithKey:definition:

- (id) initWithKey: (NSString *) key
definition: (NSDictionary *) dict 
implementation

Reimplemented from ShipEntity.

Definition at line 1 of file DockEntity.m.

1177 :(NSString *)key definition:(NSDictionary *)dict
1178{
1180
1181 self = [super initWithKey:key definition:dict];
1182 if (self != nil)
1183 {
1184 shipsOnApproach = [[NSMutableDictionary alloc] init];
1185 launchQueue = [[NSMutableArray alloc] init];
1186 allow_docking = YES;
1188 allow_launching = YES;
1189 virtual_dock = NO;
1190 }
1191
1192 return self;
1193
1195}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER

◆ isDock

- (BOOL) isDock
implementation

Reimplemented from Entity.

Definition at line 1 of file DockEntity.m.

1172{
1173 return YES;
1174}

◆ isOffCentre

- (BOOL) isOffCentre

Definition at line 1 of file DockEntity.m.

268{
269 if (fabs(position.x) + fabs(position.y) > 5.0)
270 {
271 return YES;
272 }
274 if (fabs(dir.x) + fabs(dir.y) > 0.1)
275 {
276 return YES;
277 }
278 return NO;
279}

◆ launchShip:

- (void) launchShip: (ShipEntity *) ship

Definition at line 1 of file DockEntity.m.

888 :(ShipEntity *) ship
889{
890 if (![ship isShip]) return;
891
892 BoundingBox bb = [ship boundingBox];
893 StationEntity *station = (StationEntity *)[self parentEntity];
894
895 HPVector launchPos = [self absolutePositionForSubentity];
896 Vector launchVel = [station velocity];
897 double launchSpeed = 0.5 * [ship maxFlightSpeed];
898 if ([station maxFlightSpeed] > 0 && [station flightSpeed] > 0) // is self a carrier in flight.
899 {
900 launchSpeed = 0.5 * [ship maxFlightSpeed] * (1.0 + [station flightSpeed]/[station maxFlightSpeed]);
901 }
902 Quaternion q1 = [station orientation];
904 Vector launchVector = vector_forward_from_quaternion(q1);
905
906 // launch orientation
907 if ((port_dimensions.x < port_dimensions.y) ^ (bb.max.x - bb.min.x < bb.max.y - bb.min.y))
908 {
909 quaternion_rotate_about_axis(&q1, launchVector, M_PI*0.5); // to account for the slot being at 90 degrees to vertical
910 }
911 [ship setNormalOrientation:q1];
912 // launch position
913 [ship setPosition:launchPos];
914 if([ship pendingEscortCount] > 0) [ship setPendingEscortCount:0]; // Make sure no extra escorts are added after launch. (e.g. for miners etc.)
915 if ([ship hasEscorts]) no_docking_while_launching = YES;
916 // launch speed
917 launchVel = vector_add(launchVel, vector_multiply_scalar(launchVector, launchSpeed));
918 launchSpeed = magnitude(launchVel);
919 [ship setSpeed:launchSpeed];
920 [ship setVelocity:launchVel];
921 // launch roll/pitch
922 [ship setRoll:[station flightRoll]];
923 [ship setPitch:0.0];
924 [ship setYaw:0.0];
925 [UNIVERSE addEntity:ship];
926 [ship setStatus: STATUS_LAUNCHING];
927 [ship setDesiredSpeed:launchSpeed]; // must be set after initialising the AI to correct any speed set by AI
928 last_launch_time = [UNIVERSE getTime];
929 double delay = (port_corridor + 2 * port_dimensions.z)/launchSpeed; // pause until 2 portlengths outside of the station.
930 [ship setLaunchDelay:delay];
931 [[ship getAI] setNextThinkTime:last_launch_time + delay]; // pause while launching
932
933 [ship resetExhaustPlumes]; // resets stuff for tracking/exhausts
934
935 [ship doScriptEvent:OOJSID("shipWillLaunchFromStation") withArgument:station];
936 [station doScriptEvent:OOJSID("stationLaunchedShip") withArgument:ship andReactToAIMessage: @"STATION_LAUNCHED_SHIP"];
937}
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle)
void setNextThinkTime:(OOTimeAbsolute ntt)
Definition AI.m:658
void setVelocity:(Vector vel)
Definition Entity.m:757
void setNormalOrientation:(Quaternion quat)
Definition Entity.m:744
BoundingBox boundingBox
Definition Entity.h:145
void doScriptEvent:withArgument:andReactToAIMessage:(jsid scriptEvent,[withArgument] id argument,[andReactToAIMessage] NSString *aiMessage)
void setDesiredSpeed:(double amount)
BOOL hasEscorts()
void setRoll:(double amount)
void setSpeed:(double amount)
GLfloat flightSpeed
Definition ShipEntity.h:368
void resetExhaustPlumes()
void setPitch:(double amount)
void setYaw:(double amount)
void setLaunchDelay:(double delay)
void setPendingEscortCount:(uint8_t count)
Vector velocity()
uint8_t pendingEscortCount()
void doScriptEvent:withArgument:(jsid message,[withArgument] id argument)
GLfloat flightRoll
Definition ShipEntity.h:369

◆ noteDockingForShip:

- (void) noteDockingForShip: (ShipEntity *) ship

Definition at line 1 of file DockEntity.m.

579 :(ShipEntity *) ship
580{
581 // safe to do this for now, as it just clears the ship from the docking queue
582 [self abortDockingForShip:ship];
583
584 // avoid clashes with outgoing ships
585 last_launch_time = [UNIVERSE getTime];
586
587}

◆ noteTakingDamage:from:type:

- (void) noteTakingDamage: (double) amount
from: (Entity *) entity
type: (OOShipDamageType) type 
implementation

Reimplemented from ShipEntity.

Definition at line 1 of file DockEntity.m.

1269 :(double)amount from:(Entity *)entity type:(OOShipDamageType)type
1270{
1271 if (virtual_dock) // can't be damaged
1272 {
1273 return;
1274 }
1275 [super noteTakingDamage:amount from:entity type:type];
1276}
OOShipDamageType
Definition ShipEntity.h:183

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Reimplemented from ShipEntity.

Provided by category DockEntity(OOJavaScriptExtensions).

Definition at line 256 of file OOJSDock.m.

156{
157 return @"Dock";
158}

◆ portUpVectorForShipsBoundingBox:

- (Vector) portUpVectorForShipsBoundingBox: (BoundingBox) bb

Definition at line 1 of file DockEntity.m.

624 :(BoundingBox)bb
625{
626 BOOL twist = ((port_dimensions.x < port_dimensions.y) ^ (bb.max.x - bb.min.x < bb.max.y - bb.min.y));
627
628 if (!twist)
629 {
631 }
632 else
633 {
635 }
636}
Vector vector_up_from_quaternion(Quaternion quat)
Vector vector_right_from_quaternion(Quaternion quat)

◆ pruneAndCountShipsOnApproach

- (NSUInteger) pruneAndCountShipsOnApproach

Definition at line 1 of file DockEntity.m.

63{
64 // Remove dead entities.
65 // Enumerate over allKeys explicitly because we mutate the dictionary.
66 NSNumber *idObj = nil;
67 foreach (idObj, [shipsOnApproach allKeys])
68 {
69 ShipEntity *ship = [UNIVERSE entityForUniversalID:[idObj unsignedIntValue]];
70 /* Remove ships from the approach queue if they are dead, or
71 * are more than 25.6km from the dock.
72 */
73 if (ship == nil || HPmagnitude2(HPvector_subtract([ship position],[self absolutePositionForSubentity])) > SCANNER_MAX_RANGE2)
74 {
75 [shipsOnApproach removeObjectForKey:idObj];
76 if (ship != nil) {
77 // notify ship if it's alive
78 [ship sendAIMessage:@"DOCKING_ABORTED"];
79 [ship doScriptEvent:OOJSID("stationWithdrewDockingClearance")];
80 }
81 }
82 }
83
84 if ([shipsOnApproach count] == 0)
85 {
86 if (last_launch_time < [UNIVERSE getTime])
87 {
88 last_launch_time = [UNIVERSE getTime];
89 }
90 }
91
92 return [shipsOnApproach count];
93}
#define SCANNER_MAX_RANGE2
Definition Entity.h:52

◆ pullInShipIfPermitted:

- (void) pullInShipIfPermitted: (ShipEntity *) ship
implementation

Provided by category DockEntity(OOPrivate).

Definition at line 1 of file DockEntity.m.

854 :(ShipEntity *)ship
855{
856 // allow_docking: docking permitted and expected
857 // disallowed_docking_collides: unauthorised docking does not result in explosion
859 {
860 [ship enterDock:(StationEntity*)[self parentEntity]];
861 }
862}
void enterDock:(StationEntity *station)

◆ setAllowsDocking:

- (void) setAllowsDocking: (BOOL) allow

Definition at line 1 of file DockEntity.m.

178 :(BOOL)allowed
179{
180 if (!allowed && allow_docking)
181 {
182 [self abortAllDockings];
183 }
184 allow_docking = allowed;
185}

Referenced by DockSetProperty().

+ Here is the caller graph for this function:

◆ setAllowsLaunching:

- (void) setAllowsLaunching: (BOOL) allow

Definition at line 1 of file DockEntity.m.

200 :(BOOL)allowed
201{
202 if (!allowed && allow_launching)
203 {
204 [self abortAllLaunches];
205 }
206 allow_launching = allowed;
207}

Referenced by DockSetProperty().

+ Here is the caller graph for this function:

◆ setDimensionsAndCorridor:docking:ddc:

- (void) setDimensionsAndCorridor: (BOOL)
docking: (BOOL)
ddc: (BOOL) launching 

Definition at line 1 of file DockEntity.m.

1137 :(BOOL)docking :(BOOL)ddc :(BOOL)launching
1138{
1139 StationEntity *station = (StationEntity*)[self parentEntity];
1140 if (virtual_dock)
1141 {
1143 }
1144 else
1145 {
1146 BoundingBox bb = [self boundingBox];
1147 port_dimensions = make_vector(bb.max.x - bb.min.x, bb.max.y - bb.min.y, bb.max.z - bb.min.z);
1148 }
1149
1151
1152 BoundingBox stbb = [station boundingBox];
1153 HPVector start = position;
1154 while ((start.x > stbb.min.x)&&(start.x < stbb.max.x) &&
1155 (start.y > stbb.min.y)&&(start.y < stbb.max.y) &&
1156 (start.z > stbb.min.z)&&(start.z < stbb.max.z) )
1157 {
1158 start = HPvector_add(start, HPvector_multiply_scalar(vk, port_dimensions.z));
1159 }
1160 port_corridor = start.z - position.z;
1161
1162 allow_docking = docking;
1164 allow_launching = launching;
1165}
Vector virtualPortDimensions()

◆ setDisallowedDockingCollides:

- (void) setDisallowedDockingCollides: (BOOL) ddc

Definition at line 1 of file DockEntity.m.

210 :(BOOL)ddc
211{
213}

Referenced by DockSetProperty().

+ Here is the caller graph for this function:

◆ setUpShipFromDictionary:

- (BOOL) setUpShipFromDictionary: (NSDictionary *) dict
implementation

Reimplemented from ShipEntity.

Definition at line 1 of file DockEntity.m.

1231 :(NSDictionary *) dict
1232{
1234
1235 isShip = YES;
1236 isStation = NO;
1237
1238 if (![super setUpShipFromDictionary:dict]) return NO;
1239
1240 return YES;
1241
1243}
unsigned isStation
Definition Entity.h:92

◆ setVirtual

- (void) setVirtual

Definition at line 1 of file DockEntity.m.

217{
218 virtual_dock = YES;
219}

◆ shipIsInDockingCorridor:

- (BOOL) shipIsInDockingCorridor: (ShipEntity *) ship

Definition at line 1 of file DockEntity.m.

672 :(ShipEntity *)ship
673{
674 if (![ship isShip]) return NO;
675 if ([ship isPlayer] && [ship status] == STATUS_DEAD) return NO;
676
677 BOOL allow_docking_thisship = allow_docking || !disallowed_docking_collides;
678 // ships can physically dock here, and this routine is mainly for
679 // collision detection, but will never be directed here by traffic
680 // control, if allow_docking is false but d_d_c is also false
681
682 StationEntity *station = (StationEntity *)[self parentEntity];
683 if ([station status] == STATUS_DEAD)
684 {
685 return NO;
686 }
687
688 Quaternion q0 = quaternion_multiply(orientation, [station orientation]);
689 Vector vi = vector_right_from_quaternion(q0);
690 Vector vj = vector_up_from_quaternion(q0);
691 Vector vk = vector_forward_from_quaternion(q0);
692
693 HPVector port_pos = [self absolutePositionForSubentity];
694
695 BoundingBox shipbb = [ship boundingBox];
696 BoundingBox arbb = [ship findBoundingBoxRelativeToPosition: port_pos InVectors: vi : vj : vk];
697
698 // port dimensions..
699 GLfloat ww = port_dimensions.x;
700 GLfloat hh = port_dimensions.y;
701 GLfloat dd = port_dimensions.z;
702
703 BOOL rotatedPort = (ww >= hh) ? NO : YES;
704 BOOL rotatedShip = ((shipbb.max.x - shipbb.min.x) >= (shipbb.max.y - shipbb.min.y)) ? NO : YES;
705 BOOL rotationsMatch = (rotatedShip == rotatedPort);
706 if (rotationsMatch)
707 {
708 // the ship and port are both bigger in x than y
709 while (shipbb.max.x - shipbb.min.x > ww * 0.90) ww *= 1.25;
710 while (shipbb.max.y - shipbb.min.y > hh * 0.90) hh *= 1.25;
711 }
712 else
713 {
714 // the ship and port have different x/y biggerness
715 while (shipbb.max.y - shipbb.min.y > ww * 0.90) ww *= 1.25;
716 while (shipbb.max.x - shipbb.min.x > hh * 0.90) hh *= 1.25;
717 }
718
719 ww *= 0.5;
720 hh *= 0.5;
721
722#ifndef NDEBUG
723 if ([ship isPlayer] && (gDebugFlags & DEBUG_DOCKING))
724 {
725 BOOL inLane;
726 float range;
727 unsigned laneFlags = 0;
728
729 if (arbb.max.x < ww) laneFlags |= 1;
730 if (arbb.min.x > -ww) laneFlags |= 2;
731 if (arbb.max.y < hh) laneFlags |= 4;
732 if (arbb.min.y > -hh) laneFlags |= 8;
733 inLane = laneFlags == 0xF;
734 range = 0.90 * arbb.max.z + 0.10 * arbb.min.z;
735
736 OOLog(@"docking.debug", @"Normalised port dimensions are %g x %g x %g. Player bounding box is at %@-%@ -- %s (%X), range: %g",
737 ww * 2.0, hh * 2.0, dd,
738 VectorDescription(arbb.min), VectorDescription(arbb.max),
739 inLane ? "in lane" : "out of lane", laneFlags,
740 range);
741 }
742#endif
743
744 if ((arbb.max.x < ww * 3.0)&&(arbb.min.x > -ww * 3.0)&&(arbb.max.y < hh * 3.0)&&(arbb.min.y > -hh * 3.0))
745 {
746 if ([station requiresDockingClearance] && [ship isPlayer] && [ship status] != STATUS_LAUNCHING && [ship status] != STATUS_AUTOPILOT_ENGAGED && [PLAYER getDockingClearanceStatus] < DOCKING_CLEARANCE_STATUS_GRANTED)
747 {
748 if ((0.90 * arbb.max.z + 0.10 * arbb.min.z < 3000) && (dot_product(vk,[ship forwardVector]) < -0.9))
749 {
750 // player is in docking corridor and facing dock
751 // and within 3km
752 [UNIVERSE addMessage:DESC(@"oolite-station-docking-requires-clearance") forCount:3];
753 }
754 }
755 }
756
757 if (arbb.max.z < -dd)
758 {
759 return NO;
760 }
761
762 if ((arbb.max.x < ww)&&(arbb.min.x > -ww)&&(arbb.max.y < hh)&&(arbb.min.y > -hh))
763 {
764 if ([ship status] != STATUS_LAUNCHING && !allow_docking_thisship)
765 { // launch-only dock: will collide!
766 if (arbb.min.z < dd)
767 {
768 [ship takeScrapeDamage: 5 * [UNIVERSE getTimeDelta]*[ship flightSpeed] from:station];
769 // and bounce
770 HPVector rel = HPvector_subtract([ship position],port_pos);
771 rel = HPvector_multiply_scalar(HPvector_normal(rel),[ship flightSpeed]*0.4);
772 [ship adjustVelocity:HPVectorToVector(rel)];
773 }
774
775 if (arbb.max.z < 0.0)
776 { // give some warning before exploding...
777 return NO;
778 }
779 }
780
781 // in lane
782 if (0.90 * arbb.max.z + 0.10 * arbb.min.z < 0.0) // we're 90% in docking position!
783 {
784 [self pullInShipIfPermitted:ship];
785 }
786 return YES;
787 }
788
789 if ([ship status] == STATUS_LAUNCHING)
790 {
791 return YES;
792 }
793
794 // if close enough (within 50%) correct and add damage
795 //
796 GLfloat safety = 1.0+(50.0/100.0);
797
798 if ((arbb.min.x > -safety * ww)&&(arbb.max.x < safety * ww)&&(arbb.min.y > -safety * hh)&&(arbb.max.y < safety * hh))
799 {
800 if (arbb.min.z < 0.0) // got our nose inside
801 {
802
803 if ((arbb.min.x < -ww && arbb.max.x > ww) || (arbb.min.y < -hh && arbb.max.y > hh))
804 {
805 /* No matter how much safety margin there is, if the
806 * ship is going off opposite edges of the dock at
807 * once, that's a fatal collision */
808 return NO;
809 }
810
811 GLfloat correction_factor = -arbb.min.z / (arbb.max.z - arbb.min.z); // proportion of ship inside
812
813 // damage the ship according to velocity - don't send collision messages to AIs to avoid problems.
814 [ship takeScrapeDamage: 5 * [UNIVERSE getTimeDelta]*[ship flightSpeed] from:station];
815 [station doScriptEvent:OOJSID("shipCollided") withArgument:ship]; // no COLLISION message to station AI, carriers would move away!
816 [ship doScriptEvent:OOJSID("shipCollided") withArgument:station]; // no COLLISION message to ship AI, dockingAI.plist would abort.
817
818 Vector delta;
819 delta.x = 0.5f * (arbb.max.x + arbb.min.x) * correction_factor;
820 delta.y = 0.5f * (arbb.max.y + arbb.min.y) * correction_factor;
821
822 if (arbb.max.x < ww && arbb.min.x > -ww)
823 {
824 // x is okay - no need to correct
825 delta.x = 0.0f;
826 }
827 if (arbb.max.y > hh && arbb.min.y > -hh)
828 {
829 // y is okay - no need to correct
830 delta.y = 0.0f;
831 }
832
833 // adjust the ship back to the center of the port
834 HPVector pos = [ship position];
835 pos.x -= delta.y * vj.x + delta.x * vi.x;
836 pos.y -= delta.y * vj.y + delta.x * vi.y;
837 pos.z -= delta.y * vj.z + delta.x * vi.z;
838 [ship setPosition:pos];
839 }
840
841 // if far enough in - dock
842 if (0.90f * arbb.max.z + 0.10f * arbb.min.z < 0.0f)
843 {
844 [self pullInShipIfPermitted:ship];
845 }
846
847 return YES; // okay NOW we're in the docking corridor!
848 }
849
850 return NO;
851}
NSUInteger gDebugFlags
Definition main.m:7
@ DEBUG_DOCKING
Definition OODebugFlags.h:8
#define OOLog(class, format,...)
Definition OOLogging.h:88

◆ shipIsInDockingQueue:

- (BOOL) shipIsInDockingQueue: (ShipEntity *) ship

Definition at line 1 of file DockEntity.m.

639 :(ShipEntity *)ship
640{
641 if (![ship isShip]) return NO;
642 if ([ship isPlayer] && [ship status] == STATUS_DEAD) return NO;
643
644 OOUniversalID ship_id = [ship universalID];
645 NSNumber *shipID = [NSNumber numberWithUnsignedShort:ship_id];
646
647 if ([shipsOnApproach objectForKey:shipID])
648 {
649 return YES;
650 }
651 // player docking manually
652 if ([ship isPlayer] && [[self owner] playerReservedDock] == self)
653 {
654 return YES;
655 }
656 return NO;
657}
id owner()
Definition Entity.m:583

Referenced by DockEntity(OOJavaScriptExtensions)::getJSClass:andPrototype:.

+ Here is the caller graph for this function:

◆ takeEnergyDamage:from:becauseOf:weaponIdentifier:

- (void) takeEnergyDamage: (double) amount
from: (Entity *) ent
becauseOf: (Entity *) other
weaponIdentifier: (NSString *) weaponIdentifier 
implementation

Reimplemented from ShipEntity.

Definition at line 1 of file DockEntity.m.

1279 :(double)amount from:(Entity *)ent becauseOf:(Entity *)other weaponIdentifier:(NSString *)weaponIdentifier
1280{
1281 if (virtual_dock) // can't be damaged
1282 {
1283 return;
1284 }
1285 [super takeEnergyDamage:amount from:ent becauseOf:other weaponIdentifier:weaponIdentifier];
1286}

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 1 of file DockEntity.m.

1246 :(OOTimeDelta) delta_t
1247{
1248 [super update:delta_t];
1249
1250 if (([launchQueue count] > 0)&&([shipsOnApproach count] == 0)&&[self dockingCorridorIsEmpty])
1251 {
1252 ShipEntity *se=(ShipEntity *)[launchQueue objectAtIndex:0];
1253 // check to make sure ship has not been destroyed in queue by script
1254 if ([se status] == STATUS_DOCKED)
1255 {
1256 [self launchShip:se];
1257 }
1258 [launchQueue removeObjectAtIndex:0];
1259 }
1261 {
1262 no_docking_while_launching = NO; // launching complete
1263 }
1264
1265}
double OOTimeDelta
Definition OOTypes.h:224
BOOL dockingCorridorIsEmpty()
Definition DockEntity.m:989

Member Data Documentation

◆ allow_docking

- (BOOL) allow_docking
private

Definition at line 46 of file DockEntity.h.

◆ allow_launching

- (BOOL) allow_launching
private

Definition at line 45 of file DockEntity.h.

◆ disallowed_docking_collides

- (BOOL) disallowed_docking_collides
private

Definition at line 47 of file DockEntity.h.

◆ id_lock

- (ShipEntity* id_lock[MAX_DOCKING_STAGES])
private

Definition at line 39 of file DockEntity.h.

◆ last_launch_time

- (double) last_launch_time
private

Definition at line 36 of file DockEntity.h.

◆ launchQueue

- (NSMutableArray*) launchQueue
private

Definition at line 35 of file DockEntity.h.

◆ no_docking_while_launching

- (BOOL) no_docking_while_launching
private

Definition at line 44 of file DockEntity.h.

◆ port_corridor

- (double) port_corridor
private

Definition at line 42 of file DockEntity.h.

◆ port_dimensions

- (Vector) port_dimensions
private

Definition at line 41 of file DockEntity.h.

◆ shipsOnApproach

- (NSMutableDictionary*) shipsOnApproach
private

Definition at line 34 of file DockEntity.h.

◆ virtual_dock

- (BOOL) virtual_dock
private

Definition at line 48 of file DockEntity.h.


The documentation for this class was generated from the following files: