diff --git a/ShockOsc/Config/Group.cs b/ShockOsc/Config/Group.cs index 9440614..98de4d2 100644 --- a/ShockOsc/Config/Group.cs +++ b/ShockOsc/Config/Group.cs @@ -18,4 +18,6 @@ public sealed class Group public bool OverrideCooldownTime { get; set; } public uint CooldownTime { get; set; } = 5000; + + public bool SuppressPhysBoneReleaseAction { get; set; } } \ No newline at end of file diff --git a/ShockOsc/Models/ProgramGroup.cs b/ShockOsc/Models/ProgramGroup.cs index 7dadae6..168d5d2 100644 --- a/ShockOsc/Models/ProgramGroup.cs +++ b/ShockOsc/Models/ProgramGroup.cs @@ -10,6 +10,7 @@ public sealed class ProgramGroup public DateTime LastActive { get; set; } public DateTime LastExecuted { get; set; } public DateTime LastVibration { get; set; } + public DateTime PhysBoneGrabLimitTime { get; set; } public ushort LastDuration { get; set; } public byte LastIntensity { get; set; } public float LastStretchValue { get; set; } diff --git a/ShockOsc/Services/ShockOsc.cs b/ShockOsc/Services/ShockOsc.cs index aadd986..b56d6d2 100644 --- a/ShockOsc/Services/ShockOsc.cs +++ b/ShockOsc/Services/ShockOsc.cs @@ -415,6 +415,13 @@ private async Task ReceiveLogic() } } + if (!programGroup.IsGrabbed && isGrabbed) + { + // on physbone grab + ushort TheDuration = GetDuration(programGroup); + programGroup.PhysBoneGrabLimitTime = DateTime.UtcNow.AddMilliseconds(TheDuration); + _logger.LogDebug("Limiting hold duration of Group {Group} to {Duration}ms", programGroup.Name, TheDuration); + } programGroup.IsGrabbed = isGrabbed; return; // Normal shocker actions @@ -540,10 +547,12 @@ private async Task CheckProgramGroup(ProgramGroup programGroup, Guid pos, Behavi _configManager.Config.Behaviour.WhileBoneHeld != BehaviourConf.BoneHeldAction.None && !isActiveOrOnCooldown && + !_underscoreConfig.KillSwitch && programGroup.IsGrabbed && + programGroup.PhysBoneGrabLimitTime > DateTime.UtcNow && programGroup.LastVibration < DateTime.UtcNow.Subtract(TimeSpan.FromMilliseconds(100))) { - var pullIntensityTranslated = Math.Max(Convert.ToByte(programGroup.LastStretchValue * 100f), (byte)1); + var pullIntensityTranslated = GetPhysbonePullIntensity(programGroup, programGroup.LastStretchValue); programGroup.LastVibration = DateTime.UtcNow; _logger.LogDebug("Vibrating/Shocking {Shocker} at {Intensity}", pos, pullIntensityTranslated); @@ -586,6 +595,7 @@ private async Task CheckProgramGroup(ProgramGroup programGroup, Guid pos, Behavi if (programGroup.TriggerMethod == TriggerMethod.PhysBoneRelease) { + if (programGroup.ConfigGroup is { SuppressPhysBoneReleaseAction: true }) { return; } intensity = GetPhysbonePullIntensity(programGroup, programGroup.LastStretchValue); programGroup.LastStretchValue = 0; diff --git a/ShockOsc/Ui/Pages/Dash/Tabs/GroupsTab.razor b/ShockOsc/Ui/Pages/Dash/Tabs/GroupsTab.razor index a86cd43..ed66441 100644 --- a/ShockOsc/Ui/Pages/Dash/Tabs/GroupsTab.razor +++ b/ShockOsc/Ui/Pages/Dash/Tabs/GroupsTab.razor @@ -244,6 +244,10 @@ + + + + Shockers in Group