mirror of
https://github.com/hermansimensen/eventqueue-fix.git
synced 2025-12-07 18:38:25 +00:00
bug-fixes
This commit is contained in:
parent
1d3eb2bf83
commit
9abb5d22c1
@ -33,8 +33,7 @@ enum struct event_t
|
||||
|
||||
enum struct entity_t
|
||||
{
|
||||
int caller;
|
||||
int tick;
|
||||
int outputID;
|
||||
float waitTime;
|
||||
}
|
||||
|
||||
@ -244,75 +243,31 @@ public MRESReturn DHook_AddEventThree(Handle hParams)
|
||||
{
|
||||
g_aOutputWait[event.activator].GetArray(i, ent);
|
||||
|
||||
if(ent.caller == event.caller)
|
||||
{
|
||||
if(ent.tick != GetGameTickCount())
|
||||
if(ent.outputID == event.outputID)
|
||||
{
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!bFound)
|
||||
{
|
||||
g_aPlayerEvents[event.activator].PushArray(event);
|
||||
|
||||
ent.caller = event.caller;
|
||||
ent.tick = GetGameTickCount();
|
||||
ent.outputID = event.outputID;
|
||||
ent.waitTime = m_flWait;
|
||||
g_aOutputWait[event.activator].PushArray(ent);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ent.waitTime <= 0.0)
|
||||
{
|
||||
g_aPlayerEvents[event.activator].PushArray(event);
|
||||
}
|
||||
}
|
||||
return MRES_Supercede;
|
||||
}
|
||||
|
||||
return MRES_Ignored;
|
||||
}
|
||||
|
||||
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
|
||||
{
|
||||
float timescale = Shavit_GetClientTimescale(client) != -1.0 ? Shavit_GetClientTimescale(client) : Shavit_GetStyleSettingFloat(Shavit_GetBhopStyle(client), "speed");
|
||||
|
||||
for(int i = 0; i < g_aOutputWait[client].Length; i++)
|
||||
{
|
||||
entity_t ent;
|
||||
g_aOutputWait[client].GetArray(i, ent);
|
||||
|
||||
if(ent.waitTime <= 0.0)
|
||||
{
|
||||
g_aOutputWait[client].Erase(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
ent.waitTime -= GetTickInterval() * timescale;
|
||||
g_aOutputWait[client].SetArray(i, ent);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < g_aPlayerEvents[client].Length; i++)
|
||||
{
|
||||
event_t event;
|
||||
g_aPlayerEvents[client].GetArray(i, event);
|
||||
|
||||
if(event.delay <= GetTickInterval() * timescale)
|
||||
public void ServiceEvent(event_t event)
|
||||
{
|
||||
SetVariantString(event.variantValue);
|
||||
|
||||
if(!IsValidEntity(event.caller))
|
||||
{
|
||||
event.caller = event.activator;
|
||||
}
|
||||
|
||||
int targetEntity;
|
||||
|
||||
|
||||
if(!strcmp("!activator", event.target, false))
|
||||
{
|
||||
targetEntity = event.activator;
|
||||
@ -325,7 +280,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int entity = 0; entity < GetMaxEntities(); entity++)
|
||||
for (int entity = 0; entity < GetMaxEntities()*2; entity++)
|
||||
{
|
||||
if (!IsValidEntity(entity)) {
|
||||
continue;
|
||||
@ -343,9 +298,44 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
||||
}
|
||||
|
||||
#if defined DEBUG
|
||||
PrintToChat(client, "Performing output: %s, %i, %i, %s %s, %i", event.target, targetEntity, event.caller, event.targetInput, event.variantValue, event.outputID);
|
||||
PrintToChat(event.activator, "Performing output: %s, %i, %i, %s %s, %i, %f", event.target, targetEntity, event.caller, event.targetInput, event.variantValue, event.outputID, GetGameTime());
|
||||
#endif
|
||||
}
|
||||
|
||||
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
|
||||
{
|
||||
float timescale = Shavit_GetClientTimescale(client) != -1.0 ? Shavit_GetClientTimescale(client) : Shavit_GetStyleSettingFloat(Shavit_GetBhopStyle(client), "speed");
|
||||
|
||||
for(int i = 0; i < g_aOutputWait[client].Length; i++)
|
||||
{
|
||||
entity_t ent;
|
||||
g_aOutputWait[client].GetArray(i, ent);
|
||||
|
||||
if(ent.waitTime <= GetTickInterval() * timescale)
|
||||
{
|
||||
g_aOutputWait[client].Erase(i);
|
||||
i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
ent.waitTime -= GetTickInterval() * timescale;
|
||||
g_aOutputWait[client].SetArray(i, ent);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < g_aPlayerEvents[client].Length; i++)
|
||||
{
|
||||
event_t event;
|
||||
g_aPlayerEvents[client].GetArray(i, event);
|
||||
|
||||
if(event.delay <= GetTickInterval() * timescale)
|
||||
{
|
||||
if(!IsValidEntity(event.caller))
|
||||
{
|
||||
event.caller = event.activator;
|
||||
}
|
||||
|
||||
ServiceEvent(event);
|
||||
g_aPlayerEvents[client].Erase(i);
|
||||
i--;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user