Line data Source code
1 0 : /* 2 : 3 : WormholeEntity.h 4 : 5 : Entity subclass representing a wormhole between systems. (This is -- to use 6 : technical terminology -- the blue blobby thing you see hanging in space. The 7 : purple tunnel is RingEntity.) 8 : 9 : Oolite 10 : Copyright (C) 2004-2013 Giles C Williams and contributors 11 : 12 : This program is free software; you can redistribute it and/or 13 : modify it under the terms of the GNU General Public License 14 : as published by the Free Software Foundation; either version 2 15 : of the License, or (at your option) any later version. 16 : 17 : This program is distributed in the hope that it will be useful, 18 : but WITHOUT ANY WARRANTY; without even the implied warranty of 19 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 : GNU General Public License for more details. 21 : 22 : You should have received a copy of the GNU General Public License 23 : along with this program; if not, write to the Free Software 24 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 : MA 02110-1301, USA. 26 : 27 : */ 28 : 29 : #import "Entity.h" 30 : 31 0 : #define WORMHOLE_EXPIRES_TIMEINTERVAL 900.0 32 0 : #define WORMHOLE_SHRINK_RATE 4000.0 33 0 : #define WORMHOLE_LEADER_SPEED_FACTOR 0.25 34 : 35 : @class ShipEntity, Universe; 36 : 37 0 : typedef enum 38 : { 39 : WH_SCANINFO_NONE = 0, 40 : WH_SCANINFO_SCANNED, 41 : WH_SCANINFO_COLLAPSE_TIME, 42 : WH_SCANINFO_ARRIVAL_TIME, 43 : WH_SCANINFO_DESTINATION, 44 : WH_SCANINFO_SHIP, 45 : } WORMHOLE_SCANINFO; 46 : 47 0 : @interface WormholeEntity: Entity 48 : { 49 : @private 50 0 : double expiry_time; // Time when wormhole entrance closes 51 0 : double travel_time; // Time taken for a ship to traverse the wormhole 52 0 : double arrival_time; // Time when wormhole exit opens 53 0 : double estimated_arrival_time; // Time when wormhole should open (be different to arrival_time for misjump wormholes) 54 0 : double scan_time; // Time when wormhole was scanned 55 : 56 0 : OOSystemID origin; 57 0 : OOSystemID destination; 58 : 59 0 : NSPoint originCoords; // May not equal our origin system if the wormhole opens from Interstellar Space 60 0 : NSPoint destinationCoords; // May not equal the destination system if the wormhole misjumps 61 : 62 0 : NSMutableArray *shipsInTransit; 63 : 64 0 : double witch_mass; 65 0 : double shrink_factor; // used during nova mission 66 : // not used yet 67 0 : double exit_speed; // exit speed of ships in this wormhole 68 : 69 0 : WORMHOLE_SCANINFO scan_info; 70 0 : BOOL hasExitPosition; 71 0 : BOOL _misjump; 72 0 : GLfloat _misjumpRange; 73 0 : BOOL containsPlayer; 74 : } 75 : 76 0 : - (WormholeEntity*) initWithDict:(NSDictionary*)dict; 77 0 : - (WormholeEntity*) initWormholeTo:(OOSystemID) s fromShip:(ShipEntity *) ship; 78 : 79 0 : - (BOOL) suckInShip:(ShipEntity *) ship; 80 0 : - (void) disgorgeShips; 81 0 : - (void) setExitPosition:(HPVector)pos; 82 : 83 0 : - (OOSystemID) origin; 84 0 : - (OOSystemID) destination; 85 0 : - (NSPoint) originCoordinates; 86 0 : - (NSPoint) destinationCoordinates; 87 : 88 0 : - (void) setMisjump; // Flags up a wormhole as 'misjumpy' 89 0 : - (void) setMisjumpWithRange:(GLfloat)range; // Flags up a wormhole as 'misjumpy' 90 0 : - (BOOL) withMisjump; 91 0 : - (GLfloat) misjumpRange; 92 : 93 0 : - (double) exitSpeed; // exit speed from this wormhole 94 0 : - (void) setExitSpeed:(double) speed; // set exit speed from this wormhole 95 : 96 0 : - (double) expiryTime; // Time at which the wormholes entrance closes 97 0 : - (double) arrivalTime; // Time at which the wormholes exit opens 98 0 : - (double) estimatedArrivalTime; // Time when wormhole should open (different from arrival_time for misjump wormholes) 99 0 : - (double) travelTime; // Time needed for a ship to traverse the wormhole 100 0 : - (double) scanTime; // Time when wormhole was scanned 101 0 : - (void) setScannedAt:(double)time; 102 0 : - (void) setContainsPlayer:(BOOL)val; // mark the wormhole as waiting for player exit 103 : 104 0 : - (BOOL) isScanned; // True if the wormhole has been scanned by the player 105 0 : - (WORMHOLE_SCANINFO) scanInfo; // Stage of scanning 106 0 : - (void)setScanInfo:(WORMHOLE_SCANINFO) scanInfo; 107 : 108 0 : - (NSArray*) shipsInTransit; 109 : 110 0 : - (NSString *) identFromShip:(ShipEntity*) ship; 111 : 112 0 : - (NSDictionary *)getDict; 113 : 114 : @end