BossHP: never say never
This commit is contained in:
parent
c0ad48dff8
commit
5fd1aef563
@ -21,7 +21,7 @@ ConVar g_hCvar_DebugMode;
|
||||
|
||||
char g_sHUDText[256];
|
||||
|
||||
Handle g_aHurtEntityToBoss[2048] = {INVALID_HANDLE, ...};
|
||||
Handle g_aHurtEntityToBoss[4096] = {INVALID_HANDLE, ...};
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
@ -497,7 +497,7 @@ public void OnEntitySpawned(int entity, const char[] classname)
|
||||
continue;
|
||||
}
|
||||
|
||||
g_aHurtEntityToBoss[entity] = Boss;
|
||||
g_aHurtEntityToBoss[EntRefToEntIndex(entity)] = Boss;
|
||||
|
||||
if(StrEqual(sHurtOutput, "OnTakeDamage"))
|
||||
{
|
||||
@ -518,6 +518,8 @@ public void OnEntityDestroyed(int entity)
|
||||
if(!g_aConfig)
|
||||
return;
|
||||
|
||||
entity = EntRefToEntIndex(entity);
|
||||
|
||||
if(entity >= 0 && entity < sizeof(g_aHurtEntityToBoss))
|
||||
g_aHurtEntityToBoss[entity] = INVALID_HANDLE;
|
||||
}
|
||||
@ -776,6 +778,10 @@ void OnKillTrigger(int entity, const char[] output, SDKHookType HookType = view_
|
||||
|
||||
void OnHurtTrigger(int entity, int activator, float damage = 1.0)
|
||||
{
|
||||
entity = EntRefToEntIndex(entity);
|
||||
if(entity <= 0 || entity >= sizeof(g_aHurtEntityToBoss))
|
||||
return;
|
||||
|
||||
if(g_aHurtEntityToBoss[entity] == INVALID_HANDLE)
|
||||
return;
|
||||
|
||||
@ -1272,7 +1278,7 @@ bool BossInit(CBoss _Boss)
|
||||
int entity = INVALID_ENT_REFERENCE;
|
||||
while((entity = FindEntityByTargetname(entity, sHurtTrigger)) != INVALID_ENT_REFERENCE)
|
||||
{
|
||||
g_aHurtEntityToBoss[entity] = _Boss;
|
||||
g_aHurtEntityToBoss[EntRefToEntIndex(entity)] = _Boss;
|
||||
|
||||
if(StrEqual(sHurtOutput, "OnTakeDamage"))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user