mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-03-11 00:44:27 +00:00
Compare commits
1 Commits
bc19609399
...
c19f35a5ac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c19f35a5ac |
@@ -25,7 +25,7 @@ public partial class WeaponPaints
|
||||
{"weapon_g3sg1", "G3SG1"},
|
||||
{"weapon_galilar", "Galil AR"},
|
||||
{"weapon_m249", "M249"},
|
||||
{"weapon_m4a1", "M4A4"},
|
||||
{"weapon_m4a1", "M4A1"},
|
||||
{"weapon_mac10", "MAC-10"},
|
||||
{"weapon_p90", "P90"},
|
||||
{"weapon_mp5sd", "MP5-SD"},
|
||||
|
||||
@@ -138,27 +138,6 @@ namespace WeaponPaints
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -172,7 +151,7 @@ namespace WeaponPaints
|
||||
foreach (var sticker in weaponInfo.Stickers)
|
||||
{
|
||||
int stickerSlot = weaponInfo.Stickers.IndexOf(sticker);
|
||||
|
||||
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
$"sticker slot {stickerSlot} id", ViewAsFloat(sticker.Id));
|
||||
if (sticker.OffsetX != 0 || sticker.OffsetY != 0)
|
||||
@@ -189,7 +168,7 @@ namespace WeaponPaints
|
||||
CAttributeListSetOrAddAttributeValueByName.Invoke(weapon.AttributeManager.Item.NetworkedDynamicAttributes.Handle,
|
||||
$"sticker slot {stickerSlot} rotation", sticker.Rotation);
|
||||
}
|
||||
|
||||
|
||||
if (_temporaryPlayerWeaponWear.TryGetValue(player.Slot, out var playerWear) &&
|
||||
playerWear.TryGetValue(weaponDefIndex, out float storedWear))
|
||||
{
|
||||
@@ -352,8 +331,6 @@ namespace WeaponPaints
|
||||
{
|
||||
newWeapon.Clip1 = ammo.Item1;
|
||||
newWeapon.ReserveAmmo[0] = ammo.Item2;
|
||||
|
||||
IncrementWearForWeaponWithStickers(player, newWeapon);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -380,14 +357,9 @@ namespace WeaponPaints
|
||||
pawn.SetModel(model);
|
||||
}
|
||||
|
||||
CEconItemView item = pawn.EconGloves;
|
||||
|
||||
item.NetworkedDynamicAttributes.Attributes.RemoveAll();
|
||||
item.AttributeList.Attributes.RemoveAll();
|
||||
|
||||
|
||||
Instance.AddTimer(0.08f, () =>
|
||||
{
|
||||
{
|
||||
CEconItemView item = pawn.EconGloves;
|
||||
try
|
||||
{
|
||||
if (!player.IsValid)
|
||||
|
||||
Reference in New Issue
Block a user