mirror of
https://github.com/Nereziel/cs2-WeaponPaints.git
synced 2026-02-18 10:43:22 +00:00
bodygroup and subclass change method to use AcceptInput
This commit is contained in:
@@ -93,10 +93,11 @@ public partial class WeaponPaints
|
||||
|
||||
private static readonly MemoryFunctionVoid<nint, string, float> CAttributeListSetOrAddAttributeValueByName = new(GameData.GetSignature("CAttributeList_SetOrAddAttributeValueByName"));
|
||||
|
||||
private static readonly MemoryFunctionWithReturn<nint, string, int, int> SetBodygroupFunc = new(
|
||||
GameData.GetSignature("CBaseModelEntity_SetBodygroup"));
|
||||
//we dont need anymore because we use AcceptInput
|
||||
//private static readonly MemoryFunctionWithReturn<nint, string, int, int> SetBodygroupFunc = new(
|
||||
// GameData.GetSignature("CBaseModelEntity_SetBodygroup"));
|
||||
|
||||
private static readonly Func<nint, string, int, int> SetBodygroup = SetBodygroupFunc.Invoke;
|
||||
//private static readonly Func<nint, string, int, int> SetBodygroup = SetBodygroupFunc.Invoke;
|
||||
|
||||
private static Dictionary<int, string> WeaponDefindex { get; } = new()
|
||||
{
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace WeaponPaints
|
||||
|
||||
item.Initialized = true;
|
||||
|
||||
SetBodygroup(pawn.Handle, "default_gloves", 1);
|
||||
SetBodygroup(pawn, "default_gloves", 1);
|
||||
}
|
||||
catch (Exception) { }
|
||||
}, TimerFlags.STOP_ON_MAPCHANGE);
|
||||
@@ -429,13 +429,15 @@ namespace WeaponPaints
|
||||
return int.TryParse(randomWeapon["paint"]?.ToString(), out var paintValue) ? paintValue : 0;
|
||||
}
|
||||
|
||||
private static void SubclassChange(CBasePlayerWeapon weapon, ushort itemD)
|
||||
//xstage idea on css discord
|
||||
public static void SubclassChange(CBasePlayerWeapon weapon, ushort itemD)
|
||||
{
|
||||
var subclassChangeFunc = VirtualFunction.Create<nint, string, int>(
|
||||
GameData.GetSignature("ChangeSubclass")
|
||||
);
|
||||
weapon.AcceptInput("ChangeSubclass", value: itemD.ToString());
|
||||
}
|
||||
|
||||
subclassChangeFunc(weapon.Handle, itemD.ToString());
|
||||
public static void SetBodygroup(CCSPlayerPawn pawn, string group, int value)
|
||||
{
|
||||
pawn.AcceptInput("SetBodygroup", value:$"{group},{value}");
|
||||
}
|
||||
|
||||
private static void UpdateWeaponMeshGroupMask(CBaseEntity weapon, bool isLegacy = false)
|
||||
|
||||
Reference in New Issue
Block a user