Provides an override mechanism for the amount of time a rescue in an escape pod takes. (#353)
This commit is contained in:
parent
ba63810fa7
commit
8e2edf4e4c
@ -416,6 +416,8 @@ typedef enum
|
|||||||
double ship_clock;
|
double ship_clock;
|
||||||
double ship_clock_adjust;
|
double ship_clock_adjust;
|
||||||
|
|
||||||
|
double escape_pod_rescue_time;
|
||||||
|
|
||||||
double fps_check_time;
|
double fps_check_time;
|
||||||
int fps_counter;
|
int fps_counter;
|
||||||
double last_fps_check_time;
|
double last_fps_check_time;
|
||||||
@ -902,6 +904,9 @@ typedef enum
|
|||||||
- (BOOL) clockAdjusting;
|
- (BOOL) clockAdjusting;
|
||||||
- (void) addToAdjustTime:(double) seconds ;
|
- (void) addToAdjustTime:(double) seconds ;
|
||||||
|
|
||||||
|
- (double) escapePodRescueTime;
|
||||||
|
- (void) setEscapePodRescueTime:(double) seconds;
|
||||||
|
|
||||||
- (NSString *) dial_clock;
|
- (NSString *) dial_clock;
|
||||||
- (NSString *) dial_clock_adjusted;
|
- (NSString *) dial_clock_adjusted;
|
||||||
- (NSString *) dial_fpsinfo;
|
- (NSString *) dial_fpsinfo;
|
||||||
|
@ -1099,6 +1099,9 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
|||||||
//custom view no.
|
//custom view no.
|
||||||
[result oo_setUnsignedInteger:_customViewIndex forKey:@"custom_view_index"];
|
[result oo_setUnsignedInteger:_customViewIndex forKey:@"custom_view_index"];
|
||||||
|
|
||||||
|
// escape pod rescue time
|
||||||
|
[result oo_setFloat:[self escapePodRescueTime] forKey:@"escape_pod_rescue_time"];
|
||||||
|
|
||||||
//local market for main station
|
//local market for main station
|
||||||
if ([[UNIVERSE station] localMarket]) [result setObject:[[[UNIVERSE station] localMarket] saveStationAmounts] forKey:@"localMarket"];
|
if ([[UNIVERSE station] localMarket]) [result setObject:[[[UNIVERSE station] localMarket] saveStationAmounts] forKey:@"localMarket"];
|
||||||
|
|
||||||
@ -1591,6 +1594,8 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
|||||||
ship_clock = [dict oo_doubleForKey:@"ship_clock" defaultValue:PLAYER_SHIP_CLOCK_START];
|
ship_clock = [dict oo_doubleForKey:@"ship_clock" defaultValue:PLAYER_SHIP_CLOCK_START];
|
||||||
fps_check_time = ship_clock;
|
fps_check_time = ship_clock;
|
||||||
|
|
||||||
|
escape_pod_rescue_time = [dict oo_doubleForKey:@"escape_pod_rescue_time" defaultValue:0.0];
|
||||||
|
|
||||||
// role weights
|
// role weights
|
||||||
[roleWeights release];
|
[roleWeights release];
|
||||||
roleWeights = [[dict oo_arrayForKey:@"role_weights"] mutableCopy];
|
roleWeights = [[dict oo_arrayForKey:@"role_weights"] mutableCopy];
|
||||||
@ -2058,7 +2063,8 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
|||||||
ship_clock += [nowDate secondOfMinute];
|
ship_clock += [nowDate secondOfMinute];
|
||||||
fps_check_time = ship_clock;
|
fps_check_time = ship_clock;
|
||||||
ship_clock_adjust = 0.0;
|
ship_clock_adjust = 0.0;
|
||||||
|
escape_pod_rescue_time = 0.0;
|
||||||
|
|
||||||
isSpeechOn = OOSPEECHSETTINGS_OFF;
|
isSpeechOn = OOSPEECHSETTINGS_OFF;
|
||||||
#if OOLITE_ESPEAK
|
#if OOLITE_ESPEAK
|
||||||
voice_gender_m = YES;
|
voice_gender_m = YES;
|
||||||
@ -4788,6 +4794,17 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (double) escapePodRescueTime
|
||||||
|
{
|
||||||
|
return escape_pod_rescue_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) setEscapePodRescueTime:(double)seconds
|
||||||
|
{
|
||||||
|
escape_pod_rescue_time = seconds;
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *) dial_clock
|
- (NSString *) dial_clock
|
||||||
{
|
{
|
||||||
return ClockToString(ship_clock, ship_clock_adjust > 0);
|
return ClockToString(ship_clock, ship_clock_adjust > 0);
|
||||||
@ -6473,7 +6490,17 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
[UNIVERSE setBlockJSPlayerShipProps:YES]; // no player.ship properties while inside the pod!
|
[UNIVERSE setBlockJSPlayerShipProps:YES]; // no player.ship properties while inside the pod!
|
||||||
ship_clock_adjust += 43200 + 5400 * (ranrot_rand() & 127); // add up to 8 days until rescue!
|
// if a specific amount of time has been provided for the rescue, use it now
|
||||||
|
if (escape_pod_rescue_time > 0)
|
||||||
|
{
|
||||||
|
ship_clock_adjust += escape_pod_rescue_time;
|
||||||
|
escape_pod_rescue_time = 0; // reset value
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// otherwise, use the default time calc
|
||||||
|
ship_clock_adjust += 43200 + 5400 * (ranrot_rand() & 127); // add up to 8 days until rescue!
|
||||||
|
}
|
||||||
dockingClearanceStatus = DOCKING_CLEARANCE_STATUS_NOT_REQUIRED;
|
dockingClearanceStatus = DOCKING_CLEARANCE_STATUS_NOT_REQUIRED;
|
||||||
flightSpeed = fmin(flightSpeed, maxFlightSpeed);
|
flightSpeed = fmin(flightSpeed, maxFlightSpeed);
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ enum
|
|||||||
kPlayer_contractReputationPrecise, // reputation for cargo contracts, float, read only
|
kPlayer_contractReputationPrecise, // reputation for cargo contracts, float, read only
|
||||||
kPlayer_credits, // credit balance, float, read/write
|
kPlayer_credits, // credit balance, float, read/write
|
||||||
kPlayer_dockingClearanceStatus, // docking clearance status, string, read only
|
kPlayer_dockingClearanceStatus, // docking clearance status, string, read only
|
||||||
|
kPlayer_escapePodRescueTime, // override for the amount of time an escape pod rescue takes, read/write
|
||||||
kPlayer_legalStatus, // legalStatus, string, read-only
|
kPlayer_legalStatus, // legalStatus, string, read-only
|
||||||
kPlayer_name, // Player name, string, read/write
|
kPlayer_name, // Player name, string, read/write
|
||||||
kPlayer_parcelReputation, // reputation for parcel contracts, integer, read-only
|
kPlayer_parcelReputation, // reputation for parcel contracts, integer, read-only
|
||||||
@ -122,6 +123,7 @@ static JSPropertySpec sPlayerProperties[] =
|
|||||||
{ "contractReputationPrecise", kPlayer_contractReputationPrecise, OOJS_PROP_READONLY_CB },
|
{ "contractReputationPrecise", kPlayer_contractReputationPrecise, OOJS_PROP_READONLY_CB },
|
||||||
{ "credits", kPlayer_credits, OOJS_PROP_READWRITE_CB },
|
{ "credits", kPlayer_credits, OOJS_PROP_READWRITE_CB },
|
||||||
{ "dockingClearanceStatus", kPlayer_dockingClearanceStatus, OOJS_PROP_READONLY_CB },
|
{ "dockingClearanceStatus", kPlayer_dockingClearanceStatus, OOJS_PROP_READONLY_CB },
|
||||||
|
{ "escapePodRescueTime", kPlayer_escapePodRescueTime, OOJS_PROP_READWRITE_CB },
|
||||||
{ "legalStatus", kPlayer_legalStatus, OOJS_PROP_READONLY_CB },
|
{ "legalStatus", kPlayer_legalStatus, OOJS_PROP_READONLY_CB },
|
||||||
{ "name", kPlayer_name, OOJS_PROP_READWRITE_CB },
|
{ "name", kPlayer_name, OOJS_PROP_READWRITE_CB },
|
||||||
{ "parcelReputation", kPlayer_parcelReputation, OOJS_PROP_READONLY_CB },
|
{ "parcelReputation", kPlayer_parcelReputation, OOJS_PROP_READONLY_CB },
|
||||||
@ -249,6 +251,9 @@ static JSBool PlayerGetProperty(JSContext *context, JSObject *this, jsid propID,
|
|||||||
*value = OOJSValueFromBOOL([player alertFlags] & ALERT_FLAG_HOSTILES);
|
*value = OOJSValueFromBOOL([player alertFlags] & ALERT_FLAG_HOSTILES);
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
|
case kPlayer_escapePodRescueTime:
|
||||||
|
return JS_NewNumberValue(context, [player escapePodRescueTime], value);
|
||||||
|
|
||||||
case kPlayer_trumbleCount:
|
case kPlayer_trumbleCount:
|
||||||
return JS_NewNumberValue(context, [player trumbleCount], value);
|
return JS_NewNumberValue(context, [player trumbleCount], value);
|
||||||
|
|
||||||
@ -345,7 +350,15 @@ static JSBool PlayerSetProperty(JSContext *context, JSObject *this, jsid propID,
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kPlayer_escapePodRescueTime:
|
||||||
|
if (JS_ValueToNumber(context, *value, &fValue))
|
||||||
|
{
|
||||||
|
[player setEscapePodRescueTime:fValue];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
OOJSReportBadPropertySelector(context, this, propID, sPlayerProperties);
|
OOJSReportBadPropertySelector(context, this, propID, sPlayerProperties);
|
||||||
return NO;
|
return NO;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user