diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 295b4180d..232dabe52 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -745,5 +745,16 @@ Value + EmergencyTeleportLandmarkBackup + + Comment + UUID of the landmark to teleport to in the last twenty seconds before a region will restart if you're already in the region of EmergencyTeleportLandmark or if EmergencyTeleportLandmark is set but canot be found, empty is none. + Persist + 1 + Type + String + Value + + diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index 6ae4a634a..7d2926c15 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -198,6 +198,7 @@ void LLPrefsAscentSys::refreshValues() mRestartMinimized = gSavedSettings.getBOOL("LiruRegionRestartMinimized"); mRestartSound = gSavedSettings.getString("UISndRestart"); mLandmark = gSavedPerAccountSettings.getString("EmergencyTeleportLandmark"); + mLandmarkBackup = gSavedPerAccountSettings.getString("EmergencyTeleportLandmarkBackup"); //Build ------------------------------------------------------------------------------- mAlpha = gSavedSettings.getF32("EmeraldBuildPrefs_Alpha"); @@ -329,6 +330,7 @@ void LLPrefsAscentSys::cancel() gSavedSettings.setBOOL("LiruRegionRestartMinimized", mRestartMinimized); gSavedSettings.setString("UISndRestart", mRestartSound); gSavedPerAccountSettings.setString("EmergencyTeleportLandmark", mLandmark); + gSavedPerAccountSettings.setString("EmergencyTeleportLandmarkBackup", mLandmarkBackup); //Build ------------------------------------------------------------------------------- gSavedSettings.setF32("EmeraldBuildPrefs_Alpha", mAlpha); diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index 8a8bed9e3..15824e709 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -112,6 +112,7 @@ private: F32 mNumScriptDiff; std::string mRestartSound; std::string mLandmark; + std::string mLandmarkBackup; //Build ------------------------------------------------------------------------------- F32 mAlpha; diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp index 35af32390..84e5ea934 100644 --- a/indra/newview/llfloaterregionrestarting.cpp +++ b/indra/newview/llfloaterregionrestarting.cpp @@ -37,14 +37,49 @@ // For emergency teleports #include "llinventorymodel.h" +#include "lllandmarklist.h" +#include "llviewerregion.h" +#include "llworldmap.h" void emergency_teleport() { static const LLCachedControl landmark(gSavedPerAccountSettings, "EmergencyTeleportLandmark"); if (landmark().empty()) return; - const LLUUID id(landmark); + LLUUID id(landmark); if (id.isNull()) return; - if (LLViewerInventoryItem* item = gInventory.getItem(id)) - gAgent.teleportViaLandmark(item->getAssetUUID()); + bool use_backup = false; + LLViewerInventoryItem* item = gInventory.getItem(id); + if (item) + { + if (LLLandmark* lm = gLandmarkList.getAsset(item->getAssetUUID())) + { + if (LLViewerRegion* region = gAgent.getRegion()) + use_backup = !lm->getRegionID(id) || id == region->getRegionID(); // LM's Region id null or same as current region + if (!use_backup) + { + LLVector3d pos_global; + if (lm->getGlobalPos(pos_global)) + { + if (LLSimInfo* sim_info = LLWorldMap::instance().simInfoFromPosGlobal(pos_global)) + { + use_backup = sim_info->isDown(); + } + } + else use_backup = true; // No coords, this will fail! + } + } + else use_backup = true; + } + else use_backup = true; + + if (use_backup) // Something is wrong with the first provided landmark, fallback. + { + static const LLCachedControl landmark(gSavedPerAccountSettings, "EmergencyTeleportLandmarkBackup"); + if (landmark().empty()) return; + if (!id.set(landmark)) return; + if (!(item = gInventory.getItem(id))) return; + } + + gAgent.teleportViaLandmark(item->getAssetUUID()); } // diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml index d14c8a21e..dc7155122 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_system.xml @@ -99,6 +99,8 @@ Drop a landmark below to autoteleport there in the last 20 seconds before region restarts + Drop a backup landmark to autoteleport to below, should you already be at the above + Sound played when regions will restart: