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

#include <Entity.h>

+ Inheritance diagram for Entity:
+ Collaboration diagram for Entity:

Instance Methods

(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
 
(BOOL) - validForAddToUniverse
 
(void) - addToLinkedLists
 
(void) - removeFromLinkedLists
 
(void) - updateLinkedLists
 
(void) - wasAddedToUniverse
 
(void) - wasRemovedFromUniverse
 
(void) - warnAboutHostiles
 
(CollisionRegion *) - collisionRegion
 
(void) - setCollisionRegion:
 
(void) - setUniversalID:
 
(OOUniversalID- universalID
 
(BOOL) - throwingSparks
 
(void) - setThrowSparks:
 
(void) - throwSparks
 
(void) - setOwner:
 
(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) - orientationChanged
 
(void) - setVelocity:
 
(Vector) - velocity
 
(double) - speed
 
(GLfloat) - distanceTravelled
 
(void) - setDistanceTravelled:
 
(void) - setStatus:
 
(OOEntityStatus- status
 
(void) - setScanClass:
 
(OOScanClass- scanClass
 
(void) - setEnergy:
 
(GLfloat) - energy
 
(void) - setMaxEnergy:
 
(GLfloat) - maxEnergy
 
(void) - applyRoll:andClimb:
 
(void) - applyRoll:climb:andYaw:
 
(void) - moveForward:
 
(OOMatrix) - rotationMatrix
 
(OOMatrix) - drawRotationMatrix
 
(OOMatrix) - transformationMatrix
 
(OOMatrix) - drawTransformationMatrix
 
(BOOL) - canCollide
 
(GLfloat) - collisionRadius
 
(GLfloat) - frustumRadius
 
(void) - setCollisionRadius:
 
(NSMutableArray *) - collisionArray
 
(void) - update:
 
(void) - applyVelocity:
 
(BOOL) - checkCloseCollisionWith:
 
(void) - takeEnergyDamage:from:becauseOf:weaponIdentifier:
 
(void) - dumpState
 
(void) - dumpSelfState
 
(NSUInteger) - lastDrawCounter
 
(void) - setLastDrawCounter:
 
(double) - findCollisionRadius
 
(void) - drawImmediate:translucent:
 
(BOOL) - isVisible
 
(BOOL) - isInSpace
 
(BOOL) - isImmuneToBreakPatternHide
 
(GLfloat) - universalTime
 
(GLfloat) - spawnTime
 
(GLfloat) - timeElapsedSinceSpawn
 
(void) - setAtmosphereFogging:
 
(OOColor *) - fogUniform
 
(NSString *) - descriptionForObjDumpBasic
 
(NSString *) - descriptionForObjDump
 
(NSSet *) - allTextures
 
(id) - init [implementation]
 
(void) - dealloc [implementation]
 
(NSString *) - descriptionComponents [implementation]
 
(BOOL) - checkLinkedLists [implementation]
 
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
 
(Vector) - relativePosition [implementation]
 
(void) - subEntityReallyDied: [implementation]
 
(BOOL) - isBreakPattern
 
(void) - inspect [implementation]
 
(BOOL) - isECMBlast
 
(BOOL) - isExhaust
 
(BOOL) - isFlasher
 
(BOOL) - isVisibleToScripts
 
(NSString *) - oo_jsClassName
 
(void) - getJSClass:andPrototype:
 
(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]
 
(BOOL) - isShipWithSubEntityShip:
 
(void) - drawSubEntityImmediate:translucent: [implementation]
 
- Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
 
(id) - weakRetain [implementation]
 
(void) - weakRefDied: [implementation]
 
- Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED
 

Public Attributes

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
 
OOColoratmosphereFogging
 
int zero_index
 
Entityx_previous
 
Entityx_next
 
Entityy_previous
 
Entityy_next
 
Entityz_previous
 
Entityz_next
 
Entitycollision_chain
 
OOUniversalID shadingEntityID
 
Entitycollider
 
CollisionRegioncollisionRegion
 

Protected Attributes

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
OOWeakReferenceweakSelf
 

Private Attributes

NSUInteger _sessionID
 
OOWeakReference_owner
 
OOEntityStatus _status
 

Detailed Description

Definition at line 78 of file Entity.h.

Method Documentation

◆ absolutePositionForSubentity

- (HPVector) absolutePositionForSubentity

Definition at line 55 of file Entity.m.

671{
672 return [self absolutePositionForSubentityOffset:kZeroHPVector];
673}

Referenced by ShipEntity::absoluteIJKForSubentity.

+ Here is the caller graph for this function:

◆ absolutePositionForSubentityOffset:

- (HPVector) absolutePositionForSubentityOffset: (HPVector)  offset

Definition at line 55 of file Entity.m.

676 :(HPVector) offset
677{
678 HPVector abspos = HPvector_add(position, OOHPVectorMultiplyMatrix(offset, rotMatrix));
679 Entity *last = nil;
680 Entity *father = [self parentEntity];
681
682 while (father != nil && father != last)
683 {
684 abspos = HPvector_add(OOHPVectorMultiplyMatrix(abspos, [father drawRotationMatrix]), [father position]);
685 last = father;
686 if (![last isSubEntity]) break;
687 father = [father owner];
688 }
689 return abspos;
690}
HPVector OOHPVectorMultiplyMatrix(HPVector v, OOMatrix m)
Definition OOMatrix.m:145
return nil
unsigned isSubEntity
Definition Entity.h:95
HPVector position
Definition Entity.h:112
OOMatrix rotMatrix
Definition Entity.h:138
id owner()
Definition Entity.m:584
OOMatrix drawRotationMatrix()
Definition Entity.m:880
voidpf uLong offset
Definition ioapi.h:140

Referenced by OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ addToLinkedLists

- (void) addToLinkedLists

Definition at line 55 of file Entity.m.

230{
231#ifndef NDEBUG
233 OOLog(kOOLogEntityAddToList, @"DEBUG adding entity %@ to linked lists", self);
234#endif
235 //
236 // insert at the start
237 if (UNIVERSE)
238 {
239 x_previous = nil; x_next = UNIVERSE->x_list_start;
240 // move UP the list
242 {
245 }
246 if (x_next) x_next->x_previous = self;
247 if (x_previous) x_previous->x_next = self;
248 else UNIVERSE->x_list_start = self;
249
250 y_previous = nil; y_next = UNIVERSE->y_list_start;
251 // move UP the list
253 {
256 }
257 if (y_next) y_next->y_previous = self;
258 if (y_previous) y_previous->y_next = self;
259 else UNIVERSE->y_list_start = self;
260
261 z_previous = nil; z_next = UNIVERSE->z_list_start;
262 // move UP the list
264 {
267 }
268 if (z_next) z_next->z_previous = self;
269 if (z_previous) z_previous->z_next = self;
270 else UNIVERSE->z_list_start = self;
271
272 }
273
274#ifndef NDEBUG
276 {
277 if (![self checkLinkedLists])
278 {
279 OOLog(kOOLogEntityAddToListError, @"DEBUG LINKED LISTS - problem encountered while adding %@ to linked lists", self);
280 [UNIVERSE debugDumpEntities];
281 }
282 }
283#endif
284}
NSUInteger gDebugFlags
Definition main.m:7
static NSString *const kOOLogEntityAddToList
Definition Entity.m:49
static NSString *const kOOLogEntityAddToListError
Definition Entity.m:50
@ DEBUG_LINKED_LISTS
Definition OODebugFlags.h:5
#define OOLog(class, format,...)
Definition OOLogging.h:88
#define UNIVERSE
Definition Universe.h:842
GLfloat collision_radius
Definition Entity.h:111
Entity * z_next
Definition Entity.h:122
Entity * z_previous
Definition Entity.h:122
BOOL checkLinkedLists()
Definition Entity.m:334
Entity * x_previous
Definition Entity.h:120
Entity * x_next
Definition Entity.h:120
Entity * y_next
Definition Entity.h:121
Entity * y_previous
Definition Entity.h:121

Referenced by Universe::addEntity:.

+ Here is the caller graph for this function:

◆ allTextures

- (NSSet *) allTextures

Reimplemented in OOEntityWithDrawable, OOLightParticleEntity, and OOParticleSystem.

Definition at line 55 of file Entity.m.

1122{
1123 return nil;
1124}

◆ applyRoll:andClimb:

- (void) applyRoll: (GLfloat)  roll
andClimb: (GLfloat)  climb 

Reimplemented in PlayerEntity, and ShipEntity.

Definition at line 55 of file Entity.m.

836 :(GLfloat) roll andClimb:(GLfloat) climb
837{
838 if ((roll == 0.0)&&(climb == 0.0)&&(!hasRotated))
839 return;
840
841 if (roll)
843 if (climb)
845
846 [self orientationChanged];
847}
void quaternion_rotate_about_x(Quaternion *quat, OOScalar angle)
void quaternion_rotate_about_z(Quaternion *quat, OOScalar angle)
unsigned hasRotated
Definition Entity.h:97
Quaternion orientation
Definition Entity.h:114

◆ applyRoll:climb:andYaw:

- (void) applyRoll: (GLfloat)  roll
climb: (GLfloat)  climb
andYaw: (GLfloat)  yaw 

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

850 :(GLfloat) roll climb:(GLfloat) climb andYaw:(GLfloat) yaw
851{
852 if ((roll == 0.0)&&(climb == 0.0)&&(yaw == 0.0)&&(!hasRotated))
853 return;
854
855 if (roll)
857 if (climb)
859 if (yaw)
861
862 [self orientationChanged];
863}
void quaternion_rotate_about_y(Quaternion *quat, OOScalar angle)

◆ applyVelocity:

- (void) applyVelocity: (OOTimeDelta delta_t

Definition at line 55 of file Entity.m.

966 :(OOTimeDelta)delta_t
967{
968 position = HPvector_add(position, HPvector_multiply_scalar(vectorToHPVector(velocity), delta_t));
969}
double OOTimeDelta
Definition OOTypes.h:224
Vector velocity
Definition Entity.h:140

◆ boundingBox

- (BoundingBox) boundingBox

◆ cameraRangeBack

- (GLfloat) cameraRangeBack

Reimplemented in SkyEntity.

Definition at line 55 of file Entity.m.

629{
630 return magnitude(cameraRelativePosition) + [self frustumRadius];
631}
return self
Vector cameraRelativePosition
Definition Entity.h:113
GLfloat frustumRadius()
Definition Entity.m:912

◆ cameraRangeFront

- (GLfloat) cameraRangeFront

Reimplemented in SkyEntity.

Definition at line 55 of file Entity.m.

624{
625 return magnitude(cameraRelativePosition) - [self frustumRadius];
626}

◆ cameraRelativePosition

- (Vector) cameraRelativePosition

◆ camZeroDistance

- (double) camZeroDistance

Definition at line 55 of file Entity.m.

700{
701 return cam_zero_distance;
702}
GLfloat cam_zero_distance
Definition Entity.h:109

◆ canCollide

◆ checkCloseCollisionWith:

- (BOOL) checkCloseCollisionWith: (Entity *)  other

Reimplemented in OOParticleSystem, OOPlanetEntity, OOPlasmaShotEntity, OOQuiriumCascadeEntity, OOSunEntity, ShipEntity, and WormholeEntity.

Definition at line 55 of file Entity.m.

972 :(Entity *)other
973{
974 return other != nil;
975}

◆ checkLinkedLists

- (BOOL) checkLinkedLists
implementation

Provided by category Entity(OOPrivate).

Definition at line 55 of file Entity.m.

335{
336 // DEBUG check for loops
337 if (UNIVERSE->n_entities > 0)
338 {
339 int n;
340 Entity *check, *last;
341 //
342 last = nil;
343 //
344 n = UNIVERSE->n_entities;
345 check = UNIVERSE->x_list_start;
346 while ((n--)&&(check))
347 {
348 last = check;
349 check = check->x_next;
350 }
351 if ((check)||(n > 0))
352 {
353 OOLog(kOOLogEntityVerificationError, @"Broken x_next %@ list (%d) ***", UNIVERSE->x_list_start, n);
354 return NO;
355 }
356 //
357 n = UNIVERSE->n_entities;
358 check = last;
359 while ((n--)&&(check)) check = check->x_previous;
360 if ((check)||(n > 0))
361 {
362 OOLog(kOOLogEntityVerificationError, @"Broken x_previous %@ list (%d) ***", UNIVERSE->x_list_start, n);
363 return NO;
364 }
365 //
366 n = UNIVERSE->n_entities;
367 check = UNIVERSE->y_list_start;
368 while ((n--)&&(check))
369 {
370 last = check;
371 check = check->y_next;
372 }
373 if ((check)||(n > 0))
374 {
375 OOLog(kOOLogEntityVerificationError, @"Broken y_next %@ list (%d) ***", UNIVERSE->y_list_start, n);
376 return NO;
377 }
378 //
379 n = UNIVERSE->n_entities;
380 check = last;
381 while ((n--)&&(check)) check = check->y_previous;
382 if ((check)||(n > 0))
383 {
384 OOLog(kOOLogEntityVerificationError, @"Broken y_previous %@ list (%d) ***", UNIVERSE->y_list_start, n);
385 return NO;
386 }
387 //
388 n = UNIVERSE->n_entities;
389 check = UNIVERSE->z_list_start;
390 while ((n--)&&(check))
391 {
392 last = check;
393 check = check->z_next;
394 }
395 if ((check)||(n > 0))
396 {
397 OOLog(kOOLogEntityVerificationError, @"Broken z_next %@ list (%d) ***", UNIVERSE->z_list_start, n);
398 return NO;
399 }
400 //
401 n = UNIVERSE->n_entities;
402 check = last;
403 while ((n--)&&(check)) check = check->z_previous;
404 if ((check)||(n > 0))
405 {
406 OOLog(kOOLogEntityVerificationError, @"Broken z_previous %@ list (%d) ***", UNIVERSE->z_list_start, n);
407 return NO;
408 }
409 }
410 return YES;
411}
static NSString *const kOOLogEntityVerificationError
Definition Entity.m:55

◆ clock

- (GLfloat) clock
implementation

Provided by category Entity(ShaderBindings).

Definition at line 1 of file EntityShaderBindings.m.

37{
38 return [PLAYER clockTime];
39}

◆ collisionArray

- (NSMutableArray *) collisionArray

Definition at line 55 of file Entity.m.

925{
926 return collidingEntities;
927}
NSMutableArray * collidingEntities
Definition Entity.h:148

◆ collisionRadius

- (GLfloat) collisionRadius

Reimplemented in OOVisualEffectEntity.

Definition at line 55 of file Entity.m.

907{
908 return collision_radius;
909}

Referenced by HeadUpDisplay::hudDrawReticleOnTarget.

+ Here is the caller graph for this function:

◆ collisionRegion

- (CollisionRegion *) collisionRegion

◆ compareZeroDistance:

- (NSComparisonResult) compareZeroDistance: (Entity *)  otherEntity

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

705 :(Entity *)otherEntity
706{
707 if ((otherEntity)&&(zero_distance > otherEntity->zero_distance))
708 return NSOrderedAscending;
709 else
710 return NSOrderedDescending;
711}
GLfloat zero_distance
Definition Entity.h:108

◆ dealloc

- (void) dealloc
implementation

Reimplemented from OOWeakRefObject.

Reimplemented in DockEntity, DustEntity, OOEntityWithDrawable, OOExplosionCloudEntity, OOFlasherEntity, OOLaserShotEntity, OOPlanetEntity, OOSunEntity, OOVisualEffectEntity, OOWaypointEntity, PlayerEntity, ShipEntity, SkyEntity, StationEntity, and WormholeEntity.

Definition at line 55 of file Entity.m.

103{
104 [UNIVERSE ensureEntityReallyRemoved:self];
107 [self deleteJSSelf];
108 [self setOwner:nil];
109 [atmosphereFogging release];
110
111#ifndef NDEBUG
113 gTotalEntityMemory -= [self oo_objectSize];
114#endif
115
116 [super dealloc];
117}
uint32_t gLiveEntityCount
Definition Entity.m:43
size_t gTotalEntityMemory
Definition Entity.m:44
#define DESTROY(x)
Definition OOCocoa.h:75
CollisionRegion * collisionRegion
Definition Entity.h:130

Referenced by OOEntityWithDrawable::allTextures.

+ Here is the caller graph for this function:

◆ deleteJSSelf

- (void) deleteJSSelf

Provided by category Entity(OOJavaScriptExtensions).

Definition at line 1 of file EntityOOJavaScriptExtensions.m.

96{
97 if (_jsSelf != NULL)
98 {
99 _jsSelf = NULL;
100 JSContext *context = OOJSAcquireContext();
101 JS_RemoveObjectRoot(context, &_jsSelf);
102 OOJSRelinquishContext(context);
103
104 [[NSNotificationCenter defaultCenter] removeObserver:self
105 name:kOOJavaScriptEngineWillResetNotification
107 }
108}
OOINLINE JSContext * OOJSAcquireContext(void)
OOINLINE void OOJSRelinquishContext(JSContext *context)
OOJavaScriptEngine * sharedEngine()

◆ descriptionComponents

- (NSString *) descriptionComponents
implementation

Reimplemented in OOLaserShotEntity, OOParticleSystem, OOPlanetEntity, OOQuiriumCascadeEntity, OORingEffectEntity, OOSunEntity, ShipEntity, StationEntity, and WormholeEntity.

Definition at line 55 of file Entity.m.

121{
122 return [NSString stringWithFormat:@"position: %@ scanClass: %@ status: %@", HPVectorDescription([self position]), OOStringFromScanClass([self scanClass]), OOStringFromEntityStatus([self status])];
123}

◆ descriptionForObjDump

- (NSString *) descriptionForObjDump

Reimplemented in DustEntity, ShipEntity, and SkyEntity.

Definition at line 55 of file Entity.m.

1112{
1113 NSString *result = [self descriptionForObjDumpBasic];
1114
1115 result = [result stringByAppendingFormat:@" range: %g (visible: %@)", HPdistance([self position], [PLAYER position]), [self isVisible] ? @"yes" : @"no"];
1116
1117 return result;
1118}

◆ descriptionForObjDumpBasic

- (NSString *) descriptionForObjDumpBasic

Definition at line 55 of file Entity.m.

1102{
1103 NSString *result = [self descriptionComponents];
1104 if (result != nil) result = [NSString stringWithFormat:@"%@ %@", NSStringFromClass([self class]), result];
1105 else result = [self description];
1106
1107 return result;
1108}

◆ distanceTravelled

- (GLfloat) distanceTravelled

◆ drawImmediate:translucent:

- (void) drawImmediate: (bool)  immediate
translucent: (bool)  translucent 

◆ drawRotationMatrix

- (OOMatrix) drawRotationMatrix

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

881{
882 return rotMatrix;
883}

Referenced by OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ drawSubEntityImmediate:translucent:

- (void) drawSubEntityImmediate: (bool)  immediate
translucent: (bool)  translucent 
implementation

Reimplemented in OOExhaustPlumeEntity, OOFlasherEntity, OOVisualEffectEntity, ShipEntity, and OOLightParticleEntity.

Provided by category Entity(SubEntityRelationship).

Definition at line 14062 of file ShipEntity.m.

14852 :(bool)immediate translucent:(bool)translucent
14853{
14854 // Do nothing.
14855}

◆ drawTransformationMatrix

- (OOMatrix) drawTransformationMatrix

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

894{
895 OOMatrix result = rotMatrix;
896 return OOMatrixHPTranslate(result, position);
897}

◆ dumpSelfState

- (void) dumpSelfState

Reimplemented in PlayerEntity, ShipEntity, StationEntity, and WormholeEntity.

Definition at line 55 of file Entity.m.

1015{
1016 NSMutableArray *flags = nil;
1017 NSString *flagsString = nil;
1018 id owner = [self owner];
1019
1020 if (owner == self) owner = @"self";
1021 else if (owner == nil) owner = @"none";
1022
1023 OOLog(@"dumpState.entity", @"Universal ID: %u", universalID);
1024 OOLog(@"dumpState.entity", @"Scan class: %@", OOStringFromScanClass(scanClass));
1025 OOLog(@"dumpState.entity", @"Status: %@", OOStringFromEntityStatus([self status]));
1026 OOLog(@"dumpState.entity", @"Position: %@", HPVectorDescription(position));
1027 OOLog(@"dumpState.entity", @"Orientation: %@", QuaternionDescription(orientation));
1028 OOLog(@"dumpState.entity", @"Distance travelled: %g", distanceTravelled);
1029 OOLog(@"dumpState.entity", @"Energy: %g of %g", energy, maxEnergy);
1030 OOLog(@"dumpState.entity", @"Mass: %g", mass);
1031 OOLog(@"dumpState.entity", @"Owner: %@", owner);
1032
1033 flags = [NSMutableArray array];
1034 #define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
1044 flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
1045 OOLog(@"dumpState.entity", @"Flags: %@", flagsString);
1046 OOLog(@"dumpState.entity", @"Collision Test Filter: %u", collisionTestFilter);
1047
1048}
NSString * OOStringFromScanClass(OOScanClass scanClass) CONST_FUNC
NSString * OOStringFromEntityStatus(OOEntityStatus status) CONST_FUNC
#define ADD_FLAG_IF_SET(x)
unsigned throw_sparks
Definition Entity.h:101
GLfloat maxEnergy
Definition Entity.h:143
OOUniversalID universalID
Definition Entity.h:89
unsigned hasMoved
Definition Entity.h:96
GLfloat energy
Definition Entity.h:142
unsigned isShip
Definition Entity.h:91
unsigned collisionTestFilter
Definition Entity.h:100
OOScanClass scanClass
Definition Entity.h:106
OOEntityStatus status()
Definition Entity.m:794
unsigned isWormhole
Definition Entity.h:94
GLfloat distanceTravelled
Definition Entity.h:136
unsigned isStation
Definition Entity.h:92
unsigned isPlayer
Definition Entity.h:93
unsigned isSunlit
Definition Entity.h:99
GLfloat mass
Definition Entity.h:146

◆ dumpState

- (void) dumpState

Definition at line 55 of file Entity.m.

998{
999 if (OOLogWillDisplayMessagesInClass(@"dumpState"))
1000 {
1001 OOLog(@"dumpState", @"State for %@:", self);
1003 OOLogIndent();
1004 @try
1005 {
1006 [self dumpSelfState];
1007 }
1008 @catch (id exception) {}
1010 }
1011}
void OOLogPushIndent(void)
Definition OOLogging.m:316
void OOLogPopIndent(void)
Definition OOLogging.m:340
BOOL OOLogWillDisplayMessagesInClass(NSString *inMessageClass)
Definition OOLogging.m:144
void OOLogIndent(void)
Definition OOLogging.m:366

◆ energy

- (GLfloat) energy

◆ findCollisionRadius

- (double) findCollisionRadius

Reimplemented in OOEntityWithDrawable, OOExhaustPlumeEntity, and OOFlasherEntity.

Definition at line 55 of file Entity.m.

979{
981 return 0;
982}

◆ fogUniform

- (OOColor *) fogUniform

Definition at line 55 of file Entity.m.

1096{
1097 return [[atmosphereFogging retain] autorelease];
1098}

◆ frustumRadius

- (GLfloat) frustumRadius

Reimplemented in OOVisualEffectEntity, and ShipEntity.

Definition at line 55 of file Entity.m.

913{
914 return collision_radius;
915}

◆ getJSClass:andPrototype:

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

Reimplemented in ShipEntity, DockEntity, OOPlanetEntity, StationEntity, OOSunEntity, OOExhaustPlumeEntity, OOFlasherEntity, OOVisualEffectEntity, OOWaypointEntity, and WormholeEntity.

Provided by category Entity(OOJavaScriptExtensions).

Definition at line 1 of file EntityOOJavaScriptExtensions.m.

88 :(JSClass **)outClass andPrototype:(JSObject **)outPrototype
89{
90 *outClass = JSEntityClass();
91 *outPrototype = JSEntityPrototype();
92}
OOINLINE JSClass * JSEntityClass(void)
Definition OOJSEntity.h:42
OOINLINE JSObject * JSEntityPrototype(void)
Definition OOJSEntity.h:43

◆ init

- (id) init
implementation

Reimplemented in DustEntity, OOParticleSystem, OOSunEntity, OOVisualEffectEntity, PlayerEntity, ShipEntity, and WormholeEntity.

Definition at line 55 of file Entity.m.

69{
70 self = [super init];
71 if (EXPECT_NOT(self == nil)) return nil;
72
73 _sessionID = [UNIVERSE sessionID];
74
78
79 no_draw_distance = 100000.0; // 10 km
80
81 collidingEntities = [[NSMutableArray alloc] init];
82
83 scanClass = CLASS_NOT_SET;
84 [self setStatus:STATUS_COCKPIT_DISPLAY];
85
86 spawnTime = [UNIVERSE getTime];
87
88 isSunlit = YES;
89
90 atmosphereFogging = [[OOColor colorWithRed: 0.0 green: 0.0 blue: 0.0 alpha: 0.0] retain];
91
92#ifndef NDEBUG
94 gTotalEntityMemory += [self oo_objectSize];
95#endif
96
98 return self;
99}
#define EXPECT_NOT(x)
const HPVector kZeroHPVector
Definition OOHPVector.m:28
const OOMatrix kIdentityMatrix
Definition OOMatrix.m:31
const Quaternion kIdentityQuaternion
OOColor * atmosphereFogging
Definition Entity.h:115
OOTimeAbsolute spawnTime
Definition Entity.h:150
NSUInteger lastDrawCounter
Definition Entity.h:153
NSUInteger _sessionID
Definition Entity.h:156
GLfloat no_draw_distance
Definition Entity.h:110
OOColor * colorWithRed:green:blue:alpha:(float red,[green] float green,[blue] float blue,[alpha] float alpha)
Definition OOColor.m:95

Referenced by OOLaserShotEntity::dealloc, and OOPlanetEntity::initFromDictionary:withAtmosphere:andSeed:forSystem:.

+ Here is the caller graph for this function:

◆ inspect

- (void) inspect
implementation

Provided by category Entity(OODebugInspector).

Referenced by ConsoleInspectEntity().

+ Here is the caller graph for this function:

◆ isBreakPattern

- (BOOL) isBreakPattern

Reimplemented in OOBreakPatternEntity, and OOVisualEffectEntity.

Provided by category Entity(OOBreakPatternEntity).

Definition at line 1 of file OOBreakPatternEntity.m.

180{
181 return NO;
182}

◆ isCascadeWeapon

- (BOOL) isCascadeWeapon

Reimplemented in OOQuiriumCascadeEntity.

Provided by category Entity(OOQuiriumCascadeExtensions).

Definition at line 1 of file OOQuiriumCascadeEntity.m.

176{
177 return NO;
178}

◆ isDock

- (BOOL) isDock

Reimplemented in DockEntity.

Definition at line 55 of file Entity.m.

139{
140 return NO;
141}

◆ isECMBlast

- (BOOL) isECMBlast

Reimplemented in OOECMBlastEntity.

Provided by category Entity(OOECMBlastEntity).

Definition at line 1 of file OOECMBlastEntity.m.

131{
132 return NO;
133}

◆ isEffect

- (BOOL) isEffect

◆ isExhaust

- (BOOL) isExhaust

Reimplemented in OOExhaustPlumeEntity.

Provided by category Entity(OOExhaustPlume).

Definition at line 380 of file OOExhaustPlumeEntity.m.

673{
674 return NO;
675}

◆ isFlasher

- (BOOL) isFlasher

Reimplemented in OOFlasherEntity.

Provided by category Entity(OOFlasherEntityExtensions).

Definition at line 1 of file OOFlasherEntity.m.

249{
250 return NO;
251}

◆ isImmuneToBreakPatternHide

- (BOOL) isImmuneToBreakPatternHide

◆ isInSpace

- (BOOL) isInSpace

Definition at line 55 of file Entity.m.

1135{
1136 switch ([self status])
1137 {
1138 case STATUS_IN_FLIGHT:
1139 case STATUS_DOCKING:
1140 case STATUS_LAUNCHING:
1141 case STATUS_AUTOPILOT_ENGAGED:
1142 case STATUS_WITCHSPACE_COUNTDOWN:
1143 case STATUS_BEING_SCOOPED:
1144 case STATUS_EFFECT:
1145 case STATUS_ACTIVE:
1146 return YES;
1147 default:
1148 return NO;
1149 }
1150}

◆ isPlanet

- (BOOL) isPlanet

Reimplemented in OOPlanetEntity.

Definition at line 55 of file Entity.m.

163{
164 return NO;
165}

◆ isPlayer

- (BOOL) isPlayer

◆ isPlayerLikeShip

- (BOOL) isPlayerLikeShip

Reimplemented in PlayerEntity, and ProxyPlayerEntity.

Provided by category Entity(ProxyPlayer).

Definition at line 1 of file ProxyPlayerEntity.m.

216{
217 return NO;
218}

◆ isShip

- (BOOL) isShip

◆ isShipWithSubEntityShip:

- (BOOL) isShipWithSubEntityShip: (Entity *)  other

Reimplemented in OOVisualEffectEntity, and ShipEntity.

Provided by category Entity(SubEntityRelationship).

Definition at line 14062 of file ShipEntity.m.

14846 :(Entity *)other
14847{
14848 return NO;
14849}

◆ isSky

- (BOOL) isSky

Reimplemented in SkyEntity.

Definition at line 55 of file Entity.m.

187{
188 return NO;
189}

◆ isStation

- (BOOL) isStation

◆ isStellarObject

- (BOOL) isStellarObject

Definition at line 55 of file Entity.m.

181{
182 return [self isPlanet] || [self isSun];
183}

◆ isSubEntity

- (BOOL) isSubEntity

◆ isSun

- (BOOL) isSun

Reimplemented in OOSunEntity.

Definition at line 55 of file Entity.m.

169{
170 return NO;
171}

Referenced by IsSunPredicate().

+ Here is the caller graph for this function:

◆ isSunlit

- (BOOL) isSunlit

◆ isVisible

- (BOOL) isVisible

Reimplemented in OOPlanetEntity, OOSunEntity, ShipEntity, and SkyEntity.

Definition at line 55 of file Entity.m.

1129{
1131}
#define ABSOLUTE_NO_DRAW_DISTANCE2
Definition Entity.h:47

◆ isVisibleToScripts

- (BOOL) isVisibleToScripts

Reimplemented in ShipEntity, OOExhaustPlumeEntity, OOFlasherEntity, OOPlanetEntity, OOSunEntity, OOVisualEffectEntity, OOWaypointEntity, and WormholeEntity.

Provided by category Entity(OOJavaScriptExtensions).

Definition at line 1 of file EntityOOJavaScriptExtensions.m.

43{
44 return NO;
45}

Referenced by JSEntityIsJavaScriptVisiblePredicate().

+ Here is the caller graph for this function:

◆ isVisualEffect

- (BOOL) isVisualEffect

Reimplemented in OOVisualEffectEntity.

◆ isWaypoint

- (BOOL) isWaypoint

Reimplemented in OOWaypointEntity.

Definition at line 55 of file Entity.m.

210{
211 return NO;
212}

◆ isWormhole

- (BOOL) isWormhole

◆ lastDrawCounter

- (NSUInteger) lastDrawCounter

◆ mass

- (GLfloat) mass

◆ maxEnergy

- (GLfloat) maxEnergy

◆ moveForward:

- (void) moveForward: (double)  amount

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

866 :(double)amount
867{
868 HPVector forward = HPvector_multiply_scalar(HPvector_forward_from_quaternion(orientation), amount);
869 position = HPvector_add(position, forward);
870 distanceTravelled += amount;
871}
HPVector HPvector_forward_from_quaternion(Quaternion quat)

◆ normalOrientation

- (Quaternion) normalOrientation

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

740{
741 return [self orientation];
742}

Referenced by OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ oo_jsClassName

- (NSString *) oo_jsClassName

◆ oo_jsValueInContext:

- (jsval) oo_jsValueInContext: (JSContext *)  context
implementation

Provided by category Entity(OOJavaScriptExtensions).

Definition at line 1 of file EntityOOJavaScriptExtensions.m.

54 :(JSContext *)context
55{
56 JSClass *class = NULL;
57 JSObject *prototype = NULL;
58 jsval result = JSVAL_NULL;
59
60 if (_jsSelf == NULL && [self isVisibleToScripts])
61 {
62 // Create JS object
63 [self getJSClass:&class andPrototype:&prototype];
64
65 _jsSelf = JS_NewObject(context, class, prototype, NULL);
66 if (_jsSelf != NULL)
67 {
68 if (!JS_SetPrivate(context, _jsSelf, OOConsumeReference([self weakRetain]))) _jsSelf = NULL;
69 }
70
71 if (_jsSelf != NULL)
72 {
73 OOJSAddGCObjectRoot(context, &_jsSelf, "Entity jsSelf");
74 [[NSNotificationCenter defaultCenter] addObserver:self
75 selector:@selector(deleteJSSelf)
76 name:kOOJavaScriptEngineWillResetNotification
78 }
79 }
80
81 if (_jsSelf != NULL) result = OBJECT_TO_JSVAL(_jsSelf);
82
83 return result;
84 // Analyzer: object leaked. [Expected, object is retained by JS object.]
85}
id OOConsumeReference(id OO_NS_CONSUMED value)
Definition OOCocoa.m:93
#define OOJSAddGCObjectRoot(context, root, name)

Referenced by JSFunctionPredicate(), and MissionRunScreen().

+ Here is the caller graph for this function:

◆ orientation

- (Quaternion) orientation

◆ orientationChanged

- (void) orientationChanged

Reimplemented in OOVisualEffectEntity, PlayerEntity, and ShipEntity.

Definition at line 55 of file Entity.m.

752{
753 quaternion_normalize(&orientation);
755}
OOMatrix OOMatrixForQuaternionRotation(Quaternion orientation)
Definition OOMatrix.m:65

◆ owner

- (id) owner

Definition at line 55 of file Entity.m.

585{
586 return [_owner weakRefUnderlyingObject];
587}

Referenced by EntityGetProperty(), OOExhaustPlumeEntity(OOJavaScriptExtensions)::getJSClass:andPrototype:, OOFlasherEntity(OOJavaScriptExtensions)::getJSClass:andPrototype:, and VisualEffectRemove().

+ Here is the caller graph for this function:

◆ parentEntity

- (ShipEntity *) parentEntity

Definition at line 55 of file Entity.m.

591{
592 id owner = [self owner];
593 if ([owner isShipWithSubEntityShip:self]) return owner;
594 return nil;
595}

◆ position

- (HPVector) position

◆ pseudoFixedD100

- (unsigned) pseudoFixedD100
implementation

Provided by category Entity(ShaderBindings).

Definition at line 1 of file EntityShaderBindings.m.

44{
45 return [PLAYER systemPseudoRandom100];
46}

◆ pseudoFixedD256

- (unsigned) pseudoFixedD256
implementation

Provided by category Entity(ShaderBindings).

Definition at line 1 of file EntityShaderBindings.m.

49{
50 return [PLAYER systemPseudoRandom256];
51}

◆ relativePosition

- (Vector) relativePosition
implementation

Definition at line 55 of file Entity.m.

638{
639 return HPVectorToVector(HPvector_subtract([self position], [PLAYER position]));
640}
#define PLAYER

◆ removeFromLinkedLists

- (void) removeFromLinkedLists

Definition at line 55 of file Entity.m.

288{
289#ifndef NDEBUG
291 OOLog(kOOLogEntityRemoveFromList, @"DEBUG removing entity %@ from linked lists", self);
292#endif
293
294 if ((x_next == nil)&&(x_previous == nil)) // removed already!
295 return;
296
297 // make sure the starting point is still correct
298 if (UNIVERSE)
299 {
300 if ((UNIVERSE->x_list_start == self)&&(x_next))
301 UNIVERSE->x_list_start = x_next;
302 if ((UNIVERSE->y_list_start == self)&&(y_next))
303 UNIVERSE->y_list_start = y_next;
304 if ((UNIVERSE->z_list_start == self)&&(z_next))
305 UNIVERSE->z_list_start = z_next;
306 }
307 //
310 //
313 //
316 //
320
321#ifndef NDEBUG
323 {
324 if (![self checkLinkedLists])
325 {
326 OOLog(kOOLogEntityRemoveFromListError, @"DEBUG LINKED LISTS - problem encountered while removing %@ from linked lists", self);
327 [UNIVERSE debugDumpEntities];
328 }
329 }
330#endif
331}
static NSString *const kOOLogEntityRemoveFromList
Definition Entity.m:51
static NSString *const kOOLogEntityRemoveFromListError
Definition Entity.m:52

◆ rootShipEntity

- (ShipEntity *) rootShipEntity

Definition at line 55 of file Entity.m.

605{
606 ShipEntity *parent = [self parentEntity];
607 if (parent != nil) return [parent rootShipEntity];
608 if ([self isShip]) return (ShipEntity *)self;
609 return nil;
610}
ShipEntity * rootShipEntity()
Definition Entity.m:604

Referenced by OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ rotationMatrix

- (OOMatrix) rotationMatrix

Definition at line 55 of file Entity.m.

875{
876 return rotMatrix;
877}

◆ scanClass

- (OOScanClass) scanClass

Reimplemented in ShipEntity.

◆ sessionID

- (NSUInteger) sessionID

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

127{
128 return _sessionID;
129}

◆ setAtmosphereFogging:

- (void) setAtmosphereFogging: (OOColor *)  fogging

Definition at line 55 of file Entity.m.

1089 : (OOColor *)fogging
1090{
1091 [atmosphereFogging release];
1092 atmosphereFogging = [fogging retain];
1093}

◆ setCollisionRadius:

- (void) setCollisionRadius: (GLfloat)  amount

Definition at line 55 of file Entity.m.

918 :(GLfloat) amount
919{
920 collision_radius = amount;
921}

◆ setCollisionRegion:

- (void) setCollisionRegion: (CollisionRegion*)  region

Definition at line 55 of file Entity.m.

540 : (CollisionRegion*) region
541{
542 if (collisionRegion) [collisionRegion release];
543 collisionRegion = [region retain];
544}

◆ setDistanceTravelled:

- (void) setDistanceTravelled: (GLfloat)  value

Definition at line 55 of file Entity.m.

782 : (GLfloat) value
783{
784 distanceTravelled = value;
785}

◆ setEnergy:

- (void) setEnergy: (GLfloat)  amount

Definition at line 55 of file Entity.m.

812 :(GLfloat) amount
813{
814 energy = amount;
815}

Referenced by EntitySetProperty().

+ Here is the caller graph for this function:

◆ setLastDrawCounter:

- (void) setLastDrawCounter: (NSUInteger)  drawCounter

Definition at line 55 of file Entity.m.

1063 : (NSUInteger) drawCounter
1064{
1065 lastDrawCounter = drawCounter;
1066 return;
1067}

◆ setMaxEnergy:

- (void) setMaxEnergy: (GLfloat)  amount

Definition at line 55 of file Entity.m.

824 :(GLfloat)amount
825{
826 maxEnergy = amount;
827}

Referenced by EntitySetProperty().

+ Here is the caller graph for this function:

◆ setNormalOrientation:

- (void) setNormalOrientation: (Quaternion)  quat

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

745 :(Quaternion) quat
746{
747 [self setOrientation:quat];
748}

Referenced by EntitySetProperty(), and OOWaypointEntity(OOJavaScriptExtensions)::getJSClass:andPrototype:.

+ Here is the caller graph for this function:

◆ setOrientation:

- (void) setOrientation: (Quaternion)  quat

Reimplemented in OOWaypointEntity, and OOPlanetEntity.

Definition at line 55 of file Entity.m.

726 :(Quaternion) quat
727{
728 orientation = quat;
729 [self orientationChanged];
730}

Referenced by OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ setOwner:

- (void) setOwner: (Entity *)  ent

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

577 :(Entity *)ent
578{
579 [_owner release];
580 _owner = [ent weakRetain];
581}
OOWeakReference * _owner
Definition Entity.h:158

Referenced by OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ setPosition:

- (void) setPosition: (HPVector)  posn

Reimplemented in OOSunEntity.

Definition at line 55 of file Entity.m.

648 :(HPVector) posn
649{
650 position = posn;
651 [self updateCameraRelativePosition];
652}

Referenced by OOLaserShotEntity::dealloc, and EntitySetProperty().

+ Here is the caller graph for this function:

◆ setPositionX:y:z:

- (void) setPositionX: (OOHPScalar x
y: (OOHPScalar y
z: (OOHPScalar z 

Definition at line 55 of file Entity.m.

656{
657 position.x = x;
658 position.y = y;
659 position.z = z;
660 [self updateCameraRelativePosition];
661}
double OOHPScalar
Definition OOMaths.h:69
float y
float x

◆ setScanClass:

- (void) setScanClass: (OOScanClass sClass

Definition at line 55 of file Entity.m.

800 :(OOScanClass)sClass
801{
802 scanClass = sClass;
803}
OOScanClass
Definition Entity.h:71

Referenced by EntitySetProperty().

+ Here is the caller graph for this function:

◆ setStatus:

- (void) setStatus: (OOEntityStatus stat

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

788 :(OOEntityStatus) stat
789{
790 _status = stat;
791}
OOEntityStatus
Definition Entity.h:60
OOEntityStatus _status
Definition Entity.h:159

Referenced by WormholeEntity::arrivalTime, OOLaserShotEntity::dealloc, and OOPlanetEntity::initFromDictionary:withAtmosphere:andSeed:forSystem:.

+ Here is the caller graph for this function:

◆ setThrowSparks:

- (void) setThrowSparks: (BOOL)  value

Definition at line 55 of file Entity.m.

565 :(BOOL) value
566{
567 throw_sparks = value;
568}

◆ setUniversalID:

- (void) setUniversalID: (OOUniversalID uid

Definition at line 55 of file Entity.m.

547 :(OOUniversalID)uid
548{
549 universalID = uid;
550}
uint16_t OOUniversalID
Definition OOTypes.h:189

◆ setVelocity:

- (void) setVelocity: (Vector)  vel

Definition at line 55 of file Entity.m.

758 :(Vector) vel
759{
760 velocity = vel;
761}

◆ spawnTime

- (GLfloat) spawnTime

◆ speed

- (double) speed

Definition at line 55 of file Entity.m.

771{
772 return magnitude([self velocity]);
773}

◆ status

- (OOEntityStatus) status

Definition at line 55 of file Entity.m.

795{
796 return _status;
797}

Referenced by EntityGetProperty(), and PlayerShipBeginGalacticHyperspaceCountdown().

+ Here is the caller graph for this function:

◆ subEntityReallyDied:

- (void) subEntityReallyDied: (ShipEntity *)  sub
implementation

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

1051 :(ShipEntity *)sub
1052{
1053 OOLog(@"entity.bug", @"%s called for non-ship entity %p by %p", __PRETTY_FUNCTION__, self, sub);
1054}

◆ superShaderBindingTarget

- (id< OOWeakReferenceSupport >) superShaderBindingTarget
implementation

Definition at line 55 of file Entity.m.

599{
600 return [self parentEntity];
601}

◆ systemEconomy

- (unsigned) systemEconomy
implementation

Provided by category Entity(ShaderBindings).

Definition at line 1 of file EntityShaderBindings.m.

61{
62 return [[PLAYER systemEconomy_number] unsignedIntValue];
63}

◆ systemGovernment

- (unsigned) systemGovernment
implementation

Provided by category Entity(ShaderBindings).

Definition at line 1 of file EntityShaderBindings.m.

56{
57 return [[PLAYER systemGovernment_number] unsignedIntValue];
58}

◆ systemPopulation

- (unsigned) systemPopulation
implementation

Provided by category Entity(ShaderBindings).

Definition at line 1 of file EntityShaderBindings.m.

71{
72 return [[PLAYER systemPopulation_number] unsignedIntValue];
73}

◆ systemProductivity

- (unsigned) systemProductivity
implementation

Provided by category Entity(ShaderBindings).

Definition at line 1 of file EntityShaderBindings.m.

76{
77 return [[PLAYER systemProductivity_number] unsignedIntValue];
78}

◆ systemTechLevel

- (unsigned) systemTechLevel
implementation

Provided by category Entity(ShaderBindings).

Definition at line 1 of file EntityShaderBindings.m.

66{
67 return [[PLAYER systemTechLevel_number] unsignedIntValue];
68}

◆ takeEnergyDamage:from:becauseOf:weaponIdentifier:

- (void) takeEnergyDamage: (double)  amount
from: (Entity *)  ent
becauseOf: (Entity *)  other
weaponIdentifier: (NSString *)  weaponIdentifier 

Reimplemented in DockEntity, PlayerEntity, ShipEntity, and StationEntity.

Definition at line 55 of file Entity.m.

991 :(double) amount from:(Entity *) ent becauseOf:(Entity *) other weaponIdentifier:(NSString *)weaponIdentifier
992{
993
994}

◆ throwingSparks

- (BOOL) throwingSparks

Definition at line 55 of file Entity.m.

560{
561 return throw_sparks;
562}

◆ throwSparks

- (void) throwSparks

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

572{
573 // do nothing for now
574}

◆ timeElapsedSinceSpawn

- (GLfloat) timeElapsedSinceSpawn

Definition at line 55 of file Entity.m.

1084{
1085 return [UNIVERSE getTime] - spawnTime;
1086}

◆ transformationMatrix

- (OOMatrix) transformationMatrix

Definition at line 55 of file Entity.m.

887{
888 OOMatrix result = rotMatrix;
889 return OOMatrixHPTranslate(result, position);
890}

◆ universalID

- (OOUniversalID) universalID

◆ universalTime

- (GLfloat) universalTime

Definition at line 55 of file Entity.m.

1072{
1073 return [UNIVERSE getTime];
1074}

◆ update:

- (void) update: (OOTimeDelta delta_t

Reimplemented in OOBigFragmentBurstEntity, OOPlasmaBurstEntity, OOPlasmaShotEntity, DockEntity, DustEntity, OOBreakPatternEntity, OOECMBlastEntity, OOExhaustPlumeEntity, OOExplosionCloudEntity, OOFlashEffectEntity, OOFlasherEntity, OOLaserShotEntity, OOParticleSystem, OOSmallFragmentBurstEntity, OOPlanetEntity, OOQuiriumCascadeEntity, OORingEffectEntity, OOSparkEntity, OOSunEntity, OOVisualEffectEntity, PlayerEntity, ShipEntity, SkyEntity, StationEntity, and WormholeEntity.

Definition at line 55 of file Entity.m.

930 :(OOTimeDelta)delta_t
931{
932 if (_status != STATUS_COCKPIT_DISPLAY)
933 {
934 if ([self isSubEntity])
935 {
936 zero_distance = [[self owner] zeroDistance];
937 cam_zero_distance = [[self owner] camZeroDistance];
938 [self updateCameraRelativePosition];
939 }
940 else
941 {
942 zero_distance = HPdistance2(PLAYER->position, position);
943 cam_zero_distance = HPdistance2([PLAYER viewpointPosition], position);
944 [self updateCameraRelativePosition];
945 }
946 }
947 else
948 {
949 zero_distance = HPmagnitude2(position);
951 cameraRelativePosition = HPVectorToVector(position);
952 }
953
954 if ([self status] != STATUS_COCKPIT_DISPLAY)
955 {
956 [self applyVelocity:delta_t];
957 }
958
959 hasMoved = !HPvector_equal(position, lastPosition);
960 hasRotated = !quaternion_equal(orientation, lastOrientation);
963}
Quaternion lastOrientation
Definition Entity.h:134
HPVector lastPosition
Definition Entity.h:133

◆ updateCameraRelativePosition

- (void) updateCameraRelativePosition

Reimplemented in DustEntity, and OOSunEntity.

Definition at line 55 of file Entity.m.

665{
666 cameraRelativePosition = HPVectorToVector(HPvector_subtract([self absolutePositionForSubentity],[PLAYER viewpointPosition]));
667}
HPVector absolutePositionForSubentity()
Definition Entity.m:670

◆ updateLinkedLists

- (void) updateLinkedLists

Definition at line 55 of file Entity.m.

415{
416 if (!UNIVERSE)
417 return; // not in the UNIVERSE - don't do this!
418 if ((x_next == nil)&&(x_previous == nil))
419 return; // not in the lists - don't do this!
420
421#ifndef NDEBUG
423 {
424 if (![self checkLinkedLists])
425 {
426 OOLog(kOOLogEntityVerificationError, @"DEBUG LINKED LISTS problem encountered before updating linked lists for %@", self);
427 [UNIVERSE debugDumpEntities];
428 }
429 }
430#endif
431
432 // update position in linked list for position.x
433 // take self out of list..
436 // sink DOWN the list
438 {
441 }
442 // bubble UP the list
444 {
447 }
448 if (x_next) // insert self into the list before x_next..
449 x_next->x_previous = self;
450 if (x_previous) // insert self into the list after x_previous..
451 x_previous->x_next = self;
452 if ((x_previous == nil)&&(UNIVERSE)) // if we're the first then tell the UNIVERSE!
453 UNIVERSE->x_list_start = self;
454
455 // update position in linked list for position.y
456 // take self out of list..
459 // sink DOWN the list
461 {
464 }
465 // bubble UP the list
467 {
470 }
471 if (y_next) // insert self into the list before y_next..
472 y_next->y_previous = self;
473 if (y_previous) // insert self into the list after y_previous..
474 y_previous->y_next = self;
475 if ((y_previous == nil)&&(UNIVERSE)) // if we're the first then tell the UNIVERSE!
476 UNIVERSE->y_list_start = self;
477
478 // update position in linked list for position.z
479 // take self out of list..
482 // sink DOWN the list
484 {
487 }
488 // bubble UP the list
490 {
493 }
494 if (z_next) // insert self into the list before z_next..
495 z_next->z_previous = self;
496 if (z_previous) // insert self into the list after z_previous..
497 z_previous->z_next = self;
498 if ((z_previous == nil)&&(UNIVERSE)) // if we're the first then tell the UNIVERSE!
499 UNIVERSE->z_list_start = self;
500
501 // done
502#ifndef NDEBUG
504 {
505 if (![self checkLinkedLists])
506 {
507 OOLog(kOOLogEntityUpdateError, @"DEBUG LINKED LISTS problem encountered after updating linked lists for %@", self);
508 [UNIVERSE debugDumpEntities];
509 }
510 }
511#endif
512}
static NSString *const kOOLogEntityUpdateError
Definition Entity.m:53

◆ validForAddToUniverse

- (BOOL) validForAddToUniverse

Reimplemented in PlayerEntity, and ShipEntity.

Definition at line 55 of file Entity.m.

216{
217 NSUInteger mySessionID = [self sessionID];
218 NSUInteger currentSessionID = [UNIVERSE sessionID];
219 if (EXPECT_NOT(mySessionID != currentSessionID))
220 {
221 OOLogERR(@"entity.invalidSession", @"Entity %@ from session %llu cannot be added to universe in session %llu. This is an internal error, please report it.", [self shortDescription], mySessionID, currentSessionID);
222 return NO;
223 }
224
225 return YES;
226}
#define OOLogERR(class, format,...)
Definition OOLogging.h:112

◆ vectorTo:

- (Vector) vectorTo: (Entity *)  entity

Definition at line 55 of file Entity.m.

642 :(Entity *)entity
643{
644 return HPVectorToVector(HPvector_subtract([entity position], [self position]));
645}

◆ velocity

- (Vector) velocity

Reimplemented in ShipEntity.

◆ warnAboutHostiles

- (void) warnAboutHostiles

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

528{
529 // do nothing for now, this can be expanded in sub classes
530 OOLog(@"general.error.subclassResponsibility.Entity-warnAboutHostiles", @"%@", @"***** Entity does nothing in warnAboutHostiles");
531}

◆ wasAddedToUniverse

- (void) wasAddedToUniverse

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

516{
517 // Do nothing
518}

◆ wasRemovedFromUniverse

- (void) wasRemovedFromUniverse

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

522{
523 // Do nothing
524}

◆ zeroDistance

- (double) zeroDistance

Definition at line 55 of file Entity.m.

694{
695 return zero_distance;
696}

Member Data Documentation

◆ _jsSelf

- (struct JSObject*) _jsSelf
protected

Definition at line 152 of file Entity.h.

◆ _owner

- (OOWeakReference*) _owner
private

Definition at line 158 of file Entity.h.

◆ _sessionID

- (NSUInteger) _sessionID
private

Definition at line 156 of file Entity.h.

◆ _status

- (OOEntityStatus) _status
private

Definition at line 159 of file Entity.h.

◆ atmosphereFogging

- (OOColor*) atmosphereFogging

Definition at line 115 of file Entity.h.

◆ boundingBox

- (BoundingBox) boundingBox
protected

Definition at line 145 of file Entity.h.

Referenced by OOLaserShotEntity::dealloc, and ShipGetProperty().

◆ cam_zero_distance

- (GLfloat) cam_zero_distance

Definition at line 109 of file Entity.h.

◆ cameraRelativePosition

- (Vector) cameraRelativePosition

Definition at line 113 of file Entity.h.

◆ collider

- (Entity*) collider

Definition at line 128 of file Entity.h.

◆ collidingEntities

- (NSMutableArray*) collidingEntities
protected

Definition at line 148 of file Entity.h.

◆ collision_chain

- (Entity*) collision_chain

Definition at line 124 of file Entity.h.

◆ collision_radius

◆ collisionRegion

- (CollisionRegion *) collisionRegion

Definition at line 130 of file Entity.h.

◆ collisionTestFilter

- (unsigned) collisionTestFilter

Definition at line 100 of file Entity.h.

◆ distanceTravelled

- (GLfloat) distanceTravelled
protected

Definition at line 136 of file Entity.h.

◆ energy

- (GLfloat) energy
protected

Definition at line 142 of file Entity.h.

◆ hasCollided

- (unsigned) hasCollided

Definition at line 98 of file Entity.h.

◆ hasMoved

- (unsigned) hasMoved

Definition at line 96 of file Entity.h.

◆ hasRotated

- (unsigned) hasRotated

Definition at line 97 of file Entity.h.

◆ isExplicitlyNotMainStation

- (unsigned) isExplicitlyNotMainStation

Definition at line 103 of file Entity.h.

Referenced by Universe::IsCandidateMainStationPredicate.

◆ isImmuneToBreakPatternHide

- (BOOL) isImmuneToBreakPatternHide

Definition at line 102 of file Entity.h.

◆ isPlayer

- (BOOL) isPlayer

Definition at line 93 of file Entity.h.

◆ isShip

- (BOOL) isShip

Definition at line 91 of file Entity.h.

Referenced by OOLaserShotEntity::dealloc, and IsShipPredicate().

◆ isStation

- (BOOL) isStation

◆ isSubEntity

- (BOOL) isSubEntity

Definition at line 95 of file Entity.h.

Referenced by IsShipPredicate(), and IsVisualEffectPredicate().

◆ isSunlit

- (BOOL) isSunlit

Definition at line 99 of file Entity.h.

◆ isVisualEffect

- (BOOL) isVisualEffect

Definition at line 104 of file Entity.h.

Referenced by IsVisualEffectPredicate().

◆ isWormhole

- (BOOL) isWormhole

Definition at line 94 of file Entity.h.

◆ lastDrawCounter

- (NSUInteger) lastDrawCounter
protected

Definition at line 153 of file Entity.h.

◆ lastOrientation

- (Quaternion) lastOrientation
protected

Definition at line 134 of file Entity.h.

◆ lastPosition

- (HPVector) lastPosition
protected

Definition at line 133 of file Entity.h.

◆ mass

- (GLfloat) mass
protected

Definition at line 146 of file Entity.h.

◆ maxEnergy

- (GLfloat) maxEnergy
protected

Definition at line 143 of file Entity.h.

Referenced by OOShipLibraryShields().

◆ no_draw_distance

- (GLfloat) no_draw_distance

Definition at line 110 of file Entity.h.

◆ orientation

- (Quaternion) orientation

◆ position

◆ rotMatrix

- (OOMatrix) rotMatrix
protected

Definition at line 138 of file Entity.h.

◆ scanClass

- (OOScanClass) scanClass

Definition at line 106 of file Entity.h.

Referenced by HasScanClassPredicate().

◆ shadingEntityID

- (OOUniversalID) shadingEntityID

Definition at line 126 of file Entity.h.

◆ spawnTime

- (GLfloat) spawnTime
protected

Definition at line 150 of file Entity.h.

◆ throw_sparks

- (unsigned) throw_sparks

Definition at line 101 of file Entity.h.

◆ universalID

- (OOUniversalID) universalID

Definition at line 89 of file Entity.h.

◆ velocity

- (Vector) velocity
protected

Definition at line 140 of file Entity.h.

Referenced by OOLaserShotEntity::dealloc.

◆ x_next

- (Entity *) x_next

Definition at line 120 of file Entity.h.

Referenced by Universe::addEntity:.

◆ x_previous

- (Entity*) x_previous

Definition at line 120 of file Entity.h.

Referenced by Universe::addEntity:.

◆ y_next

- (Entity *) y_next

Definition at line 121 of file Entity.h.

Referenced by Universe::addEntity:.

◆ y_previous

- (Entity*) y_previous

Definition at line 121 of file Entity.h.

Referenced by Universe::addEntity:.

◆ z_next

- (Entity *) z_next

Definition at line 122 of file Entity.h.

Referenced by Universe::addEntity:.

◆ z_previous

- (Entity*) z_previous

Definition at line 122 of file Entity.h.

Referenced by Universe::addEntity:.

◆ zero_distance

- (GLfloat) zero_distance

Definition at line 108 of file Entity.h.

Referenced by HeadUpDisplay::hudDrawReticleOnTarget.

◆ zero_index

- (int) zero_index

Definition at line 117 of file Entity.h.


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