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

#include <OOECMBlastEntity.h>

Inheritance diagram for OOECMBlastEntity:
Collaboration diagram for OOECMBlastEntity:

Instance Methods

(id) - initFromShip:
(void) - update: [implementation]
(void) - drawImmediate:translucent: [implementation]
(BOOL) - isECMBlast [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) - 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) - applyVelocity:
(BOOL) - checkCloseCollisionWith:
(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
(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]
(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

Private Attributes

OOTimeDelta _nextBlast
uint_fast8_t _blastsRemaining
OOWeakReference_ship

Additional Inherited Members

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 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 33 of file OOECMBlastEntity.h.

Method Documentation

◆ drawImmediate:translucent:

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

Reimplemented from Entity.

Definition at line 111 of file OOECMBlastEntity.m.

111 :(bool)immediate translucent:(bool)translucent
112{
113#if ECM_DEBUG_DRAW && OO_DEBUG
114 OODebugDrawPoint(kZeroVector, [OOColor cyanColor]);
115#endif
116 // Else do nothing, we're invisible!
117}
void OODebugDrawPoint(Vector position, OOColor *color)
const Vector kZeroVector
Definition OOVector.m:28

References kZeroVector, and OODebugDrawPoint().

Here is the call graph for this function:

◆ initFromShip:

- (id) initFromShip: (ShipEntity *) ship

Definition at line 48 of file OOECMBlastEntity.m.

48 :(ShipEntity *)ship
49{
50 if (ship == nil)
51 {
52 DESTROY(self);
53 }
54 else if ((self = [super init]))
55 {
58 _ship = [ship weakRetain];
59
60 [self setPosition:[ship position]];
61
62 [self setStatus:STATUS_EFFECT];
63 [self setScanClass:CLASS_NO_DRAW];
64 }
65
66 return self;
67}
#define DESTROY(x)
Definition OOCocoa.h:77
#define ECM_PULSE_INTERVAL
#define ECM_PULSE_COUNT
return nil
HPVector position
Definition Entity.m:612
id init()
Definition Entity.m:68
uint_fast8_t _blastsRemaining
OOWeakReference * _ship
OOTimeDelta _nextBlast

References _blastsRemaining, _nextBlast, _ship, DESTROY, ECM_PULSE_COUNT, ECM_PULSE_INTERVAL, Entity::init, nil, Entity::position, Entity::setPosition:, Entity::setScanClass:, Entity::setStatus:, and OOWeakRefObject::weakRetain.

Here is the call graph for this function:

◆ isECMBlast

- (BOOL) isECMBlast
implementation

Reimplemented from Entity.

Definition at line 120 of file OOECMBlastEntity.m.

121{
122 return YES;
123}

References isECMBlast.

Referenced by isECMBlast.

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

◆ update:

- (void) update: (OOTimeDelta) delta_t
implementation

Reimplemented from Entity.

Definition at line 70 of file OOECMBlastEntity.m.

70 :(OOTimeDelta)delta_t
71{
72 _nextBlast -= delta_t;
73 ShipEntity *ship = [_ship weakRefUnderlyingObject];
74 BOOL validShip = (ship != nil) && ([ship status] != STATUS_DEAD);
75
76 if (_nextBlast <= 0.0 && validShip)
77 {
78 // Do ECM stuff.
79 double radius = OOClamp_0_1_d((double)(ECM_PULSE_COUNT - _blastsRemaining + 1) * 1.0 / (double)ECM_PULSE_COUNT);
80 radius *= SCANNER_MAX_RANGE;
82
83 NSArray *targets = [UNIVERSE findEntitiesMatchingPredicate:IsShipPredicate
84 parameter:NULL
85 inRange:radius
86 ofEntity:self];
87 NSUInteger i, count = [targets count];
88 if (count > 0)
89 {
90 JSContext *context = OOJSAcquireContext();
91 jsval ecmPulsesRemaining = INT_TO_JSVAL(_blastsRemaining);
92 jsval whomVal = OOJSValueFromNativeObject(context, ship);
93
94 for (i = 0; i < count; i++)
95 {
96 ShipEntity *target = [targets objectAtIndex:i];
97 ShipScriptEvent(context, target, "shipHitByECM", ecmPulsesRemaining, whomVal);
98 [target reactToAIMessage:@"ECM" context:nil];
99 [target noticeECM];
100 }
101
102 OOJSRelinquishContext(context);
103 }
105 }
106
107 if (_blastsRemaining == 0 || !validShip) [UNIVERSE removeEntity:self];
108}
#define SCANNER_MAX_RANGE
Definition Entity.h:51
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
OOINLINE JSContext * OOJSAcquireContext(void)
OOINLINE void OOJSRelinquishContext(JSContext *context)
unsigned count
double OOTimeDelta
Definition OOTypes.h:224
#define ShipScriptEvent(context, ship, event,...)
OOEntityStatus status()
Definition Entity.m:793
void reactToAIMessage:context:(NSString *message,[context] NSString *debugContext)

References _blastsRemaining, _nextBlast, count, ECM_PULSE_COUNT, ECM_PULSE_INTERVAL, nil, ShipEntity::noticeECM, OOJSAcquireContext(), OOJSRelinquishContext(), OOJSValueFromNativeObject(), ShipEntity::reactToAIMessage:context:, SCANNER_MAX_RANGE, ShipScriptEvent, Entity::status, and OOWeakReference::weakRefUnderlyingObject.

Here is the call graph for this function:

Member Data Documentation

◆ _blastsRemaining

- (uint_fast8_t) _blastsRemaining
private

Definition at line 37 of file OOECMBlastEntity.h.

Referenced by initFromShip:, and update:.

◆ _nextBlast

- (OOTimeDelta) _nextBlast
private

Definition at line 36 of file OOECMBlastEntity.h.

Referenced by initFromShip:, and update:.

◆ _ship

- (OOWeakReference*) _ship
private

Definition at line 38 of file OOECMBlastEntity.h.

Referenced by initFromShip:.


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