Request: Add EmergencyTeleportSeconds to configure emergency teleport time

This commit is contained in:
Lirusaito
2019-01-17 04:43:01 -05:00
parent eb0477f9d7
commit ed67f77f9f
2 changed files with 18 additions and 4 deletions

View File

@@ -1032,6 +1032,17 @@ Changing this setting only affects new text.</string>
<key>Value</key>
<real>3.5</real>
</map>
<key>EmergencyTeleportSeconds</key>
<map>
<key>Comment</key>
<string>The remaining time left in seconds when to execute an emergency teleport out of a restarting region.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>20</integer>
</map>
<key>LiruFlashWhenMinimized</key>
<map>
<key>Comment</key>

View File

@@ -39,8 +39,11 @@
#include "lllandmarklist.h"
#include "llviewerregion.h"
#include "llworldmap.h"
void emergency_teleport()
void emergency_teleport(const U32& seconds)
{
static const LLCachedControl<U32> time(gSavedSettings, "EmergencyTeleportSeconds");
if (seconds > time) return;
static const LLCachedControl<std::string> landmark(gSavedPerAccountSettings, "EmergencyTeleportLandmark");
if (landmark().empty()) return;
LLUUID id(landmark);
@@ -120,7 +123,7 @@ LLFloaterRegionRestarting::~LLFloaterRegionRestarting()
BOOL LLFloaterRegionRestarting::postBuild()
{
mRegionChangedConnection = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterRegionRestarting::regionChange, this));
if (mSeconds <= 20) emergency_teleport(); // <singu/> For emergency teleports
emergency_teleport(mSeconds); // <singu/> For emergency teleports
LLStringUtil::format_map_t args;
std::string text;
@@ -158,7 +161,7 @@ void LLFloaterRegionRestarting::refresh()
args["[SECONDS]"] = llformat("%d", mSeconds);
mRestartSeconds->setValue(getString("RestartSeconds", args));
if (mSeconds == 20) emergency_teleport(); // <singu/> For emergency teleports
emergency_teleport(mSeconds); // <singu/> For emergency teleports
if (!mSeconds) return; // Zero means we're done.
--mSeconds;
}
@@ -233,6 +236,6 @@ void LLFloaterRegionRestarting::draw()
void LLFloaterRegionRestarting::updateTime(const U32& time)
{
mSeconds = time;
if (mSeconds <= 20) emergency_teleport(); // <singu/> For emergency teleports
emergency_teleport(mSeconds); // <singu/> For emergency teleports
sShakeState = SHAKE_START;
}