This commit is contained in:
zaCade 2018-10-08 19:25:53 +02:00
parent 92fd59353c
commit 4bd16dce84

View File

@ -442,55 +442,57 @@ public void OnEntitySpawned(int entity)
{
CConfig _Config = g_aConfig.Get(i);
if (_Config.IsCounter)
{
CConfigCounter Config = view_as<CConfigCounter>(_Config);
char sTargetName[64];
Config.GetCounter(sTargetName, sizeof(sTargetName));
char sOperation[64];
if (Config.bCounterReverse)
sOperation = "Add";
else
sOperation = "Subtract";
if (FindOutput(entity, "m_OnHealthChanged", 0, sTargetName) != -1)
HookSingleEntityOutput(entity, "OnHealthChanged", HookCallbackDamagedBoss, false);
if (FindOutput(entity, "m_OnDamaged", 0, sTargetName) != -1)
HookSingleEntityOutput(entity, "OnDamaged", HookCallbackDamagedBoss, false);
}
else if (_Config.IsHPBar)
{
CConfigCounter Config = view_as<CConfigHPBar>(_Config);
char sTargetName[64];
Config.GetCounter(sTargetName, sizeof(sTargetName));
char sOperation[64];
if (Config.bCounterReverse)
sOperation = "Add";
else
sOperation = "Subtract";
if (FindOutput(entity, "m_OnHealthChanged", 0, sTargetName) != -1)
HookSingleEntityOutput(entity, "OnHealthChanged", HookCallbackDamagedBoss, false);
if (FindOutput(entity, "m_OnDamaged", 0, sTargetName) != -1)
HookSingleEntityOutput(entity, "OnDamaged", HookCallbackDamagedBoss, false);
}
else if (_Config.IsBreakable)
if (_Config.IsBreakable)
{
CConfigBreakable Config = view_as<CConfigBreakable>(_Config);
char sTargetNameCfg[64];
Config.GetBreakable(sTargetNameCfg, sizeof(sTargetNameCfg));
char sBreakable[64];
Config.GetBreakable(sBreakable, sizeof(sBreakable));
char sTargetName[64];
GetEntPropString(entity, Prop_Data, "m_iName", sTargetName, sizeof(sTargetName));
if (StrEqual(sTargetNameCfg, sTargetName))
if (StrEqual(sBreakable, sTargetName))
HookSingleEntityOutput(entity, "OnHealthChanged", HookCallbackDamagedBoss, false);
}
else if (_Config.IsCounter)
{
CConfigCounter Config = view_as<CConfigCounter>(_Config);
char sCounter[64];
Config.GetCounter(sCounter, sizeof(sCounter));
char sOperation[64];
if (Config.bCounterReverse)
sOperation = "Add";
else
sOperation = "Subtract";
if (FindOutput(entity, "m_OnHealthChanged", 0, sCounter) != -1)
HookSingleEntityOutput(entity, "OnHealthChanged", HookCallbackDamagedBoss, false);
if (FindOutput(entity, "m_OnDamaged", 0, sCounter) != -1)
HookSingleEntityOutput(entity, "OnDamaged", HookCallbackDamagedBoss, false);
}
else if (_Config.IsHPBar)
{
CConfigHPBar Config = view_as<CConfigHPBar>(_Config);
char sCounter[64];
Config.GetCounter(sCounter, sizeof(sCounter));
char sOperation[64];
if (Config.bCounterReverse)
sOperation = "Add";
else
sOperation = "Subtract";
if (FindOutput(entity, "m_OnHealthChanged", 0, sCounter) != -1)
HookSingleEntityOutput(entity, "OnHealthChanged", HookCallbackDamagedBoss, false);
if (FindOutput(entity, "m_OnDamaged", 0, sCounter) != -1)
HookSingleEntityOutput(entity, "OnDamaged", HookCallbackDamagedBoss, false);
}
}
}