forked from UNLOZE/sm-plugins
entWatch4: Remove useless SMLib stuff, add template checking.
This commit is contained in:
@@ -5,14 +5,13 @@
|
||||
// Description: Handle the core functions of [entWatch]
|
||||
//
|
||||
//====================================================================================================
|
||||
#include <smlib>
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdkhooks>
|
||||
#include <sdktools>
|
||||
#include <entWatch_core>
|
||||
#include <entWatch_helpers>
|
||||
|
||||
/* BOOLS */
|
||||
bool g_bLate;
|
||||
@@ -207,11 +206,13 @@ public void OnEntitySpawned(int entity)
|
||||
{
|
||||
if (Entity_IsValid(entity) && g_hArray_Configs.Length)
|
||||
{
|
||||
int iHammerID = Entity_GetHammerID(entity);
|
||||
|
||||
for (int index; index < g_hArray_Configs.Length; index++)
|
||||
{
|
||||
CConfig config = g_hArray_Configs.Get(index);
|
||||
|
||||
if (config.iWeaponID && config.iWeaponID == Entity_GetHammerId(entity))
|
||||
if (config.iWeaponID && config.iWeaponID == iHammerID)
|
||||
{
|
||||
if (!RegisterExistingItem(entity, REGISTER_WEAPON))
|
||||
{
|
||||
@@ -221,7 +222,7 @@ public void OnEntitySpawned(int entity)
|
||||
g_hArray_Items.Push(item);
|
||||
}
|
||||
}
|
||||
else if (config.iButtonID && config.iButtonID == Entity_GetHammerId(entity))
|
||||
else if (config.iButtonID && config.iButtonID == iHammerID)
|
||||
{
|
||||
if (!RegisterExistingItem(entity, REGISTER_BUTTON))
|
||||
{
|
||||
@@ -231,7 +232,7 @@ public void OnEntitySpawned(int entity)
|
||||
g_hArray_Items.Push(item);
|
||||
}
|
||||
}
|
||||
else if (config.iTriggerID && config.iTriggerID == Entity_GetHammerId(entity))
|
||||
else if (config.iTriggerID && config.iTriggerID == iHammerID)
|
||||
{
|
||||
if (!RegisterExistingItem(entity, REGISTER_TRIGGER))
|
||||
{
|
||||
@@ -271,12 +272,17 @@ stock bool RegisterItemEntity(CItem item, int entity, int type)
|
||||
{
|
||||
if (Entity_IsValid(entity))
|
||||
{
|
||||
int iOwner = Entity_GetOwner(entity);
|
||||
int iParent = Entity_GetParent(entity);
|
||||
int iTempID = Entity_GetTempID(entity);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case REGISTER_WEAPON:
|
||||
{
|
||||
if (!item.bWeapon && (Entity_GetOwner(entity) == INVALID_ENT_REFERENCE))
|
||||
if (!item.bWeapon && item.iTempID == iTempID && (iOwner == INVALID_ENT_REFERENCE))
|
||||
{
|
||||
item.iTempID = iTempID;
|
||||
item.iWeapon = entity;
|
||||
|
||||
return true;
|
||||
@@ -284,10 +290,11 @@ stock bool RegisterItemEntity(CItem item, int entity, int type)
|
||||
}
|
||||
case REGISTER_BUTTON:
|
||||
{
|
||||
if (!item.bButton && (Entity_GetParent(entity) == INVALID_ENT_REFERENCE || (item.bWeapon && Entity_GetParent(entity) == item.iWeapon)))
|
||||
if (!item.bButton && item.iTempID == iTempID && (iParent == INVALID_ENT_REFERENCE || (item.bWeapon && iParent == item.iWeapon)))
|
||||
{
|
||||
SDKHook(entity, SDKHook_Use, OnButtonPress);
|
||||
|
||||
item.iTempID = iTempID;
|
||||
item.iButton = entity;
|
||||
|
||||
return true;
|
||||
@@ -295,12 +302,13 @@ stock bool RegisterItemEntity(CItem item, int entity, int type)
|
||||
}
|
||||
case REGISTER_TRIGGER:
|
||||
{
|
||||
if (!item.bTrigger && (Entity_GetParent(entity) == INVALID_ENT_REFERENCE || (item.bWeapon && Entity_GetParent(entity) == item.iWeapon)))
|
||||
if (!item.bTrigger && item.iTempID == iTempID && (iParent == INVALID_ENT_REFERENCE || (item.bWeapon && iParent == item.iWeapon)))
|
||||
{
|
||||
SDKHook(entity, SDKHook_StartTouch, OnTriggerTouch);
|
||||
SDKHook(entity, SDKHook_EndTouch, OnTriggerTouch);
|
||||
SDKHook(entity, SDKHook_Touch, OnTriggerTouch);
|
||||
|
||||
item.iTempID = iTempID;
|
||||
item.iTrigger = entity;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user