entWatch4: Whoop Die Doo, Fix Item Registering.

No longer will items get registered as if they are another one, hopefully ;-;
This commit is contained in:
zaCade 2019-04-09 13:04:09 +02:00
parent ecbf18e14f
commit 51f5588f3d

View File

@ -223,7 +223,7 @@ public void OnEntitySpawned(int entity)
if (config.iWeaponID && config.iWeaponID == iHammerID) if (config.iWeaponID && config.iWeaponID == iHammerID)
{ {
if (!RegisterExistingItem(entity, REGISTER_WEAPON)) if (!RegisterExistingItem(config, entity, REGISTER_WEAPON))
{ {
CItem item = new CItem(config); CItem item = new CItem(config);
@ -233,7 +233,7 @@ public void OnEntitySpawned(int entity)
} }
else if (config.iButtonID && config.iButtonID == iHammerID) else if (config.iButtonID && config.iButtonID == iHammerID)
{ {
if (!RegisterExistingItem(entity, REGISTER_BUTTON)) if (!RegisterExistingItem(config, entity, REGISTER_BUTTON))
{ {
CItem item = new CItem(config); CItem item = new CItem(config);
@ -243,7 +243,7 @@ public void OnEntitySpawned(int entity)
} }
else if (config.iTriggerID && config.iTriggerID == iHammerID) else if (config.iTriggerID && config.iTriggerID == iHammerID)
{ {
if (!RegisterExistingItem(entity, REGISTER_TRIGGER)) if (!RegisterExistingItem(config, entity, REGISTER_TRIGGER))
{ {
CItem item = new CItem(config); CItem item = new CItem(config);
@ -258,7 +258,7 @@ public void OnEntitySpawned(int entity)
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
stock bool RegisterExistingItem(int entity, int type) stock bool RegisterExistingItem(CConfig config, int entity, int type)
{ {
if (Entity_IsValid(entity) && g_hArray_Items.Length) if (Entity_IsValid(entity) && g_hArray_Items.Length)
{ {
@ -266,10 +266,13 @@ stock bool RegisterExistingItem(int entity, int type)
{ {
CItem item = g_hArray_Items.Get(index); CItem item = g_hArray_Items.Get(index);
if (item.dConfig == config)
{
if (RegisterItemEntity(item, entity, type)) if (RegisterItemEntity(item, entity, type))
return true; return true;
} }
} }
}
return false; return false;
} }