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:
parent
6348ff6acf
commit
07547dfd9f
@ -902,48 +902,48 @@ public void OnGameFrame()
|
||||
if(!g_aBoss)
|
||||
return;
|
||||
|
||||
static bool s_bRunningBossFrame = false;
|
||||
static bool s_bLastHudPrinted = false;
|
||||
g_sHUDText[0] = 0;
|
||||
|
||||
if (!s_bRunningBossFrame)
|
||||
for(int i = 0; i < g_aBoss.Length; i++)
|
||||
{
|
||||
s_bRunningBossFrame = true;
|
||||
CBoss Boss = g_aBoss.Get(i);
|
||||
|
||||
for(int i = 0; i < g_aBoss.Length; i++)
|
||||
if(Boss.fKillAt && Boss.fKillAt < GetGameTime())
|
||||
{ // Delete Boss
|
||||
LogDebugMessage("Deleting boss %d (KillAt)", i);
|
||||
|
||||
Call_StartForward(g_hFwd_OnBossKilled);
|
||||
Call_PushCell(Boss);
|
||||
Call_PushCell(Boss.dConfig);
|
||||
Call_PushCell(1);
|
||||
Call_Finish();
|
||||
|
||||
delete Boss;
|
||||
g_aBoss.Erase(i);
|
||||
i--;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!Boss.bActive)
|
||||
{
|
||||
CBoss Boss = g_aBoss.Get(i);
|
||||
|
||||
if(Boss.fKillAt && Boss.fKillAt < GetGameTime())
|
||||
{ // Delete Boss
|
||||
LogDebugMessage("Deleting boss %d (KillAt)", i);
|
||||
|
||||
Call_StartForward(g_hFwd_OnBossKilled);
|
||||
Call_PushCell(Boss);
|
||||
Call_PushCell(Boss.dConfig);
|
||||
Call_PushCell(1);
|
||||
Call_Finish();
|
||||
|
||||
delete Boss;
|
||||
g_aBoss.Erase(i);
|
||||
i--;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!Boss.bActive)
|
||||
if(Boss.fWaitUntil)
|
||||
{
|
||||
if(Boss.fWaitUntil)
|
||||
{
|
||||
if(Boss.fWaitUntil > GetGameTime())
|
||||
continue;
|
||||
Boss.fWaitUntil = 0.0;
|
||||
}
|
||||
|
||||
if(!BossInit(Boss))
|
||||
if(Boss.fWaitUntil > GetGameTime())
|
||||
continue;
|
||||
Boss.fWaitUntil = 0.0;
|
||||
}
|
||||
|
||||
if(!BossInit(Boss))
|
||||
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,37 +958,38 @@ public void OnGameFrame()
|
||||
g_aBoss.Erase(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
if(!IsVoteInProgress())
|
||||
// Unmark Boss as processing.
|
||||
Boss.bProcessing = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!IsVoteInProgress())
|
||||
{
|
||||
if(g_sHUDText[0])
|
||||
{
|
||||
if(g_sHUDText[0])
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
if(IsClientInGame(client))
|
||||
{
|
||||
if(IsClientInGame(client))
|
||||
{
|
||||
PrintHintText(client, g_sHUDText);
|
||||
StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
|
||||
}
|
||||
PrintHintText(client, g_sHUDText);
|
||||
StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
|
||||
}
|
||||
s_bLastHudPrinted = true;
|
||||
}
|
||||
else if(s_bLastHudPrinted)
|
||||
{
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(IsClientInGame(client))
|
||||
{
|
||||
PrintHintText(client, "");
|
||||
StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
|
||||
}
|
||||
}
|
||||
s_bLastHudPrinted = false;
|
||||
}
|
||||
s_bLastHudPrinted = true;
|
||||
}
|
||||
else if(s_bLastHudPrinted)
|
||||
{
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(IsClientInGame(client))
|
||||
{
|
||||
PrintHintText(client, "");
|
||||
StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
|
||||
}
|
||||
}
|
||||
s_bLastHudPrinted = false;
|
||||
}
|
||||
|
||||
s_bRunningBossFrame = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user