Implemented the allowsAutoDocking property for stations and made it visible and read/write to scripts. Defaults to YES.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3805 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
16ec149cca
commit
f81cfc21ae
@ -429,6 +429,7 @@
|
||||
"autopilot-on" = "Autopilot engaged.";
|
||||
"autopilot-off" = "Autopilot disengaged.";
|
||||
"autopilot-out-of-range" = "Could not contact station for docking instructions.";
|
||||
"autopilot-station-@-does-not-allow-autodocking" = "Could not establish SinCorn RemLock protocol link with %@.";
|
||||
"autopilot-cannot-dock-with-target" = "Target is not capable of autopilot-docking."; // string not used at tne moment. Remove? kaks 20101031
|
||||
"autopilot-target-docking-instructions-denied" = "Target has denied broadcast of docking instructions.";
|
||||
"autopilot-denied" = "Station refuses to issue docking instructions.";
|
||||
|
@ -3416,8 +3416,14 @@ static BOOL toggling_music;
|
||||
// We found a dockable, check whether we can dock with it
|
||||
StationEntity *ts = (StationEntity*)target;
|
||||
|
||||
// If station is not transmitting docking instructions, we cannot use autopilot.
|
||||
if (![ts allowsAutoDocking])
|
||||
{
|
||||
[self playAutopilotCannotDockWithTarget];
|
||||
message = [NSString stringWithFormat:DESC(@"autopilot-station-@-does-not-allow-autodocking"), [ts displayName]];
|
||||
}
|
||||
// Deny if station is hostile or player is a fugitive trying to dock at the main station.
|
||||
if ( (legalStatus > 50 && ts == [UNIVERSE station]) || [ts isHostileTo:self] )
|
||||
else if ( (legalStatus > 50 && ts == [UNIVERSE station]) || [ts isHostileTo:self] )
|
||||
{
|
||||
[self playAutopilotCannotDockWithTarget];
|
||||
message = (ts == [UNIVERSE station] ? DESC(@"autopilot-denied") : DESC(@"autopilot-target-docking-instructions-denied"));
|
||||
|
@ -99,6 +99,7 @@ typedef enum
|
||||
#endif
|
||||
BOOL interstellarUndockingAllowed;
|
||||
BOOL allowsFastDocking;
|
||||
BOOL allowsAutoDocking;
|
||||
}
|
||||
|
||||
- (void) setDockingPortModel:(ShipEntity*) dock_model :(Vector) dock_pos :(Quaternion) dock_q;
|
||||
@ -202,6 +203,9 @@ typedef enum
|
||||
- (BOOL) allowsFastDocking;
|
||||
- (void) setAllowsFastDocking:(BOOL)newValue;
|
||||
|
||||
- (BOOL) allowsAutoDocking;
|
||||
- (void) setAllowsAutoDocking:(BOOL)newValue;
|
||||
|
||||
- (NSString *) dockingPatternModelFileName;
|
||||
- (NSString *) marketOverrideName;
|
||||
- (BOOL) isRotatingStation;
|
||||
|
@ -811,6 +811,8 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
|
||||
#endif
|
||||
allowsFastDocking = [dict oo_boolForKey:@"allows_fast_docking" defaultValue:NO];
|
||||
|
||||
allowsAutoDocking = [dict oo_boolForKey:@"allows_auto_docking" defaultValue:YES];
|
||||
|
||||
NSString *defaultBreakPattern = [universalInfo oo_stringForKey:@"default_dockpattern_model" defaultValue:[universalInfo oo_stringForKey:@"default_breakpattern_model"]];
|
||||
if (defaultBreakPattern == nil) defaultBreakPattern = @"oolite-tunnel.dat";
|
||||
dockingPatternModelFileName = [dict oo_stringForKey:@"docking_pattern_model" defaultValue:defaultBreakPattern];
|
||||
@ -2169,17 +2171,31 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
- (BOOL) allowsFastDocking
|
||||
{
|
||||
return allowsFastDocking;
|
||||
}
|
||||
|
||||
|
||||
- (void) setAllowsFastDocking:(BOOL)newValue
|
||||
{
|
||||
allowsFastDocking = !!newValue; // Ensure yes or no
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) allowsAutoDocking
|
||||
{
|
||||
return allowsAutoDocking;
|
||||
}
|
||||
|
||||
|
||||
- (void) setAllowsAutoDocking:(BOOL)newValue
|
||||
{
|
||||
allowsAutoDocking = !!newValue; // Ensure yes or no
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isRotatingStation
|
||||
{
|
||||
if ([shipinfoDictionary oo_boolForKey:@"rotating" defaultValue:NO]) return YES;
|
||||
|
@ -87,6 +87,7 @@ enum
|
||||
kStation_requiresDockingClearance,
|
||||
#endif
|
||||
kStation_allowsFastDocking,
|
||||
kStation_allowsAutoDocking,
|
||||
kStation_suppressArrivalReports,
|
||||
};
|
||||
|
||||
@ -101,6 +102,7 @@ static JSPropertySpec sStationProperties[] =
|
||||
{ "requiresDockingClearance", kStation_requiresDockingClearance, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||
#endif
|
||||
{ "allowsFastDocking", kStation_allowsFastDocking, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||
{ "allowsAutoDocking", kStation_allowsAutoDocking, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||
{ "dockedContractors", kStation_dockedContractors, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "dockedPolice", kStation_dockedPolice, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "dockedDefenders", kStation_dockedDefenders, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
@ -206,6 +208,10 @@ static JSBool StationGetProperty(JSContext *context, JSObject *this, jsval name,
|
||||
case kStation_allowsFastDocking:
|
||||
*outValue = BOOLToJSVal([entity allowsFastDocking]);
|
||||
break;
|
||||
|
||||
case kStation_allowsAutoDocking:
|
||||
*outValue = BOOLToJSVal([entity allowsAutoDocking]);
|
||||
break;
|
||||
|
||||
case kStation_dockedContractors:
|
||||
*outValue = INT_TO_JSVAL([entity dockedContractors]);
|
||||
@ -289,6 +295,14 @@ static JSBool StationSetProperty(JSContext *context, JSObject *this, jsval name,
|
||||
OK = YES;
|
||||
}
|
||||
break;
|
||||
|
||||
case kStation_allowsAutoDocking:
|
||||
if (JS_ValueToBoolean(context, *value, &bValue))
|
||||
{
|
||||
[entity setAllowsAutoDocking:bValue];
|
||||
OK = YES;
|
||||
}
|
||||
break;
|
||||
|
||||
case kStation_suppressArrivalReports:
|
||||
if (JS_ValueToBoolean(context, *value, &bValue))
|
||||
|
Loading…
x
Reference in New Issue
Block a user