Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Update 1.9.6
Browse files Browse the repository at this point in the history
Simplified event fix and added an extra explanation about what it does
Changed default bounces to make stuck rockets explode faster
Newlines...
  • Loading branch information
x07x08 authored Jul 11, 2023
1 parent 350a626 commit 510b010
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 55 deletions.
Binary file modified Subplugins/EventFix/plugins/TF2DodgeballEventFix.smx
Binary file not shown.
78 changes: 27 additions & 51 deletions Subplugins/EventFix/scripting/TF2DodgeballEventFix.sp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define PLUGIN_NAME "[TFDB] Event fix"
#define PLUGIN_AUTHOR "x07x08"
#define PLUGIN_DESCRIPTION "Fixes a very weird issue that happens when unhooking event callbacks..."
#define PLUGIN_VERSION "1.0.1"
#define PLUGIN_VERSION "1.0.2"
#define PLUGIN_URL "https://github.com/x07x08/TF2-Dodgeball-Modified"

public Plugin myinfo =
Expand All @@ -29,59 +29,35 @@ public void OnPluginStart()
//
// Refer to : https://github.com/x07x08/TF2-Dodgeball-Modified/issues/7

HookEvent("teamplay_round_start", OnRoundStart);
HookEvent("arena_round_start", OnSetupFinished);
HookEvent("teamplay_round_win", OnRoundEnd);
HookEvent("player_spawn", OnPlayerSpawn);
HookEvent("player_death", OnPlayerDeath);
HookEvent("post_inventory_application", OnPlayerInventory);
HookEvent("teamplay_broadcast_audio", OnBroadcastAudio);
HookEvent("object_deflected", OnObjectDeflected);
// https://github.com/alliedmodders/sourcemod/blob/5addaffa5665f353c874f45505914ab692535c24/core/EventManager.cpp#L262
//
// If n plugins try to unhook the same event (at the same time, like inside OnMapEnd), the last one always fails and
// throws an EventHookErr_NotActive error.
//
// Example :
// Plugins 1, 2 and 3 hook the "player_team" event inside OnConfigsExecuted and unhook it inside OnMapEnd.
// Plugin 3 will always throw (if it was the last one loaded).
//
// This might happen because the event manager wrongly removes the entire event structure while the
// last plugin hasn't unloaded its events (throws on line 268) or there's an off-by-one error (line(s) 295 and / or 309)
// that causes the former to occur.
//
// This issue will not happen if the event is hooked in another plugin and never unhooked.
// The best way to observe it is on a clean install of SourceMod.

HookEvent("player_team", OnPlayerTeam);
}

public void OnRoundStart(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
}

public void OnSetupFinished(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
}

public void OnRoundEnd(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
}

public void OnPlayerSpawn(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
}

public void OnPlayerDeath(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
}

public void OnPlayerInventory(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
}

public void OnBroadcastAudio(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
}

public void OnObjectDeflected(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
HookEvent("teamplay_round_start", VoidCallback);
HookEvent("arena_round_start", VoidCallback);
HookEvent("teamplay_round_win", VoidCallback);
HookEvent("player_spawn", VoidCallback);
HookEvent("player_death", VoidCallback);
HookEvent("post_inventory_application", VoidCallback);
HookEvent("teamplay_broadcast_audio", VoidCallback);
HookEvent("object_deflected", VoidCallback);

HookEvent("player_team", VoidCallback);
}

public void OnPlayerTeam(Event hEvent, char[] strEventName, bool bDontBroadcast)
public void VoidCallback(Event hEvent, char[] strEventName, bool bDontBroadcast)
{
return;
}
Binary file modified Subplugins/NoBlock/plugins/TF2DodgeballNoBlock.smx
Binary file not shown.
2 changes: 1 addition & 1 deletion Subplugins/NoBlock/scripting/TF2DodgeballNoBlock.sp
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ public void OnPlayerSpawn(Event hEvent, char[] strEventName, bool bDontBroadcast

// SetEntityCollisionGroup makes the server crash after a while. No idea why.
SetEntProp(iClient, Prop_Data, "m_CollisionGroup", COLLISION_GROUP_PUSHAWAY);
}
}
6 changes: 3 additions & 3 deletions TF2Dodgeball/addons/sourcemod/configs/dodgeball/general.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"neutral rocket" "0" // Does the rocket have no team based targets? (Default : 0)
"keep direction" "1" // Does the rocket keep its direction after touching a surface? (Default : 0)
"teamless deflects" "0" // Can this rocket be deflected by anyone? Same as neutral but targeting is not affected. (Default : 0)
"reset bounces" "0" // Does this rocket reset its internal bounces count on deflect? (Default : 0)
"reset bounces" "1" // Does this rocket reset its internal bounces count on deflect? (Default : 0)
"no bounce drags" "0" // Can you drag this rocket after it touched a surface? Does not affect "legacy homing" rockets. (Default : 0)
"can be stolen" "0" // Can you steal this rocket from its target? (Default : 0)
"steal team check" "1" // Checks if the stealer and the target are on the same team. (Default : 0)
Expand All @@ -163,7 +163,7 @@
"drag time min" "0.05" // After how many seconds (since deflect) can you drag? Does not affect "legacy homing" rockets.
"drag time max" "0.05" // Max time to drag the rocket. Does not affect "legacy homing" rockets.

"max bounces" "10000" // How many times can this rocket bounce?
"max bounces" "1000" // How many times can this rocket bounce?
"bounce scale" "1.0" // How hard should the rocket bounce? (Default : 1.0 multiplier)
"critical chance" "100" // Percentage of chance for a critical rocket.

Expand Down Expand Up @@ -264,4 +264,4 @@
"nuke%" "10" // Chance to spawn a nuke rocket
}
}
}
}

0 comments on commit 510b010

Please sign in to comment.