Oolite 1.91.0.7677-250528-09ed63a
All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
OOPlasmaShotEntity Class Reference

#include <OOPlasmaShotEntity.h>

Inheritance diagram for OOPlasmaShotEntity:
Collaboration diagram for OOPlasmaShotEntity:

Instance Methods

(id) - initWithPosition:velocity:energy:duration:color:
(BOOL) - canCollide [implementation]
(BOOL) - checkCloseCollisionWith: [implementation]
(void) - update: [implementation]
Instance Methods inherited from OOLightParticleEntity
(id) - initWithDiameter:
(float) - diameter
(void) - setDiameter:
(void) - setColor:
(void) - setColor:alpha:
(OOTexture *) - texture
(void) - drawSubEntityImmediate:translucent:
(void) - drawImmediate:translucent: [implementation]
(BOOL) - isEffect [implementation]
(NSSet *) - allTextures [implementation]
Instance Methods inherited from Entity
(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) - 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
(GLfloat) - collisionRadius
(GLfloat) - frustumRadius
(void) - setCollisionRadius:
(NSMutableArray *) - collisionArray
(void) - applyVelocity:
(void) - takeEnergyDamage:from:becauseOf:weaponIdentifier:
(void) - dumpState
(void) - dumpSelfState
(double) - findCollisionRadius
(BOOL) - isVisible
(BOOL) - isInSpace
(BOOL) - isImmuneToBreakPatternHide
(GLfloat) - universalTime
(GLfloat) - spawnTime
(GLfloat) - timeElapsedSinceSpawn
(void) - setAtmosphereFogging:
(OOColor *) - fogUniform
(NSString *) - descriptionForObjDumpBasic
(NSString *) - descriptionForObjDump
(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:
Instance Methods inherited from OOWeakRefObject
(id) - weakSelf
(id) - weakRetain [implementation]
(void) - weakRefDied: [implementation]
Instance Methods inherited from <OOWeakReferenceSupport>
(id) - OO_RETURNS_RETAINED

Private Attributes

OOTimeDelta _duration

Additional Inherited Members

Class Methods inherited from OOLightParticleEntity
(void) + setUpTexture
(OOTexture *) + defaultParticleTexture
(void) + resetGraphicsState [implementation]
Public Attributes inherited from Entity
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 inherited from OOLightParticleEntity
GLfloat _colorComponents [4]
float _diameter
Protected Attributes inherited from Entity
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

Detailed Description

Definition at line 29 of file OOPlasmaShotEntity.h.

Method Documentation

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from OOLightParticleEntity.

Definition at line 69 of file OOPlasmaShotEntity.m.

70{
71 return [UNIVERSE getTime] > [self spawnTime] + kPlasmaShotActivationDelay;
72}
#define kPlasmaShotActivationDelay

References canCollide, kPlasmaShotActivationDelay, and Entity::spawnTime.

Referenced by canCollide.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkCloseCollisionWith:

- (BOOL) checkCloseCollisionWith: (Entity *) other
implementation

Reimplemented from Entity.

Definition at line 75 of file OOPlasmaShotEntity.m.

75 :(Entity *)other
76{
77 return ([other rootShipEntity] != [self owner]) && ![other isEffect];
78}
BOOL isEffect()
Definition Entity.m:196
ShipEntity * rootShipEntity()
Definition Entity.m:603
id owner()
Definition Entity.m:583

References Entity::isEffect, Entity::owner, and Entity::rootShipEntity.

Here is the call graph for this function:

◆ initWithPosition:velocity:energy:duration:color:

- (id) initWithPosition: (HPVector) position
velocity: (Vector) velocity
energy: (float) energy
duration: (OOTimeDelta) duration
color: (OOColor *) color 

Definition at line 46 of file OOPlasmaShotEntity.m.

46 :(HPVector)inPosition
47 velocity:(Vector)inVelocity
48 energy:(float)inEnergy
49 duration:(OOTimeDelta)duration
50 color:(OOColor *)color
51{
52 if ((self = [super initWithDiameter:kPlasmaShotSize]))
53 {
54 [self setPosition:inPosition];
55 [self setVelocity:inVelocity];
56 [self setCollisionRadius:2.0];
57
58 [self setColor:color alpha:1.0];
59 _colorComponents[3] = 1.0f;
60
61 [self setEnergy:inEnergy];
62 _duration = duration;
63 }
64
65 return self;
66}
#define kPlasmaShotSize
double OOTimeDelta
Definition OOTypes.h:224
GLfloat energy
Definition Entity.m:817
Vector velocity
Definition Entity.m:763

References OOLightParticleEntity::_colorComponents, _duration, kPlasmaShotSize, Entity::setCollisionRadius:, OOLightParticleEntity::setColor:alpha:, Entity::setEnergy:, Entity::setPosition:, and Entity::setVelocity:.

Here is the call graph for this function:

◆ update:

- (void) update: (double) delta_t
implementation

Reimplemented from Entity.

Definition at line 81 of file OOPlasmaShotEntity.m.

81 :(double)delta_t
82{
83 [super update:delta_t];
84
85 OOTimeDelta lifeTime = [self timeElapsedSinceSpawn];
86
87#if PLASMA_ATTENUATION
88 float attenuation = OOClamp_0_1_f(1.0f - lifeTime / _duration);
89#else
90 const float attenuation = 1.0f;
91#endif
92
93 NSUInteger i, count = [collidingEntities count];
94 for (i = 0; i < count; i++)
95 {
96 Entity *e = (Entity *)[collidingEntities objectAtIndex:i];
97 if ([e rootShipEntity] != [self owner])
98 {
99 // we're going to force the weapon id to be a phantom equipment key so there is something for
100 // the PlayerEntitySound to reference. it allow allows for the sound effects to be overridden by OXP.
101 [e takeEnergyDamage:[self energy] * attenuation
102 from:self
103 becauseOf:[self owner]
104 weaponIdentifier:@"EQ_WEAPON_PLASMA_SHOT"];
105 [UNIVERSE removeEntity:self];
106
107 // Spawn a plasma burst.
108 OOPlasmaBurstEntity *burst = [[OOPlasmaBurstEntity alloc] initWithPosition:[self position]];
109 [UNIVERSE addEntity:burst];
110 [burst release];
111 }
112 }
113
114#if PLASMA_ATTENUATION
115 _colorComponents[3] = attenuation;
116#endif
117
118 if (lifeTime > _duration) [UNIVERSE removeEntity:self];
119}
unsigned count
#define UNIVERSE
Definition Universe.h:840
NSMutableArray * collidingEntities
Definition Entity.h:148
void takeEnergyDamage:from:becauseOf:weaponIdentifier:(double amount,[from] Entity *ent,[becauseOf] Entity *other,[weaponIdentifier] NSString *weaponIdentifier)
Definition Entity.m:990

References OOLightParticleEntity::_colorComponents, _duration, Entity::collidingEntities, count, Entity::energy, Entity::owner, Entity::position, Entity::rootShipEntity, Entity::takeEnergyDamage:from:becauseOf:weaponIdentifier:, Entity::timeElapsedSinceSpawn, and Entity::update:.

Here is the call graph for this function:

Member Data Documentation

◆ _duration

- (OOTimeDelta) _duration
private

Definition at line 32 of file OOPlasmaShotEntity.h.

Referenced by initWithPosition:velocity:energy:duration:color:, and update:.


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