Force Swim button for AO, for when you wanna swim above water
Force Swim forces swims to be enabled
This commit is contained in:
@@ -497,6 +497,19 @@
|
||||
<key>IsCOA</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>AOSwimForced</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Sets AOSwimEnabled to true, and plays swims instead of flies, even if not underwater.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
<key>IsCOA</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>AONoStandsInMouselook</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -460,12 +460,20 @@ AOSystem::AOSystem()
|
||||
#undef BASIC_OVERRIDE
|
||||
#undef ANY_OVERRIDE
|
||||
|
||||
sSwimming = is_underwater();
|
||||
auto swim_forced = gSavedSettings.getControl("AOSwimForced");
|
||||
sSwimming = swim_forced->get().asBoolean() || is_underwater();
|
||||
mConnections[0] = gSavedSettings.getControl("AOSitsEnabled")->getSignal()->connect([this](LLControlVariable*, const LLSD& val) {
|
||||
if (!isAgentAvatarValid() || !gAgentAvatarp->isSitting()) return;
|
||||
gAgent.sendAnimationRequest(mAOOverrides[getSitType()]->ao_id, val.asBoolean() ? ANIM_REQUEST_START : ANIM_REQUEST_STOP);
|
||||
});
|
||||
mConnections[1] = gSavedSettings.getControl("AOSwimEnabled")->getSignal()->connect(boost::bind(&AOSystem::toggleSwim, this, boost::bind(is_underwater)));
|
||||
const auto& swim_cb = [=](LLControlVariable*, const LLSD&){ toggleSwim(swim_forced->get().asBoolean() || is_underwater()); };
|
||||
auto swim_enabled = gSavedSettings.getControl("AOSwimEnabled");
|
||||
mConnections[1] = swim_enabled->getSignal()->connect(swim_cb);
|
||||
mConnections[2] = swim_forced->getSignal()->connect([swim_cb, swim_enabled](LLControlVariable*, const LLSD& val) {
|
||||
if (val.asBoolean()) // Automatically enable Swim AO.
|
||||
swim_enabled->set(true);
|
||||
swim_cb(nullptr, LLSD());
|
||||
});
|
||||
}
|
||||
|
||||
AOSystem::~AOSystem()
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
<panel bg_visible="false" border="false" border_visible="false" bottom="0"
|
||||
enabled="true" follows="right|bottom" height="45" left="0" mouse_opaque="true"
|
||||
name="ao_remote" use_bounding_rect="true" width="96">
|
||||
<panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="47" left="0" width="96" />
|
||||
<panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="69" left="0" width="96" />
|
||||
<button bottom="48" control_name="AOSwimForced" toggle="true" follows="left|top" height="22" label="Force Swim" tool_tip="Flying animations will be replaced with swimming ones instead" mouse_opaque="true" name="ao_swim_btn" width="92" left="3" />
|
||||
<button bottom="-20" control_name="AOSitsEnabled" enabled="true" toggle="true"
|
||||
follows="left|top" font="SansSerif" height="22" label="AO Sits Off" label_selected="AO Sits On"
|
||||
follows="left|top" font="SansSerif" height="22" label="Sits Off" label_selected="Sits On"
|
||||
mouse_opaque="true" name="ao_sit_btn" width="92" left="3" />
|
||||
<panel bottom="13" filename="panel_ao_remote_controls.xml" name="panel_ao_controls" left="0" width="96" />
|
||||
</panel>
|
||||
|
||||
Reference in New Issue
Block a user