Add Overwrite to Shocker.Control for intensity and duration
This commit is contained in:
parent
6a862fa814
commit
f01d721281
@ -12,18 +12,18 @@ internal abstract class Shocker
|
|||||||
|
|
||||||
internal enum ControlAction { Beep, Vibrate, Shock, Nothing }
|
internal enum ControlAction { Beep, Vibrate, Shock, Nothing }
|
||||||
|
|
||||||
internal void Control(ControlAction action, string? shockerId = null)
|
internal void Control(ControlAction action, string? shockerId = null, int? intensity = null, int? duration = null)
|
||||||
{
|
{
|
||||||
int intensity = _intensity.GetValue();
|
int i = intensity ?? _intensity.GetValue();
|
||||||
int duration = _duration.GetValue();
|
int d = duration ?? _duration.GetValue();
|
||||||
this.Logger?.Log(LogLevel.Information, $"{action} {intensity} {duration}");
|
this.Logger?.Log(LogLevel.Information, $"{action} {(intensity is not null ? "Overwrite " : "")}{i} {(duration is not null ? "Overwrite " : "")}{d}");
|
||||||
if (action is ControlAction.Nothing)
|
if (action is ControlAction.Nothing)
|
||||||
return;
|
return;
|
||||||
if(shockerId is null)
|
if(shockerId is null)
|
||||||
foreach (string shocker in _shockerIds)
|
foreach (string shocker in _shockerIds)
|
||||||
ControlInternal(action, shocker, intensity, duration);
|
ControlInternal(action, shocker, i, d);
|
||||||
else
|
else
|
||||||
ControlInternal(action, shockerId, intensity, duration);
|
ControlInternal(action, shockerId, i, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void ControlInternal(ControlAction action, string shockerId, int intensity, int duration);
|
protected abstract void ControlInternal(ControlAction action, string shockerId, int intensity, int duration);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user