Add OnDamageTaken
This commit is contained in:
parent
f01d721281
commit
9f961f2c65
@ -53,8 +53,20 @@ public class OpenCS2hock
|
||||
case "OnRoundWin":
|
||||
this._cs2GSI.OnRoundWin += (cs2EventArgs) => shocker.Control(Settings.StringToAction(kv.Value));
|
||||
break;
|
||||
case "OnDamageTaken":
|
||||
this._cs2GSI.OnDamageTaken += (cs2EventArgs) =>
|
||||
shocker.Control(Settings.StringToAction(kv.Value),
|
||||
intensity: MapInt(cs2EventArgs.ValueAsOrDefault<int>(), 0, 100,
|
||||
_settings.IntensityRange.Min, _settings.IntensityRange.Max));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int MapInt(int input, int fromLow, int fromHigh, int toLow, int toHigh)
|
||||
{
|
||||
int mappedValue = (input - fromLow) * (toHigh - toLow) / (fromHigh - fromLow) + toLow;
|
||||
return mappedValue;
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CS2GSI" Version="1.0.2" />
|
||||
<PackageReference Include="CS2GSI" Version="1.0.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -32,7 +32,8 @@ public struct Settings
|
||||
{"OnRoundStart", "Vibrate"},
|
||||
{"OnRoundEnd", "Nothing"},
|
||||
{"OnRoundWin", "Beep"},
|
||||
{"OnRoundLoss", "Nothing"}
|
||||
{"OnRoundLoss", "Nothing"},
|
||||
{"OnDamageTaken", "Vibrate"}
|
||||
};
|
||||
|
||||
public Settings()
|
||||
|
Loading…
Reference in New Issue
Block a user