Added a JS method for player: addMessageToArrivalReport(message). Added a eventhandler that fires after the last arrivalReportScreen is shown. Changed the internal missions so they no longer overwrite this report.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2276 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
187dc2687f
commit
b585e1d0ed
@ -4,12 +4,12 @@
|
||||
ENTER = ("setSpeedFactorTo: 0.25", "setStateTo: FLY_HOME");
|
||||
};
|
||||
"FLY_HOME" = {
|
||||
ENTER = (setCourseToPlanet, "setDesiredRangeTo: 300.0", checkCourseToDestination);
|
||||
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
|
||||
"WAYPOINT_SET" = ("setStateTo: GO_TO_WAYPOINT");
|
||||
"APPROACHING_SURFACE" = ("setSpeedFactorTo: 0.3", "setStateTo: APPROACH");
|
||||
"DESIRED_RANGE_ACHIEVED" = ("setSpeedFactorTo: 0.7", "setStateTo: APPROACH");
|
||||
"AEGIS_LEAVING_DOCKING_RANGE" = ("setStateTo: APPROACH");
|
||||
"LAUNCHED OKAY" = ("setStateTo: CLEAR_STATION");
|
||||
ATTACKED = (setTargetToPrimaryAggressor, broadcastDistressMessage);
|
||||
"INCOMING_MISSILE" = (fireECM);
|
||||
UPDATE = (setCourseToPlanet, "setDesiredRangeTo: 300.0", checkCourseToDestination, "pauseAI: 10.0");
|
||||
@ -25,6 +25,11 @@
|
||||
"INCOMING_MISSILE" = (fireECM);
|
||||
UPDATE = ("pauseAI: 10.0");
|
||||
};
|
||||
"CLEAR_STATION" = {
|
||||
ENTER = (getWitchspaceEntryCoordinates, setDestinationFromCoordinates, "setDesiredRangeTo: 100.0",
|
||||
"setSpeedFactorTo: 0.75", performFlyToRangeFromDestination, "pauseAI: 15");
|
||||
UPDATE = ("setStateTo: FLY_HOME", "pauseAI: 5.0");
|
||||
};
|
||||
"APPROACH" = {
|
||||
ENTER = (setCourseToPlanet, "setDesiredRangeTo: 100.0", performFlyToRangeFromDestination);
|
||||
"APPROACHING_SURFACE" = ("setSpeedFactorTo: 0.3", performFlyToRangeFromDestination);
|
||||
|
@ -92,7 +92,7 @@ this.addToScreen = function ()
|
||||
|
||||
this.missionOffers = function ()
|
||||
{
|
||||
if (guiScreen === "GUI_SCREEN_MISSION" || (mission.choice && mission.choice !== "") || !player.ship.docked) { return; }
|
||||
if (guiScreen === "GUI_SCREEN_MISSION" || guiScreen === "GUI_SCREEN_REPORT" || (mission.choice && mission.choice !== "") || !player.ship.docked) { return; }
|
||||
|
||||
// there will be a "missionScreenEnded" or a "missionChoiceWasReset" in future to react to.
|
||||
if (player.ship.dockedStation.isMainStation)
|
||||
@ -155,7 +155,7 @@ this.shipDockedWithStation = function ()
|
||||
};
|
||||
|
||||
|
||||
this.missionScreenEnded = this.missionChoiceWasReset = function ()
|
||||
this.missionScreenEnded = this.reportScreenEnded = this.missionChoiceWasReset = function ()
|
||||
{
|
||||
if (!player.ship.docked) { return; }
|
||||
this.missionOffers();
|
||||
|
@ -38,7 +38,7 @@ this.version = "1.73";
|
||||
|
||||
this.missionOffers = function ()
|
||||
{
|
||||
if (guiScreen === "GUI_SCREEN_MISSION" || (mission.choice && mission.choice !== "") || !player.ship.docked) { return; }
|
||||
if (guiScreen === "GUI_SCREEN_MISSION" || guiScreen === "GUI_SCREEN_REPORT" || (mission.choice && mission.choice !== "") || !player.ship.docked) { return; }
|
||||
|
||||
// there will be a "missionScreenEnded" or a "missionChoiceWasReset" in future to react to.
|
||||
if (player.ship.dockedStation.isMainStation)
|
||||
@ -187,7 +187,7 @@ this.shipDockedWithStation = function ()
|
||||
};
|
||||
|
||||
|
||||
this.missionScreenEnded = this.missionChoiceWasReset = function ()
|
||||
this.missionScreenEnded = this.reportScreenEnded = this.missionChoiceWasReset = function ()
|
||||
{
|
||||
this.choiceEvaluation();
|
||||
if (player.ship.docked)
|
||||
|
@ -38,7 +38,7 @@ this.version = "1.73";
|
||||
|
||||
this.missionOffers = function ()
|
||||
{
|
||||
if (guiScreen === "GUI_SCREEN_MISSION" || (mission.choice && mission.choice !== "") || !player.ship.docked) { return; }
|
||||
if (guiScreen === "GUI_SCREEN_MISSION" || guiScreen === "GUI_SCREEN_REPORT" || (mission.choice && mission.choice !== "") || !player.ship.docked) { return; }
|
||||
// there will be a "missionScreenEnded" or a "missionChoiceWasReset" in future to react to.
|
||||
if (player.ship.dockedStation.isMainStation)
|
||||
{
|
||||
@ -136,7 +136,7 @@ this.shipDockedWithStation = function ()
|
||||
};
|
||||
|
||||
|
||||
this.missionScreenEnded = this.missionChoiceWasReset = function ()
|
||||
this.missionScreenEnded = this.reportScreenEnded = this.missionChoiceWasReset = function ()
|
||||
{
|
||||
if (!player.ship.docked) { return; }
|
||||
this.missionOffers();
|
||||
|
@ -3876,19 +3876,13 @@ static PlayerEntity *sSharedPlayer = nil;
|
||||
}
|
||||
|
||||
NSString *escapepodReport = [self processEscapePods];
|
||||
if ([escapepodReport length] != 0)
|
||||
{
|
||||
[dockingReport appendString:escapepodReport];
|
||||
}
|
||||
[self addMessageToReport:escapepodReport];
|
||||
|
||||
[self unloadCargoPods]; // fill up the on-ship commodities before...
|
||||
|
||||
// check contracts
|
||||
NSString *passengerReport = [self checkPassengerContracts];
|
||||
if (passengerReport != nil)
|
||||
{
|
||||
[dockingReport appendFormat:@"\n\n%@", passengerReport];
|
||||
}
|
||||
NSString *passengerAndCargoReport = [self checkPassengerContracts]; // Is also processing cargo contracts.
|
||||
[self addMessageToReport:passengerAndCargoReport];
|
||||
|
||||
[UNIVERSE setDisplayText:YES];
|
||||
|
||||
|
@ -80,6 +80,8 @@ MA 02110-1301, USA.
|
||||
|
||||
- (void) erodeReputation;
|
||||
|
||||
- (void) addMessageToReport:(NSString*) report;
|
||||
|
||||
- (void) setGuiToContractsScreen;
|
||||
- (BOOL) pickFromGuiContractsScreen;
|
||||
- (void) highlightSystemFromGuiContractsScreen;
|
||||
|
@ -334,6 +334,18 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
|
||||
}
|
||||
|
||||
|
||||
- (void) addMessageToReport:(NSString*) report
|
||||
{
|
||||
if ([report length] != 0)
|
||||
{
|
||||
if ([dockingReport length] == 0)
|
||||
[dockingReport appendString:report];
|
||||
else
|
||||
[dockingReport appendFormat:@"\n\n%@", report];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (NSDictionary*) reputation
|
||||
{
|
||||
return reputation;
|
||||
@ -520,7 +532,6 @@ static NSString * const kOOLogNoteShowShipyardModel = @"script.debug.note.showSh
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void) setGuiToContractsScreen
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -1805,8 +1805,10 @@ static NSTimeInterval time_last_frame;
|
||||
{
|
||||
if (!spacePressed)
|
||||
{
|
||||
BOOL reportEnded = ([dockingReport length] == 0);
|
||||
[self playDismissedReportScreen];
|
||||
[self setGuiToStatusScreen];
|
||||
if(reportEnded) [self doScriptEvent:@"reportScreenEnded"]; // last report given. Screen is now free for missionscreens.
|
||||
}
|
||||
spacePressed = YES;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ static JSBool PlayerIncreaseContractReputation(JSContext *context, JSObject *thi
|
||||
static JSBool PlayerDecreaseContractReputation(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool PlayerIncreasePassengerReputation(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool PlayerDecreasePassengerReputation(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
static JSBool PlayerAddMessageToArrivalReport(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||
|
||||
|
||||
|
||||
@ -135,6 +136,7 @@ static JSFunctionSpec sPlayerMethods[] =
|
||||
{ "decreaseContractReputation", PlayerDecreaseContractReputation, 0 },
|
||||
{ "increasePassengerReputation", PlayerIncreasePassengerReputation, 0 },
|
||||
{ "decreasePassengerReputation", PlayerDecreasePassengerReputation, 0 },
|
||||
{ "addMessageToArrivalReport", PlayerAddMessageToArrivalReport, 1 },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
@ -392,3 +394,19 @@ static JSBool PlayerDecreasePassengerReputation(JSContext *context, JSObject *th
|
||||
[OOPlayerForScripting() decreasePassengerReputation];
|
||||
return YES;
|
||||
}
|
||||
|
||||
// addMessageToReport(message : String)
|
||||
static JSBool PlayerAddMessageToArrivalReport(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
|
||||
{
|
||||
NSString *report = nil;
|
||||
|
||||
report = JSValToNSString(context, argv[0]);
|
||||
if (report == nil)
|
||||
{
|
||||
OOReportJSBadArguments(context, @"Player", @"addMessageToArrivalReport", argc, argv, nil, @"arrival message");
|
||||
return NO;
|
||||
}
|
||||
|
||||
[OOPlayerForScripting() addMessageToReport:report];
|
||||
return YES;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user