BossHP: Rework halt to boss specific instead of global.

Global would actually halt the entire plugin on first error. So this is more preferable.
This commit is contained in:
zaCade 2019-03-08 17:03:57 +01:00
parent 1d7a6973a1
commit efcd50f4ac
2 changed files with 70 additions and 56 deletions

View File

@ -902,14 +902,9 @@ public void OnGameFrame()
if(!g_aBoss)
return;
static bool s_bRunningBossFrame = false;
static bool s_bLastHudPrinted = false;
g_sHUDText[0] = 0;
if (!s_bRunningBossFrame)
{
s_bRunningBossFrame = true;
for(int i = 0; i < g_aBoss.Length; i++)
{
CBoss Boss = g_aBoss.Get(i);
@ -944,6 +939,11 @@ public void OnGameFrame()
continue;
}
if(!Boss.bProcessing)
{
// Mark boss as processing, this will stay true on errors, preventing spam due to OnGameFrame otherwise constantly trying again.
Boss.bProcessing = true;
if(!BossProcess(Boss))
{ // Delete Boss
LogDebugMessage("Deleting boss %d (dead)", i);
@ -958,6 +958,10 @@ public void OnGameFrame()
g_aBoss.Erase(i);
i--;
}
// Unmark Boss as processing.
Boss.bProcessing = false;
}
}
if(!IsVoteInProgress())
@ -987,9 +991,6 @@ public void OnGameFrame()
s_bLastHudPrinted = false;
}
}
s_bRunningBossFrame = false;
}
}
bool BossInit(CBoss _Boss)

View File

@ -10,6 +10,7 @@ methodmap CBoss < Basic
Basic myclass = new Basic();
myclass.SetHandle("dConfig", INVALID_HANDLE);
myclass.SetBool("bProcessing", false);
myclass.SetBool("bActive", false);
myclass.SetBool("bShow", true);
myclass.SetInt("iTemplateNum", -1);
@ -34,6 +35,18 @@ methodmap CBoss < Basic
}
}
property bool bProcessing
{
public get()
{
return this.GetBool("bProcessing");
}
public set(bool value)
{
this.SetBool("bProcessing", value);
}
}
property bool bActive
{
public get()