BossHP: Remove first version of damage callback.

This commit is contained in:
zaCade 2018-10-11 16:30:11 +02:00
parent b95606ff40
commit c22297b1a0

View File

@ -312,9 +312,6 @@ public void OnMapStart()
OnEntitySpawned(entity);
}
}
AddFileToDownloadsTable("materials/overlays/hitmarker/hitmarkerv2.vmt");
AddFileToDownloadsTable("materials/overlays/hitmarker/hitmarkerv2.vtf");
}
public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
@ -437,60 +434,6 @@ public void OnEntitySpawned(int entity)
LogMessage("Hooked killtrigger %s:%s", sKillTrigger, sKillOutput);
}
}
for(int i = 0; i < g_aConfig.Length; i++)
{
CConfig _Config = g_aConfig.Get(i);
if (_Config.IsBreakable)
{
CConfigBreakable Config = view_as<CConfigBreakable>(_Config);
char sBreakable[64];
Config.GetBreakable(sBreakable, sizeof(sBreakable));
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);
}
}
}
void OnTrigger(int entity, const char[] output, SDKHookType HookType = view_as<SDKHookType>(-1))
@ -1324,46 +1267,3 @@ int FindEntityByTargetname(int entity, const char[] sTargetname, const char[] sC
return INVALID_ENT_REFERENCE;
}
stock int IsValidClient(int client, bool nobots = true)
{
if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client)))
return false;
return IsClientInGame(client);
}
// Show overlay to a client with lifetime | 0.0 = no auto remove
stock void ShowOverlay(int client, char[] path, float lifetime)
{
if (!IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client))
return;
ClientCommand(client, "r_screenoverlay \"%s.vtf\"", path);
if (lifetime != 0.0)
CreateTimer(lifetime, DeleteOverlay, GetClientUserId(client));
}
// Remove overlay from a client - Timer!
stock Action DeleteOverlay(Handle timer, any userid)
{
int client = GetClientOfUserId(userid);
if (client <= 0 || !IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client))
return;
ClientCommand(client, "r_screenoverlay \"\"");
}
public void HookCallbackDamagedBoss(const char[] output, int caller, int activator, float delay)
{
if (IsValidClient(activator))
{
int iCurrentCash = GetEntProp(activator, Prop_Send, "m_iAccount");
if (iCurrentCash < 16000)
SetEntProp(activator, Prop_Send, "m_iAccount", iCurrentCash + 1);
ShowOverlay(activator, "overlays/hitmarker/hitmarkerv2", 0.25);
}
}