Skip to content

Commit ad2d687

Browse files
committed
Fix missing definition
1 parent d5f96cf commit ad2d687

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

addons/sourcemod/scripting/l4d_fix_prop_los.sp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <sourcemod>
55
#include <dhooks>
6-
#include <@Forgetest/gamedatawrapper>
76

87
#define PLUGIN_VERSION "1.0"
98

@@ -16,6 +15,27 @@ public Plugin myinfo =
1615
url = "https://github.com/Target5150/MoYu_Server_Stupid_Plugins",
1716
}
1817

18+
methodmap GameDataWrapper < GameData {
19+
public GameDataWrapper(const char[] file) {
20+
GameData gd = new GameData(file);
21+
if (!gd) SetFailState("Missing gamedata \"%s\"", file);
22+
return view_as<GameDataWrapper>(gd);
23+
}
24+
public DynamicDetour CreateDetourOrFail(
25+
const char[] name,
26+
DHookCallback preHook = INVALID_FUNCTION,
27+
DHookCallback postHook = INVALID_FUNCTION) {
28+
DynamicDetour hSetup = DynamicDetour.FromConf(this, name);
29+
if (!hSetup)
30+
SetFailState("Missing detour setup \"%s\"", name);
31+
if (preHook != INVALID_FUNCTION && !hSetup.Enable(Hook_Pre, preHook))
32+
SetFailState("Failed to pre-detour \"%s\"", name);
33+
if (postHook != INVALID_FUNCTION && !hSetup.Enable(Hook_Post, postHook))
34+
SetFailState("Failed to post-detour \"%s\"", name);
35+
return hSetup;
36+
}
37+
}
38+
1939
public void OnPluginStart()
2040
{
2141
GameDataWrapper gd = new GameDataWrapper("l4d_fix_prop_los");

0 commit comments

Comments
 (0)