Oolite
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:ddc:launching:
(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]
(JSClassID) - oo_jsClassID [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:v1:
(GLfloat) - doesHitLine:v1:hitEntity:
(GLfloat) - doesHitLine:v1:withPosition:i:j:k:
(BoundingBox) - findBoundingBoxRelativeToPosition:i:j:k:
(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:isHostile:flash:scannerDisplayColor1:scannerDisplayColor2:scannerDisplayColorH1:scannerDisplayColorH2:
(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:retreat:
(void) - setCoordinate:
(HPVector) - coordinates
(HPVector) - destination
(HPVector) - distance_six:
(HPVector) - distance_twelve:withOffset:
(void) - setEvasiveJink:
(void) - evasiveAction:
(double) - trackPrimaryTarget:retreat:
(double) - trackSideTarget:leftside:
(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]
(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) - drawSubEntityImmediate:translucent: [implementation]
(BOOL) - isJammingScanning [implementation]
(void) - addSubEntity: [implementation]
(void) - setOwner: [implementation]
(void) - orientationChanged [implementation]
(void) - applyRoll:andClimb: [implementation]
(void) - applyRoll:climb:andYaw: [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:i:j:k: [implementation]
(OOTimeAbsolute) - getDemoStartTime [implementation]
(void) - doNothing [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]
(NSArray *) - subEntitiesForScript
(NSArray *) - subEntitiesForScript
(void) - setTargetForScript:
(void) - setTargetForScript:
(BOOL) - isVisibleToScripts [implementation]
(void) - drawDebugStuff [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]
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
(void) - dumpSelfState
(NSUInteger) - lastDrawCounter
(void) - setLastDrawCounter:
(BOOL) - isInSpace
(BOOL) - isImmuneToBreakPatternHide
(GLfloat) - universalTime
(GLfloat) - spawnTime
(GLfloat) - timeElapsedSinceSpawn
(void) - setAtmosphereFogging:
(OOColor *) - fogUniform
(BOOL) - checkLinkedLists [implementation]
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
(Vector) - relativePosition [implementation]
(BOOL) - isBreakPattern
(BOOL) - isECMBlast
(BOOL) - isExhaust
(BOOL) - isFlasher
(void) - deleteJSSelf
(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

Private Attributes

NSMutableDictionary * shipsOnApproach
NSMutableArray * launchQueue
double last_launch_time
ShipEntity * id_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
OOColor * atmosphereFogging
int zero_index
Entity * x_previous
Entity * x_next
Entity * y_previous
Entity * y_next
Entity * z_previous
Entity * z_next
Entity * collision_chain
OOUniversalID shadingEntityID
Entity * collider
CollisionRegion * collisionRegion
Protected Attributes inherited from ShipEntity
NSDictionary * shipinfoDictionary
Quaternion subentityRotationalVelocity
OOJSScript * script
OOJSScript * aiScript
OOTimeAbsolute aiScriptWakeTime
NSDictionary * dockingInstructions
OOColor * laser_color
OOColor * default_laser_color
OOColor * exhaust_emissive_color
OOColor * scanner_display_color1
OOColor * scanner_display_color2
OOColor * scanner_display_color_hostile1
OOColor * scanner_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
AI * shipAI
NSString * name
NSString * shipUniqueName
NSString * shipClassName
NSString * displayName
NSString * scan_description
OORoleSet * roleSet
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
ShipEntity * scanned_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
Octree * octree
uint16_t entity_personality
NSDictionary * scriptInfo
NSMutableArray * subEntities
OOEquipmentType * missile_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
NSUInteger lastDrawCounter
Protected Attributes inherited from OOWeakRefObject
OOWeakReference * weakSelf

Detailed Description

Definition at line 32 of file DockEntity.h.

Method Documentation

◆ abortAllDockings

- (void) abortAllDockings

Definition at line 89 of file DockEntity.m.

90{
91 double playerExtraTime = 0;
92
94
95 NSNumber* idObj = nil;
96 foreach (idObj, [shipsOnApproach allKeys]) {
97 ShipEntity* ship = [UNIVERSE entityForUniversalID:[idObj unsignedIntValue]];
98 if ([ship isShip]) {
99 [ship sendAIMessage:@"DOCKING_ABORTED"];
100 [ship doScriptEvent:OOJSID("stationWithdrewDockingClearance")];
101 }
102 }
103 [shipsOnApproach removeAllObjects];
104
105 PlayerEntity* player = PLAYER;
106 StationEntity* station = (StationEntity*)[self parentEntity];
107 BOOL isDockingStation = (station == [player getTargetDockStation]) && ([station playerReservedDock] == self);
108 if (isDockingStation && [player status] == STATUS_IN_FLIGHT &&
109 [player getDockingClearanceStatus] >= DOCKING_CLEARANCE_STATUS_REQUESTED) {
110 if (HPmagnitude2(HPvector_subtract([player position], [self absolutePositionForSubentity])) > 2250000) // within 1500m of the dock
111 {
112 [station sendExpandedMessage:@"[station-docking-clearance-abort-cancelled]" toShip:player];
113 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
114 [player doScriptEvent:OOJSID("stationWithdrewDockingClearance")];
115 } else {
116 playerExtraTime = 10; // when very close to the port, give the player a few seconds to react on the abort message.
117 int seconds = round(playerExtraTime);
118 [station sendExpandedMessage:OOExpandKey(@"station-docking-clearance-abort-cancelled-in-time", seconds) toShip:player];
119 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_TIMING_OUT];
120 }
121 }
122
123 // mark docking queue flight pattern as clear
124 [self clearAllIdLocks];
125
126 last_launch_time = [UNIVERSE getTime] + playerExtraTime;
127}
OOINLINE HPVector HPvector_subtract(HPVector a, HPVector b) INLINE_CONST_FUNC
Definition OOHPVector.h:236
OOINLINE OOHPScalar HPmagnitude2(HPVector vec) INLINE_CONST_FUNC
Definition OOHPVector.h:255
return nil
@ DOCKING_CLEARANCE_STATUS_REQUESTED
Definition OOTypes.h:150
#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:627
unsigned isShip
Definition Entity.m:125
OOEntityStatus status()
Definition Entity.m:733
HPVector position
Definition Entity.m:576
ShipEntity * parentEntity()
Definition Entity.m:553
StationEntity * getTargetDockStation()
void setDockingClearanceStatus:(OODockingClearanceStatus newValue)
void doScriptEvent:(OOJSPropID message)
void sendExpandedMessage:toShip:(NSString *message_text,[toShip] ShipEntity *other_ship)
void sendAIMessage:(NSString *message)

References abortAllDockings, Entity::absolutePositionForSubentity, clearAllIdLocks, DOCKING_CLEARANCE_STATUS_REQUESTED, ShipEntity::doScriptEvent:, PlayerEntity::getTargetDockStation, HPmagnitude2(), HPvector_subtract(), Entity::isShip, last_launch_time, nil, no_docking_while_launching, Entity::parentEntity, PLAYER, Entity::position, ShipEntity::sendAIMessage:, ShipEntity::sendExpandedMessage:toShip:, PlayerEntity::setDockingClearanceStatus:, shipsOnApproach, and Entity::status.

Referenced by abortAllDockings, StationEntity::abortAllDockings, and setAllowsDocking:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ abortAllLaunches

- (void) abortAllLaunches
implementation

Definition at line 129 of file DockEntity.m.

130{
132 [launchQueue removeAllObjects];
133}

References abortAllLaunches, and no_docking_while_launching.

Referenced by abortAllLaunches, and setAllowsLaunching:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ abortDockingForShip:

- (void) abortDockingForShip: (ShipEntity*) ship

Definition at line 534 of file DockEntity.m.

534 :(ShipEntity*)ship
535{
536 OOUniversalID ship_id = [ship universalID];
537 NSNumber* shipID = [NSNumber numberWithUnsignedShort:ship_id];
538
539 if ([shipsOnApproach objectForKey:shipID]) {
540 [shipsOnApproach removeObjectForKey:shipID];
541 }
542
543 if ([ship isPlayer]) {
544 PlayerEntity* player = PLAYER;
545 if ([player status] == STATUS_IN_FLIGHT &&
546 [player getDockingClearanceStatus] >= DOCKING_CLEARANCE_STATUS_REQUESTED) {
547 if (HPmagnitude2(HPvector_subtract([player position], [self absolutePositionForSubentity])) > 2250000) // within 1500m of the dock
548 {
549 [[self parentEntity] sendExpandedMessage:@"[station-docking-clearance-abort-cancelled]" toShip:player];
550 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
551 } else {
552 int seconds = 10; // when very close to the port, give the player a few seconds to react on the abort message.
553 [[self parentEntity] sendExpandedMessage:OOExpandKey(@"station-docking-clearance-abort-cancelled-in-time", seconds) toShip:player];
554 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_TIMING_OUT];
555 }
556 }
557 }
558
559 // clear any previously owned docking stages
560 [self clearIdLocks:ship];
561}
uint16_t OOUniversalID
Definition OOTypes.h:165
OOUniversalID universalID
Definition Entity.m:522
unsigned isPlayer
Definition Entity.m:145

References Entity::absolutePositionForSubentity, clearIdLocks:, DOCKING_CLEARANCE_STATUS_REQUESTED, HPmagnitude2(), HPvector_subtract(), Entity::isPlayer, Entity::parentEntity, PLAYER, Entity::position, ShipEntity::sendExpandedMessage:toShip:, PlayerEntity::setDockingClearanceStatus:, shipsOnApproach, Entity::status, and Entity::universalID.

Referenced by StationEntity::abortDockingForShip:, and noteDockingForShip:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addShipToLaunchQueue:withPriority:

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

Definition at line 785 of file DockEntity.m.

785 :(ShipEntity*)ship withPriority:(BOOL)priority
786{
787 [self pruneAndCountShipsOnApproach];
788
789 if (ship == nil)
790 return;
791
792 if (launchQueue == nil) {
793 launchQueue = [[NSMutableArray alloc] init]; // retained
794 }
795
796 [ship setStatus:STATUS_DOCKED];
797 if (priority) {
798 [launchQueue insertObject:ship atIndex:0];
799 } else {
800 [launchQueue addObject:ship];
801 }
802}
NSMutableArray * launchQueue
Definition DockEntity.h:35
void setStatus:(OOEntityStatus stat)

References launchQueue, nil, pruneAndCountShipsOnApproach, and ShipEntity::setStatus:.

Referenced by StationEntity(OOPrivate)::addShipToLaunchQueue:withPriority:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addShipToShipsOnApproach:

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

Provided by category DockEntity(OOPrivate).

Definition at line 403 of file DockEntity.m.

403 :(ShipEntity*)ship
404{
405 int corridor_distance[] = { -1, 1, 3, 5, 7, 9, 11, 12, 12 };
406 int corridor_offset[] = { 0, 0, 0, 0, 0, 0, 1, 3, 12 };
407 /* Eric's improvements to the docking flight code seem to have
408 * made it safer to go quite a bit faster here. With the increased
409 * numbers of ships which might need to dock at the main station,
410 * faster docking will help avoid massive queues. Previous speed
411 * was mostly 48 - CIM: 27/8/2013*/
412 int corridor_speed[] = { 96, 96, 128, 128, 96, 128, 128, 256, 512 }; // how fast to approach the next point
413 int corridor_range[] = { 24, 12, 6, 4, 4, 6, 15, 38, 96 }; // how close you have to get to the target point
414 int corridor_rotate[] = { 1, 1, 1, 1, 0, 0, 0, 0, 0 }; // whether to match the station rotation
415 int corridor_count = 9;
416 int corridor_final_approach = 3;
417
418 NSNumber* shipID = [NSNumber numberWithUnsignedShort:[ship universalID]];
419 StationEntity* station = (StationEntity*)[self parentEntity];
420
422 HPVector temp = (fabs(launchVector.x) < 0.8) ? make_HPvector(1, 0, 0) : make_HPvector(0, 1, 0);
423 temp = HPcross_product(launchVector, temp); // 90 deg to launchVector & temp
424 HPVector rightVector = HPcross_product(launchVector, temp);
426
427 // will select a direction for offset based on the entity personality (was ship ID)
428 int offset_id = [ship entityPersonalityInt] & 0xf; // 16 point compass
429 double c = cos(offset_id * M_PI * ONE_EIGHTH);
430 double s = sin(offset_id * M_PI * ONE_EIGHTH);
431
432 // test if this points at the ship
433 HPVector point1 = [self absolutePositionForSubentity];
434 point1.x += launchVector.x * corridor_offset[corridor_count - 1];
435 point1.y += launchVector.x * corridor_offset[corridor_count - 1];
436 point1.z += launchVector.x * corridor_offset[corridor_count - 1];
437 HPVector alt1 = point1;
438 point1.x += c * upVector.x * corridor_offset[corridor_count - 1] + s * rightVector.x * corridor_offset[corridor_count - 1];
439 point1.y += c * upVector.y * corridor_offset[corridor_count - 1] + s * rightVector.y * corridor_offset[corridor_count - 1];
440 point1.z += c * upVector.z * corridor_offset[corridor_count - 1] + s * rightVector.z * corridor_offset[corridor_count - 1];
441 alt1.x -= c * upVector.x * corridor_offset[corridor_count - 1] + s * rightVector.x * corridor_offset[corridor_count - 1];
442 alt1.y -= c * upVector.y * corridor_offset[corridor_count - 1] + s * rightVector.y * corridor_offset[corridor_count - 1];
443 alt1.z -= c * upVector.z * corridor_offset[corridor_count - 1] + s * rightVector.z * corridor_offset[corridor_count - 1];
444 if (HPdistance2(alt1, ship->position) < HPdistance2(point1, ship->position)) {
445 s = -s;
446 c = -c; // turn 180 degrees
447 }
448
449 //
450 NSMutableArray* coordinatesStack = [NSMutableArray arrayWithCapacity:MAX_DOCKING_STAGES];
451 float port_depth = port_dimensions.z; // 250m deep standard port.
452
453 int i;
454 for (i = corridor_count - 1; i >= 0; i--) {
455 NSMutableDictionary* nextCoords = [NSMutableDictionary dictionaryWithCapacity:3];
456 int offset = corridor_offset[i];
457 float corridor_length = port_depth * corridor_distance[i];
458
459 float rx = s * port_depth * offset;
460 float ry = c * port_depth * offset;
461 float rz = corridor_length;
462 // if there are many ships on approach, randomise coordinates a bit
463 if ((i == corridor_count - 1) && [self countOfShipsInDockingQueue]) {
464 /* This used to try to just space the ships further out
465 * along the 16 approach lanes - this had various problems
466 * with putting ship coordinates on top of each other
467 * and/or spacing them out all the way back to the
468 * witchpoint. Instead, use a few more bits of
469 * entityPersonalityInt to shuffle the holding coordinates
470 * a bit more. It still doesn't guarantee two ships won't
471 * want the same space, but it makes it considerably more
472 * unlikely - I dropped 100 docking ships into the aegis
473 * at once, and they all got allocated positions far
474 * enough from the others to avoid collisions or near
475 * misses - CIM: 27 May 2014 */
476
477 int offset_id2 = ([ship entityPersonalityInt] & 0xf0) >> 4; // 16 point compass
478 int offset_id3 = ([ship entityPersonalityInt] & 0xf00) >> 8; // 16 point step position
479 float c2 = cos(offset_id2 * M_PI * ONE_EIGHTH);
480 float s2 = sin(offset_id2 * M_PI * ONE_EIGHTH);
481 float ssize = MAX(port_depth, 1500.0);
482 rx += c2 * ssize;
483 ry += s2 * ssize;
484 rz += ssize * ((float)offset_id3 / 4.0);
485
486 // OOLog(@"docking.debug",@"Adjusted coordinates by %f x %f x %f",c2 * ssize,s2 * ssize,ssize * ((float)offset_id3 / 4.0));
487 }
488
489 // add the lenght inside the station to the corridor, except for the final position, inside the dock.
490 if (corridor_distance[i] > 0)
491 corridor_length += port_corridor;
492
493 [nextCoords oo_setInteger:corridor_count - i forKey:@"docking_stage"];
494 [nextCoords oo_setFloat:rx forKey:@"rx"];
495 [nextCoords oo_setFloat:ry forKey:@"ry"];
496 [nextCoords oo_setFloat:rz forKey:@"rz"];
497 [nextCoords oo_setFloat:corridor_speed[i] forKey:@"speed"];
498 [nextCoords oo_setFloat:corridor_range[i] forKey:@"range"];
499
500 if (corridor_rotate[i]) {
501 [nextCoords setObject:@"YES" forKey:@"match_rotation"];
502 }
503
504 if (i == corridor_final_approach) {
505 if (station == [UNIVERSE station]) {
506 [nextCoords setObject:@"[station-begin-final-aproach]" forKey:@"comms_message"];
507 } else {
508 [nextCoords setObject:@"[docking-begin-final-aproach]" forKey:@"comms_message"];
509 }
510 }
511
512 [coordinatesStack addObject:nextCoords];
513 }
514
515 [shipsOnApproach setObject:coordinatesStack forKey:shipID];
516
517 // COMM-CHATTER
518 if (station == [UNIVERSE station]) {
519 [station sendExpandedMessage:@"[station-welcome]" toShip:ship];
520 } else {
521 [station sendExpandedMessage:@"[docking-welcome]" toShip:ship];
522 }
523}
#define ONE_EIGHTH
OOINLINE HPVector HPcross_product(HPVector first, HPVector second) INLINE_CONST_FUNC
Definition OOHPVector.h:312
struct HPVector HPVector
OOINLINE HPVector make_HPvector(OOHPScalar vx, OOHPScalar vy, OOHPScalar vz) INLINE_CONST_FUNC
Definition OOHPVector.h:149
OOINLINE OOHPScalar HPdistance2(HPVector v1, HPVector v2) INLINE_CONST_FUNC
Definition OOHPVector.h:293
#define MAX(A, B)
Definition OOMaths.h:94
#define M_PI
Definition OOMaths.h:54
Quaternion quaternion_multiply(Quaternion q1, Quaternion q2) CONST_FUNC
HPVector HPvector_forward_from_quaternion(Quaternion quat) CONST_FUNC
float y
float x
#define UNIVERSE
Definition Universe.h:827
double port_corridor
Definition DockEntity.h:42
NSUInteger countOfShipsInDockingQueue()
Definition DockEntity.m:594
Vector port_dimensions
Definition DockEntity.h:41
Quaternion orientation
Definition Entity.m:682
Vector upVector()
GLint entityPersonalityInt()
Vector rightVector()
voidpf uLong offset
Definition ioapi.h:132
OOHPScalar x
Definition OOHPVector.h:36
OOHPScalar y
Definition OOHPVector.h:37
OOHPScalar z
Definition OOHPVector.h:38

References Entity::absolutePositionForSubentity, ShipEntity::entityPersonalityInt, HPcross_product(), HPdistance2(), HPvector_forward_from_quaternion(), M_PI, make_HPvector(), MAX, ONE_EIGHTH, Entity::position, quaternion_multiply(), ShipEntity::sendExpandedMessage:toShip:, Entity::universalID, UNIVERSE, HPVector::x, HPVector::y, and HPVector::z.

Referenced by dockingInstructionsForShip:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allowsDocking

- (BOOL) allowsDocking

Definition at line 153 of file DockEntity.m.

154{
155 return allow_docking;
156}
BOOL allow_docking
Definition DockEntity.h:46

References allow_docking, and allowsDocking.

Referenced by allowsDocking.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allowsLaunching

- (BOOL) allowsLaunching

Definition at line 171 of file DockEntity.m.

172{
173 return allow_launching;
174}
BOOL allow_launching
Definition DockEntity.h:45

References allow_launching, and allowsLaunching.

Referenced by allowsLaunching.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allowsLaunchingOf:

- (BOOL) allowsLaunchingOf: (ShipEntity*) ship

Definition at line 868 of file DockEntity.m.

868 :(ShipEntity*)ship
869{
870 if (![ship isShip])
871 return NO;
872
873 BoundingBox bb = [ship totalBoundingBox];
874 if ((port_dimensions.x < (bb.max.x - bb.min.x) || port_dimensions.y < (bb.max.y - bb.min.y)) && (port_dimensions.y < (bb.max.x - bb.min.x) || port_dimensions.x < (bb.max.y - bb.min.y)) && ![ship isPlayer]) {
875 return NO;
876 }
877
878 // callback to allow more complex filtering on accept/reject
879 JSContext* context = OOJSAcquireContext();
881 OOJSVal args[] = { OOJSValueFromNativeObject(context, ship) };
882 BOOL accept = YES;
883
884 BOOL OK = [[self script] callMethod:OOJSID("acceptLaunchingRequestFrom") inContext:context withArguments:args count:1 result:&rval];
885 if (OK)
886 accept = OOJSValueToBOOL(context, rval);
887 if (!OK)
888 accept = YES; // default to permreject
889
890 OOJSFreeValue(context, rval);
891 OOJSFreeValue(context, args[0]);
892 OOJSRelinquishContext(context);
893 if (!accept) {
894 return NO;
895 }
896
897 return YES;
898}
jsval OOJSVal
#define OOJSFreeValue(context, value)
#define OOJSUndefinedValue()
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
OOINLINE BOOL OOJSValueToBOOL(JSContext *context, jsval value)
OOINLINE JSContext * OOJSAcquireContext(void)
OOINLINE void OOJSRelinquishContext(JSContext *context)
BoundingBox totalBoundingBox
OOScalar x
Definition OOVector.h:32
OOScalar y
Definition OOVector.h:33

References OOJSScript::callMethod:inContext:withArguments:count:result:, Entity::isPlayer, Entity::isShip, BoundingBox::max, BoundingBox::min, OOJSAcquireContext(), OOJSFreeValue, OOJSRelinquishContext(), OOJSUndefinedValue, OOJSValueFromNativeObject(), OOJSValueToBOOL(), port_dimensions, ShipEntity::script, ShipEntity::totalBoundingBox, Vector::x, and Vector::y.

Here is the call graph for this function:

◆ autoDockShipsInQueue:

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

Provided by category DockEntity(OOPrivate).

Definition at line 135 of file DockEntity.m.

135 :(NSMutableDictionary*)queue
136{
137 NSNumber* idObj = nil;
138 foreach (idObj, [queue allKeys]) {
139 ShipEntity* ship = [UNIVERSE entityForUniversalID:[idObj unsignedIntValue]];
140 if ([ship isShip]) {
141 [self pullInShipIfPermitted:ship];
142 }
143 }
144
145 [queue removeAllObjects];
146}

References nil, and pullInShipIfPermitted:.

Referenced by autoDockShipsOnApproach.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ autoDockShipsOnApproach

- (void) autoDockShipsOnApproach

Definition at line 148 of file DockEntity.m.

149{
150 [self autoDockShipsInQueue:shipsOnApproach];
151}

References autoDockShipsInQueue:, and autoDockShipsOnApproach.

Referenced by autoDockShipsOnApproach, and StationEntity::autoDockShipsOnApproach.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ canAcceptShipForDocking:

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

Definition at line 194 of file DockEntity.m.

194 :(ShipEntity*)ship
195{
196 // First test permanent rejection reasons
197 if (!allow_docking) {
198 return @"DOCK_CLOSED"; // could be temp or perm reject
199 }
200 BoundingBox bb = [ship totalBoundingBox];
201 if ((port_dimensions.x < (bb.max.x - bb.min.x) || port_dimensions.y < (bb.max.y - bb.min.y)) && (port_dimensions.y < (bb.max.x - bb.min.x) || port_dimensions.x < (bb.max.y - bb.min.y))) {
202 return @"TOO_BIG_TO_DOCK";
203 }
204
205 // callback to allow more complex filtering on accept/reject
206 JSContext* context = OOJSAcquireContext();
208 OOJSVal args[] = { OOJSValueFromNativeObject(context, ship) };
209 BOOL accept = YES;
210
211 BOOL OK = [[self script] callMethod:OOJSID("acceptDockingRequestFrom") inContext:context withArguments:args count:1 result:&rval];
212 if (OK)
213 accept = OOJSValueToBOOL(context, rval);
214 if (!OK)
215 accept = YES; // default to permreject
216
217 OOJSFreeValue(context, rval);
218 OOJSFreeValue(context, args[0]);
219 OOJSRelinquishContext(context);
220
221 if (!accept) {
222 return @"TOO_BIG_TO_DOCK";
223 }
224
225 // Second test temporary rejection reasons
227 return @"TRY_AGAIN_LATER";
228 }
229 // if there are pending launches, temporarily don't accept docking requests
231 return @"TRY_AGAIN_LATER";
232 }
233
234 return @"DOCKING_POSSIBLE";
235}
unsigned count

References allow_docking, allow_launching, OOJSScript::callMethod:inContext:withArguments:count:result:, count, launchQueue, BoundingBox::max, BoundingBox::min, no_docking_while_launching, OOJSAcquireContext(), OOJSFreeValue, OOJSRelinquishContext(), OOJSUndefinedValue, OOJSValueFromNativeObject(), OOJSValueToBOOL(), port_dimensions, ShipEntity::script, ShipEntity::totalBoundingBox, Vector::x, and Vector::y.

Referenced by StationEntity::acceptDockingClearanceRequestFrom:, and StationEntity::dockingInstructionsForShip:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear

- (void) clear

Definition at line 900 of file DockEntity.m.

901{
902 [launchQueue removeAllObjects];
903 [shipsOnApproach removeAllObjects];
904}

References clear.

Referenced by clear, and StationEntity::clear.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearAllIdLocks

- (void) clearAllIdLocks
implementation

Provided by category DockEntity(OOPrivate).

Definition at line 1107 of file DockEntity.m.

1108{
1109 int i;
1110 for (i = 1; i < MAX_DOCKING_STAGES; i++) {
1111 DESTROY(id_lock[i]);
1112 }
1113}
#define DESTROY(x)
#define MAX_DOCKING_STAGES
ShipEntity * id_lock[MAX_DOCKING_STAGES]
Definition DockEntity.h:39

References DockEntity(OOPrivate)::clearAllIdLocks, DESTROY, and MAX_DOCKING_STAGES.

Referenced by abortAllDockings, and DockEntity(OOPrivate)::clearAllIdLocks.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearDockingCorridor

- (void) clearDockingCorridor

Definition at line 972 of file DockEntity.m.

973{
974 // check against all ships
975 StationEntity* station = (StationEntity*)[self parentEntity];
976 BOOL isClear = YES;
977 int ent_count = UNIVERSE->n_entities;
978 Entity** uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
979 Entity* my_entities[ent_count];
980 int i;
981 int ship_count = 0;
982
983 for (i = 0; i < ent_count; i++) {
984 if (uni_entities[i]->isShip) {
985 my_entities[ship_count++] = [uni_entities[i] retain]; // retained
986 }
987 }
988
989 for (i = 0; i < ship_count; i++) {
990 ShipEntity* ship = (ShipEntity*)my_entities[i];
991 double d2 = HPdistance2([station position], [ship position]);
992 if ((ship != station) && (d2 < 25000000) && ([ship status] != STATUS_DOCKED)) // within 5km
993 {
994 HPVector ppos = [self absolutePositionForSubentity];
995 float time_out = -15.00; // 15 secs
996 do {
997 isClear = YES;
998 d2 = HPdistance2(ppos, ship->position);
999 if (d2 < 4000000) // within 2km of the port entrance
1000 {
1001 Quaternion q1 = [station orientation];
1002 q1 = quaternion_multiply([self orientation], q1);
1003 //
1005 Vector r_pos = make_vector(ship->position.x - ppos.x, ship->position.y - ppos.y, ship->position.z - ppos.z);
1006 if (r_pos.x || r_pos.y || r_pos.z)
1007 r_pos = vector_normal(r_pos);
1008 else
1009 r_pos.z = 1.0;
1010 //
1011 float vdp = dot_product(v_out, r_pos); //== cos of the angle between r_pos and v_out
1012 //
1013 if (vdp > 0.86f) {
1014 isClear = NO;
1015
1016 // okay it's in the way .. give it a wee nudge (0.25s)
1017 [ship update:0.25];
1018 time_out += 0.25;
1019 }
1020 if (time_out > 0) {
1022 HPVector spos = ship->position;
1023 spos.x += 3000.0 * v1.x;
1024 spos.y += 3000.0 * v1.y;
1025 spos.z += 3000.0 * v1.z;
1026 [ship setPosition:spos]; // move 3km out of the way
1027 }
1028 }
1029 } while (!isClear);
1030 }
1031 }
1032
1033 for (i = 0; i < ship_count; i++) {
1034 [my_entities[i] release]; // released
1035 }
1036}
Vector vector_forward_from_quaternion(Quaternion quat) CONST_FUNC
struct Quaternion Quaternion
OOINLINE Vector make_vector(OOScalar vx, OOScalar vy, OOScalar vz) INLINE_CONST_FUNC
Definition OOVector.h:149
struct Vector Vector
OOINLINE OOScalar dot_product(Vector first, Vector second) INLINE_CONST_FUNC
Definition OOVector.h:299
OOINLINE Vector vector_normal(Vector vec) INLINE_CONST_FUNC
Definition OOVector.h:270
void setPosition:(HPVector posn)
Definition Entity.m:608
void update:(OOTimeDelta delta_t)
OOScalar z
Definition OOVector.h:34

References Entity::absolutePositionForSubentity, clearDockingCorridor, dot_product(), HPdistance2(), HPvector_forward_from_quaternion(), Entity::isShip, make_vector(), Entity::orientation, Entity::parentEntity, Entity::position, quaternion_multiply(), Entity::setPosition:, Entity::status, UNIVERSE, ShipEntity::update:, vector_forward_from_quaternion(), vector_normal(), HPVector::x, Vector::x, HPVector::y, Vector::y, HPVector::z, and Vector::z.

Referenced by clearDockingCorridor, and StationEntity::clearDockingCorridor.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearIdLocks:

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

Provided by category DockEntity(OOPrivate).

Definition at line 1097 of file DockEntity.m.

1097 :(ShipEntity*)ship
1098{
1099 int i;
1100 for (i = 1; i < MAX_DOCKING_STAGES; i++) {
1101 if (ship == nil || ship == [id_lock[i] weakRefUnderlyingObject]) {
1102 DESTROY(id_lock[i]);
1103 }
1104 }
1105}

References DESTROY, MAX_DOCKING_STAGES, and nil.

Referenced by abortDockingForShip:, dealloc, and dockingInstructionsForShip:.

Here is the caller graph for this function:

◆ countOfShipsInDockingQueue

- (NSUInteger) countOfShipsInDockingQueue

Definition at line 594 of file DockEntity.m.

595{
596 return [shipsOnApproach count];
597}

References countOfShipsInDockingQueue.

Referenced by countOfShipsInDockingQueue, StationEntity::currentlyInDockingQueues, and StationEntity::dockingInstructionsForShip:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ countOfShipsInLaunchQueue

- (NSUInteger) countOfShipsInLaunchQueue

Definition at line 599 of file DockEntity.m.

600{
601 return [launchQueue count];
602}

References countOfShipsInLaunchQueue.

Referenced by countOfShipsInLaunchQueue, and StationEntity::currentlyInLaunchingQueues.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ countOfShipsInLaunchQueueWithPrimaryRole:

- (NSUInteger) countOfShipsInLaunchQueueWithPrimaryRole: (NSString*) role

Definition at line 857 of file DockEntity.m.

857 :(NSString*)role
858{
859 NSUInteger count = 0;
860 ShipEntity* ship = nil;
861 foreach (ship, launchQueue) {
862 if ([ship hasPrimaryRole:role])
863 count++;
864 }
865 return count;
866}

References count, launchQueue, and nil.

Referenced by StationEntity(OOPrivate)::countOfShipsInLaunchQueueWithPrimaryRole:.

Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Reimplemented from ShipEntity.

Definition at line 1088 of file DockEntity.m.

1089{
1092 [self clearIdLocks:nil];
1093
1094 [super dealloc];
1095}

References clearIdLocks:, dealloc, ShipEntity::dealloc, DESTROY, launchQueue, and shipsOnApproach.

Referenced by dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disallowedDockingCollides

- (BOOL) disallowedDockingCollides

Definition at line 166 of file DockEntity.m.

167{
169}
BOOL disallowed_docking_collides
Definition DockEntity.h:47

References disallowed_docking_collides, and disallowedDockingCollides.

Referenced by disallowedDockingCollides.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dockingCorridorIsEmpty

- (BOOL) dockingCorridorIsEmpty

Definition at line 906 of file DockEntity.m.

907{
908 double unitime = [UNIVERSE getTime];
909
911 // leave sufficient pause between launches
912 return NO;
913 }
914
915 StationEntity* station = (StationEntity*)[self parentEntity];
916 if ([station playerReservedDock] == self) {
917 // player probably will not appreciate a ship launch right now
918 return NO;
919 }
920
921 // check against all ships
922 BOOL isEmpty = YES;
923 int ent_count = UNIVERSE->n_entities;
924 Entity** uni_entities = UNIVERSE->sortedEntities; // grab the public sorted list
925 Entity* my_entities[ent_count];
926 int i;
927 int ship_count = 0;
928
929 for (i = 0; i < ent_count; i++) {
930 // on red alert, launch even if the player is trying block the corridor. Ignore cargopods or other small debris.
931 if ([uni_entities[i] isShip] && ([station alertLevel] < STATION_ALERT_LEVEL_RED || ![uni_entities[i] isPlayer]) && [uni_entities[i] mass] > 1000) {
932 my_entities[ship_count++] = [uni_entities[i] retain]; // retained
933 }
934 }
935
936 for (i = 0; (i < ship_count) && (isEmpty); i++) {
937 ShipEntity* ship = (ShipEntity*)my_entities[i];
938 double d2 = HPdistance2([station position], [ship position]);
939 if ((ship != station) && (d2 < 25000000) && ([ship status] != STATUS_DOCKED)) // within 5km
940 {
941 HPVector ppos = [self absolutePositionForSubentity];
942 d2 = HPdistance2(ppos, ship->position);
943 if (d2 < 4000000) // within 2km of the port entrance
944 {
945 Quaternion q1 = [station orientation];
946 q1 = quaternion_multiply([self orientation], q1);
947 //
949 HPVector r_pos = make_HPvector(ship->position.x - ppos.x, ship->position.y - ppos.y, ship->position.z - ppos.z);
950 if (r_pos.x || r_pos.y || r_pos.z)
951 r_pos = HPvector_normal(r_pos);
952 else
953 r_pos.z = 1.0;
954 //
955 double vdp = HPdot_product(v_out, r_pos); //== cos of the angle between r_pos and v_out
956 //
957 if (vdp > 0.86) {
958 isEmpty = NO;
960 }
961 }
962 }
963 }
964
965 for (i = 0; i < ship_count; i++) {
966 [my_entities[i] release]; // released
967 }
968
969 return isEmpty;
970}
OOINLINE OOHPScalar HPdot_product(HPVector first, HPVector second) INLINE_CONST_FUNC
Definition OOHPVector.h:317
OOINLINE HPVector HPvector_normal(HPVector vec) INLINE_CONST_FUNC
Definition OOHPVector.h:288
#define STATION_LAUNCH_RETRY_INTERVAL
@ STATION_ALERT_LEVEL_RED
#define STATION_DELAY_BETWEEN_LAUNCHES
GLfloat mass
Definition Entity.m:671

References Entity::absolutePositionForSubentity, dockingCorridorIsEmpty, HPdistance2(), HPdot_product(), HPvector_forward_from_quaternion(), HPvector_normal(), Entity::isPlayer, Entity::isShip, last_launch_time, make_HPvector(), Entity::mass, Entity::orientation, Entity::parentEntity, Entity::position, quaternion_multiply(), STATION_ALERT_LEVEL_RED, STATION_DELAY_BETWEEN_LAUNCHES, STATION_LAUNCH_RETRY_INTERVAL, Entity::status, UNIVERSE, HPVector::x, HPVector::y, and HPVector::z.

Referenced by dockingCorridorIsEmpty, and update:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 249 of file DockEntity.m.

249 :(ShipEntity*)ship
250{
251 if (ship == nil)
252 return nil;
253
254 OOUniversalID ship_id = [ship universalID];
255 NSNumber* shipID = [NSNumber numberWithUnsignedShort:ship_id];
256 StationEntity* station = (StationEntity*)[self parentEntity];
257
259 HPVector temp = (fabs(launchVector.x) < 0.8) ? make_HPvector(1, 0, 0) : make_HPvector(0, 1, 0);
260 temp = HPcross_product(launchVector, temp); // 90 deg to launchVector & temp
261 HPVector vi = HPcross_product(launchVector, temp);
262 HPVector vj = HPcross_product(launchVector, vi);
263 HPVector vk = launchVector;
264
265 // check if this is a new ship on approach
266 //
267 if (![shipsOnApproach objectForKey:shipID]) {
269 float ship_distance = HPmagnitude(delta);
270
271 if (ship_distance > SCANNER_MAX_RANGE) {
272 // too far away - don't claim a docking slot by not putting on approachlist for now.
273 return OOMakeDockingInstructions(station, [self absolutePositionForSubentity], [ship maxFlightSpeed], 10000, @"APPROACH", nil, NO, -1);
274 }
275
276 [self addShipToShipsOnApproach:ship];
277
278 if (ship_distance < 1000.0 + [station collisionRadius] + ship->collision_radius) // too close - back off
279 return OOMakeDockingInstructions(station, [self absolutePositionForSubentity], [ship maxFlightSpeed], 5000, @"BACK_OFF", nil, NO, -1);
280
281 float dot = HPdot_product(launchVector, delta);
282 if (dot < 0) // approaching from the wrong side of the station - construct a vector to the side of the station.
283 {
284 HPVector approachVector = HPcross_product(HPvector_normal(delta), launchVector);
285 approachVector = HPcross_product(launchVector, approachVector); // vector, 90 degr rotated from launchVector towards target.
286 return OOMakeDockingInstructions(station, OOHPVectorTowards([self absolutePositionForSubentity], approachVector, [station collisionRadius] + 5000), [ship maxFlightSpeed], 1000, @"APPROACH", nil, NO, -1);
287 }
288
289 if (ship_distance > 12500.0) {
290 // long way off - approach more closely
291 return OOMakeDockingInstructions(station, [self absolutePositionForSubentity], [ship maxFlightSpeed], 10000, @"APPROACH", nil, NO, -1);
292 }
293 }
294
295 if (![shipsOnApproach objectForKey:shipID]) {
296 // some error has occurred - log it, and send the try-again message
297 OOLogERR(@"station.issueDockingInstructions.failed", @"couldn't addShipToShipsOnApproach:%@ in %@, retrying later -- shipsOnApproach:\n%@", ship, self, shipsOnApproach);
298
299 return OOMakeDockingInstructions(station, [ship position], 200, 100, @"TRY_AGAIN_LATER", nil, NO, -1);
300 }
301
302 // shipsOnApproach now has an entry for the ship.
303 //
304 NSMutableArray* coordinatesStack = [shipsOnApproach objectForKey:shipID];
305
306 if ([coordinatesStack count] == 0) {
307 OOLogERR(@"station.issueDockingInstructions.failed", @" -- coordinatesStack = %@", coordinatesStack);
308
309 return OOMakeDockingInstructions(station, [ship position], 0, 100, @"HOLD_POSITION", nil, NO, -1);
310 }
311
312 // get the docking information from the instructions
313 NSMutableDictionary* nextCoords = (NSMutableDictionary*)[coordinatesStack objectAtIndex:0];
314 int docking_stage = [nextCoords oo_intForKey:@"docking_stage"];
315 float speedAdvised = [nextCoords oo_floatForKey:@"speed"];
316 float rangeAdvised = [nextCoords oo_floatForKey:@"range"];
317
318 // calculate world coordinates from relative coordinates
319 HPVector rel_coords;
320 rel_coords.x = [nextCoords oo_doubleForKey:@"rx"];
321 rel_coords.y = [nextCoords oo_doubleForKey:@"ry"];
322 rel_coords.z = [nextCoords oo_doubleForKey:@"rz"];
323 HPVector coords = [self absolutePositionForSubentity];
324 coords.x += rel_coords.x * vi.x + rel_coords.y * vj.x + rel_coords.z * vk.x;
325 coords.y += rel_coords.x * vi.y + rel_coords.y * vj.y + rel_coords.z * vk.y;
326 coords.z += rel_coords.x * vi.z + rel_coords.y * vj.z + rel_coords.z * vk.z;
327
328 // check if the ship is at the control point
329 double max_allowed_range = 2.0f * rangeAdvised + ship->collision_radius; // maximum distance permitted from control point - twice advised range
330 HPVector delta = HPvector_subtract(ship->position, coords);
331
332 if (HPmagnitude2(delta) > max_allowed_range * max_allowed_range) // too far from the coordinates - do not remove them from the stack!
333 {
334 if ((docking_stage == 1) && (HPmagnitude2(delta) < 1000000.0)) // 1km*1km
335 speedAdvised *= 0.5; // half speed
336
337 return OOMakeDockingInstructions(station, coords, speedAdvised, rangeAdvised, @"APPROACH_COORDINATES", nil, NO, docking_stage);
338 }
339
340 // else, reached the current coordinates okay..
341
342 // get the NEXT coordinates
343 nextCoords = (NSMutableDictionary*)[coordinatesStack oo_dictionaryAtIndex:1];
344 if (nextCoords == nil) {
345 return nil;
346 }
347
348 docking_stage = [nextCoords oo_intForKey:@"docking_stage"];
349 speedAdvised = [nextCoords oo_floatForKey:@"speed"];
350 rangeAdvised = [nextCoords oo_floatForKey:@"range"];
351 BOOL match_rotation = [nextCoords oo_boolForKey:@"match_rotation"];
352 NSString* comms_message = [nextCoords oo_stringForKey:@"comms_message"];
353
354 if (comms_message) {
355 [station sendExpandedMessage:comms_message toShip:ship];
356 }
357
358 // calculate world coordinates from relative coordinates
359 rel_coords.x = [nextCoords oo_doubleForKey:@"rx"];
360 rel_coords.y = [nextCoords oo_doubleForKey:@"ry"];
361 rel_coords.z = [nextCoords oo_doubleForKey:@"rz"];
362 coords = [self absolutePositionForSubentity];
363 coords.x += rel_coords.x * vi.x + rel_coords.y * vj.x + rel_coords.z * vk.x;
364 coords.y += rel_coords.x * vi.y + rel_coords.y * vj.y + rel_coords.z * vk.y;
365 coords.z += rel_coords.x * vi.z + rel_coords.y * vj.z + rel_coords.z * vk.z;
366
367 if ([id_lock[docking_stage] weakRefUnderlyingObject] == nil &&
368 [id_lock[docking_stage + 1] weakRefUnderlyingObject] == nil &&
369 [id_lock[docking_stage + 2] weakRefUnderlyingObject] == nil) // check three stages ahead
370 {
371 // approach is clear - move to next position
372 //
373
374 // clear any previously owned docking stages
375 [self clearIdLocks:ship];
376
377 if (docking_stage > 1) // don't claim first docking stage
378 {
379 [id_lock[docking_stage] release];
380 id_lock[docking_stage] = [ship weakRetain]; // otherwise - claim this docking stage
381 }
382
383 // remove the previous stage from the stack
384 [coordinatesStack removeObjectAtIndex:0];
385
386 return OOMakeDockingInstructions(station, coords, speedAdvised, rangeAdvised, @"APPROACH_COORDINATES", nil, match_rotation, docking_stage);
387 }
388
389 // else, approach isn't clear - hold position..
390 //
391 [[ship getAI] message:@"HOLD_POSITION"];
392
393 if (![nextCoords objectForKey:@"hold_message_given"]) {
394 // COMM-CHATTER
395 [UNIVERSE clearPreviousMessage];
396 [self sendExpandedMessage:@"[station-hold-position]" toShip:ship];
397 [nextCoords setObject:@"YES" forKey:@"hold_message_given"];
398 }
399
400 return OOMakeDockingInstructions(station, ship->position, 0, 100, @"HOLD_POSITION", nil, NO, -1);
401}
#define SCANNER_MAX_RANGE
Definition Entity.h:53
OOINLINE OOHPScalar HPmagnitude(HPVector vec) INLINE_CONST_FUNC
Definition OOHPVector.h:260
OOINLINE HPVector OOHPVectorTowards(HPVector a, HPVector b, OOHPScalar where) INLINE_CONST_FUNC
Definition OOHPVector.h:229
#define OOLogERR(class, format,...)
Definition OOLogging.h:125
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:536
GLfloat collision_radius
Definition Entity.h:107
GLfloat collisionRadius()
Definition Entity.m:830
GLfloat maxFlightSpeed

References Entity::absolutePositionForSubentity, addShipToShipsOnApproach:, clearIdLocks:, Entity::collision_radius, Entity::collisionRadius, count, ShipEntity::getAI, HPcross_product(), HPdot_product(), HPmagnitude(), HPmagnitude2(), HPvector_forward_from_quaternion(), HPvector_normal(), HPvector_subtract(), id_lock, make_HPvector(), ShipEntity::maxFlightSpeed, AI::message:, nil, OOHPVectorTowards(), OOLogERR, OOMakeDockingInstructions(), Entity::orientation, Entity::parentEntity, Entity::position, quaternion_multiply(), SCANNER_MAX_RANGE, ShipEntity::sendExpandedMessage:toShip:, shipsOnApproach, Entity::universalID, OOWeakRefObject::weakRetain, HPVector::x, HPVector::y, and HPVector::z.

Referenced by StationEntity::dockingInstructionsForShip:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawImmediate:translucent:

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

Reimplemented from ShipEntity.

Definition at line 1167 of file DockEntity.m.

1167 :(bool)immediate translucent:(bool)translucent
1168{
1169 if (virtual_dock) // not drawn
1170 {
1171 return;
1172 }
1173 [super drawImmediate:immediate translucent:translucent];
1174}
BOOL virtual_dock
Definition DockEntity.h:48

References ShipEntity::drawImmediate:translucent:, and virtual_dock.

Here is the call graph for this function:

◆ getJSClass:andPrototype:

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

Reimplemented from ShipEntity.

Provided by category DockEntity(OOJavaScriptExtensions).

Definition at line 139 of file OOJSDock.m.

139 :(JSClass**)outClass andPrototype:(JSObject**)outPrototype
140{
141 *outClass = &sDockClass;
142 *outPrototype = sDockPrototype;
143}
static JSClass sDockClass
Definition OOJSDock.m:42
static JSObject * sDockPrototype
Definition OOJSDock.m:32

◆ initWithKey:definition:

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

Reimplemented from ShipEntity.

Definition at line 1069 of file DockEntity.m.

1069 :(NSString*)key definition:(NSDictionary*)dict
1070{
1072
1073 self = [super initWithKey:key definition:dict];
1074 if (self != nil) {
1075 shipsOnApproach = [[NSMutableDictionary alloc] init];
1076 launchQueue = [[NSMutableArray alloc] init];
1077 allow_docking = YES;
1079 allow_launching = YES;
1080 virtual_dock = NO;
1081 }
1082
1083 return self;
1084
1086}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER

References allow_docking, allow_launching, disallowed_docking_collides, ShipEntity::initWithKey:definition:, launchQueue, nil, OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, shipsOnApproach, and virtual_dock.

Here is the call graph for this function:

◆ isDock

- (BOOL) isDock
implementation

Reimplemented from Entity.

Definition at line 1064 of file DockEntity.m.

1065{
1066 return YES;
1067}

References isDock.

Referenced by isDock.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOffCentre

- (BOOL) isOffCentre

Definition at line 237 of file DockEntity.m.

238{
239 if (fabs(position.x) + fabs(position.y) > 5.0) {
240 return YES;
241 }
243 if (fabs(dir.x) + fabs(dir.y) > 0.1) {
244 return YES;
245 }
246 return NO;
247}

References isOffCentre, Entity::orientation, Entity::position, vector_forward_from_quaternion(), Vector::x, and Vector::y.

Referenced by isOffCentre.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ launchShip:

- (void) launchShip: (ShipEntity*) ship

Definition at line 804 of file DockEntity.m.

804 :(ShipEntity*)ship
805{
806 if (![ship isShip])
807 return;
808
809 BoundingBox bb = [ship boundingBox];
810 StationEntity* station = (StationEntity*)[self parentEntity];
811
812 HPVector launchPos = [self absolutePositionForSubentity];
813 Vector launchVel = [station velocity];
814 double launchSpeed = 0.5 * [ship maxFlightSpeed];
815 if ([station maxFlightSpeed] > 0 && [station flightSpeed] > 0) // is self a carrier in flight.
816 {
817 launchSpeed = 0.5 * [ship maxFlightSpeed] * (1.0 + [station flightSpeed] / [station maxFlightSpeed]);
818 }
819 Quaternion q1 = [station orientation];
821 Vector launchVector = vector_forward_from_quaternion(q1);
822
823 // launch orientation
824 if ((port_dimensions.x < port_dimensions.y) ^ (bb.max.x - bb.min.x < bb.max.y - bb.min.y)) {
825 quaternion_rotate_about_axis(&q1, launchVector, M_PI * 0.5); // to account for the slot being at 90 degrees to vertical
826 }
827 [ship setNormalOrientation:q1];
828 // launch position
829 [ship setPosition:launchPos];
830 if ([ship pendingEscortCount] > 0)
831 [ship setPendingEscortCount:0]; // Make sure no extra escorts are added after launch. (e.g. for miners etc.)
832 if ([ship hasEscorts])
834 // launch speed
835 launchVel = vector_add(launchVel, vector_multiply_scalar(launchVector, launchSpeed));
836 launchSpeed = magnitude(launchVel);
837 [ship setSpeed:launchSpeed];
838 [ship setVelocity:launchVel];
839 // launch roll/pitch
840 [ship setRoll:[station flightRoll]];
841 [ship setPitch:0.0];
842 [ship setYaw:0.0];
843 [UNIVERSE addEntity:ship];
844 [ship setStatus:STATUS_LAUNCHING];
845 [ship setDesiredSpeed:launchSpeed]; // must be set after initialising the AI to correct any speed set by AI
846 last_launch_time = [UNIVERSE getTime];
847 double delay = (port_corridor + 2 * port_dimensions.z) / launchSpeed; // pause until 2 portlengths outside of the station.
848 [ship setLaunchDelay:delay];
849 [[ship getAI] setNextThinkTime:last_launch_time + delay]; // pause while launching
850
851 [ship resetExhaustPlumes]; // resets stuff for tracking/exhausts
852
853 [ship doScriptEvent:OOJSID("shipWillLaunchFromStation") withArgument:station];
854 [station doScriptEvent:OOJSID("stationLaunchedShip") withArgument:ship andReactToAIMessage:@"STATION_LAUNCHED_SHIP"];
855}
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle) NONNULL_FUNC
OOINLINE Vector vector_add(Vector a, Vector b) INLINE_CONST_FUNC
Definition OOVector.h:195
OOINLINE OOScalar magnitude(Vector vec) INLINE_CONST_FUNC
Definition OOVector.h:242
OOINLINE Vector vector_multiply_scalar(Vector v, OOScalar s) INLINE_CONST_FUNC
Definition OOVector.h:180
void setNextThinkTime:(OOTimeAbsolute ntt)
Definition AI.m:581
void setVelocity:(Vector vel)
Definition Entity.m:703
void setNormalOrientation:(Quaternion quat)
Definition Entity.m:692
BoundingBox boundingBox
Definition Entity.m:666
void setDesiredSpeed:(double amount)
BOOL hasEscorts()
void setRoll:(double amount)
void setSpeed:(double amount)
GLfloat flightSpeed
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:(OOJSPropID message,[withArgument] id argument)
GLfloat flightRoll
void doScriptEvent:withArgument:andReactToAIMessage:(OOJSPropID scriptEvent,[withArgument] id argument,[andReactToAIMessage] NSString *aiMessage)

References Entity::absolutePositionForSubentity, Entity::boundingBox, ShipEntity::doScriptEvent:withArgument:, ShipEntity::doScriptEvent:withArgument:andReactToAIMessage:, ShipEntity::flightRoll, ShipEntity::flightSpeed, ShipEntity::getAI, ShipEntity::hasEscorts, Entity::isShip, last_launch_time, M_PI, magnitude(), BoundingBox::max, ShipEntity::maxFlightSpeed, BoundingBox::min, no_docking_while_launching, Entity::orientation, Entity::parentEntity, ShipEntity::pendingEscortCount, port_corridor, port_dimensions, quaternion_multiply(), quaternion_rotate_about_axis(), ShipEntity::resetExhaustPlumes, ShipEntity::setDesiredSpeed:, ShipEntity::setLaunchDelay:, AI::setNextThinkTime:, Entity::setNormalOrientation:, ShipEntity::setPendingEscortCount:, ShipEntity::setPitch:, Entity::setPosition:, ShipEntity::setRoll:, ShipEntity::setSpeed:, ShipEntity::setStatus:, Entity::setVelocity:, ShipEntity::setYaw:, vector_add(), vector_forward_from_quaternion(), vector_multiply_scalar(), ShipEntity::velocity, Vector::x, and Vector::y.

Referenced by StationEntity::launchShip:, and update:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ noteDockingForShip:

- (void) noteDockingForShip: (ShipEntity*) ship

Definition at line 525 of file DockEntity.m.

525 :(ShipEntity*)ship
526{
527 // safe to do this for now, as it just clears the ship from the docking queue
528 [self abortDockingForShip:ship];
529
530 // avoid clashes with outgoing ships
531 last_launch_time = [UNIVERSE getTime];
532}

References abortDockingForShip:, and last_launch_time.

Referenced by StationEntity::noteDockedShip:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ noteTakingDamage:from:type:

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

Reimplemented from ShipEntity.

Definition at line 1148 of file DockEntity.m.

1148 :(double)amount from:(Entity*)entity type:(OOShipDamageType)type
1149{
1150 if (virtual_dock) // can't be damaged
1151 {
1152 return;
1153 }
1154 [super noteTakingDamage:amount from:entity type:type];
1155}
OOShipDamageType
Definition ShipEntity.h:175

References ShipEntity::noteTakingDamage:from:type:, and virtual_dock.

Here is the call graph for this function:

◆ oo_jsClassID

- (JSClassID) oo_jsClassID
implementation

Reimplemented from ShipEntity.

Provided by category DockEntity(OOJavaScriptExtensions).

Definition at line 145 of file OOJSDock.m.

146{
147 return sDockClassID;
148}
static JSClassID sDockClassID
Definition OOJSDock.m:34

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Reimplemented from ShipEntity.

Provided by category DockEntity(OOJavaScriptExtensions).

Definition at line 145 of file OOJSDock.m.

146{
147 return @"Dock";
148}

◆ portUpVectorForShipsBoundingBox:

- (Vector) portUpVectorForShipsBoundingBox: (BoundingBox) bb

Definition at line 563 of file DockEntity.m.

563 :(BoundingBox)bb
564{
565 BOOL twist = ((port_dimensions.x < port_dimensions.y) ^ (bb.max.x - bb.min.x < bb.max.y - bb.min.y));
566
567 if (!twist) {
569 } else {
571 }
572}
Vector vector_up_from_quaternion(Quaternion quat) CONST_FUNC
Vector vector_right_from_quaternion(Quaternion quat) CONST_FUNC

References BoundingBox::max, BoundingBox::min, Entity::orientation, Entity::parentEntity, port_dimensions, quaternion_multiply(), vector_right_from_quaternion(), vector_up_from_quaternion(), Vector::x, and Vector::y.

Referenced by StationEntity::portUpVectorForShip:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pruneAndCountShipsOnApproach

- (NSUInteger) pruneAndCountShipsOnApproach

Definition at line 60 of file DockEntity.m.

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

References Entity::absolutePositionForSubentity, count, ShipEntity::doScriptEvent:, HPmagnitude2(), HPvector_subtract(), last_launch_time, nil, Entity::position, pruneAndCountShipsOnApproach, SCANNER_MAX_RANGE2, ShipEntity::sendAIMessage:, shipsOnApproach, and UNIVERSE.

Referenced by addShipToLaunchQueue:withPriority:, pruneAndCountShipsOnApproach, and StationEntity::sanityCheckShipsOnApproach.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pullInShipIfPermitted:

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

Provided by category DockEntity(OOPrivate).

Definition at line 776 of file DockEntity.m.

776 :(ShipEntity*)ship
777{
778 // allow_docking: docking permitted and expected
779 // disallowed_docking_collides: unauthorised docking does not result in explosion
781 [ship enterDock:(StationEntity*)[self parentEntity]];
782 }
783}
void enterDock:(StationEntity *station)

References ShipEntity::enterDock:, and Entity::parentEntity.

Referenced by DockEntity(OOPrivate)::autoDockShipsInQueue:, and shipIsInDockingCorridor:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAllowsDocking:

- (void) setAllowsDocking: (BOOL) allow

Definition at line 158 of file DockEntity.m.

158 :(BOOL)allowed
159{
160 if (!allowed && allow_docking) {
161 [self abortAllDockings];
162 }
163 allow_docking = allowed;
164}

References abortAllDockings, and allow_docking.

Referenced by DockSetProperty(), and DockSetProperty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAllowsLaunching:

- (void) setAllowsLaunching: (BOOL) allow

Definition at line 176 of file DockEntity.m.

176 :(BOOL)allowed
177{
178 if (!allowed && allow_launching) {
179 [self abortAllLaunches];
180 }
181 allow_launching = allowed;
182}

References abortAllLaunches, and allow_launching.

Referenced by DockSetProperty(), and DockSetProperty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDimensionsAndCorridor:ddc:launching:

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

Definition at line 1038 of file DockEntity.m.

1038 :(BOOL)docking ddc:(BOOL)ddc launching:(BOOL)launching
1039{
1040 StationEntity* station = (StationEntity*)[self parentEntity];
1041 if (virtual_dock) {
1043 } else {
1044 BoundingBox bb = [self boundingBox];
1045 port_dimensions = make_vector(bb.max.x - bb.min.x, bb.max.y - bb.min.y, bb.max.z - bb.min.z);
1046 }
1047
1049
1050 BoundingBox stbb = [station boundingBox];
1051 HPVector start = position;
1052 while ((start.x > stbb.min.x) && (start.x < stbb.max.x) && (start.y > stbb.min.y) && (start.y < stbb.max.y) && (start.z > stbb.min.z) && (start.z < stbb.max.z)) {
1054 }
1055 port_corridor = start.z - position.z;
1056
1057 allow_docking = docking;
1059 allow_launching = launching;
1060}
OOINLINE HPVector HPvector_multiply_scalar(HPVector v, OOHPScalar s) INLINE_CONST_FUNC
Definition OOHPVector.h:198
OOINLINE HPVector HPvector_add(HPVector a, HPVector b) INLINE_CONST_FUNC
Definition OOHPVector.h:213
Vector virtualPortDimensions()

References allow_docking, allow_launching, Entity::boundingBox, disallowed_docking_collides, HPvector_add(), HPvector_forward_from_quaternion(), HPvector_multiply_scalar(), make_vector(), BoundingBox::max, BoundingBox::min, Entity::orientation, Entity::parentEntity, port_corridor, port_dimensions, Entity::position, virtual_dock, StationEntity::virtualPortDimensions, HPVector::x, Vector::x, HPVector::y, Vector::y, HPVector::z, and Vector::z.

Referenced by ShipEntity::setUpOneStandardSubentity:asTurret:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDisallowedDockingCollides:

- (void) setDisallowedDockingCollides: (BOOL) ddc

Definition at line 184 of file DockEntity.m.

184 :(BOOL)ddc
185{
187}

References disallowed_docking_collides.

Referenced by DockSetProperty(), and DockSetProperty().

Here is the caller graph for this function:

◆ setUpShipFromDictionary:

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

Reimplemented from ShipEntity.

Definition at line 1115 of file DockEntity.m.

1115 :(NSDictionary*)dict
1116{
1118
1119 isShip = YES;
1120 isStation = NO;
1121
1122 if (![super setUpShipFromDictionary:dict])
1123 return NO;
1124
1125 return YES;
1126
1128}
unsigned isStation
Definition Entity.m:135

References Entity::isShip, Entity::isStation, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

◆ setVirtual

- (void) setVirtual

Definition at line 189 of file DockEntity.m.

190{
191 virtual_dock = YES;
192}

References setVirtual, and virtual_dock.

Referenced by ShipEntity::setUpOneStandardSubentity:asTurret:, and setVirtual.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shipIsInDockingCorridor:

- (BOOL) shipIsInDockingCorridor: (ShipEntity*) ship

Definition at line 604 of file DockEntity.m.

604 :(ShipEntity*)ship
605{
606 if (![ship isShip])
607 return NO;
608 if ([ship isPlayer] && [ship status] == STATUS_DEAD)
609 return NO;
610
611 BOOL allow_docking_thisship = allow_docking || !disallowed_docking_collides;
612 // ships can physically dock here, and this routine is mainly for
613 // collision detection, but will never be directed here by traffic
614 // control, if allow_docking is false but d_d_c is also false
615
616 StationEntity* station = (StationEntity*)[self parentEntity];
617 if ([station status] == STATUS_DEAD) {
618 return NO;
619 }
620
625
626 HPVector port_pos = [self absolutePositionForSubentity];
627
628 BoundingBox shipbb = [ship boundingBox];
629 BoundingBox arbb = [ship findBoundingBoxRelativeToPosition:port_pos i:vi j:vj k:vk];
630
631 // port dimensions..
632 GLfloat ww = port_dimensions.x;
633 GLfloat hh = port_dimensions.y;
634 GLfloat dd = port_dimensions.z;
635
636 BOOL rotatedPort = (ww >= hh) ? NO : YES;
637 BOOL rotatedShip = ((shipbb.max.x - shipbb.min.x) >= (shipbb.max.y - shipbb.min.y)) ? NO : YES;
638 BOOL rotationsMatch = (rotatedShip == rotatedPort);
639 if (rotationsMatch) {
640 // the ship and port are both bigger in x than y
641 while (shipbb.max.x - shipbb.min.x > ww * 0.90)
642 ww *= 1.25;
643 while (shipbb.max.y - shipbb.min.y > hh * 0.90)
644 hh *= 1.25;
645 } else {
646 // the ship and port have different x/y biggerness
647 while (shipbb.max.y - shipbb.min.y > ww * 0.90)
648 ww *= 1.25;
649 while (shipbb.max.x - shipbb.min.x > hh * 0.90)
650 hh *= 1.25;
651 }
652
653 ww *= 0.5;
654 hh *= 0.5;
655
656#ifdef OO_DEBUG_MONITOR_ENABLED
657 if ([ship isPlayer] && (gDebugFlags & DEBUG_DOCKING)) {
658 BOOL inLane;
659 float range;
660 unsigned laneFlags = 0;
661
662 if (arbb.max.x < ww)
663 laneFlags |= 1;
664 if (arbb.min.x > -ww)
665 laneFlags |= 2;
666 if (arbb.max.y < hh)
667 laneFlags |= 4;
668 if (arbb.min.y > -hh)
669 laneFlags |= 8;
670 inLane = laneFlags == 0xF;
671 range = 0.90 * arbb.max.z + 0.10 * arbb.min.z;
672
673 OOLog(@"docking.debug", @"Normalised port dimensions are %g x %g x %g. Player bounding box is at %@-%@ -- %s (%X), range: %g",
674 ww * 2.0, hh * 2.0, dd,
675 VectorDescription(arbb.min), VectorDescription(arbb.max),
676 inLane ? "in lane" : "out of lane", laneFlags,
677 range);
678 }
679#endif
680
681 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)) {
682 if ([station requiresDockingClearance] && [ship isPlayer] && [ship status] != STATUS_LAUNCHING && [ship status] != STATUS_AUTOPILOT_ENGAGED && [PLAYER getDockingClearanceStatus] < DOCKING_CLEARANCE_STATUS_GRANTED) {
683 if ((0.90 * arbb.max.z + 0.10 * arbb.min.z < 3000) && (dot_product(vk, [ship forwardVector]) < -0.9)) {
684 // player is in docking corridor and facing dock
685 // and within 3km
686 [UNIVERSE addMessage:DESC(@"oolite-station-docking-requires-clearance") forCount:3];
687 }
688 }
689 }
690
691 if (arbb.max.z < -dd) {
692 return NO;
693 }
694
695 if ((arbb.max.x < ww) && (arbb.min.x > -ww) && (arbb.max.y < hh) && (arbb.min.y > -hh)) {
696 if ([ship status] != STATUS_LAUNCHING && !allow_docking_thisship) { // launch-only dock: will collide!
697 if (arbb.min.z < dd) {
698 [ship takeScrapeDamage:5 * [UNIVERSE getTimeDelta] * [ship flightSpeed] from:station];
699 // and bounce
700 HPVector rel = HPvector_subtract([ship position], port_pos);
701 rel = HPvector_multiply_scalar(HPvector_normal(rel), [ship flightSpeed] * 0.4);
702 [ship adjustVelocity:HPVectorToVector(rel)];
703 }
704
705 if (arbb.max.z < 0.0) { // give some warning before exploding...
706 return NO;
707 }
708 }
709
710 // in lane
711 if (0.90 * arbb.max.z + 0.10 * arbb.min.z < 0.0) // we're 90% in docking position!
712 {
713 [self pullInShipIfPermitted:ship];
714 }
715 return YES;
716 }
717
718 if ([ship status] == STATUS_LAUNCHING) {
719 return YES;
720 }
721
722 // if close enough (within 50%) correct and add damage
723 //
724 GLfloat safety = 1.0 + (50.0 / 100.0);
725
726 if ((arbb.min.x > -safety * ww) && (arbb.max.x < safety * ww) && (arbb.min.y > -safety * hh) && (arbb.max.y < safety * hh)) {
727 if (arbb.min.z < 0.0) // got our nose inside
728 {
729
730 if ((arbb.min.x < -ww && arbb.max.x > ww) || (arbb.min.y < -hh && arbb.max.y > hh)) {
731 /* No matter how much safety margin there is, if the
732 * ship is going off opposite edges of the dock at
733 * once, that's a fatal collision */
734 return NO;
735 }
736
737 GLfloat correction_factor = -arbb.min.z / (arbb.max.z - arbb.min.z); // proportion of ship inside
738
739 // damage the ship according to velocity - don't send collision messages to AIs to avoid problems.
740 [ship takeScrapeDamage:5 * [UNIVERSE getTimeDelta] * [ship flightSpeed] from:station];
741 [station doScriptEvent:OOJSID("shipCollided") withArgument:ship]; // no COLLISION message to station AI, carriers would move away!
742 [ship doScriptEvent:OOJSID("shipCollided") withArgument:station]; // no COLLISION message to ship AI, dockingAI.plist would abort.
743
744 Vector delta;
745 delta.x = 0.5f * (arbb.max.x + arbb.min.x) * correction_factor;
746 delta.y = 0.5f * (arbb.max.y + arbb.min.y) * correction_factor;
747
748 if (arbb.max.x < ww && arbb.min.x > -ww) {
749 // x is okay - no need to correct
750 delta.x = 0.0f;
751 }
752 if (arbb.max.y > hh && arbb.min.y > -hh) {
753 // y is okay - no need to correct
754 delta.y = 0.0f;
755 }
756
757 // adjust the ship back to the center of the port
758 HPVector pos = [ship position];
759 pos.x -= delta.y * vj.x + delta.x * vi.x;
760 pos.y -= delta.y * vj.y + delta.x * vi.y;
761 pos.z -= delta.y * vj.z + delta.x * vi.z;
762 [ship setPosition:pos];
763 }
764
765 // if far enough in - dock
766 if (0.90f * arbb.max.z + 0.10f * arbb.min.z < 0.0f) {
767 [self pullInShipIfPermitted:ship];
768 }
769
770 return YES; // okay NOW we're in the docking corridor!
771 }
772
773 return NO;
774}
#define gDebugFlags
@ DEBUG_DOCKING
Definition OODebugFlags.h:7
#define OOLog(class, format,...)
Definition OOLogging.h:84
BoundingBox findBoundingBoxRelativeToPosition:i:j:k:(HPVector opv,[i] Vector i,[j] Vector j,[k] Vector k)

References Entity::absolutePositionForSubentity, ShipEntity::adjustVelocity:, allow_docking, Entity::boundingBox, DEBUG_DOCKING, disallowed_docking_collides, DOCKING_CLEARANCE_STATUS_GRANTED, ShipEntity::doScriptEvent:withArgument:, dot_product(), ShipEntity::findBoundingBoxRelativeToPosition:i:j:k:, ShipEntity::flightSpeed, ShipEntity::forwardVector, gDebugFlags, HPvector_multiply_scalar(), HPvector_normal(), HPvector_subtract(), Entity::isPlayer, Entity::isShip, BoundingBox::max, BoundingBox::min, OOLog, Entity::orientation, Entity::parentEntity, PLAYER, port_dimensions, Entity::position, pullInShipIfPermitted:, quaternion_multiply(), Entity::setPosition:, Entity::status, ShipEntity::takeScrapeDamage:from:, vector_forward_from_quaternion(), vector_right_from_quaternion(), vector_up_from_quaternion(), HPVector::x, Vector::x, HPVector::y, Vector::y, HPVector::z, and Vector::z.

Here is the call graph for this function:

◆ shipIsInDockingQueue:

- (BOOL) shipIsInDockingQueue: (ShipEntity*) ship

Definition at line 574 of file DockEntity.m.

574 :(ShipEntity*)ship
575{
576 if (![ship isShip])
577 return NO;
578 if ([ship isPlayer] && [ship status] == STATUS_DEAD)
579 return NO;
580
581 OOUniversalID ship_id = [ship universalID];
582 NSNumber* shipID = [NSNumber numberWithUnsignedShort:ship_id];
583
584 if ([shipsOnApproach objectForKey:shipID]) {
585 return YES;
586 }
587 // player docking manually
588 if ([ship isPlayer] && [[self owner] playerReservedDock] == self) {
589 return YES;
590 }
591 return NO;
592}
id owner()
Definition Entity.m:548

References Entity::isPlayer, Entity::isShip, Entity::owner, shipsOnApproach, Entity::status, and Entity::universalID.

Referenced by DockIsQueued(), and DockIsQueued().

Here is the call graph for this function:
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 1157 of file DockEntity.m.

1157 :(double)amount from:(Entity*)ent becauseOf:(Entity*)other weaponIdentifier:(NSString*)weaponIdentifier
1158{
1159 if (virtual_dock) // can't be damaged
1160 {
1161 return;
1162 }
1163 [super takeEnergyDamage:amount from:ent becauseOf:other weaponIdentifier:weaponIdentifier];
1164}

References ShipEntity::takeEnergyDamage:from:becauseOf:weaponIdentifier:, and virtual_dock.

Here is the call graph for this function:

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 1130 of file DockEntity.m.

1130 :(OOTimeDelta)delta_t
1131{
1132 [super update:delta_t];
1133
1134 if (([launchQueue count] > 0) && ([shipsOnApproach count] == 0) && [self dockingCorridorIsEmpty]) {
1135 ShipEntity* se = (ShipEntity*)[launchQueue objectAtIndex:0];
1136 // check to make sure ship has not been destroyed in queue by script
1137 if ([se status] == STATUS_DOCKED) {
1138 [self launchShip:se];
1139 }
1140 [launchQueue removeObjectAtIndex:0];
1141 }
1143 no_docking_while_launching = NO; // launching complete
1144 }
1145}
double OOTimeDelta
Definition OOTypes.h:193
BOOL dockingCorridorIsEmpty()
Definition DockEntity.m:906

References count, dockingCorridorIsEmpty, launchQueue, launchShip:, no_docking_while_launching, shipsOnApproach, Entity::status, and ShipEntity::update:.

Here is the call graph for this function:

Member Data Documentation

◆ allow_docking

◆ allow_launching

- (BOOL) allow_launching
private

◆ disallowed_docking_collides

- (BOOL) disallowed_docking_collides
private

◆ id_lock

- (ShipEntity* id_lock[MAX_DOCKING_STAGES])
private

Definition at line 39 of file DockEntity.h.

Referenced by dockingInstructionsForShip:.

◆ last_launch_time

- (double) last_launch_time
private

◆ launchQueue

- (NSMutableArray*) launchQueue
private

◆ no_docking_while_launching

- (BOOL) no_docking_while_launching
private

Definition at line 44 of file DockEntity.h.

Referenced by abortAllDockings, abortAllLaunches, canAcceptShipForDocking:, launchShip:, and update:.

◆ port_corridor

- (double) port_corridor
private

Definition at line 42 of file DockEntity.h.

Referenced by launchShip:, and setDimensionsAndCorridor:ddc:launching:.

◆ port_dimensions

◆ shipsOnApproach

- (NSMutableDictionary*) shipsOnApproach
private

◆ virtual_dock


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