-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bone held and release action options
- Loading branch information
Showing
9 changed files
with
154 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,8 @@ | ||
namespace OpenShock.ShockOsc.Config; | ||
|
||
public sealed class BehaviourConf | ||
public sealed class BehaviourConf : SharedBehaviourConfig | ||
{ | ||
public bool RandomIntensity { get; set; } | ||
public bool RandomDuration { get; set; } | ||
public JsonRange<ushort> DurationRange { get; set; } = new JsonRange<ushort> { Min = 1000, Max = 5000 }; | ||
public JsonRange<byte> IntensityRange { get; set; } = new JsonRange<byte> { Min = 1, Max = 30 }; | ||
public byte FixedIntensity { get; set; } = 50; | ||
public ushort FixedDuration { get; set; } = 2000; | ||
public uint HoldTime { get; set; } = 250; | ||
public uint CooldownTime { get; set; } = 5000; | ||
public BoneHeldAction WhileBoneHeld { get; set; } = BoneHeldAction.Vibrate; | ||
public bool SuppressPhysBoneReleaseAction { get; set; } | ||
public bool DisableWhileAfk { get; set; } = true; | ||
public bool ForceUnmute { get; set; } | ||
|
||
public enum BoneHeldAction | ||
{ | ||
Vibrate = 0, | ||
Shock = 1, | ||
None = 2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using OpenShock.SDK.CSharp.Models; | ||
|
||
namespace OpenShock.ShockOsc.Config; | ||
|
||
public enum BoneAction | ||
{ | ||
None = 0, | ||
Shock = 1, | ||
Vibrate = 2, | ||
Sound = 3 | ||
} | ||
|
||
public static class BoneActionExtensions | ||
{ | ||
public static readonly BoneAction[] BoneActions = Enum.GetValues(typeof(BoneAction)).Cast<BoneAction>().ToArray(); | ||
|
||
public static ControlType ToControlType(this BoneAction action) | ||
{ | ||
return action switch | ||
{ | ||
BoneAction.Shock => ControlType.Shock, | ||
BoneAction.Vibrate => ControlType.Vibrate, | ||
BoneAction.Sound => ControlType.Sound, | ||
_ => ControlType.Vibrate | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using OpenShock.ShockOsc.Models; | ||
|
||
namespace OpenShock.ShockOsc.Config; | ||
|
||
public class ConfigUtils | ||
{ | ||
private readonly ConfigManager _configManager; | ||
|
||
public ConfigUtils(ConfigManager configManager) | ||
{ | ||
_configManager = configManager; | ||
} | ||
|
||
public T GetGroupOrGlobal<T>(ProgramGroup group, Func<SharedBehaviourConfig, T> selector, Func<Group, bool> groupOverrideSelector) | ||
{ | ||
if(group.ConfigGroup == null) return selector(_configManager.Config.Behaviour); | ||
|
||
var groupOverride = groupOverrideSelector(group.ConfigGroup); | ||
SharedBehaviourConfig config = groupOverride ? group.ConfigGroup : _configManager.Config.Behaviour; | ||
return selector(config); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,13 @@ | ||
namespace OpenShock.ShockOsc.Config; | ||
|
||
public sealed class Group | ||
public sealed class Group : SharedBehaviourConfig | ||
{ | ||
public required string Name { get; set; } | ||
public IList<Guid> Shockers { get; set; } = new List<Guid>(); | ||
|
||
public bool OverrideIntensity { get; set; } | ||
|
||
public bool RandomIntensity { get; set; } | ||
public JsonRange<byte> IntensityRange { get; set; } = new JsonRange<byte> { Min = 1, Max = 30 }; | ||
public byte FixedIntensity { get; set; } = 50; | ||
|
||
public bool OverrideDuration { get; set; } | ||
public bool RandomDuration { get; set; } | ||
public JsonRange<ushort> DurationRange { get; set; } = new JsonRange<ushort> { Min = 1000, Max = 5000 }; | ||
public ushort FixedDuration { get; set; } = 2000; | ||
|
||
public bool OverrideCooldownTime { get; set; } | ||
public uint CooldownTime { get; set; } = 5000; | ||
|
||
public bool OverridePhysBoneReleaseAction { get; set; } | ||
public bool SuppressPhysBoneReleaseAction { get; set; } | ||
public bool OverrideBoneHeldAction { get; set; } | ||
public bool OverrideBoneReleasedAction { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace OpenShock.ShockOsc.Config; | ||
|
||
public class SharedBehaviourConfig | ||
{ | ||
public bool RandomIntensity { get; set; } | ||
public bool RandomDuration { get; set; } | ||
|
||
public JsonRange<ushort> DurationRange { get; set; } = new JsonRange<ushort> { Min = 1000, Max = 5000 }; | ||
public JsonRange<byte> IntensityRange { get; set; } = new JsonRange<byte> { Min = 1, Max = 30 }; | ||
public byte FixedIntensity { get; set; } = 50; | ||
public ushort FixedDuration { get; set; } = 2000; | ||
|
||
public uint CooldownTime { get; set; } = 5000; | ||
|
||
public BoneAction WhileBoneHeld { get; set; } = BoneAction.Vibrate; | ||
public BoneAction WhenBoneReleased { get; set; } = BoneAction.Shock; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OverrideBoneHeldAction should be WhileBoneHeld