Oolite 1.91.0.7668-250429-8542c40
All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
PlayerEntity(ScriptMethods) Category Reference

#include <PlayerEntityScriptMethods.h>

Instance Methods

(unsigned) - score
 
(void) - setScore:
 
(double) - creditBalance
 
(void) - setCreditBalance:
 
(NSString *) - dockedStationName
 
(NSString *) - dockedStationDisplayName
 
(BOOL) - dockedAtMainStation
 
(void) - awardCommodityType:amount:
 
(void) - resetScannerZoom
 
(OOGalaxyID- currentGalaxyID
 
(OOSystemID- currentSystemID
 
(void) - setMissionChoice:
 
(void) - setMissionChoice:withEvent:
 
(void) - setMissionChoice:keyPress:
 
(void) - setMissionChoice:keyPress:withEvent:
 
(void) - allowMissionInterrupt
 
(OOTimeDelta- scriptTimer
 
(unsigned) - systemPseudoRandom100
 
(unsigned) - systemPseudoRandom256
 
(double) - systemPseudoRandomFloat
 
(NSDictionary *) - passengerContractMarker:
 
(NSDictionary *) - parcelContractMarker:
 
(NSDictionary *) - cargoContractMarker:
 
(NSDictionary *) - defaultMarker:
 
(NSDictionary *) - validatedMarker:
 
(NSString *) - keyBindingDescription2:
 
(NSString *) - getKeyBindingDescription:
 
(NSString *) - keyCodeDescription:
 
(NSString *) - keyCodeDescriptionShort:
 
(NSString *) - commanderKillsAsString
 
(NSString *) - commanderBountyAsString
 
(NSString *) - creditsFormattedForSubstitution
 
(NSString *) - creditsFormattedForLegacySubstitution
 

Detailed Description

Definition at line 31 of file PlayerEntityScriptMethods.h.

Method Documentation

◆ allowMissionInterrupt

- (void) allowMissionInterrupt

Extends class PlayerEntity.

Definition at line 236 of file PlayerEntityScriptMethods.m.

237{
238 _missionAllowInterrupt = YES;
239}

References allowMissionInterrupt.

Referenced by allowMissionInterrupt.

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

◆ awardCommodityType:amount:

- (void) awardCommodityType: (NSString *) type
amount: (OOCargoQuantity) amount 

Extends class PlayerEntity.

Definition at line 82 of file PlayerEntityScriptMethods.m.

82 :(OOCommodityType)type amount:(OOCargoQuantity)amount
83{
84 OOMassUnit unit;
85
86 if (![[UNIVERSE commodities] goodDefined:type])
87 {
88 return;
89 }
90
91 OOLog(@"script.debug.note.awardCargo", @"Going to award cargo: %d x '%@'", amount, type);
92
93 unit = [shipCommodityData massUnitForGood:type];
94
95 if ([self status] != STATUS_DOCKED)
96 {
97 // in-flight
98 while (amount)
99 {
100 if (unit != UNITS_TONS)
101 {
102 if (specialCargo)
103 {
104 // is this correct behaviour?
105 [shipCommodityData addQuantity:amount forGood:type];
106 }
107 else
108 {
109 int amount_per_container = (unit == UNITS_KILOGRAMS)? 1000 : 1000000;
110 while (amount > 0)
111 {
112 int smaller_quantity = 1 + ((amount - 1) % amount_per_container);
113 if ([cargo count] < [self maxAvailableCargoSpace])
114 {
115 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
116 if (container)
117 {
118 // the cargopod ship is just being set up. If ejected, will call UNIVERSE addEntity
119 // [container wasAddedToUniverse]; // seems to be not needed anymore for pods
120 [container setScanClass: CLASS_CARGO];
121 [container setStatus:STATUS_IN_HOLD];
122 [container setCommodity:type andAmount:smaller_quantity];
123 [cargo addObject:container];
124 [container release];
125 }
126 }
127 amount -= smaller_quantity;
128 }
129 }
130 }
131 else if (!specialCargo)
132 // no adding TCs while special cargo in hold
133 {
134 // put each ton in a separate container
135 while (amount)
136 {
137 if ([cargo count] < [self maxAvailableCargoSpace])
138 {
139 ShipEntity* container = [UNIVERSE newShipWithRole:@"1t-cargopod"];
140 if (container)
141 {
142 // the cargopod ship is just being set up. If ejected, will call UNIVERSE addEntity
143 // [container wasAddedToUniverse]; // seems to be not needed anymore for pods
144 [container setScanClass: CLASS_CARGO];
145 [container setStatus:STATUS_IN_HOLD];
146 [container setCommodity:type andAmount:1];
147 [cargo addObject:container];
148 [container release];
149 }
150 }
151 amount--;
152 }
153 }
154 }
155 }
156 else
157 { // docked
158 // like purchasing a commodity
159 int manifest_quantity = [shipCommodityData quantityForGood:type];
160 while ((amount)&&(current_cargo < [self maxAvailableCargoSpace]))
161 {
162 manifest_quantity++;
163 amount--;
164 if (unit == UNITS_TONS) current_cargo++;
165 }
166 [shipCommodityData setQuantity:manifest_quantity forGood:type];
167 }
168 [self calculateCurrentCargo];
169}
#define OOLog(class, format,...)
Definition OOLogging.h:88
unsigned count
NSString * OOCommodityType
Definition OOTypes.h:106
uint32_t OOCargoQuantity
Definition OOTypes.h:176
OOMassUnit
Definition OOTypes.h:123
@ UNITS_TONS
Definition OOTypes.h:124
@ UNITS_KILOGRAMS
Definition OOTypes.h:125
#define UNIVERSE
Definition Universe.h:840
void setScanClass:(OOScanClass sClass)
Definition Entity.m:799
void setStatus:(OOEntityStatus stat)
void setCommodity:andAmount:(OOCommodityType co_type,[andAmount] OOCargoQuantity co_amount)

References PlayerEntity::calculateCurrentCargo, count, OOLog, ShipEntity::setCommodity:andAmount:, Entity::setScanClass:, ShipEntity::setStatus:, UNITS_KILOGRAMS, UNITS_TONS, and UNIVERSE.

+ Here is the call graph for this function:

◆ cargoContractMarker:

- (NSDictionary *) cargoContractMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 300 of file PlayerEntityScriptMethods.m.

300 :(OOSystemID)system
301{
302 return [[[NSDictionary dictionaryWithObjectsAndKeys:
303 [NSNumber numberWithInt:system], @"system",
304 MISSION_DEST_LEGACY, @"name",
305 @"orangeColor", @"markerColor",
306 @"MARKER_SQUARE", @"markerShape",
307 nil] retain] autorelease];
308}
int16_t OOSystemID
Definition OOTypes.h:211

◆ commanderBountyAsString

- (NSString *) commanderBountyAsString

Extends class PlayerEntity.

Definition at line 367 of file PlayerEntityScriptMethods.m.

368{
369 return [NSString stringWithFormat:@"%i", [self legalStatus]];
370}

References commanderBountyAsString, and PlayerEntity::legalStatus.

Referenced by commanderBountyAsString.

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

◆ commanderKillsAsString

- (NSString *) commanderKillsAsString

Extends class PlayerEntity.

Definition at line 374 of file PlayerEntityScriptMethods.m.

375{
376 return [NSString stringWithFormat:@"%i", [self score]];
377}

References commanderKillsAsString, and PlayerEntity::score.

Referenced by commanderKillsAsString.

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

◆ creditBalance

- (double) creditBalance

Extends class PlayerEntity.

Definition at line 52 of file PlayerEntityScriptMethods.m.

53{
54 return 0.1 * credits;
55}

References creditBalance.

Referenced by creditBalance.

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

◆ creditsFormattedForLegacySubstitution

- (NSString *) creditsFormattedForLegacySubstitution

Extends class PlayerEntity.

Definition at line 356 of file PlayerEntityScriptMethods.m.

357{
358 OOCreditsQuantity tenthsOfCredits = [self deciCredits];
359 unsigned long long integerCredits = tenthsOfCredits / 10;
360 unsigned long long tenths = tenthsOfCredits % 10;
361
362 return [NSString stringWithFormat:@"%llu.%llu", integerCredits, tenths];
363}
uint64_t OOCreditsQuantity
Definition OOTypes.h:182

References creditsFormattedForLegacySubstitution, and PlayerEntity::deciCredits.

Referenced by creditsFormattedForLegacySubstitution.

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

◆ creditsFormattedForSubstitution

- (NSString *) creditsFormattedForSubstitution

Extends class PlayerEntity.

Definition at line 344 of file PlayerEntityScriptMethods.m.

345{
346 return OOStringFromDeciCredits([self deciCredits], YES, NO);
347}
NSString * OOStringFromDeciCredits(OOCreditsQuantity tenthsOfCredits, BOOL includeDecimal, BOOL includeSymbol)

References creditsFormattedForSubstitution, and OOStringFromDeciCredits().

Referenced by creditsFormattedForSubstitution.

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

◆ currentGalaxyID

- (OOGalaxyID) currentGalaxyID

Extends class PlayerEntity.

Definition at line 178 of file PlayerEntityScriptMethods.m.

179{
180 return galaxy_number;
181}

References currentGalaxyID.

Referenced by currentGalaxyID.

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

◆ currentSystemID

- (OOSystemID) currentSystemID

Extends class PlayerEntity.

Definition at line 184 of file PlayerEntityScriptMethods.m.

185{
186 if ([UNIVERSE sun] == nil) return -1; // Interstellar space
187 return [UNIVERSE currentSystemID];
188}
return nil

References currentSystemID, nil, and UNIVERSE.

Referenced by currentSystemID.

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

◆ defaultMarker:

- (NSDictionary *) defaultMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 311 of file PlayerEntityScriptMethods.m.

311 :(OOSystemID)system
312{
313 return [[[NSDictionary dictionaryWithObjectsAndKeys:
314 [NSNumber numberWithInt:system], @"system",
315 MISSION_DEST_LEGACY, @"name",
316 @"redColor", @"markerColor",
317 @"MARKER_X", @"markerShape",
318 nil] retain] autorelease];
319}

◆ dockedAtMainStation

- (BOOL) dockedAtMainStation

Extends class PlayerEntity.

Definition at line 76 of file PlayerEntityScriptMethods.m.

77{
78 return [self status] == STATUS_DOCKED && [self dockedStation] == [UNIVERSE station];
79}

References dockedAtMainStation, PlayerEntity::dockedStation, and Entity::status.

Referenced by dockedAtMainStation.

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

◆ dockedStationDisplayName

- (NSString *) dockedStationDisplayName

Extends class PlayerEntity.

Definition at line 70 of file PlayerEntityScriptMethods.m.

71{
72 return [[self dockedStation] displayName];
73}

References ShipEntity::displayName, PlayerEntity::dockedStation, and dockedStationDisplayName.

Referenced by dockedStationDisplayName.

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

◆ dockedStationName

- (NSString *) dockedStationName

Extends class PlayerEntity.

Definition at line 64 of file PlayerEntityScriptMethods.m.

65{
66 return [[self dockedStation] name];
67}

References PlayerEntity::dockedStation, dockedStationName, and ShipEntity::name.

Referenced by dockedStationName.

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

◆ getKeyBindingDescription:

- (NSString *) getKeyBindingDescription: (NSArray *) keyList

Extends class PlayerEntity.

Definition at line 393 of file PlayerEntityScriptMethods.m.

393 :(NSArray *) keyList
394{
395 NSUInteger i = 0;
396 NSMutableString *final = [NSMutableString string];
397 for (i = 0; i < [keyList count]; i++) {
398 if (i != 0) final = [NSMutableString stringWithFormat:@"%@ or ", final];
399 NSDictionary *def = [keyList objectAtIndex:i];
400 NSString *key = [def objectForKey:@"key"];
401 OOKeyCode k_int = (OOKeyCode)[key integerValue];
402 NSString *desc = [self keyCodeDescription:k_int];
403 // 0 = key not set
404 if (k_int != 0) {
405 if ([[def objectForKey:@"mod2"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyMod2Text];
406 if ([[def objectForKey:@"mod1"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyMod1Text];
407 if ([[def objectForKey:@"shift"] boolValue] == YES) final = [NSMutableString stringWithFormat:@"%@%@+", final, keyShiftText];
408 final = [NSMutableString stringWithFormat:@"%@%@", final, desc];
409 }
410 }
411 return final;
412}
uint16_t OOKeyCode
Definition OOTypes.h:186

References PlayerEntity::keyCodeDescription:.

+ Here is the call graph for this function:

◆ keyBindingDescription2:

- (NSString *) keyBindingDescription2: (NSString *) binding

Extends class PlayerEntity.

Definition at line 381 of file PlayerEntityScriptMethods.m.

381 :(NSString *)binding
382{
383 if ([keyconfig2_settings objectForKey:binding] == nil)
384 {
385 // no such setting
386 return nil;
387 }
388 NSArray *keyList = (NSArray*)[keyconfig2_settings objectForKey:binding];
389 return [self getKeyBindingDescription:keyList];
390}

References PlayerEntity::getKeyBindingDescription:, and nil.

+ Here is the call graph for this function:

◆ keyCodeDescription:

- (NSString *) keyCodeDescription: (OOKeyCode) code

Extends class PlayerEntity.

Definition at line 415 of file PlayerEntityScriptMethods.m.

415 :(OOKeyCode)code
416{
417 switch (code)
418 {
419 case 0:
420 return DESC(@"oolite-keycode-unset");
421 case 9:
422 return DESC(@"oolite-keycode-tab");
423 case 13:
424 return DESC(@"oolite-keycode-enter");
425 case 27:
426 return DESC(@"oolite-keycode-esc");
427 case 32:
428 return DESC(@"oolite-keycode-space");
429 case gvFunctionKey1:
430 return DESC(@"oolite-keycode-f1");
431 case gvFunctionKey2:
432 return DESC(@"oolite-keycode-f2");
433 case gvFunctionKey3:
434 return DESC(@"oolite-keycode-f3");
435 case gvFunctionKey4:
436 return DESC(@"oolite-keycode-f4");
437 case gvFunctionKey5:
438 return DESC(@"oolite-keycode-f5");
439 case gvFunctionKey6:
440 return DESC(@"oolite-keycode-f6");
441 case gvFunctionKey7:
442 return DESC(@"oolite-keycode-f7");
443 case gvFunctionKey8:
444 return DESC(@"oolite-keycode-f8");
445 case gvFunctionKey9:
446 return DESC(@"oolite-keycode-f9");
447 case gvFunctionKey10:
448 return DESC(@"oolite-keycode-f10");
449 case gvFunctionKey11:
450 return DESC(@"oolite-keycode-f11");
451 case gvArrowKeyRight:
452 return DESC(@"oolite-keycode-right");
453 case gvArrowKeyLeft:
454 return DESC(@"oolite-keycode-left");
455 case gvArrowKeyDown:
456 return DESC(@"oolite-keycode-down");
457 case gvArrowKeyUp:
458 return DESC(@"oolite-keycode-up");
459 case gvHomeKey:
460 return DESC(@"oolite-keycode-home");
461 case gvEndKey:
462 return DESC(@"oolite-keycode-end");
463 case gvInsertKey:
464 return DESC(@"oolite-keycode-insert");
465 case gvDeleteKey:
466 return DESC(@"oolite-keycode-delete");
467 case gvPageUpKey:
468 return DESC(@"oolite-keycode-pageup");
469 case gvPageDownKey:
470 return DESC(@"oolite-keycode-pagedown");
471 case gvNumberPadKey0:
472 return DESC(@"oolite-keycode-numpad0");
473 case gvNumberPadKey1:
474 return DESC(@"oolite-keycode-numpad1");
475 case gvNumberPadKey2:
476 return DESC(@"oolite-keycode-numpad2");
477 case gvNumberPadKey3:
478 return DESC(@"oolite-keycode-numpad3");
479 case gvNumberPadKey4:
480 return DESC(@"oolite-keycode-numpad4");
481 case gvNumberPadKey5:
482 return DESC(@"oolite-keycode-numpad5");
483 case gvNumberPadKey6:
484 return DESC(@"oolite-keycode-numpad6");
485 case gvNumberPadKey7:
486 return DESC(@"oolite-keycode-numpad7");
487 case gvNumberPadKey8:
488 return DESC(@"oolite-keycode-numpad8");
489 case gvNumberPadKey9:
490 return DESC(@"oolite-keycode-numpad9");
491 case gvPrintScreenKey:
492 return DESC(@"oolite-keycode-printscreen");
493 case gvPauseKey:
494 return DESC(@"oolite-keycode-pause");
496 return DESC(@"oolite-keycode-numpad/");
498 return DESC(@"oolite-keycode-numpad=");
500 return DESC(@"oolite-keycode-numpad-");
502 return DESC(@"oolite-keycode-numpad*");
504 return DESC(@"oolite-keycode-numpad.");
506 return DESC(@"oolite-keycode-numpad+");
508 return DESC(@"oolite-keycode-numpadenter");
509
510 default:
511 return [NSString stringWithFormat:@"%C",code];
512 }
513}
@ gvNumberPadKeyDivide
@ gvNumberPadKeyMultiply
@ gvNumberPadKeyPeriod
@ gvFunctionKey2
@ gvInsertKey
@ gvNumberPadKeyPlus
@ gvNumberPadKey9
@ gvNumberPadKey1
@ gvFunctionKey10
@ gvFunctionKey5
@ gvDeleteKey
@ gvArrowKeyDown
@ gvNumberPadKey2
@ gvFunctionKey9
@ gvNumberPadKey3
@ gvFunctionKey4
@ gvEndKey
@ gvHomeKey
@ gvNumberPadKeyEquals
@ gvNumberPadKey6
@ gvNumberPadKeyEnter
@ gvNumberPadKey5
@ gvNumberPadKey4
@ gvPauseKey
@ gvNumberPadKeyMinus
@ gvNumberPadKey7
@ gvPrintScreenKey
@ gvFunctionKey11
@ gvFunctionKey8
@ gvPageDownKey
@ gvNumberPadKey8
@ gvFunctionKey3
@ gvArrowKeyUp
@ gvArrowKeyRight
@ gvFunctionKey6
@ gvArrowKeyLeft
@ gvFunctionKey7
@ gvPageUpKey
@ gvNumberPadKey0
@ gvFunctionKey1
#define DESC(key)
Definition Universe.h:846

References DESC, gvArrowKeyDown, gvArrowKeyLeft, gvArrowKeyRight, gvArrowKeyUp, gvDeleteKey, gvEndKey, gvFunctionKey1, gvFunctionKey10, gvFunctionKey11, gvFunctionKey2, gvFunctionKey3, gvFunctionKey4, gvFunctionKey5, gvFunctionKey6, gvFunctionKey7, gvFunctionKey8, gvFunctionKey9, gvHomeKey, gvInsertKey, gvNumberPadKey0, gvNumberPadKey1, gvNumberPadKey2, gvNumberPadKey3, gvNumberPadKey4, gvNumberPadKey5, gvNumberPadKey6, gvNumberPadKey7, gvNumberPadKey8, gvNumberPadKey9, gvNumberPadKeyDivide, gvNumberPadKeyEnter, gvNumberPadKeyEquals, gvNumberPadKeyMinus, gvNumberPadKeyMultiply, gvNumberPadKeyPeriod, gvNumberPadKeyPlus, gvPageDownKey, gvPageUpKey, gvPauseKey, and gvPrintScreenKey.

◆ keyCodeDescriptionShort:

- (NSString *) keyCodeDescriptionShort: (OOKeyCode) code

Extends class PlayerEntity.

Definition at line 515 of file PlayerEntityScriptMethods.m.

515 :(OOKeyCode)code
516{
517 switch (code)
518 {
519 case 0:
520 return DESC(@"oolite-keycode-short-unset");
521 case 9:
522 return DESC(@"oolite-keycode-short-tab");
523 case 13:
524 return DESC(@"oolite-keycode-short-enter");
525 case 27:
526 return DESC(@"oolite-keycode-short-esc");
527 case 32:
528 return DESC(@"oolite-keycode-short-space");
529 case gvFunctionKey1:
530 return DESC(@"oolite-keycode-short-f1");
531 case gvFunctionKey2:
532 return DESC(@"oolite-keycode-short-f2");
533 case gvFunctionKey3:
534 return DESC(@"oolite-keycode-short-f3");
535 case gvFunctionKey4:
536 return DESC(@"oolite-keycode-short-f4");
537 case gvFunctionKey5:
538 return DESC(@"oolite-keycode-short-f5");
539 case gvFunctionKey6:
540 return DESC(@"oolite-keycode-short-f6");
541 case gvFunctionKey7:
542 return DESC(@"oolite-keycode-short-f7");
543 case gvFunctionKey8:
544 return DESC(@"oolite-keycode-short-f8");
545 case gvFunctionKey9:
546 return DESC(@"oolite-keycode-short-f9");
547 case gvFunctionKey10:
548 return DESC(@"oolite-keycode-short-f10");
549 case gvFunctionKey11:
550 return DESC(@"oolite-keycode-short-f11");
551 case gvArrowKeyRight:
552 return DESC(@"oolite-keycode-short-right");
553 case gvArrowKeyLeft:
554 return DESC(@"oolite-keycode-short-left");
555 case gvArrowKeyDown:
556 return DESC(@"oolite-keycode-short-down");
557 case gvArrowKeyUp:
558 return DESC(@"oolite-keycode-short-up");
559 case gvHomeKey:
560 return DESC(@"oolite-keycode-short-home");
561 case gvEndKey:
562 return DESC(@"oolite-keycode-short-end");
563 case gvInsertKey:
564 return DESC(@"oolite-keycode-short-insert");
565 case gvDeleteKey:
566 return DESC(@"oolite-keycode-short-delete");
567 case gvPageUpKey:
568 return DESC(@"oolite-keycode-short-pageup");
569 case gvPageDownKey:
570 return DESC(@"oolite-keycode-short-pagedown");
571 case gvNumberPadKey0:
572 return DESC(@"oolite-keycode-short-numpad0");
573 case gvNumberPadKey1:
574 return DESC(@"oolite-keycode-short-numpad1");
575 case gvNumberPadKey2:
576 return DESC(@"oolite-keycode-short-numpad2");
577 case gvNumberPadKey3:
578 return DESC(@"oolite-keycode-short-numpad3");
579 case gvNumberPadKey4:
580 return DESC(@"oolite-keycode-short-numpad4");
581 case gvNumberPadKey5:
582 return DESC(@"oolite-keycode-short-numpad5");
583 case gvNumberPadKey6:
584 return DESC(@"oolite-keycode-short-numpad6");
585 case gvNumberPadKey7:
586 return DESC(@"oolite-keycode-short-numpad7");
587 case gvNumberPadKey8:
588 return DESC(@"oolite-keycode-short-numpad8");
589 case gvNumberPadKey9:
590 return DESC(@"oolite-keycode-short-numpad9");
591 case gvPrintScreenKey:
592 return DESC(@"oolite-keycode-short-printscreen");
593 case gvPauseKey:
594 return DESC(@"oolite-keycode-short-pause");
596 return DESC(@"oolite-keycode-short-numpad/");
598 return DESC(@"oolite-keycode-short-numpad=");
600 return DESC(@"oolite-keycode-short-numpad-");
602 return DESC(@"oolite-keycode-short-numpad*");
604 return DESC(@"oolite-keycode-short-numpad.");
606 return DESC(@"oolite-keycode-short-numpad+");
608 return DESC(@"oolite-keycode-short-numpadenter");
609 default:
610 return [NSString stringWithFormat:@"%C",code];
611 }
612}

References DESC, gvArrowKeyDown, gvArrowKeyLeft, gvArrowKeyRight, gvArrowKeyUp, gvDeleteKey, gvEndKey, gvFunctionKey1, gvFunctionKey10, gvFunctionKey11, gvFunctionKey2, gvFunctionKey3, gvFunctionKey4, gvFunctionKey5, gvFunctionKey6, gvFunctionKey7, gvFunctionKey8, gvFunctionKey9, gvHomeKey, gvInsertKey, gvNumberPadKey0, gvNumberPadKey1, gvNumberPadKey2, gvNumberPadKey3, gvNumberPadKey4, gvNumberPadKey5, gvNumberPadKey6, gvNumberPadKey7, gvNumberPadKey8, gvNumberPadKey9, gvNumberPadKeyDivide, gvNumberPadKeyEnter, gvNumberPadKeyEquals, gvNumberPadKeyMinus, gvNumberPadKeyMultiply, gvNumberPadKeyPeriod, gvNumberPadKeyPlus, gvPageDownKey, gvPageUpKey, gvPauseKey, and gvPrintScreenKey.

◆ parcelContractMarker:

- (NSDictionary *) parcelContractMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 289 of file PlayerEntityScriptMethods.m.

289 :(OOSystemID)system
290{
291 return [[[NSDictionary dictionaryWithObjectsAndKeys:
292 [NSNumber numberWithInt:system], @"system",
293 MISSION_DEST_LEGACY, @"name",
294 @"orangeColor", @"markerColor",
295 @"MARKER_PLUS", @"markerShape",
296 nil] retain] autorelease];
297}

◆ passengerContractMarker:

- (NSDictionary *) passengerContractMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 278 of file PlayerEntityScriptMethods.m.

278 :(OOSystemID)system
279{
280 return [[[NSDictionary dictionaryWithObjectsAndKeys:
281 [NSNumber numberWithInt:system], @"system",
282 MISSION_DEST_LEGACY, @"name",
283 @"orangeColor", @"markerColor",
284 @"MARKER_DIAMOND", @"markerShape",
285 nil] retain] autorelease];
286}

◆ resetScannerZoom

- (void) resetScannerZoom

Extends class PlayerEntity.

Definition at line 172 of file PlayerEntityScriptMethods.m.

173{
174 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
175}
#define SCANNER_ZOOM_RATE_DOWN

References resetScannerZoom, and SCANNER_ZOOM_RATE_DOWN.

Referenced by resetScannerZoom.

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

◆ score

- (unsigned) score

Extends class PlayerEntity.

Definition at line 40 of file PlayerEntityScriptMethods.m.

41{
42 return ship_kills;
43}

References score.

Referenced by score.

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

◆ scriptTimer

- (OOTimeDelta) scriptTimer

Extends class PlayerEntity.

Definition at line 242 of file PlayerEntityScriptMethods.m.

243{
244 return script_time;
245}

References scriptTimer.

Referenced by scriptTimer.

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

◆ setCreditBalance:

- (void) setCreditBalance: (double) value

Extends class PlayerEntity.

Definition at line 58 of file PlayerEntityScriptMethods.m.

58 :(double)value
59{
60 credits = OODeciCreditsFromDouble(value * 10.0);
61}
OOCreditsQuantity OODeciCreditsFromDouble(double doubleDeciCredits)

References OODeciCreditsFromDouble().

+ Here is the call graph for this function:

◆ setMissionChoice:

- (void) setMissionChoice: (NSString *) newChoice

Extends class PlayerEntity.

Definition at line 191 of file PlayerEntityScriptMethods.m.

191 :(NSString *)newChoice
192{
193 [self setMissionChoice:newChoice keyPress:@"" withEvent:YES];
194}

References PlayerEntity::setMissionChoice:keyPress:withEvent:.

+ Here is the call graph for this function:

◆ setMissionChoice:keyPress:

- (void) setMissionChoice: (NSString *) newChoice
keyPress: (NSString *) keyPress 

Extends class PlayerEntity.

Definition at line 203 of file PlayerEntityScriptMethods.m.

203 :(NSString *)newChoice keyPress:(NSString *)keyPress
204{
205 [self setMissionChoice:newChoice keyPress:keyPress withEvent:YES];
206}

References PlayerEntity::setMissionChoice:keyPress:withEvent:.

+ Here is the call graph for this function:

◆ setMissionChoice:keyPress:withEvent:

- (void) setMissionChoice: (NSString *) newChoice
keyPress: (NSString *) keyPress
withEvent: (BOOL) withEvent 

Extends class PlayerEntity.

Definition at line 209 of file PlayerEntityScriptMethods.m.

209 :(NSString *)newChoice keyPress:(NSString *)keyPress withEvent:(BOOL)withEvent
210{
211 BOOL equal = [newChoice isEqualToString:missionChoice] || (newChoice == missionChoice); // Catch both being nil as well
212 if (!equal)
213 {
214 if (newChoice == nil)
215 {
216 NSString *oldChoice = missionChoice;
217 [missionChoice autorelease];
218 missionChoice = nil;
219 if (withEvent) [self doScriptEvent:OOJSID("missionChoiceWasReset") withArgument:oldChoice];
220 }
221 else
222 {
223 [missionChoice autorelease];
224 missionChoice = [newChoice copy];
225 }
226 }
227 equal = [keyPress isEqualToString:missionKeyPress] || (keyPress == missionKeyPress);
228 if (!equal)
229 {
230 [missionKeyPress autorelease];
231 missionKeyPress = [keyPress copy];
232 }
233}

References ShipEntity::doScriptEvent:withArgument:, and nil.

+ Here is the call graph for this function:

◆ setMissionChoice:withEvent:

- (void) setMissionChoice: (NSString *) newChoice
withEvent: (BOOL) withEvent 

Extends class PlayerEntity.

Definition at line 197 of file PlayerEntityScriptMethods.m.

197 :(NSString *)newChoice withEvent:(BOOL)withEvent
198{
199 [self setMissionChoice:newChoice keyPress:@"" withEvent:withEvent];
200}

References PlayerEntity::setMissionChoice:keyPress:withEvent:.

+ Here is the call graph for this function:

◆ setScore:

- (void) setScore: (unsigned) value

Extends class PlayerEntity.

Definition at line 46 of file PlayerEntityScriptMethods.m.

46 :(unsigned)value
47{
48 ship_kills = value;
49}

◆ systemPseudoRandom100

- (unsigned) systemPseudoRandom100

Extends class PlayerEntity.

Definition at line 251 of file PlayerEntityScriptMethods.m.

252{
253 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
254 return (gen_rnd_number() * 256 + gen_rnd_number()) % 100;
255}
void seed_RNG_only_for_planet_description(Random_Seed s_seed)
int gen_rnd_number(void)

References gen_rnd_number(), seed_RNG_only_for_planet_description(), systemPseudoRandom100, and UNIVERSE.

Referenced by systemPseudoRandom100.

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

◆ systemPseudoRandom256

- (unsigned) systemPseudoRandom256

Extends class PlayerEntity.

Definition at line 258 of file PlayerEntityScriptMethods.m.

259{
260 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
261 return gen_rnd_number();
262}

References gen_rnd_number(), seed_RNG_only_for_planet_description(), systemPseudoRandom256, and UNIVERSE.

Referenced by systemPseudoRandom256.

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

◆ systemPseudoRandomFloat

- (double) systemPseudoRandomFloat

Extends class PlayerEntity.

Definition at line 265 of file PlayerEntityScriptMethods.m.

266{
267 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
268 unsigned a = gen_rnd_number();
269 unsigned b = gen_rnd_number();
270 unsigned c = gen_rnd_number();
271
272 a = (a << 16) | (b << 8) | c;
273 return (double)a / (double)0x01000000;
274
275}

References gen_rnd_number(), seed_RNG_only_for_planet_description(), systemPseudoRandomFloat, and UNIVERSE.

Referenced by systemPseudoRandomFloat.

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

◆ validatedMarker:

- (NSDictionary *) validatedMarker: (NSDictionary *) marker

Extends class PlayerEntity.

Definition at line 322 of file PlayerEntityScriptMethods.m.

322 :(NSDictionary *)marker
323{
324 OOSystemID dest = [marker oo_intForKey:@"system"];
325// FIXME: parameters
326 if (dest < 0 || dest > kOOMaximumSystemID)
327 {
328 return nil;
329 }
330 NSString *group = [marker oo_stringForKey:@"name" defaultValue:MISSION_DEST_LEGACY];
331
332 return [[[NSDictionary dictionaryWithObjectsAndKeys:
333 [NSNumber numberWithInt:dest], @"system",
334 group, @"name",
335 [marker oo_stringForKey:@"markerColor" defaultValue:@"redColor"], @"markerColor",
336 [marker oo_stringForKey:@"markerShape" defaultValue:@"MARKER_X"], @"markerShape",
337 [NSNumber numberWithFloat:[marker oo_floatForKey:@"markerScale" defaultValue:1.0]], @"markerScale",
338 nil] retain] autorelease];
339
340}
@ kOOMaximumSystemID
Definition OOTypes.h:217

References kOOMaximumSystemID, and nil.


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