mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-18 10:43:22 +00:00
Compare commits
4 Commits
c19f35a5ac
...
bc19609399
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc19609399 | ||
|
|
5b43b2daef | ||
|
|
23cd692032 | ||
|
|
b801b6592a |
@@ -25,7 +25,7 @@ public partial class WeaponPaints
|
|||||||
{"weapon_g3sg1", "G3SG1"},
|
{"weapon_g3sg1", "G3SG1"},
|
||||||
{"weapon_galilar", "Galil AR"},
|
{"weapon_galilar", "Galil AR"},
|
||||||
{"weapon_m249", "M249"},
|
{"weapon_m249", "M249"},
|
||||||
{"weapon_m4a1", "M4A1"},
|
{"weapon_m4a1", "M4A4"},
|
||||||
{"weapon_mac10", "MAC-10"},
|
{"weapon_mac10", "MAC-10"},
|
||||||
{"weapon_p90", "P90"},
|
{"weapon_p90", "P90"},
|
||||||
{"weapon_mp5sd", "MP5-SD"},
|
{"weapon_mp5sd", "MP5-SD"},
|
||||||
|
|||||||
@@ -139,6 +139,27 @@ 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;
|
||||||
@@ -331,6 +352,8 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -357,9 +380,14 @@ namespace WeaponPaints
|
|||||||
pawn.SetModel(model);
|
pawn.SetModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CEconItemView item = pawn.EconGloves;
|
||||||
|
|
||||||
|
item.NetworkedDynamicAttributes.Attributes.RemoveAll();
|
||||||
|
item.AttributeList.Attributes.RemoveAll();
|
||||||
|
|
||||||
|
|
||||||
Instance.AddTimer(0.08f, () =>
|
Instance.AddTimer(0.08f, () =>
|
||||||
{
|
{
|
||||||
CEconItemView item = pawn.EconGloves;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!player.IsValid)
|
if (!player.IsValid)
|
||||||
|
|||||||
Reference in New Issue
Block a user