Oolite 1.91.0.7644-241112-7f5034b
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
 
(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
 
(NSArray *) - debugInspectorModules [implementation]
 
(NSString *) - inspScanClassLine
 
(NSString *) - inspStatusLine
 
(NSString *) - inspRetainCountLine
 
(NSString *) - inspPositionLine
 
(NSString *) - inspVelocityLine
 
(NSString *) - inspOrientationLine
 
(NSString *) - inspEnergyLine
 
(NSString *) - inspOwnerLine
 
(NSString *) - inspTargetLine
 
(NSString *) - inspDescription [implementation]
 
(NSString *) - inspBasicIdentityLine [implementation]
 
(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
 
- 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.

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

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.

675 :(HPVector) offset
676{
677 HPVector abspos = HPvector_add(position, OOHPVectorMultiplyMatrix(offset, rotMatrix));
678 Entity *last = nil;
679 Entity *father = [self parentEntity];
680
681 while (father != nil && father != last)
682 {
683 abspos = HPvector_add(OOHPVectorMultiplyMatrix(abspos, [father drawRotationMatrix]), [father position]);
684 last = father;
685 if (![last isSubEntity]) break;
686 father = [father owner];
687 }
688 return abspos;
689}
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:583
OOMatrix drawRotationMatrix()
Definition Entity.m:879
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.

229{
230#ifndef NDEBUG
232 OOLog(kOOLogEntityAddToList, @"DEBUG adding entity %@ to linked lists", self);
233#endif
234 //
235 // insert at the start
236 if (UNIVERSE)
237 {
238 x_previous = nil; x_next = UNIVERSE->x_list_start;
239 // move UP the list
241 {
244 }
245 if (x_next) x_next->x_previous = self;
246 if (x_previous) x_previous->x_next = self;
247 else UNIVERSE->x_list_start = self;
248
249 y_previous = nil; y_next = UNIVERSE->y_list_start;
250 // move UP the list
252 {
255 }
256 if (y_next) y_next->y_previous = self;
257 if (y_previous) y_previous->y_next = self;
258 else UNIVERSE->y_list_start = self;
259
260 z_previous = nil; z_next = UNIVERSE->z_list_start;
261 // move UP the list
263 {
266 }
267 if (z_next) z_next->z_previous = self;
268 if (z_previous) z_previous->z_next = self;
269 else UNIVERSE->z_list_start = self;
270
271 }
272
273#ifndef NDEBUG
275 {
276 if (![self checkLinkedLists])
277 {
278 OOLog(kOOLogEntityAddToListError, @"DEBUG LINKED LISTS - problem encountered while adding %@ to linked lists", self);
279 [UNIVERSE debugDumpEntities];
280 }
281 }
282#endif
283}
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:833
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:333
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, OOParticleSystem, and PlanetEntity.

Definition at line 55 of file Entity.m.

1108{
1109 return nil;
1110}

◆ applyRoll:andClimb:

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

Reimplemented in PlayerEntity, and ShipEntity.

Definition at line 55 of file Entity.m.

835 :(GLfloat) roll andClimb:(GLfloat) climb
836{
837 if ((roll == 0.0)&&(climb == 0.0)&&(!hasRotated))
838 return;
839
840 if (roll)
842 if (climb)
844
845 [self orientationChanged];
846}
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.

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

◆ applyVelocity:

- (void) applyVelocity: (OOTimeDelta) delta_t

Definition at line 55 of file Entity.m.

965 :(OOTimeDelta)delta_t
966{
967 position = HPvector_add(position, HPvector_multiply_scalar(vectorToHPVector(velocity), delta_t));
968}
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.

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

◆ cameraRangeFront

- (GLfloat) cameraRangeFront

Reimplemented in SkyEntity.

Definition at line 55 of file Entity.m.

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

◆ cameraRelativePosition

- (Vector) cameraRelativePosition

◆ camZeroDistance

- (double) camZeroDistance

Definition at line 55 of file Entity.m.

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

◆ canCollide

◆ checkCloseCollisionWith:

- (BOOL) checkCloseCollisionWith: (Entity *) other

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

Definition at line 55 of file Entity.m.

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

◆ checkLinkedLists

- (BOOL) checkLinkedLists
implementation

Provided by category Entity(OOPrivate).

Definition at line 55 of file Entity.m.

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

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

◆ collisionRadius

- (GLfloat) collisionRadius

Reimplemented in OOVisualEffectEntity.

Definition at line 55 of file Entity.m.

906{
907 return collision_radius;
908}

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.

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

◆ dealloc

- (void) dealloc
implementation

Reimplemented from OOWeakRefObject.

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

Definition at line 55 of file Entity.m.

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

Referenced by OOEntityWithDrawable::allTextures.

+ Here is the caller graph for this function:

◆ debugInspectorModules

- (NSArray *) debugInspectorModules
implementation

Reimplemented in ShipEntity.

Provided by category Entity(OOEntityDebugInspectorModule).

Definition at line 1 of file OOEntityDebugInspectorModule.m.

66{
67 return [[super debugInspectorModules] arrayByAddingInspectorModuleOfClass:[OOEntityDebugInspectorModule class]
68 forObject:(id)self];
69}

◆ 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, OOQuiriumCascadeEntity, OORingEffectEntity, OOSunEntity, PlanetEntity, ShipEntity, StationEntity, and WormholeEntity.

Definition at line 55 of file Entity.m.

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

◆ descriptionForObjDump

- (NSString *) descriptionForObjDump

Reimplemented in DustEntity, ShipEntity, and SkyEntity.

Definition at line 55 of file Entity.m.

1098{
1099 NSString *result = [self descriptionForObjDumpBasic];
1100
1101 result = [result stringByAppendingFormat:@" range: %g (visible: %@)", HPdistance([self position], [PLAYER position]), [self isVisible] ? @"yes" : @"no"];
1102
1103 return result;
1104}

◆ descriptionForObjDumpBasic

- (NSString *) descriptionForObjDumpBasic

Definition at line 55 of file Entity.m.

1088{
1089 NSString *result = [self descriptionComponents];
1090 if (result != nil) result = [NSString stringWithFormat:@"%@ %@", NSStringFromClass([self class]), result];
1091 else result = [self description];
1092
1093 return result;
1094}

◆ 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.

880{
881 return rotMatrix;
882}

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, OOLightParticleEntity, OOVisualEffectEntity, and ShipEntity.

Provided by category Entity(SubEntityRelationship).

Definition at line 14073 of file ShipEntity.m.

14864 :(bool)immediate translucent:(bool)translucent
14865{
14866 // Do nothing.
14867}

◆ drawTransformationMatrix

- (OOMatrix) drawTransformationMatrix

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

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

◆ dumpSelfState

- (void) dumpSelfState

Reimplemented in PlayerEntity, ShipEntity, StationEntity, and WormholeEntity.

Definition at line 55 of file Entity.m.

1014{
1015 NSMutableArray *flags = nil;
1016 NSString *flagsString = nil;
1017 id owner = [self owner];
1018
1019 if (owner == self) owner = @"self";
1020 else if (owner == nil) owner = @"none";
1021
1022 OOLog(@"dumpState.entity", @"Universal ID: %u", universalID);
1023 OOLog(@"dumpState.entity", @"Scan class: %@", OOStringFromScanClass(scanClass));
1024 OOLog(@"dumpState.entity", @"Status: %@", OOStringFromEntityStatus([self status]));
1025 OOLog(@"dumpState.entity", @"Position: %@", HPVectorDescription(position));
1026 OOLog(@"dumpState.entity", @"Orientation: %@", QuaternionDescription(orientation));
1027 OOLog(@"dumpState.entity", @"Distance travelled: %g", distanceTravelled);
1028 OOLog(@"dumpState.entity", @"Energy: %g of %g", energy, maxEnergy);
1029 OOLog(@"dumpState.entity", @"Mass: %g", mass);
1030 OOLog(@"dumpState.entity", @"Owner: %@", owner);
1031
1032 flags = [NSMutableArray array];
1033 #define ADD_FLAG_IF_SET(x) if (x) { [flags addObject:@#x]; }
1043 flagsString = [flags count] ? [flags componentsJoinedByString:@", "] : (NSString *)@"none";
1044 OOLog(@"dumpState.entity", @"Flags: %@", flagsString);
1045 OOLog(@"dumpState.entity", @"Collision Test Filter: %u", collisionTestFilter);
1046
1047}
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:793
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.

997{
998 if (OOLogWillDisplayMessagesInClass(@"dumpState"))
999 {
1000 OOLog(@"dumpState", @"State for %@:", self);
1002 OOLogIndent();
1003 @try
1004 {
1005 [self dumpSelfState];
1006 }
1007 @catch (id exception) {}
1009 }
1010}
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.

978{
980 return 0;
981}

◆ fogUniform

- (OOColor *) fogUniform

Definition at line 55 of file Entity.m.

1082{
1083 return [[atmosphereFogging retain] autorelease];
1084}

◆ frustumRadius

- (GLfloat) frustumRadius

Reimplemented in OOVisualEffectEntity, and ShipEntity.

Definition at line 55 of file Entity.m.

912{
913 return collision_radius;
914}

◆ getJSClass:andPrototype:

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

Reimplemented in DockEntity, OOExhaustPlumeEntity, OOFlasherEntity, OOSunEntity, OOVisualEffectEntity, OOWaypointEntity, ShipEntity, StationEntity, 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, PlanetEntity, 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
97 return self;
98}
#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 _sessionID
Definition Entity.h:155
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.

+ Here is the caller graph for this function:

◆ inspBasicIdentityLine

- (NSString *) inspBasicIdentityLine
implementation

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

96{
97 OOUniversalID myID = [self universalID];
98
99 if (myID != NO_TARGET)
100 {
101 return [NSString stringWithFormat:@"%@ ID %u", [self class], myID];
102 }
103 else
104 {
105 return [self className];
106 }
107}
uint16_t OOUniversalID
Definition OOTypes.h:189
@ NO_TARGET
Definition OOTypes.h:194

◆ inspDescription

- (NSString *) inspDescription
implementation

Reimplemented in PlayerEntity, and ShipEntity.

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

90{
91 return [NSString stringWithFormat:@"%@ ID %u", [self class], [self universalID]];
92}

◆ inspect

- (void) inspect
implementation

Provided by category Entity(OODebugInspector).

Referenced by ConsoleInspectEntity().

+ Here is the caller graph for this function:

◆ inspEnergyLine

- (NSString *) inspEnergyLine

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

150{
151 return [NSString stringWithFormat:@"%i/%i", (int)[self energy], (int)[self maxEnergy]];
152}

◆ inspOrientationLine

- (NSString *) inspOrientationLine

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

143{
144 Quaternion q = [self orientation];
145 return [NSString stringWithFormat:@"%.3f (%.3f, %.3f, %.3f)", q.w, q.x, q.y, q.z];
146}

◆ inspOwnerLine

- (NSString *) inspOwnerLine

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

156{
157 if ([self owner] == self) return @"Self";
158 return [[self owner] inspDescription];
159}

◆ inspPositionLine

- (NSString *) inspPositionLine

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

129{
130 HPVector v = [self position];
131 return [NSString stringWithFormat:@"%.0f, %.0f, %.0f", v.x, v.y, v.z];
132}

◆ inspRetainCountLine

- (NSString *) inspRetainCountLine

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

123{
124 return [NSString stringWithFormat:@"%lu", [self retainCount]];
125}

◆ inspScanClassLine

- (NSString *) inspScanClassLine

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

111{
112 return OOStringFromScanClass([self scanClass]);
113}

◆ inspStatusLine

- (NSString *) inspStatusLine

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

117{
118 return OOStringFromEntityStatus([self status]);
119}

◆ inspTargetLine

- (NSString *) inspTargetLine

Reimplemented in ShipEntity.

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

163{
164 return nil;
165}

◆ inspVelocityLine

- (NSString *) inspVelocityLine

Provided by category Entity(OOEntityInspectorExtensions).

Definition at line 1 of file OOEntityInspectorExtensions.m.

136{
137 Vector v = [self velocity];
138 return [NSString stringWithFormat:@"%.1f, %.1f, %.1f (%.1f)", v.x, v.y, v.z, magnitude(v)];
139}

◆ 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.

138{
139 return NO;
140}

◆ 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.

250{
251 return NO;
252}

◆ isImmuneToBreakPatternHide

- (BOOL) isImmuneToBreakPatternHide

◆ isInSpace

- (BOOL) isInSpace

Definition at line 55 of file Entity.m.

1121{
1122 switch ([self status])
1123 {
1124 case STATUS_IN_FLIGHT:
1125 case STATUS_DOCKING:
1126 case STATUS_LAUNCHING:
1127 case STATUS_AUTOPILOT_ENGAGED:
1128 case STATUS_WITCHSPACE_COUNTDOWN:
1129 case STATUS_BEING_SCOOPED:
1130 case STATUS_EFFECT:
1131 case STATUS_ACTIVE:
1132 return YES;
1133 default:
1134 return NO;
1135 }
1136}

◆ isPlanet

- (BOOL) isPlanet

Reimplemented in PlanetEntity.

Definition at line 55 of file Entity.m.

162{
163 return NO;
164}

◆ 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 14073 of file ShipEntity.m.

14858 :(Entity *)other
14859{
14860 return NO;
14861}

◆ isSky

- (BOOL) isSky

Reimplemented in SkyEntity.

Definition at line 55 of file Entity.m.

186{
187 return NO;
188}

◆ isStation

- (BOOL) isStation

◆ isStellarObject

- (BOOL) isStellarObject

Definition at line 55 of file Entity.m.

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

◆ isSubEntity

- (BOOL) isSubEntity

◆ isSun

- (BOOL) isSun

Reimplemented in OOSunEntity.

Definition at line 55 of file Entity.m.

168{
169 return NO;
170}

Referenced by IsSunPredicate().

+ Here is the caller graph for this function:

◆ isSunlit

- (BOOL) isSunlit

◆ isVisible

- (BOOL) isVisible

Reimplemented in OOSunEntity, PlanetEntity, ShipEntity, and SkyEntity.

Definition at line 55 of file Entity.m.

1115{
1117}
#define ABSOLUTE_NO_DRAW_DISTANCE2
Definition Entity.h:47

◆ isVisibleToScripts

- (BOOL) isVisibleToScripts

Reimplemented in OOExhaustPlumeEntity, OOFlasherEntity, OOSunEntity, OOVisualEffectEntity, OOWaypointEntity, ShipEntity, 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.

209{
210 return NO;
211}

◆ isWormhole

- (BOOL) isWormhole

◆ mass

- (GLfloat) mass

◆ maxEnergy

- (GLfloat) maxEnergy

◆ moveForward:

- (void) moveForward: (double) amount

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

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

◆ normalOrientation

- (Quaternion) normalOrientation

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

739{
740 return [self orientation];
741}

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.

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

◆ owner

- (id) owner

Definition at line 55 of file Entity.m.

584{
585 return [_owner weakRefUnderlyingObject];
586}

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.

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

◆ 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.

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

◆ removeFromLinkedLists

- (void) removeFromLinkedLists

Definition at line 55 of file Entity.m.

287{
288#ifndef NDEBUG
290 OOLog(kOOLogEntityRemoveFromList, @"DEBUG removing entity %@ from linked lists", self);
291#endif
292
293 if ((x_next == nil)&&(x_previous == nil)) // removed already!
294 return;
295
296 // make sure the starting point is still correct
297 if (UNIVERSE)
298 {
299 if ((UNIVERSE->x_list_start == self)&&(x_next))
300 UNIVERSE->x_list_start = x_next;
301 if ((UNIVERSE->y_list_start == self)&&(y_next))
302 UNIVERSE->y_list_start = y_next;
303 if ((UNIVERSE->z_list_start == self)&&(z_next))
304 UNIVERSE->z_list_start = z_next;
305 }
306 //
309 //
312 //
315 //
319
320#ifndef NDEBUG
322 {
323 if (![self checkLinkedLists])
324 {
325 OOLog(kOOLogEntityRemoveFromListError, @"DEBUG LINKED LISTS - problem encountered while removing %@ from linked lists", self);
326 [UNIVERSE debugDumpEntities];
327 }
328 }
329#endif
330}
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.

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

Referenced by OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ rotationMatrix

- (OOMatrix) rotationMatrix

Definition at line 55 of file Entity.m.

874{
875 return rotMatrix;
876}

◆ scanClass

- (OOScanClass) scanClass

Reimplemented in ShipEntity.

◆ sessionID

- (NSUInteger) sessionID

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

126{
127 return _sessionID;
128}

◆ setAtmosphereFogging:

- (void) setAtmosphereFogging: (OOColor *) fogging

Definition at line 55 of file Entity.m.

1075 : (OOColor *)fogging
1076{
1077 [atmosphereFogging release];
1078 atmosphereFogging = [fogging retain];
1079}

◆ setCollisionRadius:

- (void) setCollisionRadius: (GLfloat) amount

Definition at line 55 of file Entity.m.

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

◆ setCollisionRegion:

- (void) setCollisionRegion: (CollisionRegion*) region

Definition at line 55 of file Entity.m.

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

◆ setDistanceTravelled:

- (void) setDistanceTravelled: (GLfloat) value

Definition at line 55 of file Entity.m.

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

◆ setEnergy:

- (void) setEnergy: (GLfloat) amount

Definition at line 55 of file Entity.m.

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

Referenced by EntitySetProperty().

+ Here is the caller graph for this function:

◆ setMaxEnergy:

- (void) setMaxEnergy: (GLfloat) amount

Definition at line 55 of file Entity.m.

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

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.

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

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 PlanetEntity.

Definition at line 55 of file Entity.m.

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

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.

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

Referenced by OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ setPosition:

- (void) setPosition: (HPVector) posn

Reimplemented in OOSunEntity, and PlanetEntity.

Definition at line 55 of file Entity.m.

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

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.

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

◆ setScanClass:

- (void) setScanClass: (OOScanClass) sClass

Definition at line 55 of file Entity.m.

799 :(OOScanClass)sClass
800{
801 scanClass = sClass;
802}
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.

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

Referenced by WormholeEntity::arrivalTime, and OOLaserShotEntity::dealloc.

+ Here is the caller graph for this function:

◆ setThrowSparks:

- (void) setThrowSparks: (BOOL) value

Definition at line 55 of file Entity.m.

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

◆ setUniversalID:

- (void) setUniversalID: (OOUniversalID) uid

Definition at line 55 of file Entity.m.

546 :(OOUniversalID)uid
547{
548 universalID = uid;
549}

◆ setVelocity:

- (void) setVelocity: (Vector) vel

Definition at line 55 of file Entity.m.

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

◆ spawnTime

- (GLfloat) spawnTime

◆ speed

- (double) speed

Definition at line 55 of file Entity.m.

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

◆ status

- (OOEntityStatus) status

Definition at line 55 of file Entity.m.

794{
795 return _status;
796}

Referenced by EntityGetProperty().

+ 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.

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

◆ superShaderBindingTarget

- (id< OOWeakReferenceSupport >) superShaderBindingTarget
implementation

Definition at line 55 of file Entity.m.

598{
599 return [self parentEntity];
600}

◆ 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.

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

◆ throwingSparks

- (BOOL) throwingSparks

Definition at line 55 of file Entity.m.

559{
560 return throw_sparks;
561}

◆ throwSparks

- (void) throwSparks

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

571{
572 // do nothing for now
573}

◆ timeElapsedSinceSpawn

- (GLfloat) timeElapsedSinceSpawn

Definition at line 55 of file Entity.m.

1070{
1071 return [UNIVERSE getTime] - spawnTime;
1072}

◆ transformationMatrix

- (OOMatrix) transformationMatrix

Definition at line 55 of file Entity.m.

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

◆ universalID

- (OOUniversalID) universalID

◆ universalTime

- (GLfloat) universalTime

Definition at line 55 of file Entity.m.

1058{
1059 return [UNIVERSE getTime];
1060}

◆ update:

- (void) update: (OOTimeDelta) delta_t

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

Definition at line 55 of file Entity.m.

929 :(OOTimeDelta)delta_t
930{
931 if (_status != STATUS_COCKPIT_DISPLAY)
932 {
933 if ([self isSubEntity])
934 {
935 zero_distance = [[self owner] zeroDistance];
936 cam_zero_distance = [[self owner] camZeroDistance];
937 [self updateCameraRelativePosition];
938 }
939 else
940 {
941 zero_distance = HPdistance2(PLAYER->position, position);
942 cam_zero_distance = HPdistance2([PLAYER viewpointPosition], position);
943 [self updateCameraRelativePosition];
944 }
945 }
946 else
947 {
948 zero_distance = HPmagnitude2(position);
950 cameraRelativePosition = HPVectorToVector(position);
951 }
952
953 if ([self status] != STATUS_COCKPIT_DISPLAY)
954 {
955 [self applyVelocity:delta_t];
956 }
957
958 hasMoved = !HPvector_equal(position, lastPosition);
959 hasRotated = !quaternion_equal(orientation, lastOrientation);
962}
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.

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

◆ updateLinkedLists

- (void) updateLinkedLists

Definition at line 55 of file Entity.m.

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

◆ validForAddToUniverse

- (BOOL) validForAddToUniverse

Reimplemented in PlayerEntity, and ShipEntity.

Definition at line 55 of file Entity.m.

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

◆ vectorTo:

- (Vector) vectorTo: (Entity *) entity

Definition at line 55 of file Entity.m.

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

◆ velocity

- (Vector) velocity

Reimplemented in ShipEntity.

◆ warnAboutHostiles

- (void) warnAboutHostiles

Reimplemented in PlayerEntity.

Definition at line 55 of file Entity.m.

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

◆ wasAddedToUniverse

- (void) wasAddedToUniverse

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

515{
516 // Do nothing
517}

◆ wasRemovedFromUniverse

- (void) wasRemovedFromUniverse

Reimplemented in ShipEntity.

Definition at line 55 of file Entity.m.

521{
522 // Do nothing
523}

◆ zeroDistance

- (double) zeroDistance

Definition at line 55 of file Entity.m.

693{
694 return zero_distance;
695}

Member Data Documentation

◆ _jsSelf

- (struct JSObject*) _jsSelf
protected

Definition at line 152 of file Entity.h.

◆ _owner

- (OOWeakReference*) _owner
private

Definition at line 157 of file Entity.h.

◆ _sessionID

- (NSUInteger) _sessionID
private

Definition at line 155 of file Entity.h.

◆ _status

- (OOEntityStatus) _status
private

Definition at line 158 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.

◆ 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: