clean up debugging outputs
This commit is contained in:
@@ -10,6 +10,11 @@ public sealed class SendProxyConcealedCarryPlugin : BasePlugin
|
||||
{
|
||||
private const string WeaponListField = "m_pWeaponServices.m_hMyWeapons";
|
||||
private const string ActiveWeaponField = "m_pWeaponServices.m_hActiveWeapon";
|
||||
private const string EntityClass = "CBaseEntity";
|
||||
private static readonly byte[] InvalidHandle = UInt32Bytes(0xffffffff);
|
||||
private static readonly byte[] EmptyToken = UInt32Bytes(0);
|
||||
private static readonly byte[] NoAttachment = Int16Bytes(-1);
|
||||
private static readonly byte[] FalseByte = [0];
|
||||
|
||||
private readonly Dictionary<RuleKey, int> _activeRules = new();
|
||||
private SendProxyNative? _sendProxy;
|
||||
@@ -110,36 +115,8 @@ public sealed class SendProxyConcealedCarryPlugin : BasePlugin
|
||||
if (viewer.Slot == weapon.OwnerSlot)
|
||||
continue;
|
||||
|
||||
desired[new RuleKey(
|
||||
ToEngineSlot(viewer),
|
||||
weapon.EntityIndex,
|
||||
"CBaseEntity",
|
||||
"m_hOwnerEntity")] = UInt32Bytes(0xffffffff);
|
||||
desired[new RuleKey(
|
||||
ToEngineSlot(viewer),
|
||||
weapon.EntityIndex,
|
||||
"CBaseEntity",
|
||||
"m_CBodyComponent.m_pSceneNode.m_hParent.m_hOwner")] = UInt32Bytes(0xffffffff);
|
||||
desired[new RuleKey(
|
||||
ToEngineSlot(viewer),
|
||||
weapon.EntityIndex,
|
||||
"CBaseEntity",
|
||||
"m_CBodyComponent.m_pSceneNode.m_hParent.m_name")] = UInt32Bytes(0);
|
||||
desired[new RuleKey(
|
||||
ToEngineSlot(viewer),
|
||||
weapon.EntityIndex,
|
||||
"CBaseEntity",
|
||||
"m_CBodyComponent.m_pSceneNode.m_nParentAttachmentOrBone")] = Int16Bytes(-1);
|
||||
desired[new RuleKey(
|
||||
ToEngineSlot(viewer),
|
||||
weapon.EntityIndex,
|
||||
"CBaseEntity",
|
||||
"m_CBodyComponent.m_pSceneNode.m_hierarchyAttachName")] = UInt32Bytes(0);
|
||||
desired[new RuleKey(
|
||||
ToEngineSlot(viewer),
|
||||
weapon.EntityIndex,
|
||||
"CBaseEntity",
|
||||
"m_CBodyComponent.m_pSceneNode.m_bForceParentToBeNetworked")] = new byte[] { 0 };
|
||||
int recipient = ToEngineSlot(viewer);
|
||||
AddAssociationDisconnectRules(desired, recipient, weapon.EntityIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,13 +183,6 @@ public sealed class SendProxyConcealedCarryPlugin : BasePlugin
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] UInt16Bytes(ushort value)
|
||||
{
|
||||
byte[] bytes = new byte[2];
|
||||
BitConverter.TryWriteBytes(bytes, value);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private static byte[] Int16Bytes(short value)
|
||||
{
|
||||
byte[] bytes = new byte[2];
|
||||
@@ -227,6 +197,16 @@ public sealed class SendProxyConcealedCarryPlugin : BasePlugin
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private static void AddAssociationDisconnectRules(Dictionary<RuleKey, byte[]> desired, int recipientSlot, int weaponEntityIndex)
|
||||
{
|
||||
desired[new RuleKey(recipientSlot, weaponEntityIndex, EntityClass, "m_hOwnerEntity")] = InvalidHandle;
|
||||
desired[new RuleKey(recipientSlot, weaponEntityIndex, EntityClass, "m_CBodyComponent.m_pSceneNode.m_hParent.m_hOwner")] = InvalidHandle;
|
||||
desired[new RuleKey(recipientSlot, weaponEntityIndex, EntityClass, "m_CBodyComponent.m_pSceneNode.m_hParent.m_name")] = EmptyToken;
|
||||
desired[new RuleKey(recipientSlot, weaponEntityIndex, EntityClass, "m_CBodyComponent.m_pSceneNode.m_nParentAttachmentOrBone")] = NoAttachment;
|
||||
desired[new RuleKey(recipientSlot, weaponEntityIndex, EntityClass, "m_CBodyComponent.m_pSceneNode.m_hierarchyAttachName")] = EmptyToken;
|
||||
desired[new RuleKey(recipientSlot, weaponEntityIndex, EntityClass, "m_CBodyComponent.m_pSceneNode.m_bForceParentToBeNetworked")] = FalseByte;
|
||||
}
|
||||
|
||||
private static int ToEngineSlot(CCSPlayerController player)
|
||||
{
|
||||
return Math.Max(0, player.Slot - 1);
|
||||
|
||||
Reference in New Issue
Block a user