Add OnDamageTaken
This commit is contained in:
parent
f01d721281
commit
9f961f2c65
@ -53,8 +53,20 @@ public class OpenCS2hock
|
|||||||
case "OnRoundWin":
|
case "OnRoundWin":
|
||||||
this._cs2GSI.OnRoundWin += (cs2EventArgs) => shocker.Control(Settings.StringToAction(kv.Value));
|
this._cs2GSI.OnRoundWin += (cs2EventArgs) => shocker.Control(Settings.StringToAction(kv.Value));
|
||||||
break;
|
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>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CS2GSI" Version="1.0.2" />
|
<PackageReference Include="CS2GSI" Version="1.0.3" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@ public struct Settings
|
|||||||
{"OnRoundStart", "Vibrate"},
|
{"OnRoundStart", "Vibrate"},
|
||||||
{"OnRoundEnd", "Nothing"},
|
{"OnRoundEnd", "Nothing"},
|
||||||
{"OnRoundWin", "Beep"},
|
{"OnRoundWin", "Beep"},
|
||||||
{"OnRoundLoss", "Nothing"}
|
{"OnRoundLoss", "Nothing"},
|
||||||
|
{"OnDamageTaken", "Vibrate"}
|
||||||
};
|
};
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user