- On scooping the cloak, the cloak now becomes repairable in tech level 15 systems.

- Improved the docking approach when arriving from the backside of a station.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4800 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Eric Walch 2012-03-10 15:19:44 +00:00
parent 62ce17e260
commit cb9e2a2cee
5 changed files with 54 additions and 41 deletions

View File

@ -34,7 +34,9 @@
};
APPROACH =
{
ENTER = (recallDockingInstructions, "setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
ENTER = (recallDockingInstructions, "setSpeedFactorTo: 1.0", checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS");
"DOCKING_ABORTED" = ("setStateTo: ABORT");
"COLLISION" = ("setStateTo: ABORT");
@ -42,6 +44,7 @@
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 7", "setStateTo: ATTACK_SHIP");
"GROUP_ATTACK_TARGET" = ("setStateTo: ATTACK_SHIP");
"RESTART_DOCKING" = ("setStateTo: GLOBAL");
RESTARTED = (recallDockingInstructions, "setSpeedFactorTo: 1.0", checkCourseToDestination);
};
RETREAT =
{

View File

@ -37,7 +37,7 @@
};
"GO_TO_STATION" =
{
ENTER = (setTargetToSystemStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination);
ENTER = ("dropMessages: WAYPOINT_SET", setTargetToSystemStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (dockEscorts, setTargetToSystemStation, "setAITo: dockingAI.plist");
@ -59,7 +59,7 @@
};
"GO_TO_SUB_STATION" =
{
ENTER = (setTargetToNearestFriendlyStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination);
ENTER = ("dropMessages: WAYPOINT_SET", setTargetToNearestFriendlyStation, "setDesiredRangeTo: 5000.0", setDestinationToTarget, checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (dockEscorts, setTargetToNearestFriendlyStation, "setAITo: dockingAI.plist");
@ -81,7 +81,7 @@
};
"GO_TO_RANDOM_STATION" =
{
ENTER = ("setDesiredRangeTo: 15000.0", setDestinationToTarget, checkCourseToDestination);
ENTER = ("dropMessages: WAYPOINT_SET", "setDesiredRangeTo: 15000.0", setDestinationToTarget, checkCourseToDestination);
"COURSE_OK" = ("setSpeedFactorTo: 0.5", performFlyToRangeFromDestination);
"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
"DESIRED_RANGE_ACHIEVED" = (dockEscorts, setTargetToNearestStation, "setAITo: dockingAI.plist");

View File

@ -1,29 +1,29 @@
/*
oolite-cloaking-device-pod.js
Ship script for cloaking device cargo pod.
Oolite
Copyright © 2004-2012 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-cloaking-device-pod.js
Ship script for cloaking device cargo pod.
Oolite
Copyright © 2004-2012 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.
*/
/*jslint white: true, undef: true, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */
@ -41,18 +41,20 @@ this.version = "1.77";
this.shipWasScooped = function (scooper)
{
if (scooper.equipmentStatus("EQ_CLOAKING_DEVICE") !== "EQUIPMENT_OK")
{
scooper.awardEquipment("EQ_CLOAKING_DEVICE");
}
else if (scooper.isPlayer)
{
// Should probably award 100 gold to non-player ships too, but they dont have a manifest at the moment.
player.ship.manifest.gold += 100;
}
if (scooper.isPlayer)
{
if (player.ship.equipmentStatus("EQ_CLOAKING_DEVICE") !== "EQUIPMENT_OK")
{
player.ship.awardEquipment("EQ_CLOAKING_DEVICE");
// Should we make it possible to repair?
// EquipmentInfo.infoForKey("EQ_CLOAKING_DEVICE").effectiveTechLevel = 14;
}
else
{
player.ship.manifest.gold += 100;
}
// effectiveTechLevel 15 makes it repairable at a level 15 system.
// Level 15 systems only exist in G1 (1x), G2 (1x), G5 (1x), G6 (1x) and G7 (2x)
EquipmentInfo.infoForKey("EQ_CLOAKING_DEVICE").effectiveTechLevel = 15;
}
// Should probably award 100 gold to non-player ships too, but they dont have awardCargo at the moment.
};

View File

@ -456,6 +456,14 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
if (ship_distance < 1000.0 + collision_radius + ship->collision_radius) // too close - back off
return instructions(universalID, position, 0, 5000, @"BACK_OFF", nil, NO);
float dot = dot_product(launchVector, delta);
if (dot < 0) // approaching from the wrong side of the station - construct a vector to the side of the station.
{
Vector approachVector = cross_product(vector_normal(delta), launchVector);
approachVector = cross_product(launchVector, approachVector); // vector, 90 degr rotated from launchVector towards target.
return instructions(universalID, OOVectorTowards(position, approachVector, [self collisionRadius] + 5000) , 0, 1000, @"APPROACH", nil, NO);
}
if (ship_distance > 12500.0) // long way off - approach more closely
return instructions(universalID, position, 0, 10000, @"APPROACH", nil, NO);
}

View File

@ -385,7 +385,7 @@ static JSBool EquipmentInfoSetProperty(JSContext *context, JSObject *this, jsid
if (JS_ValueToInt32(context, *value, &iValue))
{
if (iValue < 0) iValue = 0;
if (14 < iValue && iValue != kOOVariableTechLevel) iValue = 14;
if (15 < iValue && iValue != kOOVariableTechLevel) iValue = 15;
[OOPlayerForScripting() setMissionVariable:[NSString stringWithFormat:@"%u", iValue]
forKey:[@"mission_TL_FOR_" stringByAppendingString:[eqType identifier]]];
return YES;