Oolite
Loading...
Searching...
No Matches
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]
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
(NSUInteger) - lastDrawCounter
(void) - setLastDrawCounter:
(double) - findCollisionRadius
(BOOL) - isVisible
(BOOL) - isInSpace
(BOOL) - isImmuneToBreakPatternHide
(GLfloat) - universalTime
(GLfloat) - spawnTime
(GLfloat) - timeElapsedSinceSpawn
(void) - setAtmosphereFogging:
(OOColor *) - fogUniform
(id) - init [implementation]
(void) - dealloc [implementation]
(NSString *) - descriptionComponents [implementation]
(BOOL) - checkLinkedLists [implementation]
(id< OOWeakReferenceSupport >) - superShaderBindingTarget [implementation]
(Vector) - relativePosition [implementation]
(void) - subEntityReallyDied: [implementation]
(BOOL) - isBreakPattern
(BOOL) - isECMBlast
(BOOL) - isExhaust
(BOOL) - isFlasher
(BOOL) - isVisibleToScripts
(BOOL) - isVisibleToScripts
(NSString *) - oo_jsClassName
(NSString *) - oo_jsClassName
(void) - getJSClass:andPrototype:
(void) - deleteJSSelf
(void) - deleteJSSelf
(JSClassID) - oo_jsClassID
(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
OOColor * atmosphereFogging
int zero_index
Entity * x_previous
Entity * x_next
Entity * y_previous
Entity * y_next
Entity * z_previous
Entity * z_next
Entity * collision_chain
OOUniversalID shadingEntityID
Entity * collider
CollisionRegion * collisionRegion
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
NSUInteger lastDrawCounter
Protected Attributes inherited from OOWeakRefObject
OOWeakReference * weakSelf

Detailed Description

Definition at line 28 of file OOPlasmaShotEntity.h.

Method Documentation

◆ canCollide

- (BOOL) canCollide
implementation

Reimplemented from OOLightParticleEntity.

Definition at line 64 of file OOPlasmaShotEntity.m.

65{
66 return [UNIVERSE getTime] > [self spawnTime] + kPlasmaShotActivationDelay;
67}
#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 69 of file OOPlasmaShotEntity.m.

69 :(Entity*)other
70{
71 return ([other rootShipEntity] != [self owner]) && ![other isEffect];
72}
BOOL isEffect()
Definition Entity.m:180
ShipEntity * rootShipEntity()
Definition Entity.m:566
id owner()
Definition Entity.m:548

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 43 of file OOPlasmaShotEntity.m.

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

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 74 of file OOPlasmaShotEntity.m.

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

References OOLightParticleEntity::_colorComponents, _duration, Entity::collidingEntities, count, Entity::energy, OOClamp_0_1_f(), 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 30 of file OOPlasmaShotEntity.h.

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


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