Oolite
Loading...
Searching...
No Matches
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 30 of file PlayerEntityScriptMethods.h.

Method Documentation

◆ allowMissionInterrupt

- (void) allowMissionInterrupt

Extends class PlayerEntity.

Definition at line 202 of file PlayerEntityScriptMethods.m.

203{
204 _missionAllowInterrupt = YES;
205}

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 75 of file PlayerEntityScriptMethods.m.

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

258 :(OOSystemID)system
259{
260 return [[[NSDictionary dictionaryWithObjectsAndKeys:
261 [NSNumber numberWithInt:system], @"system",
262 MISSION_DEST_LEGACY, @"name",
263 @"orangeColor", @"markerColor",
264 @"MARKER_SQUARE", @"markerShape",
265 nil] retain] autorelease];
266}
int16_t OOSystemID
Definition OOTypes.h:183

◆ commanderBountyAsString

- (NSString *) commanderBountyAsString

Extends class PlayerEntity.

Definition at line 322 of file PlayerEntityScriptMethods.m.

323{
324 return [NSString stringWithFormat:@"%i", [self legalStatus]];
325}

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 328 of file PlayerEntityScriptMethods.m.

329{
330 return [NSString stringWithFormat:@"%i", [self score]];
331}

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 50 of file PlayerEntityScriptMethods.m.

51{
52 return 0.1 * credits;
53}

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 312 of file PlayerEntityScriptMethods.m.

313{
314 OOCreditsQuantity tenthsOfCredits = [self deciCredits];
315 unsigned long long integerCredits = tenthsOfCredits / 10;
316 unsigned long long tenths = tenthsOfCredits % 10;
317
318 return [NSString stringWithFormat:@"%llu.%llu", integerCredits, tenths];
319}
uint64_t OOCreditsQuantity
Definition OOTypes.h:160

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 301 of file PlayerEntityScriptMethods.m.

302{
303 return OOStringFromDeciCredits([self deciCredits], YES, NO);
304}
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 153 of file PlayerEntityScriptMethods.m.

154{
155 return galaxy_number;
156}

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 158 of file PlayerEntityScriptMethods.m.

159{
160 if ([UNIVERSE sun] == nil)
161 return -1; // Interstellar space
162 return [UNIVERSE currentSystemID];
163}
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 268 of file PlayerEntityScriptMethods.m.

268 :(OOSystemID)system
269{
270 return [[[NSDictionary dictionaryWithObjectsAndKeys:
271 [NSNumber numberWithInt:system], @"system",
272 MISSION_DEST_LEGACY, @"name",
273 @"redColor", @"markerColor",
274 @"MARKER_X", @"markerShape",
275 nil] retain] autorelease];
276}

◆ dockedAtMainStation

- (BOOL) dockedAtMainStation

Extends class PlayerEntity.

Definition at line 70 of file PlayerEntityScriptMethods.m.

71{
72 return [self status] == STATUS_DOCKED && [self dockedStation] == [UNIVERSE station];
73}

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 65 of file PlayerEntityScriptMethods.m.

66{
67 return [[self dockedStation] displayName];
68}

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 60 of file PlayerEntityScriptMethods.m.

61{
62 return [[self dockedStation] name];
63}

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 344 of file PlayerEntityScriptMethods.m.

344 :(NSArray*)keyList
345{
346 NSUInteger i = 0;
347 NSMutableString* final = [NSMutableString string];
348 for (i = 0; i < [keyList count]; i++) {
349 if (i != 0)
350 final = [NSMutableString stringWithFormat:@"%@ or ", final];
351 NSDictionary* def = [keyList objectAtIndex:i];
352 NSString* key = [def objectForKey:@"key"];
353 OOKeyCode k_int = (OOKeyCode)[key integerValue];
354 NSString* desc = [self keyCodeDescription:k_int];
355 // 0 = key not set
356 if (k_int != 0) {
357 if ([[def objectForKey:@"mod2"] boolValue] == YES)
358 final = [NSMutableString stringWithFormat:@"%@%@+", final, keyMod2Text];
359 if ([[def objectForKey:@"mod1"] boolValue] == YES)
360 final = [NSMutableString stringWithFormat:@"%@%@+", final, keyMod1Text];
361 if ([[def objectForKey:@"shift"] boolValue] == YES)
362 final = [NSMutableString stringWithFormat:@"%@%@+", final, keyShiftText];
363 final = [NSMutableString stringWithFormat:@"%@%@", final, desc];
364 }
365 }
366 return final;
367}
uint16_t OOKeyCode
Definition OOTypes.h:163

References PlayerEntity::keyCodeDescription:.

Here is the call graph for this function:

◆ keyBindingDescription2:

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

Extends class PlayerEntity.

Definition at line 334 of file PlayerEntityScriptMethods.m.

334 :(NSString*)binding
335{
336 if ([keyconfig2_settings objectForKey:binding] == nil) {
337 // no such setting
338 return nil;
339 }
340 NSArray* keyList = (NSArray*)[keyconfig2_settings objectForKey:binding];
341 return [self getKeyBindingDescription:keyList];
342}

References PlayerEntity::getKeyBindingDescription:, and nil.

Here is the call graph for this function:

◆ keyCodeDescription:

- (NSString *) keyCodeDescription: (OOKeyCode) code

Extends class PlayerEntity.

Definition at line 369 of file PlayerEntityScriptMethods.m.

369 :(OOKeyCode)code
370{
371 switch (code) {
372 case 0:
373 return DESC(@"oolite-keycode-unset");
374 case 9:
375 return DESC(@"oolite-keycode-tab");
376 case 13:
377 return DESC(@"oolite-keycode-enter");
378 case 27:
379 return DESC(@"oolite-keycode-esc");
380 case 32:
381 return DESC(@"oolite-keycode-space");
382 case gvFunctionKey1:
383 return DESC(@"oolite-keycode-f1");
384 case gvFunctionKey2:
385 return DESC(@"oolite-keycode-f2");
386 case gvFunctionKey3:
387 return DESC(@"oolite-keycode-f3");
388 case gvFunctionKey4:
389 return DESC(@"oolite-keycode-f4");
390 case gvFunctionKey5:
391 return DESC(@"oolite-keycode-f5");
392 case gvFunctionKey6:
393 return DESC(@"oolite-keycode-f6");
394 case gvFunctionKey7:
395 return DESC(@"oolite-keycode-f7");
396 case gvFunctionKey8:
397 return DESC(@"oolite-keycode-f8");
398 case gvFunctionKey9:
399 return DESC(@"oolite-keycode-f9");
400 case gvFunctionKey10:
401 return DESC(@"oolite-keycode-f10");
402 case gvFunctionKey11:
403 return DESC(@"oolite-keycode-f11");
404 case gvArrowKeyRight:
405 return DESC(@"oolite-keycode-right");
406 case gvArrowKeyLeft:
407 return DESC(@"oolite-keycode-left");
408 case gvArrowKeyDown:
409 return DESC(@"oolite-keycode-down");
410 case gvArrowKeyUp:
411 return DESC(@"oolite-keycode-up");
412 case gvHomeKey:
413 return DESC(@"oolite-keycode-home");
414 case gvEndKey:
415 return DESC(@"oolite-keycode-end");
416 case gvInsertKey:
417 return DESC(@"oolite-keycode-insert");
418 case gvDeleteKey:
419 return DESC(@"oolite-keycode-delete");
420 case gvPageUpKey:
421 return DESC(@"oolite-keycode-pageup");
422 case gvPageDownKey:
423 return DESC(@"oolite-keycode-pagedown");
424 case gvNumberPadKey0:
425 return DESC(@"oolite-keycode-numpad0");
426 case gvNumberPadKey1:
427 return DESC(@"oolite-keycode-numpad1");
428 case gvNumberPadKey2:
429 return DESC(@"oolite-keycode-numpad2");
430 case gvNumberPadKey3:
431 return DESC(@"oolite-keycode-numpad3");
432 case gvNumberPadKey4:
433 return DESC(@"oolite-keycode-numpad4");
434 case gvNumberPadKey5:
435 return DESC(@"oolite-keycode-numpad5");
436 case gvNumberPadKey6:
437 return DESC(@"oolite-keycode-numpad6");
438 case gvNumberPadKey7:
439 return DESC(@"oolite-keycode-numpad7");
440 case gvNumberPadKey8:
441 return DESC(@"oolite-keycode-numpad8");
442 case gvNumberPadKey9:
443 return DESC(@"oolite-keycode-numpad9");
444 case gvPrintScreenKey:
445 return DESC(@"oolite-keycode-printscreen");
446 case gvPauseKey:
447 return DESC(@"oolite-keycode-pause");
449 return DESC(@"oolite-keycode-numpad/");
451 return DESC(@"oolite-keycode-numpad=");
453 return DESC(@"oolite-keycode-numpad-");
455 return DESC(@"oolite-keycode-numpad*");
457 return DESC(@"oolite-keycode-numpad.");
459 return DESC(@"oolite-keycode-numpad+");
461 return DESC(@"oolite-keycode-numpadenter");
462
463 default:
464 return [NSString stringWithFormat:@"%C", code];
465 }
466}
@ 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:832

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 468 of file PlayerEntityScriptMethods.m.

468 :(OOKeyCode)code
469{
470 switch (code) {
471 case 0:
472 return DESC(@"oolite-keycode-short-unset");
473 case 9:
474 return DESC(@"oolite-keycode-short-tab");
475 case 13:
476 return DESC(@"oolite-keycode-short-enter");
477 case 27:
478 return DESC(@"oolite-keycode-short-esc");
479 case 32:
480 return DESC(@"oolite-keycode-short-space");
481 case gvFunctionKey1:
482 return DESC(@"oolite-keycode-short-f1");
483 case gvFunctionKey2:
484 return DESC(@"oolite-keycode-short-f2");
485 case gvFunctionKey3:
486 return DESC(@"oolite-keycode-short-f3");
487 case gvFunctionKey4:
488 return DESC(@"oolite-keycode-short-f4");
489 case gvFunctionKey5:
490 return DESC(@"oolite-keycode-short-f5");
491 case gvFunctionKey6:
492 return DESC(@"oolite-keycode-short-f6");
493 case gvFunctionKey7:
494 return DESC(@"oolite-keycode-short-f7");
495 case gvFunctionKey8:
496 return DESC(@"oolite-keycode-short-f8");
497 case gvFunctionKey9:
498 return DESC(@"oolite-keycode-short-f9");
499 case gvFunctionKey10:
500 return DESC(@"oolite-keycode-short-f10");
501 case gvFunctionKey11:
502 return DESC(@"oolite-keycode-short-f11");
503 case gvArrowKeyRight:
504 return DESC(@"oolite-keycode-short-right");
505 case gvArrowKeyLeft:
506 return DESC(@"oolite-keycode-short-left");
507 case gvArrowKeyDown:
508 return DESC(@"oolite-keycode-short-down");
509 case gvArrowKeyUp:
510 return DESC(@"oolite-keycode-short-up");
511 case gvHomeKey:
512 return DESC(@"oolite-keycode-short-home");
513 case gvEndKey:
514 return DESC(@"oolite-keycode-short-end");
515 case gvInsertKey:
516 return DESC(@"oolite-keycode-short-insert");
517 case gvDeleteKey:
518 return DESC(@"oolite-keycode-short-delete");
519 case gvPageUpKey:
520 return DESC(@"oolite-keycode-short-pageup");
521 case gvPageDownKey:
522 return DESC(@"oolite-keycode-short-pagedown");
523 case gvNumberPadKey0:
524 return DESC(@"oolite-keycode-short-numpad0");
525 case gvNumberPadKey1:
526 return DESC(@"oolite-keycode-short-numpad1");
527 case gvNumberPadKey2:
528 return DESC(@"oolite-keycode-short-numpad2");
529 case gvNumberPadKey3:
530 return DESC(@"oolite-keycode-short-numpad3");
531 case gvNumberPadKey4:
532 return DESC(@"oolite-keycode-short-numpad4");
533 case gvNumberPadKey5:
534 return DESC(@"oolite-keycode-short-numpad5");
535 case gvNumberPadKey6:
536 return DESC(@"oolite-keycode-short-numpad6");
537 case gvNumberPadKey7:
538 return DESC(@"oolite-keycode-short-numpad7");
539 case gvNumberPadKey8:
540 return DESC(@"oolite-keycode-short-numpad8");
541 case gvNumberPadKey9:
542 return DESC(@"oolite-keycode-short-numpad9");
543 case gvPrintScreenKey:
544 return DESC(@"oolite-keycode-short-printscreen");
545 case gvPauseKey:
546 return DESC(@"oolite-keycode-short-pause");
548 return DESC(@"oolite-keycode-short-numpad/");
550 return DESC(@"oolite-keycode-short-numpad=");
552 return DESC(@"oolite-keycode-short-numpad-");
554 return DESC(@"oolite-keycode-short-numpad*");
556 return DESC(@"oolite-keycode-short-numpad.");
558 return DESC(@"oolite-keycode-short-numpad+");
560 return DESC(@"oolite-keycode-short-numpadenter");
561 default:
562 return [NSString stringWithFormat:@"%C", code];
563 }
564}

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 248 of file PlayerEntityScriptMethods.m.

248 :(OOSystemID)system
249{
250 return [[[NSDictionary dictionaryWithObjectsAndKeys:
251 [NSNumber numberWithInt:system], @"system",
252 MISSION_DEST_LEGACY, @"name",
253 @"orangeColor", @"markerColor",
254 @"MARKER_PLUS", @"markerShape",
255 nil] retain] autorelease];
256}

◆ passengerContractMarker:

- (NSDictionary *) passengerContractMarker: (OOSystemID) system

Extends class PlayerEntity.

Definition at line 238 of file PlayerEntityScriptMethods.m.

238 :(OOSystemID)system
239{
240 return [[[NSDictionary dictionaryWithObjectsAndKeys:
241 [NSNumber numberWithInt:system], @"system",
242 MISSION_DEST_LEGACY, @"name",
243 @"orangeColor", @"markerColor",
244 @"MARKER_DIAMOND", @"markerShape",
245 nil] retain] autorelease];
246}

◆ resetScannerZoom

- (void) resetScannerZoom

Extends class PlayerEntity.

Definition at line 148 of file PlayerEntityScriptMethods.m.

149{
150 scanner_zoom_rate = SCANNER_ZOOM_RATE_DOWN;
151}
#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 207 of file PlayerEntityScriptMethods.m.

208{
209 return script_time;
210}

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 55 of file PlayerEntityScriptMethods.m.

55 :(double)value
56{
57 credits = OODeciCreditsFromDouble(value * 10.0);
58}
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 165 of file PlayerEntityScriptMethods.m.

165 :(NSString*)newChoice
166{
167 [self setMissionChoice:newChoice keyPress:@"" withEvent:YES];
168}

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 175 of file PlayerEntityScriptMethods.m.

175 :(NSString*)newChoice keyPress:(NSString*)keyPress
176{
177 [self setMissionChoice:newChoice keyPress:keyPress withEvent:YES];
178}

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 180 of file PlayerEntityScriptMethods.m.

180 :(NSString*)newChoice keyPress:(NSString*)keyPress withEvent:(BOOL)withEvent
181{
182 BOOL equal = [newChoice isEqualToString:missionChoice] || (newChoice == missionChoice); // Catch both being nil as well
183 if (!equal) {
184 if (newChoice == nil) {
185 NSString* oldChoice = missionChoice;
186 [missionChoice autorelease];
187 missionChoice = nil;
188 if (withEvent)
189 [self doScriptEvent:OOJSID("missionChoiceWasReset") withArgument:oldChoice];
190 } else {
191 [missionChoice autorelease];
192 missionChoice = [newChoice copy];
193 }
194 }
195 equal = [keyPress isEqualToString:missionKeyPress] || (keyPress == missionKeyPress);
196 if (!equal) {
197 [missionKeyPress autorelease];
198 missionKeyPress = [keyPress copy];
199 }
200}

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 170 of file PlayerEntityScriptMethods.m.

170 :(NSString*)newChoice withEvent:(BOOL)withEvent
171{
172 [self setMissionChoice:newChoice keyPress:@"" withEvent:withEvent];
173}

References PlayerEntity::setMissionChoice:keyPress:withEvent:.

Here is the call graph for this function:

◆ setScore:

- (void) setScore: (unsigned) value

Extends class PlayerEntity.

Definition at line 45 of file PlayerEntityScriptMethods.m.

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

◆ systemPseudoRandom100

- (unsigned) systemPseudoRandom100

Extends class PlayerEntity.

Definition at line 215 of file PlayerEntityScriptMethods.m.

216{
217 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
218 return (gen_rnd_number() * 256 + gen_rnd_number()) % 100;
219}
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 221 of file PlayerEntityScriptMethods.m.

222{
223 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
224 return gen_rnd_number();
225}

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 227 of file PlayerEntityScriptMethods.m.

228{
229 seed_RNG_only_for_planet_description([[UNIVERSE systemManager] getRandomSeedForCurrentSystem]);
230 unsigned a = gen_rnd_number();
231 unsigned b = gen_rnd_number();
232 unsigned c = gen_rnd_number();
233
234 a = (a << 16) | (b << 8) | c;
235 return (double)a / (double)0x01000000;
236}

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 278 of file PlayerEntityScriptMethods.m.

278 :(NSDictionary*)marker
279{
280 OOSystemID dest = [marker oo_intForKey:@"system"];
281 // FIXME: parameters
282 if (dest < 0 || dest > kOOMaximumSystemID) {
283 return nil;
284 }
285 NSString* group = [marker oo_stringForKey:@"name" defaultValue:MISSION_DEST_LEGACY];
286
287 return [[[NSDictionary dictionaryWithObjectsAndKeys:
288 [NSNumber numberWithInt:dest], @"system",
289 group, @"name",
290 [marker oo_stringForKey:@"markerColor"
291 defaultValue:@"redColor"],
292 @"markerColor",
293 [marker oo_stringForKey:@"markerShape"
294 defaultValue:@"MARKER_X"],
295 @"markerShape",
296 [NSNumber numberWithFloat:[marker oo_floatForKey:@"markerScale" defaultValue:1.0]], @"markerScale",
297 nil] retain] autorelease];
298}
@ kOOMaximumSystemID
Definition OOTypes.h:187

References kOOMaximumSystemID, and nil.


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