mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-03-13 01:18:59 +00:00
we don't need IncrementWearForWeaponWithStickers anymore
This commit is contained in:
@@ -137,27 +137,6 @@ namespace WeaponPaints
|
|||||||
UpdatePlayerWeaponMeshGroupMask(player, weapon, isLegacyModel);
|
UpdatePlayerWeaponMeshGroupMask(player, weapon, isLegacyModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// silly method to update sticker when call RefreshWeapons()
|
|
||||||
private void IncrementWearForWeaponWithStickers(CCSPlayerController player, CBasePlayerWeapon weapon)
|
|
||||||
{
|
|
||||||
int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;
|
|
||||||
if (!HasChangedPaint(player, weaponDefIndex, out var weaponInfo) || weaponInfo == null ||
|
|
||||||
weaponInfo.Stickers.Count <= 0) return;
|
|
||||||
|
|
||||||
float wearIncrement = 0.001f;
|
|
||||||
float currentWear = weaponInfo.Wear;
|
|
||||||
|
|
||||||
var playerWear = _temporaryPlayerWeaponWear.GetOrAdd(player.Slot, _ => new ConcurrentDictionary<int, float>());
|
|
||||||
|
|
||||||
float incrementedWear = playerWear.AddOrUpdate(
|
|
||||||
weaponDefIndex,
|
|
||||||
currentWear + wearIncrement,
|
|
||||||
(_, oldWear) => Math.Min(oldWear + wearIncrement, 1.0f)
|
|
||||||
);
|
|
||||||
|
|
||||||
weapon.FallbackWear = incrementedWear;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetStickers(CCSPlayerController? player, CBasePlayerWeapon weapon)
|
private void SetStickers(CCSPlayerController? player, CBasePlayerWeapon weapon)
|
||||||
{
|
{
|
||||||
if (player == null || !player.IsValid) return;
|
if (player == null || !player.IsValid) return;
|
||||||
@@ -350,8 +329,6 @@ namespace WeaponPaints
|
|||||||
{
|
{
|
||||||
newWeapon.Clip1 = ammo.Item1;
|
newWeapon.Clip1 = ammo.Item1;
|
||||||
newWeapon.ReserveAmmo[0] = ammo.Item2;
|
newWeapon.ReserveAmmo[0] = ammo.Item2;
|
||||||
|
|
||||||
IncrementWearForWeaponWithStickers(player, newWeapon);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user