Oolite
Loading...
Searching...
No Matches
StationEntity.h
Go to the documentation of this file.
1/*
2
3StationEntity.h
4
5ShipEntity subclass representing a space station or dockable ship.
6
7Oolite
8Copyright (C) 2004-2013 Giles C Williams and contributors
9
10This program is free software; you can redistribute it and/or
11modify it under the terms of the GNU General Public License
12as published by the Free Software Foundation; either version 2
13of the License, or (at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23MA 02110-1301, USA.
24
25*/
26
27#pragma once
28
29#import "OOJSInterfaceDefinition.h"
30#import "ShipEntity.h"
31#import "Universe.h"
32
33@class OOWeakSet;
34
40
41#define STATION_MAX_POLICE 8
42
43#define STATION_DELAY_BETWEEN_LAUNCHES 6.0
44
45#define STATION_LAUNCH_RETRY_INTERVAL 2.0
46
47#define MAX_DOCKING_STAGES 16
48
49#define DOCKING_CLEARANCE_WINDOW 126.0
50
52@private
58
59 unsigned max_police; // max no. of police ships allowed
60 unsigned max_defense_ships; // max no. of defense ships allowed
62
63 unsigned max_scavengers; // max no. of scavenger ships allowed
65
68
71
73 hasNPCTraffic : 1;
75
77
78 NSString* allegiance;
79
82 NSArray* marketDefinition;
83 NSString* marketScriptName;
84 // NSMutableArray *localPassengers;
85 // NSMutableArray *localContracts;
86 NSMutableArray* localShipyard;
87
88 NSMutableDictionary* localInterfaces;
89
93
97
100
105 allowsSaving : 1,
107 hasBreakPattern : 1,
108 marketMonitored : 1,
109 marketBroadcast : 1;
110}
111
114- (NSString*)marketScriptName;
117- (OOCreditsQuantity)legalStatusOfManifest:(OOCommodityMarket*)manifest export:(BOOL)export;
118
120- (void)setLocalMarket:(NSArray*)market;
121- (NSDictionary*)localMarketForScripting;
122- (void)setPrice:(OOCreditsQuantity)price forCommodity:(OOCommodityType)commodity;
123- (void)setQuantity:(OOCargoQuantity)quantity forCommodity:(OOCommodityType)commodity;
124
125/*- (NSMutableArray *) localPassengers;
126- (void) setLocalPassengers:(NSArray *)market;
127- (NSMutableArray *) localContracts;
128- (void) setLocalContracts:(NSArray *)market; */
129- (NSMutableArray*)localShipyard;
130- (void)setLocalShipyard:(NSArray*)market;
131- (void)generateShipyard;
132- (void)generateShipyard:(OOTechLevelID)stationTechLevel;
133- (NSMutableDictionary*)localInterfaces;
134- (void)setInterfaceDefinition:(OOJSInterfaceDefinition*)definition forKey:(NSString*)key;
135
137
139- (void)setEquivalentTechLevel:(OOTechLevelID)value;
140
141- (NSEnumerator*)dockSubEntityEnumerator;
144
146
148
149- (void)setPlanet:(OOPlanetEntity*)planet;
150
151- (OOPlanetEntity*)planet;
152
153- (void)setAllegiance:(NSString*)newAllegiance;
154- (NSString*)allegiance;
155
156- (unsigned)countOfDockedContractors;
157- (unsigned)countOfDockedPolice;
158- (unsigned)countOfDockedDefenders;
159
161
163
164- (Vector)portUpVectorForShip:(ShipEntity*)ship;
165
166- (NSDictionary*)dockingInstructionsForShip:(ShipEntity*)ship;
167
168- (BOOL)shipIsInDockingCorridor:(ShipEntity*)ship;
169
171
173
174- (void)clear;
175
176- (void)abortAllDockings;
177
178- (void)abortDockingForShip:(ShipEntity*)ship;
179
180- (BOOL)hasMultipleDocks;
181- (BOOL)hasClearDock;
182- (BOOL)hasLaunchDock;
185- (unsigned)currentlyInDockingQueues;
186
187- (void)launchShip:(ShipEntity*)ship;
188
189- (ShipEntity*)launchIndependentShip:(NSString*)role;
190
191- (void)noteDockedShip:(ShipEntity*)ship;
192
195- (void)setHasNPCTraffic:(BOOL)flag;
196
198- (void)setAlertLevel:(OOStationAlertLevel)level signallingScript:(BOOL)signallingScript;
199
201
202- (void)increaseAlertLevel;
203- (void)decreaseAlertLevel;
204
205- (NSArray*)launchPolice;
214
215- (void)launchShipWithRole:(NSString*)role;
216
217- (void)acceptPatrolReportFrom:(ShipEntity*)patrol_ship;
218
219- (NSString*)acceptDockingClearanceRequestFrom:(ShipEntity*)other;
221- (void)setRequiresDockingClearance:(BOOL)newValue;
222
224- (void)setAllowsFastDocking:(BOOL)newValue;
225
227- (void)setAllowsAutoDocking:(BOOL)newValue;
228
230// no setting this after station creation
231
232- (NSString*)marketOverrideName;
233- (BOOL)isRotatingStation;
234- (BOOL)hasShipyard;
235
237- (void)setSuppressArrivalReports:(BOOL)newValue;
238
240- (void)setHasBreakPattern:(BOOL)newValue;
241
242- (BOOL)fitsInDock:(ShipEntity*)ship;
243- (BOOL)fitsInDock:(ShipEntity*)ship andLogNoFit:(BOOL)logNoFit;
244
245@end
246
247NSDictionary* OOMakeDockingInstructions(StationEntity* station, HPVector coords, float speed, float range, NSString* ai_message, NSString* comms_message, BOOL match_rotation, int docking_stage);
NSString * OOCommodityType
Definition OOTypes.h:97
uint64_t OOCreditsQuantity
Definition OOTypes.h:160
uint16_t OOUniversalID
Definition OOTypes.h:165
NSUInteger OOTechLevelID
Definition OOTypes.h:177
uint32_t OOCargoQuantity
Definition OOTypes.h:155
@ ALERT_CONDITION_GREEN
Definition ShipEntity.h:170
@ ALERT_CONDITION_RED
Definition ShipEntity.h:172
@ ALERT_CONDITION_YELLOW
Definition ShipEntity.h:171
NSDictionary * OOMakeDockingInstructions(StationEntity *station, HPVector coords, float speed, float range, NSString *ai_message, NSString *comms_message, BOOL match_rotation, int docking_stage)
OOStationAlertLevel
@ STATION_ALERT_LEVEL_RED
@ STATION_ALERT_LEVEL_YELLOW
@ STATION_ALERT_LEVEL_GREEN
Vector port_dimensions
NSArray * launchPolice()
ShipEntity * launchMiner()
double last_launch_time
ShipEntity * launchScavenger()
OOCommodityMarket * localMarket
double patrol_launch_interval
NSString * marketOverrideName()
double last_trader_launch_time
OOCommodityMarket * initialiseLocalMarket()
ShipEntity * launchDefenseShip()
void autoDockShipsOnApproach()
ShipEntity * launchPirateShip()
unsigned currentlyInDockingQueues()
BOOL suppressArrivalReports()
Vector virtualPortDimensions()
NSMutableDictionary * localInterfaces
DockEntity * player_reserved_dock
ShipEntity * launchShuttle()
NSMutableArray * localShipyard
unsigned allowsAutoDocking
BOOL dockingCorridorIsEmpty()
ShipEntity * launchPatrol()
unsigned defenders_launched
unsigned marketMonitored
OOUniversalID planet
unsigned countOfDockedDefenders()
unsigned max_police
unsigned countOfDockedPolice()
unsigned no_docking_while_launching
OOCargoQuantity marketCapacity
NSDictionary * localMarketForScripting()
OOTechLevelID equivalentTechLevel
unsigned allowsSaving
unsigned max_scavengers
OOStationAlertLevel alertLevel
unsigned countOfDockedContractors()
unsigned marketBroadcast
unsigned hasBreakPattern
void sanityCheckShipsOnApproach()
double last_shuttle_launch_time
unsigned interstellarUndockingAllowed
NSString * allegiance
unsigned currentlyInLaunchingQueues()
unsigned scavengers_launched
unsigned docked_traders
OOWeakSet * _shipsOnHold
unsigned suppress_arrival_reports
HPVector beaconPosition()
unsigned allowsFastDocking
double shuttle_launch_interval
unsigned hasNPCTraffic
ShipEntity * launchEscort()
unsigned docked_shuttles
unsigned max_defense_ships
NSArray * marketDefinition
double approach_spacing
float equipmentPriceFactor
double last_patrol_report_time
NSString * marketScriptName
DockEntity * playerReservedDock()
DockEntity * selectDockForDocking()
NSEnumerator * dockSubEntityEnumerator()
unsigned requiresDockingClearance
double trader_launch_interval
void clearDockingCorridor()