Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOEquipmentType.h
Go to the documentation of this file.
1/*
2
3OOEquipmentType.h
4
5Class representing a type of ship equipment. Exposed to JavaScript as
6EquipmentInfo.
7
8
9Copyright (C) 2008-2013 Jens Ayton and contributors
10
11Permission is hereby granted, free of charge, to any person obtaining a copy
12of this software and associated documentation files (the "Software"), to deal
13in the Software without restriction, including without limitation the rights
14to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15copies of the Software, and to permit persons to whom the Software is
16furnished to do so, subject to the following conditions:
17
18The above copyright notice and this permission notice shall be included in all
19copies or substantial portions of the Software.
20
21THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27SOFTWARE.
28
29*/
30
31#import "OOCocoa.h"
32#import "OOTypes.h"
33#import "OOScript.h"
34#import "Universe.h"
35
36
37@interface OOEquipmentType: NSObject <NSCopying>
38{
39@private
42 NSString *_name;
43 NSString *_identifier;
44 NSString *_description;
45 unsigned _isAvailableToAll: 1,
63 NSUInteger _installTime;
64 NSUInteger _repairTime;
70 NSArray *_conditions;
71 NSArray *_provides;
74 NSDictionary *_scriptInfo;
75 NSDictionary *_weaponInfo;
76 NSString *_script;
79 struct JSObject *_jsSelf;
81
82+ (void) loadEquipment; // Load equipment data; called on loading and when changing to/from strict mode.
83+ (void) addEquipmentWithInfo:(NSArray *)itemInfo; // Used to generate equipment from missile_role entries.
84
85+ (NSString *) getMissileRegistryRoleForShip:(NSString *)shipKey;
86+ (void) setMissileRegistryRole:(NSString *)roles forShip:(NSString *)shipKey;
87
88+ (NSArray *) allEquipmentTypes;
89+ (NSEnumerator *) equipmentEnumerator;
90+ (NSEnumerator *) reverseEquipmentEnumerator;
91+ (NSEnumerator *) equipmentEnumeratorOutfitting;
92
93+ (OOEquipmentType *) equipmentTypeWithIdentifier:(NSString *)identifier;
94
95- (NSString *) identifier;
96- (NSString *) damagedIdentifier;
97- (NSString *) name; // localized
98- (NSString *) descriptiveText; // localized
99- (OOTechLevelID) techLevel;
100- (OOCreditsQuantity) price; // Tenths of credits
101
102- (BOOL) isAvailableToAll;
103- (BOOL) requiresEmptyPylon;
104- (BOOL) requiresMountedPylon;
105- (BOOL) requiresCleanLegalRecord;
106- (BOOL) requiresNonCleanLegalRecord;
107- (BOOL) requiresFreePassengerBerth;
108- (BOOL) requiresFullFuel;
109- (BOOL) requiresNonFullFuel;
110- (BOOL) isPrimaryWeapon;
111- (BOOL) isMissileOrMine;
112- (BOOL) isPortableBetweenShips;
113
114- (BOOL) canCarryMultiple;
115- (GLfloat) damageProbability;
116- (BOOL) canBeDamaged;
117- (BOOL) isVisible; // Visible in UI?
118- (BOOL) hideValues;
119- (OOColor *) displayColor;
120- (void) setDisplayColor:(OOColor *)newColor;
121
122- (BOOL) isAvailableToPlayer;
123- (BOOL) isAvailableToNPCs;
124
125- (OOCargoQuantity) requiredCargoSpace;
126- (NSSet *) requiresEquipment; // Set of equipment identifiers; all items required
127- (NSSet *) requiresAnyEquipment; // Set of equipment identifiers; any item required
128- (NSSet *) incompatibleEquipment; // Set of equipment identifiers; all items prohibited
129
130// FIXME: should have general mechanism to handle scripts or legacy conditions.
131- (NSArray *) conditions;
132
133- (NSString *) conditionScript;
134
135- (NSDictionary *) scriptInfo;
136- (NSString *) scriptName;
137
138- (BOOL) fastAffinityDefensive;
139- (BOOL) fastAffinityOffensive;
140
141- (NSArray *) defaultActivateKey;
142- (NSArray *) defaultModeKey;
143
144- (NSUInteger) installTime;
145- (NSUInteger) repairTime;
146
147- (NSArray *) providesForScripting;
148- (BOOL) provides:(NSString *)key;
149
150// weapon properties
151- (BOOL) isTurretLaser;
152- (BOOL) isMiningLaser;
153- (NSDictionary *) weaponInfo;
154- (GLfloat) weaponRange;
155- (GLfloat) weaponEnergyUse;
156- (GLfloat) weaponDamage;
157- (GLfloat) weaponRechargeRate;
158- (GLfloat) weaponShotTemperature;
159- (GLfloat) weaponThreatAssessment;
160- (OOColor *) weaponColor;
161- (NSString *) fxShotMissName;
162- (NSString *) fxShotHitName;
163- (NSString *) fxShieldHitName;
164- (NSString *) fxUnshieldedHitName;
165- (NSString *) fxWeaponLaunchedName;
166
167@end
168
169
170@interface OOEquipmentType (Conveniences)
173
174@end
uint64_t OOCreditsQuantity
Definition OOTypes.h:182
NSUInteger OOTechLevelID
Definition OOTypes.h:204
uint32_t OOCargoQuantity
Definition OOTypes.h:176
unsigned _fastAffinityA
OOCargoQuantity _requiredCargoSpace
unsigned _isMissileOrMine
NSArray * _defaultActivateKey
NSArray * _defaultModeKey
unsigned _requiresFullFuel
unsigned _fastAffinityB
NSString * _description
NSDictionary * _scriptInfo
NSArray * _conditions
NSUInteger _repairTime
NSUInteger _installTime
unsigned _portableBetweenShips
NSSet * _requiresEquipment
NSSet * _requiresAnyEquipment
unsigned _requiresMountedPylon
GLfloat _damageProbability
unsigned _isAvailableToAll
unsigned _isAvailableToNPCs
OOTechLevelID _techLevel
NSSet * _incompatibleEquipment
unsigned _requiresNotClean
unsigned _requiresClean
OOCreditsQuantity _price
unsigned _requiresFreePassengerBerth
unsigned _requiresNonFullFuel
unsigned _isAvailableToPlayer
struct JSObject * _jsSelf
OOColor * _displayColor
NSString * _identifier
NSDictionary * _weaponInfo
unsigned _requiresEmptyPylon
NSString * _condition_script
unsigned _canCarryMultiple