- takeSnapShot() is excluded from the timelimiter.

- scooping constrictor pilot without killing the ship no longer gives a success message.
- activating a "becomeEnergyBlast" or "becomeExplosion" within a shipDied event, no longer triggers a new shipDied event.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4794 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Eric Walch 2012-03-04 16:04:45 +00:00
parent a106f4055f
commit bb50cc8433
5 changed files with 67 additions and 40 deletions

View File

@ -19,6 +19,8 @@
"constrictor_hunt_info1b" = "Hunt for the Constrictor stolen from Xeer Shipyards.";
"constrictor_hunt_debrief" = "---INCOMING MESSAGE\n\nCongratulations Commander!\n\nThere will always be a place for you in Her Imperial Majestys Space Navy.\n\nAnd maybe sooner than you think…\n\n---MESSAGE ENDS.";
"constrictor_hunt_thief_captured" = "You captured the thief who stole the constrictor! Her Imperial Navy awards you a bonus of 1000 credits!\n";
"constrictor_hunt_thief_captured2" = "You captured an empty escape pod. The thief who stole the constrictor is still on board and you left the ship intact! Her Imperial Navy gives you a second chance!\n";
"constrictor_hunt_pilot_captured" = "You captured a pilot from a constrictor! %I police awards you a bonus of 250 credits!\n";
// Thargoid Plans mission (oolite-thargoid-plans-mission.js)

View File

@ -1,29 +1,29 @@
/*
oolite-constrictor-pilot.js
Character script for Constrictor Hunt mission.
Oolite
Copyright © 2004-2010 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
oolite-constrictor-pilot.js
Character script for Constrictor Hunt mission.
Oolite
Copyright © 2004-2010 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/
@ -35,11 +35,31 @@ this.version = "1.77";
this.unloadCharacter = function ()
{
/*
print congratulatory message from the Imperial Navy
award a special bounty
*/
player.addMessageToArrivalReport(expandMissionText("constrictor_hunt_thief_captured"));
player.credits += 1000;
switch (missionVariables.conhunt)
{
case "CONSTRICTOR_DESTROYED":
{
/*
print congratulatory message from the Imperial Navy
award a special bounty
*/
player.addMessageToArrivalReport(expandMissionText("constrictor_hunt_thief_captured"));
player.credits += 1000;
break;
}
case "STAGE_1":
{
// Pilot was scooped, but the ship is still intact. Mission continues.
player.addMessageToArrivalReport(expandMissionText("constrictor_hunt_thief_captured2"));
break;
}
default:
{
// was not a pilot from a mission ship. Probably created by a like_ship reference. Create generic message.
player.addMessageToArrivalReport(expandMissionText("constrictor_hunt_pilot_captured"));
player.credits += 250;
break;
}
}
}

View File

@ -4596,20 +4596,18 @@ static GLfloat sBaseMass = 0.0;
[UNIVERSE setDisplayText:NO];
[UNIVERSE setDisplayCursor:NO];
[UNIVERSE setViewDirection:VIEW_AFT];
[self becomeLargeExplosion:4.0];
// Let scripts know the player died.
[self noteKilledBy:whom damageType:type]; // called before exploding, consistant with npc ships.
[self becomeLargeExplosion:4.0]; // also sets STATUS_DEAD
[self moveForward:100.0];
flightSpeed = 160.0f;
[[UNIVERSE messageGUI] clear]; // No messages for the dead.
[self suppressTargetLost]; // No target lost messages when dead.
[self setStatus:STATUS_DEAD];
[self playGameOver];
// Let scripts know the player died.
[self noteKilledBy:whom damageType:type];
[UNIVERSE setBlockJSPlayerShipProps:YES]; // Treat JS player as stale entity.
[self setStatus:STATUS_DEAD]; // set dead again in case a script managed to revive the player.
[self removeAllEquipment]; // No scooping / equipment damage when dead.
[self loseTargetStatus];
[self showGameOver];

View File

@ -5815,6 +5815,8 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
- (void) noteKilledBy:(Entity *)whom damageType:(OOShipDamageType)type
{
if ([self status] == STATUS_DEAD) return;
[PLAYER setScriptTarget:self];
JSContext *context = OOJSAcquireContext();

View File

@ -451,6 +451,7 @@ static JSBool GlobalTakeSnapShot(JSContext *context, uintN argc, jsval *vp)
NSString *value = nil;
NSMutableCharacterSet *allowedChars = (NSMutableCharacterSet *)[NSMutableCharacterSet alphanumericCharacterSet];
BOOL result = NO;
[allowedChars addCharactersInString:@"_-"];
@ -478,7 +479,11 @@ static JSBool GlobalTakeSnapShot(JSContext *context, uintN argc, jsval *vp)
}
OOJS_RETURN_BOOL([[UNIVERSE gameView] snapShot:value]);
OOJS_BEGIN_FULL_NATIVE(context)
result = [[UNIVERSE gameView] snapShot:value];
OOJS_END_FULL_NATIVE
OOJS_RETURN_BOOL(result);
OOJS_NATIVE_EXIT
}