Oolite
Loading...
Searching...
No Matches
ShipEntity(Private) Category Reference

Instance Methods

(void) - subEntityDied:
 
(void) - subEntityReallyDied:
 
(void) - drawDebugStuff
 
(void) - rescaleBy:
 
(void) - rescaleBy:writeToCache:
 
(BOOL) - setUpOneSubentity:
 
(BOOL) - setUpOneFlasher:
 
(Entity< OOStellarBody > *) - lastAegisLock
 
(void) - addSubEntity:
 
(void) - refreshEscortPositions
 
(HPVector) - coordinatesForEscortPosition:
 
(void) - setUpMixedEscorts
 
(void) - setUpOneEscort:inGroup:withRole:atPosition:andCount:
 
(void) - addSubentityToCollisionRadius:
 
(ShipEntity *) - launchPodWithCrew:
 
(OOEquipmentType *) - generateMissileEquipmentTypeFrom:
 
(void) - setShipHitByLaser:
 
(void) - noteFrustration:
 
(BOOL) - cloakPassive
 

Detailed Description

Definition at line 131 of file ShipEntity.m.

Method Documentation

◆ addSubEntity:

- (void) addSubEntity: (Entity< OOSubEntity > *)  subent

Extends class ShipEntity.

Definition at line 6493 of file ShipEntity.m.

6704 :(Entity<OOSubEntity> *)sub
6705{
6706 if (sub == nil) return;
6707
6708 if (subEntities == nil) subEntities = [[NSMutableArray alloc] init];
6709 sub->isSubEntity = YES;
6710 // Order matters - need consistent state in setOwner:. -- Ahruman 2008-04-20
6711 [subEntities addObject:sub];
6712 [sub setOwner:self];
6713
6714 [self addSubentityToCollisionRadius:sub];
6715}
return nil

◆ addSubentityToCollisionRadius:

- (void) addSubentityToCollisionRadius: (Entity< OOSubEntity > *)  subent

Extends class ShipEntity.

Definition at line 2092 of file ShipEntity.m.

2255 :(Entity<OOSubEntity> *)subent
2256{
2257 if (!subent) return;
2258
2259 double distance = HPmagnitude([subent position]) + [subent findCollisionRadius];
2260 if ([subent isKindOfClass:[ShipEntity class]]) // Solid subentity
2261 {
2262 if (distance > collision_radius)
2263 {
2264 collision_radius = distance;
2265 }
2266
2267 mass += [subent mass];
2268 }
2269 if (distance > _profileRadius)
2270 {
2271 _profileRadius = distance;
2272 }
2273}

◆ cloakPassive

- (BOOL) cloakPassive

Extends class ShipEntity.

Definition at line 266 of file ShipEntity.h.

◆ coordinatesForEscortPosition:

- (HPVector) coordinatesForEscortPosition: (unsigned)  idx

Extends class ShipEntity.

Definition at line 9589 of file ShipEntity.m.

13812 :(unsigned)idx
13813{
13814 /*
13815 This function causes problems with Thargoids: their missiles (aka Thargons) are automatically
13816 added to the escorts group, and when a mother ship dies all thargons will attach themselves
13817 as escorts to the surviving battleships. This can lead to huge escort groups.
13818 TODO: better handling of Thargoid groups:
13819 - put thargons (& all other thargon missiles) in their own non-escort group perhaps?
13820 */
13821
13822 // The _escortPositions array is always MAX_ESCORTS long.
13823 // Kludge: return the same last escort position if we have escorts above MAX_ESCORTS...
13824 idx = MIN(idx, (unsigned)(MAX_ESCORTS - 1));
13825
13826 return HPvector_add(self->position, vectorToHPVector(quaternion_rotate_vector([self normalOrientation], _escortPositions[idx])));
13827}
#define MIN(A, B)
Definition OOMaths.h:111
return self
Vector quaternion_rotate_vector(Quaternion q, Vector v)
#define MAX_ESCORTS
Definition ShipEntity.h:74

◆ drawDebugStuff

- (void) drawDebugStuff

Extends class ShipEntity.

Definition at line 2092 of file ShipEntity.m.

6425{
6426 // HPVect: imprecise here - needs camera relative
6427 if (0 && reportAIMessages)
6428 {
6429 OODebugDrawPoint(HPVectorToVector(_destination), [OOColor blueColor]);
6430 OODebugDrawColoredLine(HPVectorToVector([self position]), HPVectorToVector(_destination), [OOColor colorWithWhite:0.15 alpha:1.0]);
6431
6432 Entity *pTarget = [self primaryTarget];
6433 if (pTarget != nil)
6434 {
6435 OODebugDrawPoint(HPVectorToVector([pTarget position]), [OOColor redColor]);
6436 OODebugDrawColoredLine(HPVectorToVector([self position]), HPVectorToVector([pTarget position]), [OOColor colorWithRed:0.2 green:0.0 blue:0.0 alpha:1.0]);
6437 }
6438
6439 Entity *sTarget = [self targetStation];
6440 if (sTarget != pTarget && [sTarget isStation])
6441 {
6442 OODebugDrawPoint(HPVectorToVector([sTarget position]), [OOColor cyanColor]);
6443 }
6444
6445 Entity *fTarget = [self foundTarget];
6446 if (fTarget != nil && fTarget != pTarget && fTarget != sTarget)
6447 {
6448 OODebugDrawPoint(HPVectorToVector([fTarget position]), [OOColor magentaColor]);
6449 }
6450 }
6451}
void OODebugDrawColoredLine(Vector start, Vector end, OOColor *color)
void OODebugDrawPoint(Vector position, OOColor *color)

◆ generateMissileEquipmentTypeFrom:

- (OOEquipmentType *) generateMissileEquipmentTypeFrom: (NSString *)  role

Extends class ShipEntity.

Definition at line 2092 of file ShipEntity.m.

3327 :(NSString *)role
3328{
3329 /* The generated missile equipment type provides for backward compatibility with pre-1.74 OXPs missile_roles
3330 and follows this template:
3331
3332 //NPC equipment, incompatible with player ship. Not buyable because of its TL.
3333 (
3334 100, 100000, "Missile",
3335 "EQ_X_MISSILE",
3336 "Unidentified missile type.",
3337 {
3338 is_external_store = true;
3339 }
3340 )
3341 */
3342 NSArray *itemInfo = [NSArray arrayWithObjects:@"100", @"100000", @"Missile", role, @"Unidentified missile type.",
3343 [NSDictionary dictionaryWithObjectsAndKeys: @"true", @"is_external_store", nil], nil];
3344
3347}
void addEquipmentWithInfo:(NSArray *itemInfo)
OOEquipmentType * equipmentTypeWithIdentifier:(NSString *identifier)

◆ lastAegisLock

- (Entity< OOStellarBody > *) lastAegisLock

Extends class ShipEntity.

Definition at line 7616 of file ShipEntity.m.

7883{
7884 Entity<OOStellarBody> *stellar = [_lastAegisLock weakRefUnderlyingObject];
7885 if (stellar == nil)
7886 {
7887 [_lastAegisLock release];
7888 _lastAegisLock = nil;
7889 }
7890
7891 return stellar;
7892}

◆ launchPodWithCrew:

- (ShipEntity *) launchPodWithCrew: (NSArray *)  podCrew

Extends class ShipEntity.

Definition at line 2092 of file ShipEntity.m.

2276 :(NSArray *)podCrew
2277{
2278 ShipEntity *pod = nil;
2279
2280 pod = [UNIVERSE newShipWithRole:[shipinfoDictionary oo_stringForKey:@"escape_pod_role"]]; // or nil
2281 if (!pod)
2282 {
2283 // _role not defined? it might have _model defined;
2284 pod = [UNIVERSE newShipWithRole:[shipinfoDictionary oo_stringForKey:@"escape_pod_model" defaultValue:@"escape-capsule"]];
2285 if (!pod)
2286 {
2287 pod = [UNIVERSE newShipWithRole:@"escape-capsule"];
2288 OOLog(@"shipEntity.noEscapePod", @"Ship %@ has no correct escape_pod_role defined. Now using default capsule.", self);
2289 }
2290 }
2291
2292 if (pod)
2293 {
2294 [pod setOwner:self];
2295 [pod setTemperature:[self randomEjectaTemperatureWithMaxFactor:0.9]];
2296 [pod setCommodity:@"slaves" andAmount:1];
2297 [pod setCrew:podCrew];
2298 [pod switchAITo:@"oolite-shuttleAI.js"];
2299 [self dumpItem:pod]; // CLASS_CARGO, STATUS_IN_FLIGHT, AI state GLOBAL
2300 [pod release]; //release
2301 }
2302
2303 return pod;
2304}
#define OOLog(class, format,...)
Definition OOLogging.h:88
void setTemperature:(GLfloat value)
void setCrew:(NSArray *crewArray)
void switchAITo:(NSString *aiString)
void setCommodity:andAmount:(OOCommodityType co_type,[andAmount] OOCargoQuantity co_amount)
void setOwner:(Entity *who_owns_entity)

◆ noteFrustration:

- (void) noteFrustration: (NSString *)  context

Extends class ShipEntity.

Definition at line 2092 of file ShipEntity.m.

2952 :(NSString *)context
2953{
2954 [shipAI reactToMessage:@"FRUSTRATED" context:context];
2955 [self doScriptEvent:OOJSID("shipAIFrustrated") withArgument:context];
2956}

◆ refreshEscortPositions

- (void) refreshEscortPositions

Extends class ShipEntity.

Definition at line 9589 of file ShipEntity.m.

13782{
13783 if (!_escortPositionsValid)
13784 {
13785 JSContext *context = OOJSAcquireContext();
13786 jsval result;
13787 jsval args[] = { INT_TO_JSVAL(0), INT_TO_JSVAL(_maxEscortCount) };
13788 BOOL OK;
13789
13790 // Reset validity first so updateEscortFormation can be called from the update callback.
13791 _escortPositionsValid = YES;
13792
13793 uint8_t i;
13794 for (i = 0; i < _maxEscortCount; i++)
13795 {
13796 args[0] = INT_TO_JSVAL(i);
13797 OK = [script callMethod:OOJSID("coordinatesForEscortPosition")
13798 inContext:context
13799 withArguments:args count:sizeof args / sizeof *args
13800 result:&result];
13801
13802 if (OK) OK = JSValueToVector(context, result, &_escortPositions[i]);
13803
13804 if (!OK) _escortPositions[i] = kZeroVector;
13805 }
13806
13807 OOJSRelinquishContext(context);
13808 }
13809}
BOOL JSValueToVector(JSContext *context, jsval value, Vector *outVector) NONNULL_FUNC
Definition OOJSVector.m:259
OOINLINE JSContext * OOJSAcquireContext(void)
OOINLINE void OOJSRelinquishContext(JSContext *context)
const Vector kZeroVector
Definition OOVector.m:28

◆ rescaleBy:

- (void) rescaleBy: (GLfloat)  factor

Extends class ShipEntity.

Definition at line 7616 of file ShipEntity.m.

9040 :(GLfloat)factor
9041{
9042 [self rescaleBy:factor writeToCache:YES];
9043}

◆ rescaleBy:writeToCache:

- (void) rescaleBy: (GLfloat)  factor
writeToCache: (BOOL)  writeToCache 

Extends class ShipEntity.

Definition at line 7616 of file ShipEntity.m.

9046 :(GLfloat)factor writeToCache:(BOOL)writeToCache
9047{
9048 _scaleFactor *= factor;
9049 OOMesh *mesh = nil;
9050
9051 NSDictionary *shipDict = [self shipInfoDictionary];
9052 NSString *modelName = [shipDict oo_stringForKey:@"model"];
9053 if (modelName != nil)
9054 {
9055 mesh = [OOMesh meshWithName:modelName
9056 cacheKey:[NSString stringWithFormat:@"%@-%.3f",_shipKey,_scaleFactor]
9057 materialDictionary:[shipDict oo_dictionaryForKey:@"materials"]
9058 shadersDictionary:[shipDict oo_dictionaryForKey:@"shaders"]
9059 smooth:[shipDict oo_boolForKey:@"smooth" defaultValue:NO]
9060 shaderMacros:OODefaultShipShaderMacros()
9062 scaleFactor:factor
9063 cacheWriteable:writeToCache];
9064
9065 if (mesh == nil) return;
9066 [self setMesh:mesh];
9067 }
9068
9069 // rescale subentities
9071 foreach (se, [self subEntities])
9072 {
9073 [se setPosition:HPvector_multiply_scalar([se position], factor)];
9074 [se rescaleBy:factor writeToCache:writeToCache];
9075 }
9076
9077 // rescale mass
9078 mass *= factor * factor * factor;
9079}
HPVector position
Definition Entity.h:112
void setPosition:(HPVector posn)
Definition Entity.m:648
instancetype meshWithName:cacheKey:materialDictionary:shadersDictionary:smooth:shaderMacros:shaderBindingTarget:scaleFactor:cacheWriteable:(NSString *name,[cacheKey] NSString *cacheKey,[materialDictionary] NSDictionary *materialDict,[shadersDictionary] NSDictionary *shadersDict,[smooth] BOOL smooth,[shaderMacros] NSDictionary *macros,[shaderBindingTarget] id< OOWeakReferenceSupport > object,[scaleFactor] float factor,[cacheWriteable] BOOL cacheWriteable)
Definition OOMesh.m:252

◆ setShipHitByLaser:

- (void) setShipHitByLaser: (ShipEntity *)  ship

Extends class ShipEntity.

Definition at line 9589 of file ShipEntity.m.

10176 :(ShipEntity *)ship
10177{
10178 if (ship != [self shipHitByLaser])
10179 {
10180 [_shipHitByLaser release];
10181 _shipHitByLaser = [ship weakRetain];
10182 }
10183}

◆ setUpMixedEscorts

- (void) setUpMixedEscorts

Extends class ShipEntity.

Definition at line 14942 of file ShipEntity.m.

1791{
1792 NSArray *escortRoles = [shipinfoDictionary oo_arrayForKey:@"escort_roles" defaultValue:nil];
1793 if (escortRoles == nil)
1794 {
1795 OOLogWARN(@"eship.setUp.escortShipRoles",
1796 @"Ship %@ has bad escort_roles definition.", self);
1797 return;
1798 }
1799 NSDictionary *escortDefinition = nil;
1800 NSDictionary *systeminfo = nil;
1801 OOGovernmentID government;
1802
1803 systeminfo = [UNIVERSE currentSystemData];
1804 government = [systeminfo oo_unsignedCharForKey:KEY_GOVERNMENT];
1805
1806 OOShipGroup *escortGroup = [self escortGroup];
1807 if ([self group] == nil)
1808 {
1809 [self setGroup:escortGroup]; // should probably become a copy of the escortGroup post NMSR.
1810 }
1811 [escortGroup setLeader:self];
1812 _maxEscortCount = MAX_ESCORTS;
1813 [self refreshEscortPositions];
1814
1815 uint8_t currentEscortCount = [escortGroup count] - 1; // always at least 0
1816
1817 _maxEscortCount = 0;
1818 int8_t i = 0;
1819 foreach (escortDefinition, escortRoles)
1820 {
1821 if (currentEscortCount >= MAX_ESCORTS)
1822 {
1823 break;
1824 }
1825 // int rather than uint because, at least for min, there is a
1826 // use to giving a negative value
1827 int8_t min = [escortDefinition oo_intForKey:@"min" defaultValue:0];
1828 int8_t max = [escortDefinition oo_intForKey:@"max" defaultValue:2];
1829 NSString *escortRole = [escortDefinition oo_stringForKey:@"role" defaultValue:@"escort"];
1830 int8_t desired = max;
1831 if (min < desired)
1832 {
1833 for (i = min ; i < max ; i++)
1834 {
1835 if (Ranrot()%11 < government+2)
1836 {
1837 desired--;
1838 }
1839 }
1840 }
1841 for (i = 0; i < desired; i++)
1842 {
1843 if (currentEscortCount >= MAX_ESCORTS)
1844 {
1845 break;
1846 }
1847 if (![escortRole isEqualToString:@""])
1848 {
1849 HPVector ex_pos = [self coordinatesForEscortPosition:currentEscortCount];
1850 ShipEntity *escorter = [UNIVERSE newShipWithRole:escortRole]; // retained
1851 if (escorter == nil)
1852 {
1853 break;
1854 }
1855 [self setUpOneEscort:escorter inGroup:escortGroup withRole:escortRole atPosition:ex_pos andCount:currentEscortCount];
1856 [escorter release];
1857 }
1858 currentEscortCount++;
1859 _maxEscortCount++;
1860 }
1861 }
1862 // done assigning escorts
1863 _pendingEscortCount = 0;
1864}
#define OOLogWARN(class, format,...)
Definition OOLogging.h:113
uint8_t OOGovernmentID
Definition OOTypes.h:206
void setLeader:(ShipEntity *leader)
NSUInteger count()
unsigned Ranrot(void)

◆ setUpOneEscort:inGroup:withRole:atPosition:andCount:

- (void) setUpOneEscort: (ShipEntity *)  escorter
inGroup: (OOShipGroup *)  escortGroup
withRole: (NSString *)  escortRole
atPosition: (HPVector)  ex_pos
andCount: (uint8_t)  currentEscortCount 

Extends class ShipEntity.

Definition at line 14942 of file ShipEntity.m.

1867 :(ShipEntity *)escorter inGroup:(OOShipGroup *)escortGroup withRole:(NSString *)escortRole atPosition:(HPVector)ex_pos andCount:(uint8_t)currentEscortCount
1868{
1869 NSString *autoAI = nil;
1870 NSString *pilotRole = nil;
1871 NSDictionary *autoAIMap = nil;
1872 NSDictionary *escortShipDict = nil;
1873 AI *escortAI = nil;
1874 NSString *defaultRole = @"escort";
1875
1876 if ([self isPolice])
1877 {
1878 defaultRole = @"wingman";
1879 pilotRole = @"police"; // police are always insured.
1880 }
1881 else
1882 {
1883 pilotRole = bounty ? @"pirate" : @"hunter"; // hunters have insurancies, pirates not.
1884 }
1885
1886 double dd = escorter->collision_radius;
1887
1888 if (EXPECT(currentEscortCount < (uint8_t)MAX_ESCORTS))
1889 {
1890 // spread them around a little randomly
1891 ex_pos.x += dd * 6.0 * (randf() - 0.5);
1892 ex_pos.y += dd * 6.0 * (randf() - 0.5);
1893 ex_pos.z += dd * 6.0 * (randf() - 0.5);
1894 }
1895 else
1896 {
1897 // Thargoid armada(!) Add more distance between the 'escorts'.
1898 ex_pos.x += dd * 12.0 * (randf() - 0.5);
1899 ex_pos.y += dd * 12.0 * (randf() - 0.5);
1900 ex_pos.z += dd * 12.0 * (randf() - 0.5);
1901 }
1902
1903 [escorter setPosition:ex_pos]; // minimise lollipop flash
1904
1905 if ([escorter crew] == nil)
1906 {
1907 [escorter setSingleCrewWithRole:pilotRole];
1908 }
1909
1910 [escorter setPrimaryRole:defaultRole]; //for mothership
1911 // in case this hasn't yet been set, make sure escorts get a real scan class
1912 // shouldn't happen very often, but is possible
1913 if (scanClass == CLASS_NOT_SET)
1914 {
1915 scanClass = CLASS_NEUTRAL;
1916 }
1917 [escorter setScanClass:scanClass]; // you are the same as I
1918
1919 if ([self bounty] == 0) [escorter setBounty:0 withReason:kOOLegalStatusReasonSetup]; // Avoid dirty escorts for clean mothers
1920
1921 // find the right autoAI.
1922 escortShipDict = [escorter shipInfoDictionary];
1923 autoAIMap = [ResourceManager dictionaryFromFilesNamed:@"autoAImap.plist" inFolder:@"Config" andMerge:YES];
1924 autoAI = [autoAIMap oo_stringForKey:defaultRole];
1925 if (autoAI==nil) // no 'wingman' defined in autoAImap?
1926 {
1927 autoAI = [autoAIMap oo_stringForKey:@"escort" defaultValue:@"nullAI.plist"];
1928 }
1929
1930 escortAI = [escorter getAI];
1931
1932 // Let the populator decide which AI to use, unless we have a working alternative AI & we specify auto_ai = NO !
1933 if ( (escortRole && [escortShipDict oo_fuzzyBooleanForKey:@"auto_ai" defaultValue:YES])
1934 || ([[escortAI name] isEqualToString: @"nullAI.plist"] && ![autoAI isEqualToString:@"nullAI.plist"]) )
1935 {
1936 [escorter switchAITo:autoAI];
1937 }
1938
1939 [escorter setGroup:escortGroup];
1940 [escorter setOwner:self]; // mark self as group leader
1941
1942
1943 if ([self status] == STATUS_DOCKED)
1944 {
1945 [[self owner] addShipToLaunchQueue:escorter withPriority:NO];
1946 }
1947 else
1948 {
1949 [UNIVERSE addEntity:escorter]; // STATUS_IN_FLIGHT, AI state GLOBAL
1950 [escortAI setState:@"FLYING_ESCORT"]; // Begin escort flight. (If the AI doesn't define FLYING_ESCORT, this has no effect.)
1951 [escorter doScriptEvent:OOJSID("spawnedAsEscort") withArgument:self];
1952 }
1953
1954 if([escorter heatInsulation] < [self heatInsulation]) [escorter setHeatInsulation:[self heatInsulation]]; // give escorts same protection as mother.
1955 if(([escorter maxFlightSpeed] < cruiseSpeed) && ([escorter maxFlightSpeed] > cruiseSpeed * 0.3))
1956 cruiseSpeed = [escorter maxFlightSpeed] * 0.99; // adapt patrolSpeed to the slowest escort but ignore the very slow ones.
1957
1958
1959 if (bounty)
1960 {
1961 int extra = 1 | (ranrot_rand() & 15);
1962 // if mothership is offender, make sure escorter is too.
1963 [escorter markAsOffender:extra withReason:kOOLegalStatusReasonSetup];
1964 }
1965 else
1966 {
1967 // otherwise force the escort to be clean
1968 [escorter setBounty:0 withReason:kOOLegalStatusReasonSetup];
1969 }
1970
1971}
#define EXPECT(x)
Definition AI.h:38
void setState:(NSString *stateName)
Definition AI.m:334
GLfloat collision_radius
Definition Entity.h:111
void setScanClass:(OOScanClass sClass)
Definition Entity.m:800
NSDictionary * dictionaryFromFilesNamed:inFolder:andMerge:(NSString *fileName,[inFolder] NSString *folderName,[andMerge] BOOL mergeFiles)
void setBounty:withReason:(OOCreditsQuantity amount,[withReason] OOLegalStatusReason reason)
NSDictionary * shipInfoDictionary()
void setSingleCrewWithRole:(NSString *crewRole)
void setGroup:(OOShipGroup *group)
void setPrimaryRole:(NSString *role)
void setHeatInsulation:(GLfloat value)
void markAsOffender:withReason:(int offence_value,[withReason] OOLegalStatusReason reason)
void doScriptEvent:withArgument:(jsid message,[withArgument] id argument)
GLfloat maxFlightSpeed
Definition ShipEntity.h:239
float randf(void)
#define ranrot_rand()

◆ setUpOneFlasher:

- (BOOL) setUpOneFlasher: (NSDictionary *)  subentDict

Extends class ShipEntity.

Definition at line 14942 of file ShipEntity.m.

926 :(NSDictionary *) subentDict
927{
929 [flasher setPosition:HPvector_multiply_scalar([subentDict oo_hpvectorForKey:@"position"],_scaleFactor)];
930 [flasher rescaleBy:_scaleFactor];
931 [self addSubEntity:flasher];
932 return YES;
933}
instancetype flasherWithDictionary:(NSDictionary *dictionary)
void rescaleBy:(GLfloat factor)

◆ setUpOneSubentity:

- (BOOL) setUpOneSubentity: (NSDictionary *)  subentDict

Extends class ShipEntity.

Definition at line 14942 of file ShipEntity.m.

906 :(NSDictionary *) subentDict
907{
909
910 NSString *type = nil;
911
912 type = [subentDict oo_stringForKey:@"type"];
913 if ([type isEqualToString:@"flasher"])
914 {
915 return [self setUpOneFlasher:subentDict];
916 }
917 else
918 {
919 return [self setUpOneStandardSubentity:subentDict asTurret:[type isEqualToString:@"ball_turret"]];
920 }
921
923}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER

◆ subEntityDied:

- (void) subEntityDied: (ShipEntity *)  sub

Extends class ShipEntity.

Definition at line 7616 of file ShipEntity.m.

9516 :(ShipEntity *)sub
9517{
9518 if ([self subEntityTakingDamage] == sub) [self setSubEntityTakingDamage:nil];
9519
9520 [sub setOwner:nil];
9521 // TODO? Recalculating collision radius should increase collision testing efficiency,
9522 // but for most ship models the difference would be marginal. -- Kaks 20110429
9523 mass -= [sub mass]; // missing subents affect fuel charge rate, etc..
9524 [subEntities removeObject:sub];
9525}

◆ subEntityReallyDied:

- (void) subEntityReallyDied: (ShipEntity *)  sub

Extends class ShipEntity.

Definition at line 7616 of file ShipEntity.m.

9528 :(ShipEntity *)sub
9529{
9530 if ([self subEntityTakingDamage] == sub) [self setSubEntityTakingDamage:nil];
9531
9532 if ([self hasSubEntity:sub])
9533 {
9534 OOLogERR(@"shipEntity.bug.subEntityRetainUnderflow", @"Subentity of %@ died while still in subentity list! This is bad. Leaking subentity list to avoid crash. %@", self, @"This is an internal error, please report it.");
9535
9536 // Leak subentity list.
9537 subEntities = nil;
9538 }
9539}
#define OOLogERR(class, format,...)
Definition OOLogging.h:112

The documentation for this category was generated from the following file: