FIRE-21622: Rework Flight Assist to work with llSetForce() instead of llApplyImpulse()

master
PanteraPolnocy 2018-07-13 22:20:25 +02:00
parent ae4a3c0d32
commit 1d8f706523
5 changed files with 19 additions and 21 deletions

View File

@ -900,7 +900,7 @@
<key>UseLSLFlightAssist</key>
<map>
<key>Comment</key>
<string>Use the client LSL bridge for flight boost - boost power: 0.0 (disabled), 5.0 (low), 10.0 (moderate), 15.0 (high).</string>
<string>Use the client LSL bridge for flight boost - boost power: 0.0 (disabled), 0.5 (mild), 1.0 (moderate), 2.0 (high), 15.0 (extreme).</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>

View File

@ -7,7 +7,7 @@
//
// Bridge platform
string BRIDGE_VERSION = "2.22"; // This should match fslslbridge.cpp
string BRIDGE_VERSION = "2.23"; // This should match fslslbridge.cpp
string gLatestURL;
integer gViewerIsFirestorm;
integer gTryHandshakeOnce = TRUE;
@ -27,10 +27,9 @@
// Flight assist
integer gIsFlyingNow;
float FLIGHT_CHECK_NORMAL = 0.2;
float FLIGHT_CHECK_NORMAL = 0.5;
float FLIGHT_CHECK_SLOW = 3.0;
float gFlightAssistPushForce;
float gFlightAssistMinAltitude = 10;
// OpenCollar/LockMeister AO interface
integer gAO_EnabledOC;
@ -131,11 +130,11 @@
{
if (yes)
{
llSetForce((<0.0, 0.0, 9.8> * llGetMass()), 0);
llSetForce((<0.0, 0.0, 9.8> * llGetMass()), 1);
}
else
{
llSetForce(ZERO_VECTOR, 0);
llSetForce(ZERO_VECTOR, 1);
}
}
@ -255,16 +254,7 @@ default
if (gFlightAssistPushForce > 0 && gIsFlyingNow)
{
vector currentPosition = llGetPos();
float currentGroundLevel = llGround(ZERO_VECTOR);
float currentWaterLevel = llWater(ZERO_VECTOR);
if (currentGroundLevel < currentWaterLevel)
{
currentGroundLevel = currentWaterLevel;
}
if (currentPosition.z > currentGroundLevel + gFlightAssistMinAltitude && level & (CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_UP | CONTROL_DOWN))
if (level & edge & (CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_UP | CONTROL_DOWN))
{
vector pushingForce = ZERO_VECTOR;
// Forward / back
@ -294,9 +284,12 @@ default
{
pushingForce += <0, 0, -gFlightAssistPushForce>;
}
llApplyImpulse(llGetMassMKS() * pushingForce, 1);
llSetForce(llGetMassMKS() * pushingForce, 1);
}
else if (~level & edge & (CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_UP | CONTROL_DOWN))
{
flightHover(TRUE);
}
}
}

View File

@ -52,7 +52,7 @@
static const std::string FS_BRIDGE_FOLDER = "#LSL Bridge";
static const std::string FS_BRIDGE_CONTAINER_FOLDER = "Landscaping";
static const U32 FS_BRIDGE_MAJOR_VERSION = 2;
static const U32 FS_BRIDGE_MINOR_VERSION = 22;
static const U32 FS_BRIDGE_MINOR_VERSION = 23;
static const U32 FS_MAX_MINOR_VERSION = 99;
static const std::string UPLOAD_SCRIPT_CURRENT = "EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt";
static const std::string FS_STATE_ATTRIBUTE = "state=";

View File

@ -168,14 +168,18 @@
<combo_box.item
label="Flight Assist: Mild boost"
name="flight_mild"
value="5.0" />
value="0.5" />
<combo_box.item
label="Flight Assist: Moderate boost"
name="flight_moderate"
value="10.0" />
value="1.0" />
<combo_box.item
label="Flight Assist: Strong boost"
name="flight_strong"
value="2.0" />
<combo_box.item
label="Flight Assist: Extreme boost"
name="flight_extreme"
value="15.0" />
</combo_box>

View File

@ -31,6 +31,7 @@
<combo_box.item label="Pomocnik lotu: Lekkie przyspieszanie" name="flight_mild" />
<combo_box.item label="Pomocnik lotu: Umiarkowane przyspieszanie" name="flight_moderate" />
<combo_box.item label="Pomocnik lotu: Silne przyspieszanie" name="flight_strong" />
<combo_box.item label="Pomocnik lotu: Ekstremalne przyspieszanie" name="flight_extreme" />
</combo_box>
</panel>
<panel label="Ochrona" name="ProtectionTab">