Oolite
Loading...
Searching...
No Matches
StationEntity Class Reference

#include <StationEntity.h>

Inheritance diagram for StationEntity:
Collaboration diagram for StationEntity:

Instance Methods

(OOCargoQuantity) - marketCapacity
(NSArray *) - marketDefinition
(NSString *) - marketScriptName
(BOOL) - marketMonitored
(BOOL) - marketBroadcast
(OOCreditsQuantity) - legalStatusOfManifest:export:
(OOCommodityMarket *) - localMarket
(void) - setLocalMarket:
(NSDictionary *) - localMarketForScripting
(void) - setPrice:forCommodity:
(void) - setQuantity:forCommodity:
(NSMutableArray *) - localShipyard
(void) - setLocalShipyard:
(void) - generateShipyard
(void) - generateShipyard:
(NSMutableDictionary *) - localInterfaces
(void) - setInterfaceDefinition:forKey:
(OOCommodityMarket *) - initialiseLocalMarket
(OOTechLevelID) - equivalentTechLevel
(void) - setEquivalentTechLevel:
(NSEnumerator *) - dockSubEntityEnumerator
(Vector) - virtualPortDimensions
(DockEntity *) - playerReservedDock
(HPVector) - beaconPosition
(float) - equipmentPriceFactor
(void) - setPlanet:
(OOPlanetEntity *) - planet
(void) - setAllegiance:
(NSString *) - allegiance
(unsigned) - countOfDockedContractors
(unsigned) - countOfDockedPolice
(unsigned) - countOfDockedDefenders
(void) - sanityCheckShipsOnApproach
(void) - autoDockShipsOnApproach
(Vector) - portUpVectorForShip:
(NSDictionary *) - dockingInstructionsForShip:
(BOOL) - shipIsInDockingCorridor:
(BOOL) - dockingCorridorIsEmpty
(void) - clearDockingCorridor
(void) - clear
(void) - abortAllDockings
(void) - abortDockingForShip:
(BOOL) - hasMultipleDocks
(BOOL) - hasClearDock
(BOOL) - hasLaunchDock
(DockEntity *) - selectDockForDocking
(unsigned) - currentlyInLaunchingQueues
(unsigned) - currentlyInDockingQueues
(void) - launchShip:
(ShipEntity *) - launchIndependentShip:
(void) - noteDockedShip:
(BOOL) - interstellarUndockingAllowed
(BOOL) - hasNPCTraffic
(void) - setHasNPCTraffic:
(OOStationAlertLevel) - alertLevel
(void) - setAlertLevel:signallingScript:
(void) - increaseAlertLevel
(void) - decreaseAlertLevel
(NSArray *) - launchPolice
(ShipEntity *) - launchDefenseShip
(ShipEntity *) - launchScavenger
(ShipEntity *) - launchMiner
(ShipEntity *) - launchPirateShip
(ShipEntity *) - launchShuttle
(ShipEntity *) - launchEscort
(ShipEntity *) - launchPatrol
(void) - launchShipWithRole:
(void) - acceptPatrolReportFrom:
(NSString *) - acceptDockingClearanceRequestFrom:
(BOOL) - requiresDockingClearance
(void) - setRequiresDockingClearance:
(BOOL) - allowsFastDocking
(void) - setAllowsFastDocking:
(BOOL) - allowsAutoDocking
(void) - setAllowsAutoDocking:
(BOOL) - allowsSaving
(NSString *) - marketOverrideName
(BOOL) - isRotatingStation
(BOOL) - hasShipyard
(BOOL) - suppressArrivalReports
(void) - setSuppressArrivalReports:
(BOOL) - hasBreakPattern
(void) - setHasBreakPattern:
(BOOL) - fitsInDock:
(BOOL) - fitsInDock:andLogNoFit:
(BOOL) - isUnpiloted [implementation]
(void) - autoDockShipsOnHold [implementation]
(NSDictionary *) - OOMakeDockingInstructions [implementation]
(NSDictionary *) - holdPositionInstructionForShip: [implementation]
(id) - initWithKey:definition: [implementation]
(void) - dealloc [implementation]
(BOOL) - setUpShipFromDictionary: [implementation]
(BOOL) - setUpSubEntities [implementation]
(void) - pullInShipIfPermitted: [implementation]
(void) - update: [implementation]
(BOOL) - hasEligibleDock [implementation]
(void) - addShipToLaunchQueue:withPriority: [implementation]
(unsigned) - countOfShipsInLaunchQueueWithPrimaryRole: [implementation]
(void) - addShipToStationCount: [implementation]
(BOOL) - collideWithShip: [implementation]
(BOOL) - hasHostileTarget [implementation]
(void) - takeEnergyDamage:from:becauseOf:weaponIdentifier: [implementation]
(void) - adjustVelocity: [implementation]
(void) - takeScrapeDamage:from: [implementation]
(void) - takeHeatDamage: [implementation]
(void) - becomeExplosion [implementation]
(void) - becomeEnergyBlast [implementation]
(void) - becomeLargeExplosion: [implementation]
(NSString *) - descriptionComponents [implementation]
(void) - dumpSelfState [implementation]
(NSArray *) - dbgGetShipsOnApproach [implementation]
(NSArray *) - dbgGetIdLocks [implementation]
(NSString *) - dbgDumpIdLocks [implementation]
(void) - acceptDistressMessageFrom: [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) - 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
(OOAlertCondition) - alertCondition
(OOAlertCondition) - realAlertCondition
(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) - noteTakingDamage:from:type:
(void) - noteKilledBy:damageType:
(void) - getDestroyedBy:damageType:
(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
(void) - addImpactMoment:fraction:
(BOOL) - canScoop:
(void) - getTractoredBy:
(void) - scoopIn:
(void) - scoopUp:
(void) - scoopUpProcess:processEvents:processMessages:
(BOOL) - abandonShip
(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 *) - 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) - drawImmediate:translucent: [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]
(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) - isDock
(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
(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

OOWeakSet * _shipsOnHold
DockEntity * player_reserved_dock
double last_launch_time
double approach_spacing
OOStationAlertLevel alertLevel
unsigned max_police
unsigned max_defense_ships
unsigned defenders_launched
unsigned max_scavengers
unsigned scavengers_launched
OOTechLevelID equivalentTechLevel
float equipmentPriceFactor
Vector port_dimensions
double port_radius
unsigned no_docking_while_launching: 1
unsigned hasNPCTraffic: 1
BOOL hasPatrolShips
OOUniversalID planet
NSString * allegiance
OOCommodityMarket * localMarket
OOCargoQuantity marketCapacity
NSArray * marketDefinition
NSString * marketScriptName
NSMutableArray * localShipyard
NSMutableDictionary * localInterfaces
unsigned docked_shuttles
double last_shuttle_launch_time
double shuttle_launch_interval
unsigned docked_traders
double last_trader_launch_time
double trader_launch_interval
double last_patrol_report_time
double patrol_launch_interval
unsigned suppress_arrival_reports: 1
unsigned requiresDockingClearance: 1
unsigned interstellarUndockingAllowed: 1
unsigned allowsFastDocking: 1
unsigned allowsSaving: 1
unsigned allowsAutoDocking: 1
unsigned hasBreakPattern: 1
unsigned marketMonitored: 1
unsigned marketBroadcast: 1

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 51 of file StationEntity.h.

Method Documentation

◆ abortAllDockings

- (void) abortAllDockings

Definition at line 312 of file StationEntity.m.

313{
314 NSEnumerator* subEnum = nil;
315 DockEntity* sub = nil;
316 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
317 [sub abortAllDockings];
318 }
319
320 [_shipsOnHold makeObjectsPerformSelector:@selector(sendAIMessage:) withObject:@"DOCKING_ABORTED"];
321 NSEnumerator* holdEnum = nil;
322 ShipEntity* hold = nil;
323 for (holdEnum = [_shipsOnHold objectEnumerator]; (hold = [holdEnum nextObject]);) {
324 [hold doScriptEvent:OOJSID("stationWithdrewDockingClearance")];
325 }
326
327 PlayerEntity* player = PLAYER;
328
329 if ([player getTargetDockStation] == self && [player getDockingClearanceStatus] >= DOCKING_CLEARANCE_STATUS_REQUESTED) {
330 // then docking clearance is requested but hasn't been cancelled
331 // yet by a DockEntity
332 [self sendExpandedMessage:@"[station-docking-clearance-abort-cancelled]" toShip:player];
333 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
334 [player doScriptEvent:OOJSID("stationWithdrewDockingClearance")];
335 }
336
337 [_shipsOnHold removeAllObjects];
338
339 [shipAI message:@"DOCKING_COMPLETE"];
340 [self doScriptEvent:OOJSID("stationDockingQueuesAreEmpty")];
341}
return nil
@ DOCKING_CLEARANCE_STATUS_REQUESTED
Definition OOTypes.h:150
#define PLAYER
void abortAllDockings()
Definition DockEntity.m:89
void setDockingClearanceStatus:(OODockingClearanceStatus newValue)
void doScriptEvent:(OOJSPropID message)
OOWeakSet * _shipsOnHold
NSEnumerator * dockSubEntityEnumerator()

References _shipsOnHold, DockEntity::abortAllDockings, abortAllDockings, DOCKING_CLEARANCE_STATUS_REQUESTED, dockSubEntityEnumerator, ShipEntity::doScriptEvent:, OOWeakSet::makeObjectsPerformSelector:withObject:, AI::message:, nil, PLAYER, OOWeakSet::removeAllObjects, ShipEntity::sendExpandedMessage:toShip:, and PlayerEntity::setDockingClearanceStatus:.

Referenced by abortAllDockings, allegiance, launchDefenseShip, launchPirateShip, launchPolice, StationAbortAllDockings(), StationAbortAllDockings(), StationLaunchShipWithRole(), and StationLaunchShipWithRole().

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

◆ abortDockingForShip:

- (void) abortDockingForShip: (ShipEntity*) ship

Definition at line 516 of file StationEntity.m.

516 :(ShipEntity*)ship
517{
518 [ship sendAIMessage:@"DOCKING_ABORTED"];
519 [ship doScriptEvent:OOJSID("stationWithdrewDockingClearance")];
520
521 [_shipsOnHold removeObject:ship];
522
523 NSEnumerator* subEnum = nil;
524 DockEntity* sub = nil;
525 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
526 [sub abortDockingForShip:ship];
527 }
528
529 if ([ship isPlayer]) {
531 }
532
533 [self sanityCheckShipsOnApproach];
534}
void abortDockingForShip:(ShipEntity *ship)
Definition DockEntity.m:534
unsigned isPlayer
Definition Entity.m:145
void sendAIMessage:(NSString *message)
DockEntity * player_reserved_dock

References DockEntity::abortDockingForShip:, dockSubEntityEnumerator, ShipEntity::doScriptEvent:, Entity::isPlayer, nil, player_reserved_dock, OOWeakSet::removeObject:, sanityCheckShipsOnApproach, and ShipEntity::sendAIMessage:.

Referenced by StationAbortDockingForShip(), and StationAbortDockingForShip().

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

◆ acceptDistressMessageFrom:

- (void) acceptDistressMessageFrom: (ShipEntity*) other
implementation

Reimplemented from ShipEntity.

Provided by category StationEntity(OOAIPrivate).

Definition at line 2532 of file ShipEntityAI.m.

2532 :(ShipEntity*)other
2533{
2534 if (self != [UNIVERSE station])
2535 return;
2536
2537 OOWeakReference* old_target = _primaryTarget;
2538 _primaryTarget = [[[other primaryTarget] weakRetain] autorelease];
2539 [(ShipEntity*)[other primaryTarget] markAsOffender:8 withReason:kOOLegalStatusReasonDistressCall]; // mark their card
2540 [self launchDefenseShip];
2541 _primaryTarget = old_target;
2542}
#define UNIVERSE
Definition Universe.h:827
OOWeakReference * _primaryTarget
Definition ShipEntity.h:425
void markAsOffender:withReason:(int offence_value,[withReason] OOLegalStatusReason reason)

◆ acceptDockingClearanceRequestFrom:

- (NSString *) acceptDockingClearanceRequestFrom: (ShipEntity*) other

Definition at line 1785 of file StationEntity.m.

1785 :(ShipEntity*)other
1786{
1787 NSString* result = nil;
1788 double timeNow = [UNIVERSE getTime];
1789 PlayerEntity* player = PLAYER;
1790
1791 [self doScriptEvent:OOJSID("stationReceivedDockingRequest") withArgument:other];
1792
1793 [UNIVERSE clearPreviousMessage];
1794
1795 [self sanityCheckShipsOnApproach];
1796
1797 // Docking clearance not required - clear it just in case it's been
1798 // set for another nearby station.
1799 if (![self requiresDockingClearance]) {
1800 // TODO: We're potentially cancelling docking at another station, so
1801 // ensure we clear the timer to allow NPC traffic. If we
1802 // don't, normal traffic will resume once the timer runs out.
1803 // No clearance is needed, but don't send friendly messages to hostile ships!
1804 if (!(([other isPlayer] && [other hasHostileTarget]) || (self == [UNIVERSE station] && [other bounty] > 50))) {
1805 [self sendExpandedMessage:@"[station-docking-clearance-not-required]" toShip:other];
1806 }
1807 if ([other isPlayer]) {
1808 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NOT_REQUIRED];
1809 }
1810 [shipAI reactToMessage:@"DOCKING_REQUESTED" context:nil]; // react to the request
1811 [self doScriptEvent:OOJSID("stationAcceptedDockingRequest") withArgument:other];
1812
1814 result = @"DOCKING_CLEARANCE_NOT_REQUIRED";
1815 }
1816
1817 // Docking clearance already granted for this station - check for
1818 // time-out or cancellation (but only for the Player).
1819 if (result == nil && [other isPlayer] && self == [player getTargetDockStation]) {
1820 switch ([player getDockingClearanceStatus]) {
1824 [self sendExpandedMessage:[NSString stringWithFormat:
1825 DESC(@"station-docking-clearance-extended-until-@"),
1826 ClockToString([player clockTime] + DOCKING_CLEARANCE_WINDOW, NO)]
1827 toShip:other];
1828 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_GRANTED];
1829 result = @"DOCKING_CLEARANCE_EXTENDED";
1830 break;
1831 }
1832 // else, continue with canceling.
1835 last_launch_time = timeNow;
1836 [self sendExpandedMessage:@"[station-docking-clearance-cancelled]" toShip:other];
1837 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
1838 result = @"DOCKING_CLEARANCE_CANCELLED";
1840 if ([self currentlyInDockingQueues] == 0) {
1841 [shipAI message:@"DOCKING_COMPLETE"];
1842 [self doScriptEvent:OOJSID("stationDockingQueuesAreEmpty")];
1843 }
1844 break;
1847 break;
1848 }
1849 }
1850
1851 // First we must set the status to REQUESTED to avoid problems when
1852 // switching docking targets - even if we later set it back to NONE.
1853 if (result == nil && [other isPlayer] && self != [player getTargetDockStation]) {
1854 player_reserved_dock = nil; // and clear any previously reserved dock
1855 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_REQUESTED];
1856 }
1857
1858 // Deny docking for fugitives at the main station
1859 // TODO: Should this be another key in shipdata.plist and/or should this
1860 // apply to all stations?
1861 if (result == nil && self == [UNIVERSE station] && [other bounty] > 50) // do not grant docking clearance to fugitives
1862 {
1863 [self sendExpandedMessage:@"[station-docking-clearance-H-clearance-refused]" toShip:other];
1864 if ([other isPlayer])
1865 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
1866 result = @"DOCKING_CLEARANCE_DENIED_SHIP_FUGITIVE";
1867 }
1868
1869 if (result == nil && [other hasHostileTarget]) // do not grant docking clearance to hostile ships.
1870 {
1871 [self sendExpandedMessage:@"[station-docking-clearance-denied]" toShip:other];
1872 if ([other isPlayer])
1873 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
1874 result = @"DOCKING_CLEARANCE_DENIED_SHIP_HOSTILE";
1875 }
1876
1877 if (![self hasEligibleDock]) // make sure at least one dock could plausibly accept the player
1878 {
1879 if ([other isPlayer]) {
1880 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
1881 }
1882 [self sendExpandedMessage:@"[station-docking-clearance-denied-no-docks]" toShip:other];
1883
1884 result = @"DOCKING_CLEARANCE_DENIED_NO_DOCKS";
1885 } else if (![self hasClearDock]) // skip check if at least one dock clear
1886 {
1887 // Put ship in queue if we've got incoming or outgoing traffic or
1888 // if the player is waiting for manual clearance and we are not
1889 // the player
1890 if (result == nil && (([self currentlyInDockingQueues] && last_launch_time < timeNow) || (![other isPlayer] && [player getDockingClearanceStatus] == DOCKING_CLEARANCE_STATUS_REQUESTED))) {
1891 [self sendExpandedMessage:[NSString stringWithFormat:
1892 DESC(@"station-docking-clearance-acknowledged-d-ships-approaching"),
1893 [self currentlyInDockingQueues] + 1]
1894 toShip:other];
1895 // No need to set status to REQUESTED as we've already done that earlier.
1896 result = @"DOCKING_CLEARANCE_DENIED_TRAFFIC_INBOUND";
1897 }
1898
1899 if (result == nil && [self currentlyInLaunchingQueues]) {
1900 [self sendExpandedMessage:[NSString stringWithFormat:
1901 DESC(@"station-docking-clearance-acknowledged-d-ships-departing"),
1902 [self currentlyInLaunchingQueues] + 1]
1903 toShip:other];
1904 // No need to set status to REQUESTED as we've already done that earlier.
1905 result = @"DOCKING_CLEARANCE_DENIED_TRAFFIC_OUTBOUND";
1906 }
1907 if (result == nil) {
1908 // if this happens, the station has no docks which allow
1909 // docking, so deny clearance
1910 if ([other isPlayer]) {
1911 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
1912 }
1913 result = @"DOCKING_CLEARANCE_DENIED_NO_DOCKS";
1914 // but can check to see if we'll open some for later.
1915 NSEnumerator* subEnum = nil;
1916 DockEntity* sub = nil;
1917 BOOL openLater = NO;
1918 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
1919 NSString* docking = [sub canAcceptShipForDocking:other];
1920 if ([docking isEqualToString:@"DOCK_CLOSED"]) {
1921 JSContext* context = OOJSAcquireContext();
1922 OOJSVal rval = OOJSUndefinedValue();
1923 OOJSVal args[] = { OOJSValueFromNativeObject(context, sub),
1924 OOJSValueFromNativeObject(context, other) };
1925 BOOL tempreject = NO;
1926
1927 BOOL OK = [[self script] callMethod:OOJSID("willOpenDockingPortFor") inContext:context withArguments:args count:2 result:&rval];
1928 if (OK)
1929 tempreject = OOJSValueToBOOL(context, rval);
1930 if (!OK)
1931 tempreject = NO; // default to permreject
1932 if (tempreject) {
1933 openLater = YES;
1934 }
1935
1936 OOJSFreeValue(context, rval);
1937 OOJSFreeValue(context, args[0]);
1938 OOJSFreeValue(context, args[1]);
1939 OOJSRelinquishContext(context);
1940 }
1941 if (openLater)
1942 break;
1943 }
1944
1945 if (openLater) {
1946 [self sendExpandedMessage:@"[station-docking-clearance-denied-no-docks-yet]" toShip:other];
1947 } else {
1948 [self sendExpandedMessage:@"[station-docking-clearance-denied-no-docks]" toShip:other];
1949 }
1950 }
1951 }
1952
1953 // Ship has passed all checks - grant docking!
1954 if (result == nil) {
1956 if ([other isPlayer]) {
1957 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_GRANTED];
1958 player_reserved_dock = [self selectDockForDocking];
1959 }
1960
1961 if ([self hasMultipleDocks] && [other isPlayer]) {
1962 [self sendExpandedMessage:[NSString stringWithFormat:
1963 DESC(@"station-docking-clearance-granted-in-@-until-@"),
1964 [player_reserved_dock displayName],
1965 ClockToString([player clockTime] + DOCKING_CLEARANCE_WINDOW, NO)]
1966 toShip:other];
1967 } else {
1968 [self sendExpandedMessage:[NSString stringWithFormat:
1969 DESC(@"station-docking-clearance-granted-until-@"),
1970 ClockToString([player clockTime] + DOCKING_CLEARANCE_WINDOW, NO)]
1971 toShip:other];
1972 }
1973
1974 result = @"DOCKING_CLEARANCE_GRANTED";
1975 [shipAI reactToMessage:@"DOCKING_REQUESTED" context:nil]; // react to the request
1976 [self doScriptEvent:OOJSID("stationAcceptedDockingRequest") withArgument:other];
1977 }
1978 return result;
1979}
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)
@ DOCKING_CLEARANCE_STATUS_TIMING_OUT
Definition OOTypes.h:152
@ DOCKING_CLEARANCE_STATUS_NOT_REQUIRED
Definition OOTypes.h:149
@ DOCKING_CLEARANCE_STATUS_GRANTED
Definition OOTypes.h:151
@ DOCKING_CLEARANCE_STATUS_NONE
Definition OOTypes.h:148
#define DOCKING_CLEARANCE_WINDOW
NSString * canAcceptShipForDocking:(ShipEntity *ship)
Definition DockEntity.m:194
OOCreditsQuantity bounty
double last_launch_time
unsigned currentlyInDockingQueues()
unsigned no_docking_while_launching
unsigned currentlyInLaunchingQueues()
unsigned requiresDockingClearance

References ShipEntity::bounty, OOJSScript::callMethod:inContext:withArguments:count:result:, DockEntity::canAcceptShipForDocking:, PlayerEntity::clockTime, currentlyInDockingQueues, currentlyInLaunchingQueues, ShipEntity::displayName, DOCKING_CLEARANCE_STATUS_GRANTED, DOCKING_CLEARANCE_STATUS_NONE, DOCKING_CLEARANCE_STATUS_NOT_REQUIRED, DOCKING_CLEARANCE_STATUS_REQUESTED, DOCKING_CLEARANCE_STATUS_TIMING_OUT, DOCKING_CLEARANCE_WINDOW, dockSubEntityEnumerator, ShipEntity::doScriptEvent:, ShipEntity::doScriptEvent:withArgument:, hasClearDock, hasEligibleDock, hasHostileTarget, hasMultipleDocks, Entity::isPlayer, last_launch_time, AI::message:, nil, no_docking_while_launching, OOJSAcquireContext(), OOJSFreeValue, OOJSRelinquishContext(), OOJSUndefinedValue, OOJSValueFromNativeObject(), OOJSValueToBOOL(), PLAYER, player_reserved_dock, AI::reactToMessage:context:, requiresDockingClearance, sanityCheckShipsOnApproach, ShipEntity::script, selectDockForDocking, ShipEntity::sendExpandedMessage:toShip:, PlayerEntity::setDockingClearanceStatus:, and UNIVERSE.

Referenced by PlayerEntity::cancelDockingRequest:, and PlayerEntity::performDockingRequest:.

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

◆ acceptPatrolReportFrom:

- (void) acceptPatrolReportFrom: (ShipEntity*) patrol_ship

Definition at line 1778 of file StationEntity.m.

1778 :(ShipEntity*)patrol_ship
1779{
1780 last_patrol_report_time = [UNIVERSE getTime];
1781}
double last_patrol_report_time

References last_patrol_report_time.

Referenced by launchPatrol, ShipEntity(PureAI)::patrolReportIn, ShipPatrolReportIn(), and ShipPatrolReportIn().

Here is the caller graph for this function:

◆ addShipToLaunchQueue:withPriority:

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

Provided by category StationEntity(OOPrivate).

Definition at line 936 of file StationEntity.m.

936 :(ShipEntity*)ship withPriority:(BOOL)priority
937{
938 NSEnumerator* subEnum = nil;
939 DockEntity* sub = nil;
940 unsigned threshold = 0;
941
942 // quickest launch if we assign ships to those bays with no incoming ships
943 // and spread the ships evenly around those bays
944 // much easier if the station has at least one launch-only dock
945 while (threshold < 16) {
946 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
947 if (sub != player_reserved_dock) {
948 if ([sub countOfShipsInDockingQueue] == 0) {
949 if ([sub allowsLaunching] && [sub countOfShipsInLaunchQueue] <= threshold) {
950 if ([sub allowsLaunchingOf:ship]) {
951 [sub addShipToLaunchQueue:ship withPriority:priority];
952 return;
953 }
954 }
955 }
956 }
957 }
958 threshold++;
959 }
960 // if we get this far, all docks have at least some incoming traffic.
961 // usually most efficient (since launching is far faster than docking)
962 // to assign all ships to the *same* dock with the smallest incoming queue
963 // rather than to try spreading them out across several queues
964 // also stops escorts being launched before their mothership
965 threshold = 0;
966 while (threshold < 16) {
967 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
968 /* so this time as long as it allows launching only check
969 * the docking queue size so long as enumerator order is
970 * deterministic, this will assign every launch this
971 * update to the same dock (edge case where new docking
972 * ship appears in the middle, probably not a problem) */
973 if ([sub allowsLaunching] && [sub countOfShipsInDockingQueue] <= threshold) {
974 if ([sub allowsLaunchingOf:ship]) {
975 [sub addShipToLaunchQueue:ship withPriority:priority];
976 return;
977 }
978 }
979 }
980 threshold++;
981 }
982
983 OOLog(@"station.launchShip.failed", @"Cancelled launch for a %@ with role %@, as the %@ has too many ships in its launch queue(s) or no suitable launch docks.",
984 [ship displayName], [ship primaryRole], [self displayName]);
985}
#define OOLog(class, format,...)
Definition OOLogging.h:84
void addShipToLaunchQueue:withPriority:(ShipEntity *ship,[withPriority] BOOL priority)
Definition DockEntity.m:785
NSString * primaryRole
NSString * displayName

References DockEntity::addShipToLaunchQueue:withPriority:, nil, and OOLog.

Referenced by launchDefenseShip, launchEscort, launchIndependentShip:, launchMiner, launchPatrol, launchPirateShip, launchPolice, launchScavenger, launchShipWithRole:, and launchShuttle.

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

◆ addShipToStationCount:

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

Provided by category StationEntity(OOPrivate).

Definition at line 1068 of file StationEntity.m.

1068 :(ShipEntity*)ship
1069{
1070 if ([ship isShuttle])
1072 else if ([ship isTrader] && ![ship isPlayer])
1074 else if (([ship isPolice] && ![ship isEscort]) || [ship hasPrimaryRole:@"defense_ship"]) {
1075 if (0 < defenders_launched)
1077 } else if ([ship hasPrimaryRole:@"scavenger"] || [ship hasPrimaryRole:@"miner"]) // treat miners and scavengers alike!
1078 {
1079 if (0 < scavengers_launched)
1081 }
1082}
BOOL isTrader()
BOOL isPolice()
BOOL isShuttle()
BOOL isEscort()
unsigned defenders_launched
unsigned scavengers_launched
unsigned docked_traders
unsigned docked_shuttles

Referenced by noteDockedShip:.

Here is the caller graph for this function:

◆ adjustVelocity:

- (void) adjustVelocity: (Vector) xVel
implementation

Reimplemented from ShipEntity.

Definition at line 1159 of file StationEntity.m.

1159 :(Vector)xVel
1160{
1161 if (self != [UNIVERSE station])
1162 [super adjustVelocity:xVel]; // dont get moved
1163}
struct Vector Vector

References ShipEntity::adjustVelocity:, and UNIVERSE.

Here is the call graph for this function:

◆ alertLevel

References alertLevel, decreaseAlertLevel, increaseAlertLevel, launchDefenseShip, launchEscort, launchMiner, launchPatrol, launchPirateShip, launchPolice, launchScavenger, and launchShuttle.

Here is the call graph for this function:

◆ allegiance

◆ allowsAutoDocking

References allowsAutoDocking.

◆ allowsFastDocking

References allowsFastDocking.

◆ allowsSaving

- (BOOL) allowsSaving

References allowsSaving, hasShipyard, isRotatingStation, marketOverrideName, and suppressArrivalReports.

Here is the call graph for this function:

◆ autoDockShipsOnApproach

- (void) autoDockShipsOnApproach

Definition at line 354 of file StationEntity.m.

355{
356 NSEnumerator* subEnum = nil;
357 DockEntity* sub = nil;
358 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
360 }
361
362 [self autoDockShipsOnHold];
363
364 [shipAI message:@"DOCKING_COMPLETE"];
365 [self doScriptEvent:OOJSID("stationDockingQueuesAreEmpty")];
366}
void autoDockShipsOnApproach()
Definition DockEntity.m:148

References DockEntity::autoDockShipsOnApproach, autoDockShipsOnApproach, autoDockShipsOnHold, dockSubEntityEnumerator, ShipEntity::doScriptEvent:, AI::message:, and nil.

Referenced by allegiance, autoDockShipsOnApproach, and PlayerEntity::leaveDock:.

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

◆ autoDockShipsOnHold

- (void) autoDockShipsOnHold
implementation

Definition at line 343 of file StationEntity.m.

344{
345 NSEnumerator* onHoldEnum = [_shipsOnHold objectEnumerator];
346 ShipEntity* ship = nil;
347 while ((ship = [onHoldEnum nextObject])) {
348 [self pullInShipIfPermitted:ship];
349 }
350
351 [_shipsOnHold removeAllObjects];
352}

References autoDockShipsOnHold, nil, OOWeakSet::objectEnumerator, pullInShipIfPermitted:, and OOWeakSet::removeAllObjects.

Referenced by autoDockShipsOnApproach, and autoDockShipsOnHold.

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

◆ beaconPosition

- (HPVector) beaconPosition

Definition at line 105 of file StationEntity.m.

106{
107 double buoy_distance = 10000.0; // distance from station entrance
109 HPVector result = HPvector_add([self position], vectorToHPVector(vector_multiply_scalar(v_f, buoy_distance)));
110
111 return result;
112}
OOINLINE HPVector vectorToHPVector(Vector v) INLINE_CONST_FUNC
Definition OOHPVector.h:166
struct HPVector HPVector
OOINLINE HPVector HPvector_add(HPVector a, HPVector b) INLINE_CONST_FUNC
Definition OOHPVector.h:213
Vector vector_forward_from_quaternion(Quaternion quat) CONST_FUNC
OOINLINE Vector vector_multiply_scalar(Vector v, OOScalar s) INLINE_CONST_FUNC
Definition OOVector.h:180
Quaternion orientation
Definition Entity.m:682
HPVector position
Definition Entity.m:576

References beaconPosition, HPvector_add(), Entity::orientation, Entity::position, vector_forward_from_quaternion(), vector_multiply_scalar(), and vectorToHPVector().

Referenced by beaconPosition, and equivalentTechLevel.

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

◆ becomeEnergyBlast

- (void) becomeEnergyBlast
implementation

Reimplemented from ShipEntity.

Definition at line 1764 of file StationEntity.m.

1765{
1766 if (self == [UNIVERSE station])
1767 return;
1768 [super becomeEnergyBlast];
1769}

References ShipEntity::becomeEnergyBlast, becomeEnergyBlast, and UNIVERSE.

Referenced by becomeEnergyBlast.

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

◆ becomeExplosion

- (void) becomeExplosion
implementation

Reimplemented from ShipEntity.

Definition at line 1737 of file StationEntity.m.

1738{
1739 if (self == [UNIVERSE station])
1740 return;
1741
1742 // launch docked ships if possible
1743 PlayerEntity* player = PLAYER;
1744 if ((player) && ([player status] == STATUS_DOCKED || [player status] == STATUS_DOCKING) && ([player dockedStation] == self)) {
1745 // undock the player!
1746 [player leaveDock:self];
1747 [UNIVERSE setViewDirection:VIEW_FORWARD];
1748 [[UNIVERSE gameController] setMouseInteractionModeForFlight];
1749 [player warnAboutHostiles]; // sound a klaxon
1750 }
1751
1752 if (scanClass == CLASS_ROCK) // ie we're a rock hermit or similar
1753 {
1754 // set the role so that we break up into rocks!
1755 [self setPrimaryRole:@"asteroid"];
1756 being_mined = YES;
1757 }
1758
1759 // finally bite the bullet
1760 [super becomeExplosion];
1761}
OOScanClass scanClass
Definition Entity.m:743
OOEntityStatus status()
Definition Entity.m:733
void warnAboutHostiles()
void leaveDock:(StationEntity *station)
unsigned being_mined
Definition ShipEntity.h:246

References ShipEntity::becomeExplosion, becomeExplosion, ShipEntity::being_mined, PlayerEntity::leaveDock:, PLAYER, ShipEntity::scanClass, ShipEntity::setPrimaryRole:, Entity::status, UNIVERSE, and PlayerEntity::warnAboutHostiles.

Referenced by becomeExplosion.

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

◆ becomeLargeExplosion:

- (void) becomeLargeExplosion: (double) factor
implementation

Reimplemented from ShipEntity.

Definition at line 1771 of file StationEntity.m.

1771 :(double)factor
1772{
1773 if (self == [UNIVERSE station])
1774 return;
1775 [super becomeLargeExplosion:factor];
1776}

References ShipEntity::becomeLargeExplosion:, and UNIVERSE.

Here is the call graph for this function:

◆ clear

- (void) clear

Definition at line 856 of file StationEntity.m.

857{
858 NSEnumerator* subEnum = nil;
859 DockEntity* sub = nil;
860 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
861 [sub clear];
862 }
863
864 [_shipsOnHold removeAllObjects];
865}

References DockEntity::clear, clear, dockSubEntityEnumerator, nil, and OOWeakSet::removeAllObjects.

Referenced by allegiance, clear, Universe::removeAllEntitiesExceptPlayer, and Universe::setUpUniverseFromStation.

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

◆ clearDockingCorridor

- (void) clearDockingCorridor

Definition at line 740 of file StationEntity.m.

741{
742 if (!UNIVERSE)
743 return;
744
745 NSEnumerator* subEnum = nil;
746 DockEntity* sub = nil;
747 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
749 }
750
751 return;
752}
void clearDockingCorridor()
Definition DockEntity.m:972

References DockEntity::clearDockingCorridor, clearDockingCorridor, dockSubEntityEnumerator, nil, and UNIVERSE.

Referenced by allegiance, clearDockingCorridor, and PlayerEntity::leaveDock:.

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

◆ collideWithShip:

- (BOOL) collideWithShip: (ShipEntity*) other
implementation

Reimplemented from ShipEntity.

Definition at line 1099 of file StationEntity.m.

1099 :(ShipEntity*)other
1100{
1101 /*
1102 There used to be a [self abortAllDockings] here. Removed as there
1103 doesn't appear to be a good reason for it and it interferes with
1104 docking clearance.
1105 -- Micha 2010-06-10
1106 Reformatted, Ahruman 2012-08-26
1107 */
1108 return [super collideWithShip:other];
1109}

References ShipEntity::collideWithShip:.

Here is the call graph for this function:

◆ countOfDockedContractors

- (unsigned) countOfDockedContractors

Definition at line 245 of file StationEntity.m.

References countOfDockedContractors, max_scavengers, and scavengers_launched.

Referenced by allegiance, and countOfDockedContractors.

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

◆ countOfDockedDefenders

- (unsigned) countOfDockedDefenders

Definition at line 255 of file StationEntity.m.

References countOfDockedDefenders, defenders_launched, and max_defense_ships.

Referenced by allegiance, and countOfDockedDefenders.

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

◆ countOfDockedPolice

- (unsigned) countOfDockedPolice

Definition at line 250 of file StationEntity.m.

251{
253}
unsigned max_police

References countOfDockedPolice, defenders_launched, and max_police.

Referenced by allegiance, and countOfDockedPolice.

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

◆ countOfShipsInLaunchQueueWithPrimaryRole:

- (unsigned) countOfShipsInLaunchQueueWithPrimaryRole: (NSString*) role
implementation

Provided by category StationEntity(OOPrivate).

Definition at line 987 of file StationEntity.m.

987 :(NSString*)role
988{
989 unsigned result = 0;
990 NSEnumerator* subEnum = nil;
991 DockEntity* sub = nil;
992 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
993 result += [sub countOfShipsInLaunchQueueWithPrimaryRole:role];
994 }
995 return result;
996}

References DockEntity::countOfShipsInLaunchQueueWithPrimaryRole:, and nil.

Referenced by launchMiner, and launchScavenger.

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

◆ currentlyInDockingQueues

- (unsigned) currentlyInDockingQueues

Definition at line 1981 of file StationEntity.m.

1982{
1983 NSEnumerator* subEnum = nil;
1984 DockEntity* sub = nil;
1985 unsigned soa = 0;
1986 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
1987 soa += [sub countOfShipsInDockingQueue];
1988 }
1989 soa += [_shipsOnHold count];
1990 return soa;
1991}
unsigned count

References OOWeakSet::count, DockEntity::countOfShipsInDockingQueue, currentlyInDockingQueues, dockSubEntityEnumerator, and nil.

Referenced by acceptDockingClearanceRequestFrom:, allegiance, currentlyInDockingQueues, noteDockedShip:, and update:.

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

◆ currentlyInLaunchingQueues

- (unsigned) currentlyInLaunchingQueues

Definition at line 1993 of file StationEntity.m.

1994{
1995 NSEnumerator* subEnum = nil;
1996 DockEntity* sub = nil;
1997 unsigned soa = 0;
1998 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
1999 soa += [sub countOfShipsInLaunchQueue];
2000 }
2001 return soa;
2002}

References DockEntity::countOfShipsInLaunchQueue, currentlyInLaunchingQueues, dockSubEntityEnumerator, and nil.

Referenced by acceptDockingClearanceRequestFrom:, allegiance, currentlyInLaunchingQueues, and noteDockedShip:.

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

◆ dbgDumpIdLocks

- (NSString *) dbgDumpIdLocks
implementation

Provided by category StationEntity(mwDebug).

◆ dbgGetIdLocks

- (NSArray *) dbgGetIdLocks
implementation

Provided by category StationEntity(mwDebug).

◆ dbgGetShipsOnApproach

- (NSArray *) dbgGetShipsOnApproach
implementation

Provided by category StationEntity(mwDebug).

◆ dealloc

- (void) dealloc
implementation

Reimplemented from ShipEntity.

Definition at line 554 of file StationEntity.m.

555{
561 // DESTROY(localPassengers);
562 // DESTROY(localContracts);
565
566 [super dealloc];
567}
#define DESTROY(x)
OOCommodityMarket * localMarket
NSMutableDictionary * localInterfaces
NSMutableArray * localShipyard
NSString * allegiance
NSArray * marketDefinition
NSString * marketScriptName

References _shipsOnHold, allegiance, ShipEntity::dealloc, dealloc, DESTROY, localInterfaces, localMarket, localShipyard, marketDefinition, and marketScriptName.

Referenced by dealloc.

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

◆ decreaseAlertLevel

- (void) decreaseAlertLevel

Definition at line 1306 of file StationEntity.m.

1307{
1308 [self setAlertLevel:[self alertLevel] - 1 signallingScript:YES];
1309}

References alertLevel, decreaseAlertLevel, and setAlertLevel:signallingScript:.

Referenced by alertLevel, decreaseAlertLevel, StationDecreaseAlertLevel(), and StationDecreaseAlertLevel().

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

◆ descriptionComponents

- (NSString *) descriptionComponents
implementation

Reimplemented from ShipEntity.

Definition at line 2122 of file StationEntity.m.

2123{
2124 return [NSString stringWithFormat:@"\"%@\" %@", name, [super descriptionComponents]];
2125}

References ShipEntity::descriptionComponents, and descriptionComponents.

Referenced by descriptionComponents.

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

◆ dockingCorridorIsEmpty

- (BOOL) dockingCorridorIsEmpty

Definition at line 725 of file StationEntity.m.

726{
727 if (!UNIVERSE)
728 return NO;
729
730 NSEnumerator* subEnum = nil;
731 DockEntity* sub = nil;
732 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
733 if ([sub dockingCorridorIsEmpty]) {
734 return YES; // if any are
735 }
736 }
737 return NO;
738}
BOOL dockingCorridorIsEmpty()

References dockingCorridorIsEmpty, dockSubEntityEnumerator, nil, and UNIVERSE.

Referenced by allegiance, dockingCorridorIsEmpty, and dumpSelfState.

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

◆ dockingInstructionsForShip:

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

Definition at line 401 of file StationEntity.m.

401 :(ShipEntity*)ship
402{
403 if (ship == nil)
404 return nil;
405
406 [self doScriptEvent:OOJSID("stationReceivedDockingRequest") withArgument:ship];
407
408 if ([ship isPlayer]) {
409 player_reserved_dock = nil; // clear any dock reservation for manual docking
410 }
411
412 if ([ship isPlayer] && [ship legalStatus] > 50) // note: non-player fugitives dock as normal
413 {
414 // refuse docking to the fugitive player
415 return OOMakeDockingInstructions(self, [ship position], 0, 100, @"DOCKING_REFUSED", @"[station-docking-refused-to-fugitive]", NO, -1);
416 }
417
418 if (magnitude2(velocity) > 1.0 || fabs(flightPitch) > 0.01 || fabs(flightYaw) > 0.01) {
419 // no docking while station is moving, pitching or yawing
420 return [self holdPositionInstructionForShip:ship];
421 }
422 PlayerEntity* player = PLAYER;
423 BOOL player_is_ahead = (![ship isPlayer] && [player getDockingClearanceStatus] == DOCKING_CLEARANCE_STATUS_REQUESTED && (self == [player getTargetDockStation]));
424
425 NSEnumerator* subEnum = nil;
426 DockEntity* chosenDock = nil;
427 NSString* docking = nil;
428 DockEntity* sub = nil;
429 NSUInteger queue = 100;
430
431 BOOL alldockstoosmall = YES;
432 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
433 if ([sub shipIsInDockingQueue:ship]) {
434 // if already claimed a docking queue, use that one
435 chosenDock = sub;
436 alldockstoosmall = NO;
437 break;
438 }
439 if (player_is_ahead) {
440 // can't allocate a new queue while player is manually docking
441 continue;
442 }
443 if (sub != player_reserved_dock || [ship isPlayer]) {
444 docking = [sub canAcceptShipForDocking:ship];
445 if ([docking isEqualToString:@"DOCK_CLOSED"]) {
446 JSContext* context = OOJSAcquireContext();
448 OOJSVal args[] = { OOJSValueFromNativeObject(context, sub),
449 OOJSValueFromNativeObject(context, ship) };
450 BOOL tempreject = NO;
451
452 BOOL OK = [[self script] callMethod:OOJSID("willOpenDockingPortFor") inContext:context withArguments:args count:2 result:&rval];
453 if (OK)
454 tempreject = OOJSValueToBOOL(context, rval);
455 if (!OK)
456 tempreject = NO; // default to permreject
457 if (tempreject) {
458 docking = @"TRY_AGAIN_LATER";
459 } else {
460 docking = @"TOO_BIG_TO_DOCK";
461 }
462
463 OOJSFreeValue(context, rval);
464 OOJSFreeValue(context, args[0]);
465 OOJSFreeValue(context, args[1]);
466 OOJSRelinquishContext(context);
467 }
468
469 if ([docking isEqualToString:@"DOCKING_POSSIBLE"] && [sub countOfShipsInDockingQueue] < queue) {
470 // try to select the dock with the fewest ships already enqueued
471 chosenDock = sub;
472 queue = [sub countOfShipsInDockingQueue];
473 alldockstoosmall = NO;
474 } else if (![docking isEqualToString:@"TOO_BIG_TO_DOCK"]) {
475 alldockstoosmall = NO;
476 }
477 } else {
478 alldockstoosmall = NO;
479 }
480 }
481 if (chosenDock == nil) {
482 if (player_is_ahead || ([docking isEqualToString:@"TOO_BIG_TO_DOCK"] && !alldockstoosmall) || docking == nil) {
483 // either player is manually docking and we can't allocate new docks,
484 // or the last dock was too small, and there may be an acceptable one
485 // not tested yet or returning TRY_AGAIN_LATER
486 docking = @"TRY_AGAIN_LATER";
487 }
488 // no docks accept this ship (or the player is blocking them)
489 return OOMakeDockingInstructions(self, [ship position], 200, 100, docking, nil, NO, -1);
490 }
491
492 // rolling is okay for some
493 if (fabs(flightRoll) > 0.01 && [chosenDock isOffCentre]) {
494 return [self holdPositionInstructionForShip:ship];
495 }
496
497 // we made it through holding!
498 [_shipsOnHold removeObject:ship];
499
500 [shipAI reactToMessage:@"DOCKING_REQUESTED" context:@"requestDockingCoordinates"]; // react to the request
501 [self doScriptEvent:OOJSID("stationAcceptedDockingRequest") withArgument:ship];
502
503 return [chosenDock dockingInstructionsForShip:ship];
504}
OOINLINE OOScalar magnitude2(Vector vec) INLINE_CONST_FUNC
Definition OOVector.h:237
NSDictionary * dockingInstructionsForShip:(ShipEntity *ship)
Definition DockEntity.m:249
NSUInteger countOfShipsInDockingQueue()
Definition DockEntity.m:594
Vector velocity
Definition Entity.m:708
OODockingClearanceStatus getDockingClearanceStatus()
StationEntity * getTargetDockStation()
GLfloat flightPitch
int legalStatus()
GLfloat flightRoll
GLfloat flightYaw
NSDictionary * OOMakeDockingInstructions(StationEntity *station, HPVector coords, float speed, float range, NSString *ai_message, NSString *comms_message, BOOL match_rotation, int docking_stage)

References OOJSScript::callMethod:inContext:withArguments:count:result:, DockEntity::canAcceptShipForDocking:, DockEntity::countOfShipsInDockingQueue, DOCKING_CLEARANCE_STATUS_REQUESTED, DockEntity::dockingInstructionsForShip:, dockSubEntityEnumerator, ShipEntity::doScriptEvent:withArgument:, ShipEntity::flightPitch, ShipEntity::flightRoll, ShipEntity::flightYaw, PlayerEntity::getDockingClearanceStatus, PlayerEntity::getTargetDockStation, holdPositionInstructionForShip:, Entity::isPlayer, ShipEntity::legalStatus, magnitude2(), nil, OOJSAcquireContext(), OOJSFreeValue, OOJSRelinquishContext(), OOJSUndefinedValue, OOJSValueFromNativeObject(), OOJSValueToBOOL(), OOMakeDockingInstructions(), PLAYER, player_reserved_dock, Entity::position, AI::reactToMessage:context:, OOWeakSet::removeObject:, ShipEntity::script, and ShipEntity::velocity.

Referenced by ShipEntity(AI)::requestDockingCoordinates.

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

◆ dockSubEntityEnumerator

- (NSEnumerator *) dockSubEntityEnumerator

Definition at line 260 of file StationEntity.m.

261{
262 return [[self subEntities] objectEnumeratorFilteredWithSelector:@selector(isDock)];
263}

References dockSubEntityEnumerator, and ShipEntity::subEntities.

Referenced by abortAllDockings, abortDockingForShip:, acceptDockingClearanceRequestFrom:, autoDockShipsOnApproach, clear, clearDockingCorridor, currentlyInDockingQueues, currentlyInLaunchingQueues, dockingCorridorIsEmpty, dockingInstructionsForShip:, dockSubEntityEnumerator, equivalentTechLevel, fitsInDock:andLogNoFit:, hasClearDock, hasEligibleDock, hasLaunchDock, hasMultipleDocks, launchShip:, noteDockedShip:, portUpVectorForShip:, sanityCheckShipsOnApproach, selectDockForDocking, setUpSubEntities, and shipIsInDockingCorridor:.

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

◆ dumpSelfState

- (void) dumpSelfState
implementation

Reimplemented from Entity.

Definition at line 2127 of file StationEntity.m.

2128{
2129 NSMutableArray* flags = nil;
2130 NSString* flagsString = nil;
2131 NSString* alertString = @"*** ERROR: UNKNOWN ALERT LEVEL ***";
2132
2133 [super dumpSelfState];
2134
2135 switch (alertLevel) {
2137 alertString = @"green";
2138 break;
2139
2141 alertString = @"yellow";
2142 break;
2143
2145 alertString = @"red";
2146 break;
2147 }
2148
2149 OOLog(@"dumpState.stationEntity", @"Alert level: %@", alertString);
2150 OOLog(@"dumpState.stationEntity", @"Max police: %u", max_police);
2151 OOLog(@"dumpState.stationEntity", @"Max defense ships: %u", max_defense_ships);
2152 OOLog(@"dumpState.stationEntity", @"Defenders launched: %u", defenders_launched);
2153 OOLog(@"dumpState.stationEntity", @"Max scavengers: %u", max_scavengers);
2154 OOLog(@"dumpState.stationEntity", @"Scavengers launched: %u", scavengers_launched);
2155 OOLog(@"dumpState.stationEntity", @"Docked shuttles: %u", docked_shuttles);
2156 OOLog(@"dumpState.stationEntity", @"Docked traders: %u", docked_traders);
2157 OOLog(@"dumpState.stationEntity", @"Equivalent tech level: %zu", equivalentTechLevel);
2158 OOLog(@"dumpState.stationEntity", @"Equipment price factor: %g", equipmentPriceFactor);
2159
2160 flags = [NSMutableArray array];
2161#define ADD_FLAG_IF_SET(x) \
2162 if (x) { \
2163 [flags addObject:@ #x]; \
2164 }
2166 if ([self isRotatingStation]) {
2167 [flags addObject:@"rotatingStation"];
2168 }
2169 if (![self dockingCorridorIsEmpty]) {
2170 [flags addObject:@"dockingCorridorIsBusy"];
2171 }
2172 flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString*)@"none";
2173 OOLog(@"dumpState.stationEntity", @"Flags: %@", flagsString);
2174
2175 // approach and hold lists.
2176
2177 // Ships on hold list, only used with moving stations (= carriers)
2178 if ([_shipsOnHold count] > 0) {
2179 OOLog(@"dumpState.stationEntity", @"%zu Ships on hold (unsorted):", [_shipsOnHold count]);
2180
2181 OOLogIndent();
2182 NSEnumerator* onHoldEnum = [_shipsOnHold objectEnumerator];
2183 ShipEntity* ship = nil;
2184 unsigned i = 1;
2185 foreach (ship, onHoldEnum) {
2186 OOLog(@"dumpState.stationEntity", @"Nr %i: %@ at distance %g with role: %@", i++, [ship displayName], HPdistance([self position], [ship position]), [ship primaryRole]);
2187 }
2188 OOLogOutdent();
2189 }
2190}
#define ADD_FLAG_IF_SET(x)
OOINLINE OOHPScalar HPdistance(HPVector v1, HPVector v2) INLINE_CONST_FUNC
Definition OOHPVector.h:298
void OOLogOutdent(void)
Definition OOLogging.m:354
void OOLogIndent(void)
Definition OOLogging.m:345
@ STATION_ALERT_LEVEL_RED
@ STATION_ALERT_LEVEL_YELLOW
@ STATION_ALERT_LEVEL_GREEN
OOTechLevelID equivalentTechLevel
OOStationAlertLevel alertLevel
float equipmentPriceFactor

References _shipsOnHold, ADD_FLAG_IF_SET, alertLevel, count, defenders_launched, ShipEntity::displayName, docked_shuttles, docked_traders, dockingCorridorIsEmpty, Entity::dumpSelfState, dumpSelfState, equipmentPriceFactor, equivalentTechLevel, HPdistance(), isRotatingStation, max_defense_ships, max_police, max_scavengers, nil, no_docking_while_launching, OOWeakSet::objectEnumerator, OOLog, OOLogIndent(), OOLogOutdent(), Entity::position, ShipEntity::primaryRole, scavengers_launched, STATION_ALERT_LEVEL_GREEN, STATION_ALERT_LEVEL_RED, and STATION_ALERT_LEVEL_YELLOW.

Referenced by dumpSelfState.

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

◆ equipmentPriceFactor

◆ equivalentTechLevel

References beaconPosition, dockSubEntityEnumerator, equivalentTechLevel, playerReservedDock, and virtualPortDimensions.

Here is the call graph for this function:

◆ fitsInDock:

- (BOOL) fitsInDock: (ShipEntity*) ship

Definition at line 998 of file StationEntity.m.

998 :(ShipEntity*)ship
999{
1000 return [self fitsInDock:ship andLogNoFit:YES];
1001}

References fitsInDock:andLogNoFit:.

Here is the call graph for this function:

◆ fitsInDock:andLogNoFit:

- (BOOL) fitsInDock: (ShipEntity*) ship
andLogNoFit: (BOOL) logNoFit 

Definition at line 1003 of file StationEntity.m.

1003 :(ShipEntity*)ship andLogNoFit:(BOOL)logNoFit
1004{
1005 if (![ship isShip])
1006 return NO;
1007
1008 NSEnumerator* subEnum = nil;
1009 DockEntity* sub = nil;
1010 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
1011 if ([sub allowsLaunchingOf:ship]) {
1012 return YES;
1013 }
1014 }
1015
1016 if (logNoFit)
1017 OOLog(@"station.launchShip.failed", @"Cancelled launch for a %@ with role %@, as it is too large for the docking port of the %@.",
1018 [ship displayName], [ship primaryRole], self);
1019 return NO;
1020}
unsigned isShip
Definition Entity.m:125

References ShipEntity::displayName, dockSubEntityEnumerator, Entity::isShip, nil, OOLog, and ShipEntity::primaryRole.

Referenced by fitsInDock:, StationCanDockShip(), and StationCanDockShip().

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

◆ generateShipyard

- (void) generateShipyard

Definition at line 2078 of file StationEntity.m.

2079{
2080 [self generateShipyard:[self equivalentTechLevel]];
2081}

References equivalentTechLevel, generateShipyard, and generateShipyard:.

Referenced by generateShipyard, generateShipyard:, localShipyard, StationAddShipToShipyard(), StationAddShipToShipyard(), StationGetProperty(), StationGetProperty(), StationRemoveShipFromShipyard(), and StationRemoveShipFromShipyard().

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

◆ generateShipyard:

- (void) generateShipyard: (OOTechLevelID) stationTechLevel

Definition at line 2083 of file StationEntity.m.

2083 :(OOTechLevelID)stationTechLevel
2084{
2085 unsigned i;
2086
2087 if ([self localShipyard] == nil) {
2088 [self setLocalShipyard:[UNIVERSE shipsForSaleForSystem:[UNIVERSE currentSystemID] withTL:stationTechLevel atTime:[PLAYER clockTime]]];
2089 }
2090
2091 NSMutableArray* shipyard = [self localShipyard];
2092
2093 // remove ships that the player has already bought
2094 for (i = 0; i < [shipyard count]; i++) {
2095 NSString* shipID = [[shipyard oo_dictionaryAtIndex:i] oo_stringForKey:SHIPYARD_KEY_ID];
2096 if ([[PLAYER shipyardRecord] objectForKey:shipID]) {
2097 [shipyard removeObjectAtIndex:i--];
2098 }
2099 }
2100}
NSUInteger OOTechLevelID
Definition OOTypes.h:177

References generateShipyard, localShipyard, nil, PLAYER, and setLocalShipyard:.

Referenced by generateShipyard, and PlayerEntity(Contracts)::setGuiToShipyardScreen:.

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

◆ getJSClass:andPrototype:

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

Reimplemented from ShipEntity.

Provided by category StationEntity(OOJavaScriptExtensions).

Definition at line 208 of file OOJSStation.m.

208 :(JSClass**)outClass andPrototype:(JSObject**)outPrototype
209{
210 *outClass = &sStationClass;
211 *outPrototype = sStationPrototype;
212}
static JSClass sStationClass
Definition OOJSStation.m:66
static JSObject * sStationPrototype
Definition OOJSStation.m:38

◆ hasBreakPattern

- (BOOL) hasBreakPattern

References hasBreakPattern.

◆ hasClearDock

- (BOOL) hasClearDock

Definition at line 883 of file StationEntity.m.

884{
885 NSEnumerator* subEnum = nil;
886 DockEntity* sub = nil;
887 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
888 if ([sub allowsDocking] && [sub countOfShipsInLaunchQueue] == 0 && [sub countOfShipsInDockingQueue] == 0) {
889 if ([[sub canAcceptShipForDocking:PLAYER] isEqualToString:@"DOCKING_POSSIBLE"]) {
890 return YES;
891 }
892 }
893 }
894 return NO;
895}

References dockSubEntityEnumerator, hasClearDock, nil, and PLAYER.

Referenced by acceptDockingClearanceRequestFrom:, allegiance, hasClearDock, noteDockedShip:, and update:.

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

◆ hasEligibleDock

- (BOOL) hasEligibleDock
implementation

Definition at line 897 of file StationEntity.m.

898{
899 NSEnumerator* subEnum = nil;
900 DockEntity* sub = nil;
901 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
902 // TRY_AGAIN_LATER in this context means "ships launching now"
903 if ([sub allowsDocking] && ([[sub canAcceptShipForDocking:PLAYER] isEqualToString:@"DOCKING_POSSIBLE"] || [[sub canAcceptShipForDocking:PLAYER] isEqualToString:@"TRY_AGAIN_LATER"])) {
904 return YES;
905 }
906 }
907 return NO;
908}

References dockSubEntityEnumerator, hasEligibleDock, nil, and PLAYER.

Referenced by acceptDockingClearanceRequestFrom:, and hasEligibleDock.

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

◆ hasHostileTarget

- (BOOL) hasHostileTarget
implementation

Reimplemented from ShipEntity.

Definition at line 1111 of file StationEntity.m.

1112{
1113 return [super hasHostileTarget] || ([self primaryTarget] != nil && ((alertLevel == STATION_ALERT_LEVEL_YELLOW) || (alertLevel == STATION_ALERT_LEVEL_RED)));
1114}

References alertLevel, ShipEntity::hasHostileTarget, hasHostileTarget, nil, ShipEntity::primaryTarget, STATION_ALERT_LEVEL_RED, and STATION_ALERT_LEVEL_YELLOW.

Referenced by acceptDockingClearanceRequestFrom:, and hasHostileTarget.

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

◆ hasLaunchDock

- (BOOL) hasLaunchDock

Definition at line 911 of file StationEntity.m.

912{
913 NSEnumerator* subEnum = nil;
914 DockEntity* sub = nil;
915 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
916 if ([sub allowsLaunching]) {
917 return YES;
918 }
919 }
920 return NO;
921}

References dockSubEntityEnumerator, hasLaunchDock, and nil.

Referenced by allegiance, hasLaunchDock, launchDefenseShip, launchEscort, launchIndependentShip:, launchMiner, launchPatrol, launchPirateShip, launchPolice, launchScavenger, launchShipWithRole:, and launchShuttle.

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

◆ hasMultipleDocks

- (BOOL) hasMultipleDocks

Definition at line 867 of file StationEntity.m.

868{
869 NSEnumerator* subEnum = nil;
870 DockEntity* sub = nil;
871 unsigned docks = 0;
872 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
873 docks++;
874 if (docks > 1) {
875 return YES;
876 }
877 }
878 return NO;
879}

References dockSubEntityEnumerator, hasMultipleDocks, and nil.

Referenced by acceptDockingClearanceRequestFrom:, allegiance, hasMultipleDocks, and update:.

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

◆ hasNPCTraffic

- (BOOL) hasNPCTraffic

References hasNPCTraffic.

◆ hasShipyard

- (BOOL) hasShipyard

Definition at line 2057 of file StationEntity.m.

2058{
2059 if ([UNIVERSE station] == self)
2060 return YES;
2061 id determinant = [shipinfoDictionary objectForKey:@"has_shipyard"];
2062
2063 if (!determinant)
2064 determinant = [shipinfoDictionary objectForKey:@"hasShipyard"];
2065
2066 // NOTE: non-standard capitalization is documented and entrenched.
2067 if (determinant) {
2068 if ([determinant isKindOfClass:[NSArray class]]) {
2069 return [PLAYER scriptTestConditions:OOSanitizeLegacyScriptConditions(determinant, nil)];
2070 } else {
2071 return OOFuzzyBooleanFromObject(determinant, 0.0f);
2072 }
2073 } else {
2074 return NO;
2075 }
2076}
BOOL OOFuzzyBooleanFromObject(id object, float defaultValue)

References hasShipyard, OOFuzzyBooleanFromObject(), and UNIVERSE.

Referenced by allowsSaving, and hasShipyard.

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

◆ holdPositionInstructionForShip:

- (NSDictionary *) holdPositionInstructionForShip: (ShipEntity*) ship
implementation

Provided by category StationEntity(OOPrivate).

Definition at line 506 of file StationEntity.m.

506 :(ShipEntity*)ship
507{
508 if (![_shipsOnHold containsObject:ship]) {
509 [self sendExpandedMessage:@"[station-acknowledges-hold-position]" toShip:ship];
510 [_shipsOnHold addObject:ship];
511 }
512
513 return OOMakeDockingInstructions(self, [ship position], 0, 100, @"HOLD_POSITION", nil, NO, -1);
514}

References nil, OOMakeDockingInstructions(), and ShipEntity::sendExpandedMessage:toShip:.

Referenced by dockingInstructionsForShip:.

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

◆ increaseAlertLevel

- (void) increaseAlertLevel

Definition at line 1300 of file StationEntity.m.

1301{
1302 [self setAlertLevel:[self alertLevel] + 1 signallingScript:YES];
1303}

References alertLevel, increaseAlertLevel, and setAlertLevel:signallingScript:.

Referenced by alertLevel, increaseAlertLevel, StationIncreaseAlertLevel(), StationIncreaseAlertLevel(), and takeEnergyDamage:from:becauseOf:weaponIdentifier:.

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

◆ initialiseLocalMarket

- (OOCommodityMarket *) initialiseLocalMarket

Definition at line 225 of file StationEntity.m.

226{
228 localMarket = [[[UNIVERSE commodities] generateMarketForStation:self] retain];
229 return localMarket;
230}

References DESTROY, initialiseLocalMarket, and localMarket.

Referenced by PlayerEntity::docked, initialiseLocalMarket, PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:, localInterfaces, PlayerEntity::localMarket, Universe::reinitAndShowDemo:, and update:.

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

◆ initWithKey:definition:

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

Reimplemented from ShipEntity.

Definition at line 538 of file StationEntity.m.

538 :(NSString*)key definition:(NSDictionary*)dict
539{
541
542 self = [super initWithKey:key definition:dict];
543 if (self != nil) {
544 isStation = YES;
545 _shipsOnHold = [[OOWeakSet alloc] init];
546 hasBreakPattern = YES;
547 localInterfaces = [[NSMutableDictionary alloc] init];
548 }
549 return self;
550
552}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER
unsigned isStation
Definition Entity.m:135
unsigned hasBreakPattern

References _shipsOnHold, hasBreakPattern, ShipEntity::initWithKey:definition:, Entity::isStation, localInterfaces, nil, OOJS_PROFILE_ENTER, and OOJS_PROFILE_EXIT.

Here is the call graph for this function:

◆ interstellarUndockingAllowed

◆ isRotatingStation

- (BOOL) isRotatingStation

Definition at line 2040 of file StationEntity.m.

2041{
2042 if ([shipinfoDictionary oo_boolForKey:@"rotating" defaultValue:NO])
2043 return YES;
2044 return [[shipinfoDictionary objectForKey:@"roles"] rangeOfString:@"rotating-station"].location != NSNotFound; // legacy
2045}
NSDictionary * shipinfoDictionary
Definition ShipEntity.h:206

References isRotatingStation, and ShipEntity::shipinfoDictionary.

Referenced by allowsSaving, dumpSelfState, and isRotatingStation.

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

◆ isUnpiloted

- (BOOL) isUnpiloted
implementation

Reimplemented from ShipEntity.

Definition at line 76 of file StationEntity.m.

77{
78 return [self isExplicitlyUnpiloted] || [self isHulk];
79}

References ShipEntity::isExplicitlyUnpiloted, ShipEntity::isHulk, and isUnpiloted.

Referenced by isUnpiloted.

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

◆ launchDefenseShip

- (ShipEntity *) launchDefenseShip

Definition at line 1369 of file StationEntity.m.

1370{
1371 if (![self hasLaunchDock]) {
1372 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a defense ship, as the %@ has no launch docks.",
1373 [self displayName]);
1374 return nil;
1375 }
1376
1377 OOUniversalID defense_target = [[self primaryTarget] universalID];
1378 ShipEntity* defense_ship = nil;
1379 NSString *defense_ship_key = nil,
1380 *defense_ship_role = nil,
1381 *default_defense_ship_role = nil;
1382 NSString* defense_ship_ai = @"oolite-defenseShipAI.js";
1383
1384 OOTechLevelID techlevel;
1385
1386 techlevel = [self equivalentTechLevel];
1387 if (techlevel == NSNotFound)
1388 techlevel = 6;
1389 if ((Ranrot() & 7) + 6 <= techlevel)
1390 default_defense_ship_role = @"interceptor";
1391 else
1392 default_defense_ship_role = @"police";
1393
1394 if (scanClass == CLASS_ROCK)
1395 default_defense_ship_role = @"hermit-ship";
1396
1397 if (defenders_launched >= max_defense_ships) // shuttles are to rockhermits what police ships are to stations
1398 return nil;
1399
1400 if (![UNIVERSE entityForUniversalID:defense_target]) {
1401 [self noteLostTarget];
1402 return nil;
1403 }
1404
1405 defense_ship_key = [shipinfoDictionary oo_stringForKey:@"defense_ship"];
1406 if (defense_ship_key != nil) {
1407 defense_ship = [UNIVERSE newShipWithName:defense_ship_key];
1408 }
1409 if (!defense_ship) {
1410 defense_ship_role = [shipinfoDictionary oo_stringForKey:@"defense_ship_role" defaultValue:default_defense_ship_role];
1411 defense_ship = [UNIVERSE newShipWithRole:defense_ship_role];
1412 }
1413
1414 if (!defense_ship && default_defense_ship_role != defense_ship_role)
1415 defense_ship = [UNIVERSE newShipWithRole:default_defense_ship_role];
1416
1417 if (!defense_ship || ![self fitsInDock:defense_ship]) {
1418 [defense_ship release];
1419 return nil;
1420 }
1421
1422 if ([defense_ship isPolice] || [defense_ship hasPrimaryRole:@"hermit-ship"]) {
1423 [defense_ship switchAITo:defense_ship_ai];
1424 }
1425
1426 [defense_ship setPrimaryRole:@"defense_ship"];
1427
1429
1430 if (![defense_ship crew]) {
1431 if ([defense_ship isPolice]) {
1432 [defense_ship setSingleCrewWithRole:@"police"];
1433 } else {
1434 [defense_ship setSingleCrewWithRole:@"hunter"];
1435 }
1436 }
1437
1438 [defense_ship setOwner:self];
1439 if ([self group] == nil) {
1440 [self setGroup:[self stationGroup]];
1441 }
1442 [defense_ship setGroup:[self stationGroup]]; // who's your Daddy
1443
1444 [defense_ship addTarget:[UNIVERSE entityForUniversalID:defense_target]];
1445
1446 if ((scanClass != CLASS_ROCK) && (scanClass != CLASS_STATION)) {
1447 [defense_ship setScanClass:scanClass]; // same as self
1448 } else if ([defense_ship scanClass] == CLASS_NOT_SET) {
1449 [defense_ship setScanClass:CLASS_NEUTRAL];
1450 }
1451
1452 if ([defense_ship heatInsulation] < [self heatInsulation]) {
1453 [defense_ship setHeatInsulation:[self heatInsulation]];
1454 }
1455
1456 [self addShipToLaunchQueue:defense_ship withPriority:YES];
1457 [defense_ship autorelease];
1458 [self abortAllDockings];
1459
1460 return defense_ship;
1461}
uint16_t OOUniversalID
Definition OOTypes.h:165
OOShipGroup * group()
GLfloat heatInsulation()
NSArray * crew
unsigned Ranrot(void)

References abortAllDockings, addShipToLaunchQueue:withPriority:, ShipEntity::addTarget:, ShipEntity::crew, defenders_launched, ShipEntity::displayName, equivalentTechLevel, ShipEntity::group, hasLaunchDock, ShipEntity::heatInsulation, ShipEntity::isPolice, launchDefenseShip, max_defense_ships, nil, ShipEntity::noteLostTarget, OOLog, ShipEntity::primaryTarget, Ranrot(), ShipEntity::scanClass, ShipEntity::setGroup:, ShipEntity::setHeatInsulation:, ShipEntity::setOwner:, ShipEntity::setPrimaryRole:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, ShipEntity::stationGroup, ShipEntity::switchAITo:, and UNIVERSE.

Referenced by StationEntity(OOAIPrivate)::acceptDistressMessageFrom:, alertLevel, launchDefenseShip, StationLaunchDefenseShip(), and StationLaunchDefenseShip().

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

◆ launchEscort

- (ShipEntity *) launchEscort

Definition at line 1639 of file StationEntity.m.

1640{
1641 if (![self hasLaunchDock]) {
1642 OOLog(@"station.launchShip.impossible", @"Cancelled launch for an escort ship, as the %@ has no launch docks.",
1643 [self displayName]);
1644 return nil;
1645 }
1646 ShipEntity* escort_ship;
1647
1648 escort_ship = [UNIVERSE newShipWithRole:@"escort"]; // retain count = 1
1649
1650 if (escort_ship && [self fitsInDock:escort_ship]) {
1651 if (![escort_ship crew]) {
1652 [escort_ship setSingleCrewWithRole:@"hunter"];
1653 }
1654
1655 [escort_ship setScanClass:CLASS_NEUTRAL];
1656 [escort_ship setCargoFlag:CARGO_FLAG_FULL_PLENTIFUL];
1657 [escort_ship switchAITo:@"oolite-escortAI.js"];
1658 [self addShipToLaunchQueue:escort_ship withPriority:NO];
1659 }
1660 [escort_ship release];
1661 return escort_ship;
1662}

References addShipToLaunchQueue:withPriority:, ShipEntity::crew, ShipEntity::displayName, hasLaunchDock, launchEscort, nil, OOLog, ShipEntity::setCargoFlag:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, and ShipEntity::switchAITo:.

Referenced by alertLevel, launchEscort, StationLaunchEscort(), and StationLaunchEscort().

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

◆ launchIndependentShip:

- (ShipEntity *) launchIndependentShip: (NSString*) role

Definition at line 1225 of file StationEntity.m.

1225 :(NSString*)role
1226{
1227 if (![self hasLaunchDock]) {
1228 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a ship with role %@, as the %@ has no launch docks.",
1229 role, [self displayName]);
1230 return nil;
1231 }
1232
1233 BOOL trader = [role isEqualToString:@"trader"];
1234 BOOL sunskimmer = ([role isEqualToString:@"sunskim-trader"]);
1235 ShipEntity* ship = nil;
1236
1237 if ((trader && (randf() < 0.1)) || sunskimmer) {
1238 ship = [UNIVERSE newShipWithRole:@"sunskim-trader"];
1239 sunskimmer = true;
1240 trader = true;
1241 role = @"trader"; // make sure also sunskimmers get trader role.
1242 } else {
1243 ship = [UNIVERSE newShipWithRole:role];
1244 }
1245
1246 if (![self fitsInDock:ship]) {
1247 [ship release];
1248 return nil;
1249 }
1250
1251 if (ship) {
1252 if (![ship crew]) {
1253 [ship setSingleCrewWithRole:role];
1254 }
1255 [ship setPrimaryRole:role];
1256
1257 if (trader || ship->scanClass == CLASS_NOT_SET)
1258 [ship setScanClass:CLASS_NEUTRAL]; // keep defined scanclasses for non-traders.
1259
1260 if (trader) {
1261 [ship setBounty:0 withReason:kOOLegalStatusReasonSetup];
1262 [ship setCargoFlag:CARGO_FLAG_FULL_PLENTIFUL];
1263 if (sunskimmer) {
1264 [ship setFuel:(Ranrot() & 31)];
1265 [UNIVERSE makeSunSkimmer:ship andSetAI:YES];
1266 } else {
1267 // JSAI: not needed - oolite-traderAI.js handles exiting if full fuel and plentiful cargo
1268 // [ship switchAITo:@"exitingTraderAI.plist"];
1269 if ([ship fuel] == 0)
1270 [ship setFuel:70];
1271 // if ([ship hasRole:@"sunskim-trader"]) [UNIVERSE makeSunSkimmer:ship andSetAI:NO];
1272 }
1273 }
1274
1275 [self addShipToLaunchQueue:ship withPriority:NO];
1276
1277 OOShipGroup* escortGroup = [ship escortGroup];
1278 if ([ship group] == nil)
1279 [ship setGroup:escortGroup];
1280 // Eric: Escorts are defined both as _group and as _escortGroup because friendly attacks are only handled within _group.
1281 [escortGroup setLeader:ship];
1282
1283 // add escorts to the trader
1284 unsigned escorts = [ship pendingEscortCount];
1285 if (escorts > 0) {
1286 [ship setOwner:self]; // makes escorts get added to station launch queue
1287 [ship setUpEscorts];
1288 [ship setOwner:ship];
1289 }
1290
1291 [ship setPendingEscortCount:0];
1292 [ship autorelease];
1293 }
1294 return ship;
1295}
void setLeader:(ShipEntity *leader)
OOShipGroup * escortGroup()
OOFuelQuantity fuel
float randf(void)

References addShipToLaunchQueue:withPriority:, ShipEntity::crew, ShipEntity::displayName, ShipEntity::escortGroup, ShipEntity::fuel, ShipEntity::group, hasLaunchDock, nil, OOLog, ShipEntity::pendingEscortCount, randf(), ShipEntity::scanClass, ShipEntity::setBounty:withReason:, ShipEntity::setCargoFlag:, ShipEntity::setFuel:, ShipEntity::setGroup:, OOShipGroup::setLeader:, ShipEntity::setOwner:, ShipEntity::setPendingEscortCount:, ShipEntity::setPrimaryRole:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, and ShipEntity::setUpEscorts.

Referenced by StationLaunchShipWithRole(), StationLaunchShipWithRole(), and update:.

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

◆ launchMiner

- (ShipEntity *) launchMiner

Definition at line 1506 of file StationEntity.m.

1507{
1508 if (![self hasLaunchDock]) {
1509 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a miner ship, as the %@ has no launch docks.",
1510 [self displayName]);
1511 return nil;
1512 }
1513
1514 ShipEntity* miner_ship;
1515
1516 int n_miners = [UNIVERSE countShipsWithPrimaryRole:@"miner" inRange:SCANNER_MAX_RANGE ofEntity:self] + [self countOfShipsInLaunchQueueWithPrimaryRole:@"miner"];
1517
1518 if (n_miners >= 1) // just the one
1519 return nil;
1520
1521 // count miners as scavengers...
1523 return nil;
1524
1525 miner_ship = [UNIVERSE newShipWithRole:@"miner"]; // retain count = 1
1526
1527 if (![self fitsInDock:miner_ship]) {
1528 [miner_ship release];
1529 return nil;
1530 }
1531
1532 if (miner_ship) {
1533 if (![miner_ship crew]) {
1534 [miner_ship setSingleCrewWithRole:@"miner"];
1535 }
1536
1538 [miner_ship setScanClass:CLASS_NEUTRAL];
1539 if ([miner_ship heatInsulation] < [self heatInsulation])
1540 [miner_ship setHeatInsulation:[self heatInsulation]];
1541 [miner_ship setGroup:[self stationGroup]]; // who's your Daddy -- FIXME: should we have a separate group for non-escort auxiliaires?
1542 [miner_ship switchAITo:@"oolite-scavengerAI.js"];
1543 [self addShipToLaunchQueue:miner_ship withPriority:NO];
1544 [miner_ship autorelease];
1545 }
1546 return miner_ship;
1547}
return self

References addShipToLaunchQueue:withPriority:, countOfShipsInLaunchQueueWithPrimaryRole:, ShipEntity::crew, ShipEntity::displayName, hasLaunchDock, ShipEntity::heatInsulation, launchMiner, max_scavengers, nil, OOLog, scavengers_launched, ShipEntity::setGroup:, ShipEntity::setHeatInsulation:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, ShipEntity::stationGroup, and ShipEntity::switchAITo:.

Referenced by alertLevel, launchMiner, StationLaunchMiner(), and StationLaunchMiner().

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

◆ launchPatrol

- (ShipEntity *) launchPatrol

Reimplemented from ShipEntity.

Definition at line 1665 of file StationEntity.m.

1666{
1667 if (![self hasLaunchDock]) {
1668 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a patrol ship, as the %@ has no launch docks.",
1669 [self displayName]);
1670 return nil;
1671 }
1673 ShipEntity* patrol_ship = nil;
1674 OOTechLevelID techlevel;
1675
1676 techlevel = [self equivalentTechLevel];
1677 if (techlevel == NSNotFound)
1678 techlevel = 6;
1679
1680 if ((Ranrot() & 7) + 6 <= techlevel)
1681 patrol_ship = [UNIVERSE newShipWithRole:@"interceptor"]; // retain count = 1
1682 else
1683 patrol_ship = [UNIVERSE newShipWithRole:@"police"]; // retain count = 1
1684
1685 if (![self fitsInDock:patrol_ship]) {
1686 [patrol_ship release];
1687 return nil;
1688 }
1689
1690 if (patrol_ship) {
1691 if (![patrol_ship crew]) {
1692 [patrol_ship setSingleCrewWithRole:@"police"];
1693 }
1694
1696 [patrol_ship switchLightsOff];
1697 if ([patrol_ship scanClass] == CLASS_NOT_SET)
1698 [patrol_ship setScanClass:CLASS_POLICE];
1699 if ([patrol_ship heatInsulation] < [self heatInsulation])
1700 [patrol_ship setHeatInsulation:[self heatInsulation]];
1701 [patrol_ship setPrimaryRole:@"police-station-patrol"];
1702 [patrol_ship setBounty:0 withReason:kOOLegalStatusReasonSetup];
1703 [patrol_ship setGroup:[self stationGroup]]; // who's your Daddy
1704 [patrol_ship switchAITo:@"oolite-policeAI.js"];
1705 [self addShipToLaunchQueue:patrol_ship withPriority:NO];
1706 [self acceptPatrolReportFrom:patrol_ship];
1707 [patrol_ship autorelease];
1708 return patrol_ship;
1709 }
1710 }
1711 return nil;
1712}

References acceptPatrolReportFrom:, addShipToLaunchQueue:withPriority:, ShipEntity::crew, defenders_launched, ShipEntity::displayName, equivalentTechLevel, hasLaunchDock, ShipEntity::heatInsulation, launchPatrol, max_police, nil, OOLog, Ranrot(), ShipEntity::scanClass, ShipEntity::setBounty:withReason:, ShipEntity::setGroup:, ShipEntity::setHeatInsulation:, ShipEntity::setPrimaryRole:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, ShipEntity::stationGroup, ShipEntity::switchAITo:, and ShipEntity::switchLightsOff.

Referenced by alertLevel, launchPatrol, StationLaunchPatrol(), StationLaunchPatrol(), and update:.

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

◆ launchPirateShip

- (ShipEntity *) launchPirateShip

Lazygun** added the following line

Lazygun** added the following method. A complete rip-off of launchDefenseShip.

Definition at line 1552 of file StationEntity.m.

1553{
1554 if (![self hasLaunchDock]) {
1555 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a pirate ship, as the %@ has no launch docks.",
1556 [self displayName]);
1557 return nil;
1558 }
1559 // Pirate ships are launched from the same pool as defence ships.
1560 OOUniversalID defense_target = [[self primaryTarget] universalID];
1561 ShipEntity* pirate_ship = nil;
1562
1564 return nil; // shuttles are to rockhermits what police ships are to stations
1565
1566 if (![UNIVERSE entityForUniversalID:defense_target]) {
1567 [self noteLostTarget];
1568 return nil;
1569 }
1570
1571 // Yep! The standard hermit defence ships, even if they're the aggressor.
1572 pirate_ship = [UNIVERSE newShipWithRole:@"pirate"]; // retain count = 1
1573 // Nope, use standard pirates in a generic method.
1574
1575 if (![self fitsInDock:pirate_ship]) {
1576 [pirate_ship release];
1577 return nil;
1578 }
1579
1580 if (pirate_ship) {
1581 if (![pirate_ship crew]) {
1582 [pirate_ship setSingleCrewWithRole:@"pirate"];
1583 }
1584
1586
1587 // set the owner of the ship to the station so that it can check back for docking later
1588 [pirate_ship setOwner:self];
1589 [pirate_ship setGroup:[self stationGroup]]; // who's your Daddy
1590 [pirate_ship setPrimaryRole:@"defense_ship"];
1591 [pirate_ship addTarget:[UNIVERSE entityForUniversalID:defense_target]];
1592 [pirate_ship setScanClass:CLASS_NEUTRAL];
1593 if ([pirate_ship heatInsulation] < [self heatInsulation])
1594 [pirate_ship setHeatInsulation:[self heatInsulation]];
1595 //**Lazygun** added 30 Nov 04 to put a bounty on those pirates' heads.
1596 [pirate_ship setBounty:10 + floor(randf() * 20) withReason:kOOLegalStatusReasonSetup]; // modified for variety
1597
1598 [self addShipToLaunchQueue:pirate_ship withPriority:NO];
1599 [pirate_ship autorelease];
1600 [self abortAllDockings];
1601 }
1602 return pirate_ship;
1603}

References abortAllDockings, addShipToLaunchQueue:withPriority:, ShipEntity::addTarget:, ShipEntity::crew, defenders_launched, ShipEntity::displayName, hasLaunchDock, ShipEntity::heatInsulation, launchPirateShip, max_defense_ships, nil, ShipEntity::noteLostTarget, OOLog, ShipEntity::primaryTarget, ShipEntity::setBounty:withReason:, ShipEntity::setGroup:, ShipEntity::setHeatInsulation:, ShipEntity::setOwner:, ShipEntity::setPrimaryRole:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, ShipEntity::stationGroup, and UNIVERSE.

Referenced by alertLevel, launchPirateShip, StationLaunchPirateShip(), and StationLaunchPirateShip().

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

◆ launchPolice

- (NSArray *) launchPolice

Definition at line 1312 of file StationEntity.m.

1313{
1314 if (![self hasLaunchDock]) {
1315 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a police ship, as the %@ has no launch docks.",
1316 [self displayName]);
1317 return [NSArray array];
1318 }
1319
1320 OOUniversalID police_target = [[self primaryTarget] universalID];
1321 unsigned i;
1322 NSMutableArray* result = nil;
1323 OOTechLevelID techlevel = [self equivalentTechLevel];
1324 if (techlevel == NSNotFound)
1325 techlevel = 6;
1326
1327 result = [NSMutableArray arrayWithCapacity:4];
1328
1329 for (i = 0; (i < 4) && (defenders_launched < max_police); i++) {
1330 ShipEntity* police_ship = nil;
1331 if (![UNIVERSE entityForUniversalID:police_target]) {
1332 [self noteLostTarget];
1333 return [NSArray array];
1334 }
1335 /* this is more likely to give interceptors than the
1336 * equivalent populator function: save them for defense
1337 * ships */
1338 if ((Ranrot() & 3) + 9 < techlevel) {
1339 police_ship = [UNIVERSE newShipWithRole:@"interceptor"]; // retain count = 1
1340 } else {
1341 police_ship = [UNIVERSE newShipWithRole:@"police"]; // retain count = 1
1342 }
1343
1344 if (police_ship && [self fitsInDock:police_ship]) {
1345 if (![police_ship crew]) {
1346 [police_ship setSingleCrewWithRole:@"police"];
1347 }
1348
1349 [police_ship setGroup:[self stationGroup]]; // who's your Daddy
1350 [police_ship setPrimaryRole:@"police"];
1351 [police_ship addTarget:[UNIVERSE entityForUniversalID:police_target]];
1352 if ([police_ship scanClass] == CLASS_NOT_SET)
1353 [police_ship setScanClass:CLASS_POLICE];
1354 [police_ship setBounty:0 withReason:kOOLegalStatusReasonSetup];
1355 if ([police_ship heatInsulation] < [self heatInsulation])
1356 [police_ship setHeatInsulation:[self heatInsulation]];
1357 [police_ship switchAITo:@"oolite-defenseShipAI.js"];
1358 [self addShipToLaunchQueue:police_ship withPriority:YES];
1360 [result addObject:police_ship];
1361 }
1362 [police_ship autorelease];
1363 }
1364 [self abortAllDockings];
1365 return result;
1366}

References abortAllDockings, addShipToLaunchQueue:withPriority:, ShipEntity::addTarget:, ShipEntity::crew, defenders_launched, ShipEntity::displayName, equivalentTechLevel, hasLaunchDock, ShipEntity::heatInsulation, launchPolice, max_police, nil, ShipEntity::noteLostTarget, OOLog, ShipEntity::primaryTarget, Ranrot(), ShipEntity::scanClass, ShipEntity::setBounty:withReason:, ShipEntity::setGroup:, ShipEntity::setHeatInsulation:, ShipEntity::setPrimaryRole:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, ShipEntity::stationGroup, ShipEntity::switchAITo:, and UNIVERSE.

Referenced by alertLevel, launchPolice, StationLaunchPolice(), StationLaunchPolice(), and takeEnergyDamage:from:becauseOf:weaponIdentifier:.

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

◆ launchScavenger

- (ShipEntity *) launchScavenger

Definition at line 1464 of file StationEntity.m.

1465{
1466 if (![self hasLaunchDock]) {
1467 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a scavenger ship, as the %@ has no launch docks.",
1468 [self displayName]);
1469 return nil;
1470 }
1471
1472 ShipEntity* scavenger_ship;
1473
1474 unsigned scavs = [UNIVERSE countShipsWithPrimaryRole:@"scavenger" inRange:SCANNER_MAX_RANGE ofEntity:self] + [self countOfShipsInLaunchQueueWithPrimaryRole:@"scavenger"];
1475
1476 if (scavs >= max_scavengers)
1477 return nil;
1479 return nil;
1480
1481 scavenger_ship = [UNIVERSE newShipWithRole:@"scavenger"]; // retain count = 1
1482
1483 if (![self fitsInDock:scavenger_ship]) {
1484 [scavenger_ship release];
1485 return nil;
1486 }
1487
1488 if (scavenger_ship) {
1489 if (![scavenger_ship crew]) {
1490 [scavenger_ship setSingleCrewWithRole:@"miner"];
1491 }
1492
1494 [scavenger_ship setScanClass:CLASS_NEUTRAL];
1495 if ([scavenger_ship heatInsulation] < [self heatInsulation])
1496 [scavenger_ship setHeatInsulation:[self heatInsulation]];
1497 [scavenger_ship setGroup:[self stationGroup]]; // who's your Daddy -- FIXME: should we have a separate group for non-escort auxiliaires?
1498 [scavenger_ship switchAITo:@"oolite-scavengerAI.js"];
1499 [self addShipToLaunchQueue:scavenger_ship withPriority:NO];
1500 [scavenger_ship autorelease];
1501 }
1502 return scavenger_ship;
1503}

References addShipToLaunchQueue:withPriority:, countOfShipsInLaunchQueueWithPrimaryRole:, ShipEntity::crew, ShipEntity::displayName, hasLaunchDock, ShipEntity::heatInsulation, launchScavenger, max_scavengers, nil, OOLog, scavengers_launched, ShipEntity::setGroup:, ShipEntity::setHeatInsulation:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, ShipEntity::stationGroup, and ShipEntity::switchAITo:.

Referenced by alertLevel, launchScavenger, StationLaunchScavenger(), and StationLaunchScavenger().

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

◆ launchShip:

- (void) launchShip: (ShipEntity*) ship

Definition at line 283 of file StationEntity.m.

283 :(ShipEntity*)ship
284{
285 NSEnumerator* subEnum = nil;
286 DockEntity* sub = nil;
287
288 // try to find an unused dock first
289 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
290 if ([sub allowsLaunching] && [sub countOfShipsInLaunchQueue] == 0) {
291 [sub launchShip:ship];
292 return;
293 }
294 }
295 // otherwise any launchable dock will do
296 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
297 if ([sub allowsLaunching]) {
298 [sub launchShip:ship];
299 return;
300 }
301 }
302
303 // ship has no launch docks specified; just use the last one
304 if (sub != nil) {
305 [sub launchShip:ship];
306 return;
307 }
308 // guaranteed to always be a dock as virtual dock will suffice
309}
void launchShip:(ShipEntity *ship)
Definition DockEntity.m:804

References dockSubEntityEnumerator, DockEntity::launchShip:, and nil.

Referenced by PlayerEntity::leaveDock:, and ShipEntity::leaveDock:.

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

◆ launchShipWithRole:

- (void) launchShipWithRole: (NSString*) role

Definition at line 1715 of file StationEntity.m.

1715 :(NSString*)role
1716{
1717 if (![self hasLaunchDock]) {
1718 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a ship with role %@, as the %@ has no launch docks.",
1719 role, [self displayName]);
1720 return;
1721 }
1722 ShipEntity* ship = [UNIVERSE newShipWithRole:role]; // retain count = 1
1723 if (ship && [self fitsInDock:ship]) {
1724 if (![ship crew]) {
1725 [ship setSingleCrewWithRole:role];
1726 }
1727 if (ship->scanClass == CLASS_NOT_SET)
1728 [ship setScanClass:CLASS_NEUTRAL];
1729 [ship setPrimaryRole:role];
1730 [ship setGroup:[self stationGroup]]; // who's your Daddy
1731 [self addShipToLaunchQueue:ship withPriority:NO];
1732 }
1733 [ship release];
1734}

References addShipToLaunchQueue:withPriority:, ShipEntity::crew, ShipEntity::displayName, hasLaunchDock, OOLog, ShipEntity::scanClass, ShipEntity::setGroup:, ShipEntity::setPrimaryRole:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, and ShipEntity::stationGroup.

Here is the call graph for this function:

◆ launchShuttle

- (ShipEntity *) launchShuttle

Definition at line 1606 of file StationEntity.m.

1607{
1608 if (![self hasLaunchDock]) {
1609 OOLog(@"station.launchShip.impossible", @"Cancelled launch for a shuttle ship, as the %@ has no launch docks.",
1610 [self displayName]);
1611 return nil;
1612 }
1613 ShipEntity* shuttle_ship;
1614
1615 shuttle_ship = [UNIVERSE newShipWithRole:@"shuttle"]; // retain count = 1
1616
1617 if (![self fitsInDock:shuttle_ship]) {
1618 [shuttle_ship release];
1619 return nil;
1620 }
1621
1622 if (shuttle_ship) {
1623 if (![shuttle_ship crew]) {
1624 [shuttle_ship setSingleCrewWithRole:@"trader"];
1625 }
1626
1628 [shuttle_ship setScanClass:CLASS_NEUTRAL];
1629 [shuttle_ship setCargoFlag:CARGO_FLAG_FULL_SCARCE];
1630 [shuttle_ship switchAITo:@"oolite-shuttleAI.js"];
1631 [self addShipToLaunchQueue:shuttle_ship withPriority:NO];
1632
1633 [shuttle_ship autorelease];
1634 }
1635 return shuttle_ship;
1636}

References addShipToLaunchQueue:withPriority:, ShipEntity::crew, ShipEntity::displayName, docked_shuttles, hasLaunchDock, launchShuttle, nil, OOLog, ShipEntity::setCargoFlag:, Entity::setScanClass:, ShipEntity::setSingleCrewWithRole:, and ShipEntity::switchAITo:.

Referenced by alertLevel, launchShuttle, StationLaunchShuttle(), StationLaunchShuttle(), and update:.

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

◆ legalStatusOfManifest:export:

- (OOCreditsQuantity) legalStatusOfManifest: (OOCommodityMarket*) manifest
export: (BOOL) export 

Definition at line 150 of file StationEntity.m.

150 :(OOCommodityMarket*)manifest export:(BOOL)export
151{
152 OOCreditsQuantity penalty, status = 0;
153 OOCommodityMarket* market = [self localMarket];
154 OOCommodityType good = nil;
155 foreach (good, [market goods]) {
156 if (export) {
157 penalty = [market exportLegalityForGood:good];
158 } else {
159 penalty = [market importLegalityForGood:good];
160 }
161 status += penalty * [manifest quantityForGood:good];
162 }
163 return status;
164}
NSString * OOCommodityType
Definition OOTypes.h:97
uint64_t OOCreditsQuantity
Definition OOTypes.h:160
NSUInteger exportLegalityForGood:(OOCommodityType good)
NSUInteger importLegalityForGood:(OOCommodityType good)

References OOCommodityMarket::exportLegalityForGood:, OOCommodityMarket::importLegalityForGood:, localMarket, nil, OOCommodityMarket::quantityForGood:, and Entity::status.

Referenced by PlayerEntity::docked, and PlayerEntity::leaveDock:.

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

◆ localInterfaces

- (NSMutableDictionary *) localInterfaces

References initialiseLocalMarket, and localInterfaces.

Here is the call graph for this function:

◆ localMarket

References localMarket, and localMarketForScripting.

Here is the call graph for this function:

◆ localMarketForScripting

- (NSDictionary *) localMarketForScripting

Definition at line 184 of file StationEntity.m.

185{
186 return [[self localMarket] dictionaryForScripting];
187}

References OOCommodityMarket::dictionaryForScripting, localMarket, and localMarketForScripting.

Referenced by localMarket, localMarketForScripting, StationGetProperty(), and StationGetProperty().

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

◆ localShipyard

- (NSMutableArray *) localShipyard

References generateShipyard, and localShipyard.

Here is the call graph for this function:

◆ marketBroadcast

- (BOOL) marketBroadcast

References marketBroadcast.

◆ marketCapacity

◆ marketDefinition

- (NSArray *) marketDefinition

References marketDefinition.

◆ marketMonitored

- (BOOL) marketMonitored

References marketMonitored.

◆ marketOverrideName

- (NSString *) marketOverrideName

Definition at line 2047 of file StationEntity.m.

2048{
2049 // 2010.06.14 - Micha - we can't default to the primary role as otherwise the logic
2050 // generating the market in [Universe commodityDataForEconomy:] doesn't
2051 // work properly with the various overrides. The primary role will get
2052 // used if either there is no market override, or the market wasn't
2053 // defined.
2054 return [shipinfoDictionary oo_stringForKey:@"market"];
2055}

References marketOverrideName.

Referenced by allowsSaving, and marketOverrideName.

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

◆ marketScriptName

- (NSString *) marketScriptName

References marketScriptName.

◆ noteDockedShip:

- (void) noteDockedShip: (ShipEntity*) ship

Definition at line 1022 of file StationEntity.m.

1022 :(ShipEntity*)ship
1023{
1024 if (ship == nil)
1025 return;
1026
1027 PlayerEntity* player = PLAYER;
1028 // set last launch time to avoid clashes with outgoing ships
1029 if ([player getDockingClearanceStatus] != DOCKING_CLEARANCE_STATUS_GRANTED) {
1030 // avoid interfering with docking clearance on another bay
1031 last_launch_time = [UNIVERSE getTime];
1032 }
1033 [self addShipToStationCount:ship];
1034
1035 NSEnumerator* subEnum = nil;
1036 DockEntity* sub = nil;
1037 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
1038 [sub noteDockingForShip:ship];
1039 }
1040 [self sanityCheckShipsOnApproach];
1041
1042 [self doScriptEvent:OOJSID("otherShipDocked") withArgument:ship];
1043
1044 BOOL isDockingStation = (self == [player getTargetDockStation]);
1045 if (isDockingStation && [player status] == STATUS_IN_FLIGHT &&
1046 [player getDockingClearanceStatus] == DOCKING_CLEARANCE_STATUS_REQUESTED) {
1047 if (![self hasClearDock]) {
1048 // then say why
1049 if ([self currentlyInDockingQueues]) {
1050 [self sendExpandedMessage:[NSString stringWithFormat:
1051 DESC(@"station-docking-clearance-holding-d-ships-approaching"),
1052 [self currentlyInDockingQueues] + 1]
1053 toShip:player];
1054 } else if ([self currentlyInLaunchingQueues]) {
1055 [self sendExpandedMessage:[NSString stringWithFormat:
1056 DESC(@"station-docking-clearance-holding-d-ships-departing"),
1057 [self currentlyInLaunchingQueues] + 1]
1058 toShip:player];
1059 }
1060 }
1061 }
1062
1063 if ([ship isPlayer]) {
1065 }
1066}
void noteDockingForShip:(ShipEntity *ship)
Definition DockEntity.m:525

References addShipToStationCount:, currentlyInDockingQueues, currentlyInLaunchingQueues, DOCKING_CLEARANCE_STATUS_GRANTED, DOCKING_CLEARANCE_STATUS_REQUESTED, dockSubEntityEnumerator, ShipEntity::doScriptEvent:withArgument:, PlayerEntity::getTargetDockStation, hasClearDock, Entity::isPlayer, last_launch_time, nil, DockEntity::noteDockingForShip:, PLAYER, player_reserved_dock, sanityCheckShipsOnApproach, ShipEntity::sendExpandedMessage:toShip:, and Entity::status.

Referenced by PlayerEntity::enterDock:, and ShipEntity::enterDock:.

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

◆ oo_jsClassID

- (JSClassID) oo_jsClassID
implementation

Reimplemented from ShipEntity.

Provided by category StationEntity(OOJavaScriptExtensions).

Definition at line 228 of file OOJSStation.m.

229{
230 return sStationClassID;
231}
static JSClassID sStationClassID
Definition OOJSStation.m:40

◆ oo_jsClassName

- (NSString *) oo_jsClassName
implementation

Reimplemented from ShipEntity.

Provided by category StationEntity(OOJavaScriptExtensions).

Definition at line 214 of file OOJSStation.m.

215{
216 return @"Station";
217}

◆ OOMakeDockingInstructions

- (NSDictionary *) OOMakeDockingInstructions (StationEntity *) station
(HPVector) coords
(float) speed
(float) range
(NSString *) ai_message
(NSString *) comms_message
(BOOL) match_rotation
(int) docking_stage 
implementation

Definition at line 380 of file StationEntity.m.

381{
382 NSMutableDictionary* acc = [NSMutableDictionary dictionaryWithCapacity:8];
383 [acc oo_setHPVector:coords forKey:@"destination"];
384 [acc oo_setFloat:speed forKey:@"speed"];
385 [acc oo_setFloat:range forKey:@"range"];
386 [acc setObject:[[station weakRetain] autorelease] forKey:@"station"];
387 [acc oo_setBool:match_rotation forKey:@"match_rotation"];
388 [acc oo_setInteger:docking_stage forKey:@"docking_stage"];
389 if (ai_message) {
390 [acc setObject:ai_message forKey:@"ai_message"];
391 }
392 if (comms_message) {
393 [acc setObject:comms_message forKey:@"comms_message"];
394 }
395 return [NSDictionary dictionaryWithDictionary:acc];
396}

References Entity::speed, and OOWeakRefObject::weakRetain.

Here is the call graph for this function:

◆ planet

- (OOPlanetEntity *) planet

References planet.

◆ playerReservedDock

- (DockEntity *) playerReservedDock

Definition at line 100 of file StationEntity.m.

101{
103}

References player_reserved_dock, and playerReservedDock.

Referenced by equivalentTechLevel, and playerReservedDock.

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

◆ portUpVectorForShip:

- (Vector) portUpVectorForShip: (ShipEntity*) ship

Definition at line 368 of file StationEntity.m.

368 :(ShipEntity*)ship
369{
370 NSEnumerator* subEnum = nil;
371 DockEntity* sub = nil;
372 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
373 if ([sub shipIsInDockingQueue:ship]) {
374 return [sub portUpVectorForShipsBoundingBox:[ship totalBoundingBox]];
375 }
376 }
377 return kZeroVector;
378}
const Vector kZeroVector
Definition OOVector.m:27
Vector portUpVectorForShipsBoundingBox:(BoundingBox bb)
Definition DockEntity.m:563

References dockSubEntityEnumerator, kZeroVector, nil, and DockEntity::portUpVectorForShipsBoundingBox:.

Referenced by ShipEntity::trackDestination:retreat:.

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 StationEntity(OOPrivate).

Definition at line 720 of file StationEntity.m.

720 :(ShipEntity*)ship
721{
722 [ship enterDock:self]; // dock performs permitted checks
723}
void enterDock:(StationEntity *station)

References ShipEntity::enterDock:.

Referenced by autoDockShipsOnHold.

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

◆ requiresDockingClearance

◆ sanityCheckShipsOnApproach

- (void) sanityCheckShipsOnApproach

Definition at line 265 of file StationEntity.m.

266{
267
268 NSEnumerator* subEnum = nil;
269 DockEntity* sub = nil;
270 unsigned soa = 0;
271 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
272 soa += [sub pruneAndCountShipsOnApproach];
273 }
274
275 if (soa == 0) {
276 // if all docks have no ships on approach
277 [shipAI message:@"DOCKING_COMPLETE"];
278 [self doScriptEvent:OOJSID("stationDockingQueuesAreEmpty")];
279 }
280}

References dockSubEntityEnumerator, ShipEntity::doScriptEvent:, AI::message:, nil, DockEntity::pruneAndCountShipsOnApproach, and sanityCheckShipsOnApproach.

Referenced by abortDockingForShip:, acceptDockingClearanceRequestFrom:, allegiance, noteDockedShip:, and sanityCheckShipsOnApproach.

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

◆ selectDockForDocking

- (DockEntity *) selectDockForDocking

Definition at line 924 of file StationEntity.m.

925{
926 NSEnumerator* subEnum = nil;
927 DockEntity* sub = nil;
928 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
929 if ([sub allowsDocking] && [sub countOfShipsInLaunchQueue] == 0 && [sub countOfShipsInDockingQueue] == 0) {
930 return sub;
931 }
932 }
933 return nil;
934}

References dockSubEntityEnumerator, nil, and selectDockForDocking.

Referenced by acceptDockingClearanceRequestFrom:, allegiance, selectDockForDocking, and update:.

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

◆ setAlertLevel:signallingScript:

- (void) setAlertLevel: (OOStationAlertLevel) level
signallingScript: (BOOL) signallingScript 

Definition at line 1195 of file StationEntity.m.

1195 :(OOStationAlertLevel)level signallingScript:(BOOL)signallingScript
1196{
1197 if (level < STATION_ALERT_LEVEL_GREEN)
1199 if (level > STATION_ALERT_LEVEL_RED)
1201
1202 if (alertLevel != level) {
1204 alertLevel = level;
1205 if (signallingScript) {
1206 [self doScriptEvent:OOJSID("alertConditionChanged") withArgument:[NSNumber numberWithInt:level] andArgument:[NSNumber numberWithInt:oldLevel]];
1207 }
1208 switch (level) {
1210 [shipAI reactToMessage:@"GREEN_ALERT" context:nil];
1211 break;
1212
1214 [shipAI reactToMessage:@"YELLOW_ALERT" context:nil];
1215 break;
1216
1218 [shipAI reactToMessage:@"RED_ALERT" context:nil];
1219 break;
1220 }
1221 }
1222}
OOStationAlertLevel

References alertLevel, ShipEntity::doScriptEvent:withArgument:andArgument:, AI::reactToMessage:context:, STATION_ALERT_LEVEL_GREEN, STATION_ALERT_LEVEL_RED, and STATION_ALERT_LEVEL_YELLOW.

Referenced by decreaseAlertLevel, increaseAlertLevel, StationSetProperty(), and StationSetProperty().

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

◆ setAllegiance:

- (void) setAllegiance: (NSString*) newAllegiance

Definition at line 1184 of file StationEntity.m.

1184 :(NSString*)newAllegiance
1185{
1186 [allegiance release];
1187 allegiance = [newAllegiance copy];
1188}

References allegiance.

Referenced by setUpShipFromDictionary:, Universe::setUpSpace, StationSetProperty(), and StationSetProperty().

Here is the caller graph for this function:

◆ setAllowsAutoDocking:

- (void) setAllowsAutoDocking: (BOOL) newValue

Definition at line 2029 of file StationEntity.m.

2029 :(BOOL)newValue
2030{
2031 allowsAutoDocking = !!newValue; // Ensure yes or no
2032}
unsigned allowsAutoDocking

References allowsAutoDocking.

Referenced by StationSetProperty(), and StationSetProperty().

Here is the caller graph for this function:

◆ setAllowsFastDocking:

- (void) setAllowsFastDocking: (BOOL) newValue

Definition at line 2019 of file StationEntity.m.

2019 :(BOOL)newValue
2020{
2021 allowsFastDocking = !!newValue; // Ensure yes or no
2022}
unsigned allowsFastDocking

References allowsFastDocking.

Referenced by Universe::setUpSpace, StationSetProperty(), and StationSetProperty().

Here is the caller graph for this function:

◆ setEquivalentTechLevel:

- (void) setEquivalentTechLevel: (OOTechLevelID) value

Definition at line 90 of file StationEntity.m.

90 :(OOTechLevelID)value
91{
92 equivalentTechLevel = value;
93}

References equivalentTechLevel.

Referenced by Universe::setSystemDataForGalaxy:planet:key:value:fromManifest:forLayer:, and Universe::setUpSpace.

Here is the caller graph for this function:

◆ setHasBreakPattern:

- (void) setHasBreakPattern: (BOOL) newValue

Definition at line 2117 of file StationEntity.m.

2117 :(BOOL)newValue
2118{
2119 hasBreakPattern = !!newValue;
2120}

References hasBreakPattern.

Referenced by StationSetProperty(), and StationSetProperty().

Here is the caller graph for this function:

◆ setHasNPCTraffic:

- (void) setHasNPCTraffic: (BOOL) flag

Definition at line 1094 of file StationEntity.m.

1094 :(BOOL)flag
1095{
1096 hasNPCTraffic = flag != NO;
1097}
unsigned hasNPCTraffic

References hasNPCTraffic.

Referenced by StationSetProperty(), and StationSetProperty().

Here is the caller graph for this function:

◆ setInterfaceDefinition:forKey:

- (void) setInterfaceDefinition: (OOJSInterfaceDefinition*) definition
forKey: (NSString*) key 

Definition at line 216 of file StationEntity.m.

216 :(OOJSInterfaceDefinition*)definition forKey:(NSString*)key
217{
218 if (definition == nil) {
219 [localInterfaces removeObjectForKey:key];
220 } else {
221 [localInterfaces setObject:definition forKey:key];
222 }
223}

References nil.

Referenced by StationSetInterface(), and StationSetInterface().

Here is the caller graph for this function:

◆ setLocalMarket:

- (void) setLocalMarket: (NSArray*) market

Definition at line 179 of file StationEntity.m.

179 :(NSArray*)some_market
180{
181 [[self localMarket] loadStationAmounts:some_market];
182}

References OOCommodityMarket::loadStationAmounts:, and localMarket.

Referenced by PlayerEntity(LoadSave)::loadPlayerFromFile:asNew:, and Universe::loadStationMarkets:.

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

◆ setLocalShipyard:

- (void) setLocalShipyard: (NSArray*) market

Definition at line 204 of file StationEntity.m.

204 :(NSArray*)some_market
205{
206 if (localShipyard)
207 [localShipyard release];
208 localShipyard = [[NSMutableArray alloc] initWithArray:some_market];
209}

References localShipyard.

Referenced by generateShipyard:, and Universe::setSystemDataForGalaxy:planet:key:value:fromManifest:forLayer:.

Here is the caller graph for this function:

◆ setPlanet:

- (void) setPlanet: (OOPlanetEntity*) planet

Definition at line 232 of file StationEntity.m.

232 :(OOPlanetEntity*)planet_entity
233{
234 if (planet_entity)
235 planet = [planet_entity universalID];
236 else
238}
@ NO_TARGET
Definition OOTypes.h:169
OOUniversalID planet

References NO_TARGET, and planet.

Referenced by Universe::addEntity:.

Here is the caller graph for this function:

◆ setPrice:forCommodity:

- (void) setPrice: (OOCreditsQuantity) price
forCommodity: (OOCommodityType) commodity 

Definition at line 189 of file StationEntity.m.

189 :(OOCreditsQuantity)price forCommodity:(OOCommodityType)commodity
190{
191 [[self localMarket] setPrice:price forGood:commodity];
192}

References localMarket, and OOCommodityMarket::setPrice:forGood:.

Referenced by StationSetMarketPrice(), and StationSetMarketPrice().

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

◆ setQuantity:forCommodity:

- (void) setQuantity: (OOCargoQuantity) quantity
forCommodity: (OOCommodityType) commodity 

Definition at line 194 of file StationEntity.m.

194 :(OOCargoQuantity)quantity forCommodity:(OOCommodityType)commodity
195{
196 [[self localMarket] setQuantity:quantity forGood:commodity];
197}
uint32_t OOCargoQuantity
Definition OOTypes.h:155

References localMarket, and OOCommodityMarket::setQuantity:forGood:.

Referenced by StationSetMarketQuantity(), and StationSetMarketQuantity().

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

◆ setRequiresDockingClearance:

- (void) setRequiresDockingClearance: (BOOL) newValue

Definition at line 2009 of file StationEntity.m.

2009 :(BOOL)newValue
2010{
2011 requiresDockingClearance = !!newValue; // Ensure yes or no
2012}

References requiresDockingClearance.

Referenced by Universe::setDockingClearanceProtocolActive:, StationSetProperty(), and StationSetProperty().

Here is the caller graph for this function:

◆ setSuppressArrivalReports:

- (void) setSuppressArrivalReports: (BOOL) newValue

Definition at line 2107 of file StationEntity.m.

2107 :(BOOL)newValue
2108{
2109 suppress_arrival_reports = !!newValue; // ensure YES or NO
2110}
unsigned suppress_arrival_reports

References suppress_arrival_reports.

Referenced by StationSetProperty(), and StationSetProperty().

Here is the caller graph for this function:

◆ setUpShipFromDictionary:

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

Reimplemented from ShipEntity.

Definition at line 569 of file StationEntity.m.

569 :(NSDictionary*)dict
570{
572
573 isShip = YES;
574 isStation = YES;
576
577 port_radius = [dict oo_nonNegativeDoubleForKey:@"port_radius" defaultValue:500.0];
578
579 // port_dimensions is deprecated
580 port_dimensions = make_vector(69, 69, 250);
581 NSString* portDimensionsStr = [dict oo_stringForKey:@"port_dimensions"];
582 if (portDimensionsStr != nil) {
583 OOStandardsDeprecated(@"The port_dimensions key is deprecated");
584 if (!OOEnforceStandards()) {
585 NSArray* tokens = [portDimensionsStr componentsSeparatedByString:@"x"];
586 if ([tokens count] == 3) {
587 port_dimensions = make_vector([[tokens objectAtIndex:0] floatValue],
588 [[tokens objectAtIndex:1] floatValue],
589 [[tokens objectAtIndex:2] floatValue]);
590 }
591 }
592 }
593
594 if (![super setUpShipFromDictionary:dict])
595 return NO;
596
597 equivalentTechLevel = [dict oo_unsignedIntegerForKey:@"equivalent_tech_level" defaultValue:NSNotFound];
598 max_scavengers = [dict oo_unsignedIntForKey:@"max_scavengers" defaultValue:3];
599 max_defense_ships = [dict oo_unsignedIntForKey:@"max_defense_ships" defaultValue:3];
600 max_police = [dict oo_unsignedIntForKey:@"max_police" defaultValue:STATION_MAX_POLICE];
601 equipmentPriceFactor = [dict oo_nonNegativeFloatForKey:@"equipment_price_factor" defaultValue:1.0];
603 hasNPCTraffic = [dict oo_fuzzyBooleanForKey:@"has_npc_traffic" defaultValue:(maxFlightSpeed == 0)]; // carriers default to NO
604 hasPatrolShips = [dict oo_fuzzyBooleanForKey:@"has_patrol_ships" defaultValue:NO];
605 suppress_arrival_reports = [dict oo_boolForKey:@"suppress_arrival_reports" defaultValue:NO];
606 [self setAllegiance:[dict oo_stringForKey:@"allegiance"]];
607
608 marketCapacity = [dict oo_unsignedIntForKey:@"market_capacity" defaultValue:MAIN_SYSTEM_MARKET_LIMIT];
609 marketDefinition = [[dict oo_arrayForKey:@"market_definition" defaultValue:nil] retain];
610 marketScriptName = [[dict oo_stringForKey:@"market_script" defaultValue:nil] retain];
611 marketMonitored = [dict oo_boolForKey:@"market_monitored" defaultValue:NO];
612 marketBroadcast = [dict oo_boolForKey:@"market_broadcast" defaultValue:YES];
613
614 // Non main stations may have requiresDockingClearance set to yes as a result of the code below,
615 // but this variable should be irrelevant for them, as they do not make use of it anyway.
616 requiresDockingClearance = [dict oo_boolForKey:@"requires_docking_clearance" defaultValue:[UNIVERSE dockingClearanceProtocolActive]];
617
618 allowsFastDocking = [dict oo_boolForKey:@"allows_fast_docking" defaultValue:NO];
619
620 allowsAutoDocking = [dict oo_boolForKey:@"allows_auto_docking" defaultValue:YES];
621
622 allowsSaving = [UNIVERSE deterministicPopulation];
623
624 interstellarUndockingAllowed = [dict oo_boolForKey:@"interstellar_undocking" defaultValue:NO];
625
626 double unitime = [UNIVERSE getTime];
627
628 if ([self hasNPCTraffic]) // removed the 'isRotatingStation' restriction.
629 {
630 docked_shuttles = ranrot_rand() & 3; // 0..3;
631 shuttle_launch_interval = 15.0 * 60.0; // every 15 minutes
633
634 docked_traders = 3 + (ranrot_rand() & 7); // 1..3;
635 trader_launch_interval = 3600.0 / docked_traders; // every few minutes
636 last_trader_launch_time = unitime + 60.0 - trader_launch_interval; // in one minute's time
637 } else {
638 docked_shuttles = 0;
639 docked_traders = 0; // 1..3;
640 }
641
642 patrol_launch_interval = 300.0; // 5 minutes
644
645 if ([self crew] == nil) {
646 [self setSingleCrewWithRole:@"police"];
647 }
648
649 if ([self group] == nil) {
650 [self setGroup:[self stationGroup]];
651 }
652 return YES;
653
655}
void OOStandardsDeprecated(NSString *message)
BOOL OOEnforceStandards(void)
OOINLINE Vector make_vector(OOScalar vx, OOScalar vy, OOScalar vz) INLINE_CONST_FUNC
Definition OOVector.h:149
Vector port_dimensions
double patrol_launch_interval
double last_trader_launch_time
unsigned marketMonitored
OOCargoQuantity marketCapacity
unsigned allowsSaving
unsigned marketBroadcast
double last_shuttle_launch_time
unsigned interstellarUndockingAllowed
double shuttle_launch_interval
double trader_launch_interval
#define ranrot_rand()

References alertLevel, allowsAutoDocking, allowsFastDocking, allowsSaving, count, ShipEntity::crew, docked_shuttles, docked_traders, equipmentPriceFactor, equivalentTechLevel, ShipEntity::group, hasNPCTraffic, hasPatrolShips, interstellarUndockingAllowed, Entity::isShip, Entity::isStation, last_patrol_report_time, last_shuttle_launch_time, last_trader_launch_time, make_vector(), marketBroadcast, marketCapacity, marketDefinition, marketMonitored, marketScriptName, max_defense_ships, max_police, max_scavengers, nil, OOEnforceStandards(), OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOStandardsDeprecated(), patrol_launch_interval, port_dimensions, port_radius, ranrot_rand, requiresDockingClearance, setAllegiance:, ShipEntity::setGroup:, ShipEntity::setSingleCrewWithRole:, shuttle_launch_interval, STATION_ALERT_LEVEL_GREEN, ShipEntity::stationGroup, suppress_arrival_reports, and trader_launch_interval.

Here is the call graph for this function:

◆ setUpSubEntities

- (BOOL) setUpSubEntities
implementation

Reimplemented from ShipEntity.

Definition at line 658 of file StationEntity.m.

659{
660 if (![super setUpSubEntities]) {
661 return NO;
662 }
663
664 NSEnumerator* subEnum = nil;
665
666#ifndef NDEBUG
667 ShipEntity* subEntity = nil;
668 for (subEnum = [self shipSubEntityEnumerator]; (subEntity = [subEnum nextObject]);) {
669 if ([subEntity isStation]) {
670 OOLog(@"setup.ship.badType.subentities", @"Subentity %@ (%@) of station %@ is itself a StationEntity. This is an internal error - please report it. ", subEntity, [subEntity shipDataKey], [self displayName]);
671 }
672 }
673#endif
674
675 // and now check for docks
676 DockEntity* sub = nil;
677 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
678 return YES;
679 }
680
681 OOStandardsDeprecated([NSString stringWithFormat:@"No docks set up for %@", self]);
682 OOLog(@"ship.setup.docks", @"No docks set up for %@, making virtual dock", self);
683
684 // no real docks, make a virtual one
685 NSMutableDictionary* virtualDockDict = [NSMutableDictionary dictionaryWithCapacity:10];
686 [virtualDockDict setObject:@"standard" forKey:@"type"];
687 [virtualDockDict setObject:@"oolite-dock-virtual" forKey:@"subentity_key"];
688 [virtualDockDict oo_setVector:make_vector(0, 0, port_radius) forKey:@"position"];
689 [virtualDockDict oo_setQuaternion:kIdentityQuaternion forKey:@"orientation"];
690 [virtualDockDict oo_setBool:YES forKey:@"is_dock"];
691 [virtualDockDict setObject:@"the docking bay" forKey:@"dock_label"];
692 [virtualDockDict oo_setBool:YES forKey:@"allow_docking"];
693 [virtualDockDict oo_setBool:NO forKey:@"disallowed_docking_collides"];
694 [virtualDockDict oo_setBool:YES forKey:@"allow_launching"];
695 [virtualDockDict oo_setBool:YES forKey:@"_is_virtual_dock"];
696
697 if (![self setUpOneStandardSubentity:virtualDockDict asTurret:NO]) {
698 return NO;
699 }
700 return YES;
701}
NSString * shipDataKey()
NSEnumerator * shipSubEntityEnumerator()

References ShipEntity::displayName, dockSubEntityEnumerator, Entity::isStation, nil, OOLog, OOStandardsDeprecated(), setUpSubEntities, ShipEntity::shipDataKey, and ShipEntity::shipSubEntityEnumerator.

Referenced by setUpSubEntities.

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

◆ shipIsInDockingCorridor:

- (BOOL) shipIsInDockingCorridor: (ShipEntity*) ship

Definition at line 703 of file StationEntity.m.

703 :(ShipEntity*)ship
704{
705 if (![ship isShip])
706 return NO;
707 if ([ship isPlayer] && [ship status] == STATUS_DEAD)
708 return NO;
709
710 NSEnumerator* subEnum = nil;
711 DockEntity* sub = nil;
712 for (subEnum = [self dockSubEntityEnumerator]; (sub = [subEnum nextObject]);) {
713 if ([sub shipIsInDockingCorridor:ship]) {
714 return YES;
715 }
716 }
717 return NO;
718}

References dockSubEntityEnumerator, Entity::isPlayer, Entity::isShip, nil, and Entity::status.

Referenced by CollisionRegion::findCollisions.

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

◆ suppressArrivalReports

- (BOOL) suppressArrivalReports

Definition at line 2102 of file StationEntity.m.

2103{
2105}

References suppress_arrival_reports, and suppressArrivalReports.

Referenced by allowsSaving, and suppressArrivalReports.

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 1116 of file StationEntity.m.

1116 :(double)amount from:(Entity*)ent becauseOf:(Entity*)other weaponIdentifier:(NSString*)weaponIdentifier
1117{
1118 // stations must ignore friendly fire, otherwise the defenders' AI gets stuck.
1119 BOOL isFriend = NO;
1120 OOShipGroup* group = [self group];
1121
1122 if ([other isShip] && group != nil) {
1123 OOShipGroup* otherGroup = [(ShipEntity*)other group];
1124 isFriend = otherGroup == group || [otherGroup leader] == self;
1125 }
1126
1127 // If this is the system's main station...
1128 if (self == [UNIVERSE station] && !isFriend) {
1129 //...get angry
1130 BOOL isEnergyMine = [ent isCascadeWeapon];
1131
1132 // JSAIs might ignore friendly fire from conventional weapons
1133 if ([self hasNewAI] || isEnergyMine) {
1134 unsigned b = isEnergyMine ? 96 : 64;
1135 if ([(ShipEntity*)other bounty] >= b) // already a hardened criminal?
1136 {
1137 b *= 1.5; // bigger bounty!
1138 }
1139 [(ShipEntity*)other markAsOffender:b withReason:kOOLegalStatusReasonAttackedMainStation];
1140 [self setPrimaryAggressor:other];
1141 [self setFoundTarget:other];
1142 [self launchPolice];
1143 }
1144
1145 if (isEnergyMine) // don't blow up!
1146 {
1147 [self increaseAlertLevel];
1148 [self respondToAttackFrom:ent becauseOf:other];
1149 return;
1150 }
1151 }
1152 // Stop damage if main station & close to death!
1153 if (!isFriend && (self != [UNIVERSE station] || amount < energy)) {
1154 // Handle damage like a ship.
1155 [super takeEnergyDamage:amount from:ent becauseOf:other weaponIdentifier:weaponIdentifier];
1156 }
1157}
GLfloat energy
Definition Entity.m:753
ShipEntity * leader()
BOOL hasNewAI()

References ShipEntity::bounty, Entity::energy, ShipEntity::group, ShipEntity::hasNewAI, increaseAlertLevel, Entity::isCascadeWeapon, Entity::isShip, launchPolice, OOShipGroup::leader, ShipEntity::markAsOffender:withReason:, nil, ShipEntity::respondToAttackFrom:becauseOf:, ShipEntity::setFoundTarget:, ShipEntity::setPrimaryAggressor:, ShipEntity::takeEnergyDamage:from:becauseOf:weaponIdentifier:, and UNIVERSE.

Referenced by PlayerEntity(Scripting)::blowUpStation.

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

◆ takeHeatDamage:

- (void) takeHeatDamage: (double) amount
implementation

Reimplemented from ShipEntity.

Definition at line 1172 of file StationEntity.m.

1172 :(double)amount
1173{
1174 // Stop damage if main station
1175 if (self != [UNIVERSE station])
1176 [super takeHeatDamage:amount];
1177}

References ShipEntity::takeHeatDamage:, and UNIVERSE.

Here is the call graph for this function:

◆ takeScrapeDamage:from:

- (void) takeScrapeDamage: (double) amount
from: (Entity*) ent 
implementation

Reimplemented from ShipEntity.

Definition at line 1165 of file StationEntity.m.

1165 :(double)amount from:(Entity*)ent
1166{
1167 // Stop damage if main station
1168 if (self != [UNIVERSE station])
1169 [super takeScrapeDamage:amount from:ent];
1170}

References ShipEntity::takeScrapeDamage:from:, and UNIVERSE.

Here is the call graph for this function:

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from ShipEntity.

Definition at line 754 of file StationEntity.m.

754 :(OOTimeDelta)delta_t
755{
756 BOOL isRockHermit = (scanClass == CLASS_ROCK);
757 BOOL isMainStation = (self == [UNIVERSE station]);
758
759 double unitime = [UNIVERSE getTime];
760
761 if (!isMainStation && localMarket == nil) {
762 [self initialiseLocalMarket];
763 }
764
765 [super update:delta_t];
766
767 PlayerEntity* player = PLAYER;
768
769 BOOL isDockingStation = (self == [player getTargetDockStation]);
770 if (isDockingStation && [player status] == STATUS_IN_FLIGHT) {
771 if ([player getDockingClearanceStatus] >= DOCKING_CLEARANCE_STATUS_GRANTED) {
772 if (last_launch_time - 30 < unitime && [player getDockingClearanceStatus] != DOCKING_CLEARANCE_STATUS_TIMING_OUT) {
773 [self sendExpandedMessage:@"[station-docking-clearance-about-to-expire]" toShip:player];
774 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_TIMING_OUT];
775 } else if (last_launch_time < unitime) {
776 [self sendExpandedMessage:@"[station-docking-clearance-expired]" toShip:player];
777 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE]; // Docking clearance for player has expired.
778 [player doScriptEvent:OOJSID("playerDockingClearanceExpired")];
779 if ([self currentlyInDockingQueues] == 0) {
780 [[self getAI] message:@"DOCKING_COMPLETE"];
781 [self doScriptEvent:OOJSID("stationDockingQueuesAreEmpty")];
782 }
784 }
785 }
786
787 else if ([player getDockingClearanceStatus] == DOCKING_CLEARANCE_STATUS_NOT_REQUIRED) {
788 if (last_launch_time < unitime) {
789 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_NONE];
790 if ([self currentlyInDockingQueues] == 0) {
791 [[self getAI] message:@"DOCKING_COMPLETE"];
792 [self doScriptEvent:OOJSID("stationDockingQueuesAreEmpty")];
793 }
794 }
795 }
796
797 else if ([player getDockingClearanceStatus] == DOCKING_CLEARANCE_STATUS_REQUESTED &&
798 [self hasClearDock]) {
799 DockEntity* dock = [self selectDockForDocking];
801 if ([self hasMultipleDocks]) {
802 [self sendExpandedMessage:[NSString stringWithFormat:
803 DESC(@"station-docking-clearance-granted-in-@-until-@"),
804 [dock displayName],
805 ClockToString([player clockTime] + DOCKING_CLEARANCE_WINDOW, NO)]
806 toShip:player];
807 } else {
808 [self sendExpandedMessage:[NSString stringWithFormat:
809 DESC(@"station-docking-clearance-granted-until-@"),
810 ClockToString([player clockTime] + DOCKING_CLEARANCE_WINDOW, NO)]
811 toShip:player];
812 }
814 [player setDockingClearanceStatus:DOCKING_CLEARANCE_STATUS_GRANTED];
815 [player doScriptEvent:OOJSID("playerDockingClearanceGranted")];
816 }
817 }
818
819 if (approach_spacing > 0.0) {
820 approach_spacing -= delta_t * 10.0; // reduce by 10 m/s
821 if (approach_spacing < 0.0)
822 approach_spacing = 0.0;
823 }
824
825 /* JSAI: JS-based AIs handle their own traffic either alone or
826 * in conjunction with the system repopulator */
827 if (![self hasNewAI]) {
828 // begin launch of shuttles, traders, patrols
829 if ((docked_shuttles > 0) && (!isRockHermit)) {
831 if (([self hasNPCTraffic]) && (aegis_status != AEGIS_NONE)) {
832 [self launchShuttle];
833 }
834 last_shuttle_launch_time = unitime;
835 }
836 }
837
838 if ((docked_traders > 0) && (!isRockHermit)) {
840 if ([self hasNPCTraffic]) {
841 [self launchIndependentShip:@"trader"];
843 }
844 last_trader_launch_time = unitime;
845 }
846 }
847
848 // testing patrols
850 if (!((isMainStation && [self hasNPCTraffic]) || hasPatrolShips) || [self launchPatrol] != nil)
851 last_patrol_report_time = unitime;
852 }
853 }
854}
@ AEGIS_NONE
Definition OOTypes.h:54
double OOTimeDelta
Definition OOTypes.h:193
OOAegisStatus aegis_status
Definition ShipEntity.h:367
ShipEntity * launchPatrol()
double approach_spacing

References AEGIS_NONE, ShipEntity::aegis_status, approach_spacing, PlayerEntity::clockTime, currentlyInDockingQueues, ShipEntity::displayName, docked_shuttles, docked_traders, DOCKING_CLEARANCE_STATUS_GRANTED, DOCKING_CLEARANCE_STATUS_NOT_REQUIRED, DOCKING_CLEARANCE_STATUS_REQUESTED, DOCKING_CLEARANCE_STATUS_TIMING_OUT, DOCKING_CLEARANCE_WINDOW, ShipEntity::doScriptEvent:, ShipEntity::getAI, PlayerEntity::getTargetDockStation, hasClearDock, hasMultipleDocks, ShipEntity::hasNewAI, hasNPCTraffic, hasPatrolShips, initialiseLocalMarket, last_launch_time, last_patrol_report_time, last_shuttle_launch_time, last_trader_launch_time, launchIndependentShip:, launchPatrol, launchShuttle, localMarket, AI::message:, nil, patrol_launch_interval, PLAYER, player_reserved_dock, ShipEntity::scanClass, selectDockForDocking, ShipEntity::sendExpandedMessage:toShip:, PlayerEntity::setDockingClearanceStatus:, shuttle_launch_interval, Entity::status, trader_launch_interval, and ShipEntity::update:.

Here is the call graph for this function:

◆ virtualPortDimensions

- (Vector) virtualPortDimensions

Definition at line 95 of file StationEntity.m.

96{
97 return port_dimensions;
98}

References port_dimensions, and virtualPortDimensions.

Referenced by equivalentTechLevel, DockEntity::setDimensionsAndCorridor:ddc:launching:, and virtualPortDimensions.

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

Member Data Documentation

◆ _shipsOnHold

- (OOWeakSet*) _shipsOnHold
private

Definition at line 53 of file StationEntity.h.

Referenced by abortAllDockings, dealloc, dumpSelfState, and initWithKey:definition:.

◆ alertLevel

◆ allegiance

- (NSString *) allegiance
private

Definition at line 1179 of file StationEntity.m.

1180{
1181 return allegiance;
1182}

Referenced by allegiance, dealloc, setAllegiance:, StationGetProperty(), and StationGetProperty().

◆ allowsAutoDocking

- (BOOL) allowsAutoDocking
private

Definition at line 2024 of file StationEntity.m.

2025{
2026 return allowsAutoDocking;
2027}

Referenced by allowsAutoDocking, setAllowsAutoDocking:, and setUpShipFromDictionary:.

◆ allowsFastDocking

- (BOOL) allowsFastDocking
private

Definition at line 2014 of file StationEntity.m.

2015{
2016 return allowsFastDocking;
2017}

Referenced by allowsFastDocking, setAllowsFastDocking:, and setUpShipFromDictionary:.

◆ allowsSaving

- (BOOL) allowsSaving
private

Definition at line 2034 of file StationEntity.m.

2035{
2036 // fixed stations only, not carriers!
2037 return allowsSaving && ([self maxFlightSpeed] == 0);
2038}
GLfloat maxFlightSpeed

Referenced by allowsSaving, PlayerEntity::setGuiToLoadSaveScreen, and setUpShipFromDictionary:.

◆ approach_spacing

- (double) approach_spacing
private

Definition at line 56 of file StationEntity.h.

Referenced by update:.

◆ defenders_launched

- (unsigned) defenders_launched
private

◆ docked_shuttles

- (unsigned) docked_shuttles
private

Definition at line 90 of file StationEntity.h.

Referenced by dumpSelfState, launchShuttle, setUpShipFromDictionary:, and update:.

◆ docked_traders

- (unsigned) docked_traders
private

Definition at line 94 of file StationEntity.h.

Referenced by dumpSelfState, setUpShipFromDictionary:, and update:.

◆ equipmentPriceFactor

◆ equivalentTechLevel

◆ hasBreakPattern

- (BOOL) hasBreakPattern
private

Definition at line 2112 of file StationEntity.m.

2113{
2114 return hasBreakPattern;
2115}

Referenced by hasBreakPattern, initWithKey:definition:, and setHasBreakPattern:.

◆ hasNPCTraffic

- (BOOL) hasNPCTraffic
private

Definition at line 1089 of file StationEntity.m.

1090{
1091 return hasNPCTraffic;
1092}

Referenced by hasNPCTraffic, setHasNPCTraffic:, setUpShipFromDictionary:, and update:.

◆ hasPatrolShips

- (BOOL) hasPatrolShips
private

Definition at line 74 of file StationEntity.h.

Referenced by setUpShipFromDictionary:, and update:.

◆ interstellarUndockingAllowed

- (BOOL) interstellarUndockingAllowed
private

◆ last_launch_time

- (double) last_launch_time
private

Definition at line 55 of file StationEntity.h.

Referenced by acceptDockingClearanceRequestFrom:, noteDockedShip:, and update:.

◆ last_patrol_report_time

- (double) last_patrol_report_time
private

Definition at line 98 of file StationEntity.h.

Referenced by acceptPatrolReportFrom:, setUpShipFromDictionary:, and update:.

◆ last_shuttle_launch_time

- (double) last_shuttle_launch_time
private

Definition at line 91 of file StationEntity.h.

Referenced by setUpShipFromDictionary:, and update:.

◆ last_trader_launch_time

- (double) last_trader_launch_time
private

Definition at line 95 of file StationEntity.h.

Referenced by setUpShipFromDictionary:, and update:.

◆ localInterfaces

◆ localMarket

- (OOCommodityMarket *) localMarket
private

Definition at line 166 of file StationEntity.m.

167{
168 if (self == [UNIVERSE station]) {
169 // main stations use the system market
170 // just return a reference
171 return [UNIVERSE commodityMarket];
172 }
173 if (!localMarket) {
175 }
176 return localMarket;
177}
OOCommodityMarket * initialiseLocalMarket()

Referenced by dealloc, Universe::getStationMarkets, initialiseLocalMarket, legalStatusOfManifest:export:, PlayerEntity::localMarket, localMarket, localMarketForScripting, setLocalMarket:, setPrice:forCommodity:, setQuantity:forCommodity:, and update:.

◆ localShipyard

◆ marketBroadcast

- (BOOL) marketBroadcast
private

Definition at line 142 of file StationEntity.m.

143{
144 if (self == [UNIVERSE station]) {
145 return YES;
146 }
147 return marketBroadcast;
148}

Referenced by marketBroadcast, and setUpShipFromDictionary:.

◆ marketCapacity

- (OOCargoQuantity) marketCapacity
private

Definition at line 119 of file StationEntity.m.

120{
121 return marketCapacity;
122}

Referenced by OOCommodities::generateMarketForStation:, marketCapacity, and setUpShipFromDictionary:.

◆ marketDefinition

- (NSArray *) marketDefinition
private

◆ marketMonitored

- (BOOL) marketMonitored
private

Definition at line 134 of file StationEntity.m.

135{
136 if (self == [UNIVERSE station]) {
137 return YES;
138 }
139 return marketMonitored;
140}

Referenced by marketMonitored, and setUpShipFromDictionary:.

◆ marketScriptName

- (NSString *) marketScriptName
private

◆ max_defense_ships

- (unsigned) max_defense_ships
private

◆ max_police

- (unsigned) max_police
private

◆ max_scavengers

- (unsigned) max_scavengers
private

◆ no_docking_while_launching

- (unsigned) no_docking_while_launching
private

Definition at line 72 of file StationEntity.h.

Referenced by acceptDockingClearanceRequestFrom:, and dumpSelfState.

◆ patrol_launch_interval

- (double) patrol_launch_interval
private

Definition at line 99 of file StationEntity.h.

Referenced by setUpShipFromDictionary:, and update:.

◆ planet

- (OOPlanetEntity *) planet
private

Definition at line 240 of file StationEntity.m.

241{
242 return [UNIVERSE entityForUniversalID:planet];
243}

Referenced by planet, and setPlanet:.

◆ player_reserved_dock

◆ port_dimensions

- (Vector) port_dimensions
private

Definition at line 69 of file StationEntity.h.

Referenced by setUpShipFromDictionary:, and virtualPortDimensions.

◆ port_radius

- (double) port_radius
private

Definition at line 70 of file StationEntity.h.

Referenced by setUpShipFromDictionary:.

◆ requiresDockingClearance

- (BOOL) requiresDockingClearance
private

◆ scavengers_launched

- (unsigned) scavengers_launched
private

Definition at line 64 of file StationEntity.h.

Referenced by countOfDockedContractors, dumpSelfState, launchMiner, and launchScavenger.

◆ shuttle_launch_interval

- (double) shuttle_launch_interval
private

Definition at line 92 of file StationEntity.h.

Referenced by setUpShipFromDictionary:, and update:.

◆ suppress_arrival_reports

- (unsigned) suppress_arrival_reports
private

◆ trader_launch_interval

- (double) trader_launch_interval
private

Definition at line 96 of file StationEntity.h.

Referenced by setUpShipFromDictionary:, and update:.


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