Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ShockOsc/Config/SharedBehaviourConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ public class SharedBehaviourConfig
public BoneAction WhenBoneReleased { get; set; } = BoneAction.Shock;

public uint? BoneHeldDurationLimit { get; set; } = null;
public bool OnPullTriggerRandomBehavior { get; set; }
}
15 changes: 15 additions & 0 deletions ShockOsc/Services/ShockOsc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using OpenShock.ShockOSC.Utils;
using OscQueryLibrary;
using OscQueryLibrary.Utils;
using Serilog;

#pragma warning disable CS4014

Expand Down Expand Up @@ -411,6 +412,17 @@ private async Task PhysboneHandling(ProgramGroup programGroup, bool isGrabbed)
// Check all preconditions, maybe send stop command here aswell?
if (!await HandlePrecondition(CheckAndSetAllPreconditions(programGroup), programGroup)) return;

var pullTriggerBehavior = _moduleConfig.Config.GetGroupOrGlobal(programGroup,
behaviourConfig => behaviourConfig.OnPullTriggerRandomBehavior,
group => group.OnPullTriggerRandomBehavior);

if (pullTriggerBehavior)
{
SendCommand(programGroup, GetDuration(programGroup), GetIntensity(programGroup), ControlType.Shock, false);

return;
}

var releaseAction = _moduleConfig.Config.GetGroupOrGlobal(programGroup,
behaviourConfig => behaviourConfig.WhenBoneReleased,
group => group.OverrideBoneReleasedAction);
Expand All @@ -421,6 +433,9 @@ private async Task PhysboneHandling(ProgramGroup programGroup, bool isGrabbed)
return;
}

_logger.LogDebug("Physbone released, sending {Action} to group {Group}", releaseAction, programGroup.Name);
_logger.LogDebug("Physbone stretch value: {StretchValue}", programGroup.LastStretchValue);

var physBoneIntensity = GetPhysbonePullIntensity(programGroup, programGroup.LastStretchValue);
programGroup.LastStretchValue = 0;

Expand Down
10 changes: 10 additions & 0 deletions ShockOsc/Ui/Pages/Dash/Tabs/ConfigTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@
OnSaveAction="_ => OnSettingsValueChange()">
Max Intensity: @ModuleConfig.Config.Behaviour.IntensityRange.Max%
</DebouncedSlider>

<br />

<div style="display: flex; align-items: center;">
<MudCheckBox Class="option-width option-checkbox-height" @bind-Value="ModuleConfig.Config.Behaviour.OnPullTriggerRandomBehavior" Label="Pull Trigger Random" @bind-Value:after="OnSettingsValueChangeAsync"/>

<MudTooltip Text="When enabled, the shock will randomly choose between the two intensity values set above, instead of using the intensity based on distance.">
<MudIcon Icon="@Icons.Material.Filled.Info" Size="Size.Small" Title="Information" />
</MudTooltip>
</div>
}


Expand Down
10 changes: 10 additions & 0 deletions ShockOsc/Ui/Pages/Dash/Tabs/GroupsTab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@
OnSaveAction="_ => ModuleConfig.SaveDeferred()">
Max Intensity: @CurrentGroup.IntensityRange.Max%
</DebouncedSlider>

<br />

<div style="display: flex; align-items: center;">
<MudCheckBox Class="option-width option-checkbox-height" @bind-Value="@CurrentGroup.OnPullTriggerRandomBehavior" Label="Pull Trigger Random" @bind-Value:after="OnGroupSettingsValueChange"/>

<MudTooltip Text="When enabled, the shock will randomly choose between the two intensity values set above, instead of using the intensity based on distance.">
<MudIcon Icon="@Icons.Material.Filled.Info" Size="Size.Small" Title="Information" />
</MudTooltip>
</div>
}

</MudCollapse>
Expand Down