BossHP: fix everything?
This commit is contained in:
parent
d8d5eb3128
commit
31f8571e8d
@ -21,7 +21,6 @@ ConVar g_hCvar_DebugMode;
|
|||||||
|
|
||||||
char g_sHUDText[256];
|
char g_sHUDText[256];
|
||||||
|
|
||||||
bool g_bProcessNewEntities = false;
|
|
||||||
char g_aHurtEntityToBossIdx[2048] = {0xFF, ...};
|
char g_aHurtEntityToBossIdx[2048] = {0xFF, ...};
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
@ -393,8 +392,6 @@ public void OnEntitySpawned(int entity, const char[] classname)
|
|||||||
if(!g_aConfig)
|
if(!g_aConfig)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_bProcessNewEntities = true;
|
|
||||||
|
|
||||||
char sTargetname[64];
|
char sTargetname[64];
|
||||||
GetEntPropString(entity, Prop_Data, "m_iName", sTargetname, sizeof(sTargetname));
|
GetEntPropString(entity, Prop_Data, "m_iName", sTargetname, sizeof(sTargetname));
|
||||||
|
|
||||||
@ -470,6 +467,7 @@ public void OnEntitySpawned(int entity, const char[] classname)
|
|||||||
char sHurtOutput[64];
|
char sHurtOutput[64];
|
||||||
Config.GetHurtOutput(sHurtOutput, sizeof(sHurtOutput));
|
Config.GetHurtOutput(sHurtOutput, sizeof(sHurtOutput));
|
||||||
|
|
||||||
|
int iBoss = -1;
|
||||||
for(int j = 0; j < g_aBoss.Length; j++)
|
for(int j = 0; j < g_aBoss.Length; j++)
|
||||||
{
|
{
|
||||||
CBoss Boss = g_aBoss.Get(j);
|
CBoss Boss = g_aBoss.Get(j);
|
||||||
@ -477,18 +475,20 @@ public void OnEntitySpawned(int entity, const char[] classname)
|
|||||||
if(Boss.dConfig != Config)
|
if(Boss.dConfig != Config)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
g_aHurtEntityToBossIdx[entity] = j;
|
iBoss = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(g_aHurtEntityToBossIdx[entity] == 0xFF)
|
if(iBoss == -1)
|
||||||
{
|
{
|
||||||
char sBoss[64];
|
char sBoss[64];
|
||||||
Config.GetName(sBoss, sizeof(sBoss));
|
Config.GetName(sBoss, sizeof(sBoss));
|
||||||
LogError("ERROR Hooking hurttrigger %s:%s!!! Boss = %s", sHurtTrigger, sHurtOutput, sBoss);
|
LogDebugMessage("Couldn't find boss \"%s\" for hurttrigger %s:%s", sBoss, sHurtTrigger, sHurtOutput);
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_aHurtEntityToBossIdx[entity] = iBoss;
|
||||||
|
|
||||||
if(StrEqual(sHurtOutput, "OnTakeDamage"))
|
if(StrEqual(sHurtOutput, "OnTakeDamage"))
|
||||||
{
|
{
|
||||||
SDKHook(entity, SDKHook_OnTakeDamagePost, OnTakeDamagePostHurt);
|
SDKHook(entity, SDKHook_OnTakeDamagePost, OnTakeDamagePostHurt);
|
||||||
@ -498,7 +498,7 @@ public void OnEntitySpawned(int entity, const char[] classname)
|
|||||||
HookSingleEntityOutput(entity, sHurtOutput, OnEntityOutputHurt);
|
HookSingleEntityOutput(entity, sHurtOutput, OnEntityOutputHurt);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogDebugMessage("Hooked hurttrigger %s:%s (iBoss %d)", sHurtTrigger, sHurtOutput, g_aHurtEntityToBossIdx[entity]);
|
LogDebugMessage("Hooked hurttrigger %s:%s (iBoss %d)", sHurtTrigger, sHurtOutput, iBoss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -879,18 +879,13 @@ public void OnGameFrame()
|
|||||||
|
|
||||||
if(!Boss.bActive)
|
if(!Boss.bActive)
|
||||||
{
|
{
|
||||||
bool bProcess = g_bProcessNewEntities;
|
|
||||||
if(Boss.fWaitUntil)
|
if(Boss.fWaitUntil)
|
||||||
{
|
{
|
||||||
if(Boss.fWaitUntil > GetGameTime())
|
if(Boss.fWaitUntil > GetGameTime())
|
||||||
continue;
|
continue;
|
||||||
Boss.fWaitUntil = 0.0;
|
Boss.fWaitUntil = 0.0;
|
||||||
bProcess = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!bProcess)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(!BossInit(i, Boss))
|
if(!BossInit(i, Boss))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -949,8 +944,6 @@ public void OnGameFrame()
|
|||||||
s_bLastHudPrinted = false;
|
s_bLastHudPrinted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_bProcessNewEntities = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BossInit(int iBoss, CBoss _Boss)
|
bool BossInit(int iBoss, CBoss _Boss)
|
||||||
@ -1208,7 +1201,21 @@ bool BossInit(int iBoss, CBoss _Boss)
|
|||||||
if(sShowTrigger[0])
|
if(sShowTrigger[0])
|
||||||
{
|
{
|
||||||
Format(sShowTrigger, sizeof(sShowTrigger), "%s&%04d", sShowTrigger, iTemplateNum);
|
Format(sShowTrigger, sizeof(sShowTrigger), "%s&%04d", sShowTrigger, iTemplateNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sKillTrigger[0])
|
||||||
|
{
|
||||||
|
Format(sKillTrigger, sizeof(sKillTrigger), "%s&%04d", sKillTrigger, iTemplateNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sHurtTrigger[0])
|
||||||
|
{
|
||||||
|
Format(sHurtTrigger, sizeof(sHurtTrigger), "%s&%04d", sHurtTrigger, iTemplateNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sShowTrigger[0])
|
||||||
|
{
|
||||||
char sShowOutput[64];
|
char sShowOutput[64];
|
||||||
_Config.GetShowOutput(sShowOutput, sizeof(sShowOutput));
|
_Config.GetShowOutput(sShowOutput, sizeof(sShowOutput));
|
||||||
|
|
||||||
@ -1231,8 +1238,6 @@ bool BossInit(int iBoss, CBoss _Boss)
|
|||||||
|
|
||||||
if(sKillTrigger[0])
|
if(sKillTrigger[0])
|
||||||
{
|
{
|
||||||
Format(sKillTrigger, sizeof(sKillTrigger), "%s&%04d", sKillTrigger, iTemplateNum);
|
|
||||||
|
|
||||||
char sKillOutput[64];
|
char sKillOutput[64];
|
||||||
_Config.GetKillOutput(sKillOutput, sizeof(sKillOutput));
|
_Config.GetKillOutput(sKillOutput, sizeof(sKillOutput));
|
||||||
|
|
||||||
@ -1277,7 +1282,6 @@ bool BossInit(int iBoss, CBoss _Boss)
|
|||||||
LogDebugMessage("Hooked hurttrigger %s:%s", sHurtTrigger, sHurtOutput);
|
LogDebugMessage("Hooked hurttrigger %s:%s", sHurtTrigger, sHurtOutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_Boss.bActive = true;
|
_Boss.bActive = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user