|
pred@1958
|
1 |
#include <sourcemod> |
|
pred@1958
|
2 |
#include <sdktools> |
|
pred@1958
|
3 |
|
|
pred@1958
|
4 |
public Plugin:myinfo = |
|
pred@1958
|
5 |
{ |
|
pred@1958
|
6 |
name = "Entity Output Hook Testing", |
|
pred@1958
|
7 |
author = "AlliedModders LLC", |
|
pred@1958
|
8 |
description = "Test suite for Entity Output Hooks", |
|
pred@1958
|
9 |
version = "1.0.0.0", |
|
pred@1958
|
10 |
url = "http://www.sourcemod.net/" |
|
pred@1958
|
11 |
}; |
|
pred@1958
|
12 |
|
|
pred@1958
|
13 |
public OnPluginStart() |
|
pred@1958
|
14 |
{ |
|
pred@1958
|
15 |
HookEntityOutput("point_spotlight", "OnLightOn", OutputHook); |
|
pred@1958
|
16 |
|
|
pred@1958
|
17 |
HookEntityOutput("func_door", "OnOpen", OutputHook); |
|
pred@1958
|
18 |
HookEntityOutput("func_door_rotating", "OnOpen", OutputHook); |
|
pred@1958
|
19 |
HookEntityOutput("func_door", "OnClose", OutputHook); |
|
pred@1958
|
20 |
HookEntityOutput("func_door_rotating", "OnClose", OutputHook); |
|
pred@1958
|
21 |
} |
|
pred@1958
|
22 |
|
|
pred@1958
|
23 |
public OutputHook(const String:name[], caller, activator, Float:delay) |
|
pred@1958
|
24 |
{ |
|
pred@1958
|
25 |
LogMessage("[ENTOUTPUT] %s", name); |
|
pred@1958
|
26 |
} |
|
pred@1958
|
27 |
|
|
pred@1958
|
28 |
public OnMapStart() |
|
pred@1958
|
29 |
{ |
|
pred@1958
|
30 |
new ent = FindEntityByClassname(-1, "point_spotlight"); |
|
pred@1958
|
31 |
|
|
pred@1958
|
32 |
if (ent == -1) |
|
pred@1958
|
33 |
{ |
|
pred@1958
|
34 |
LogError("Could not find a point_spotlight"); |
|
pred@1958
|
35 |
ent = CreateEntityByName("point_spotlight"); |
|
pred@1958
|
36 |
DispatchSpawn(ent); |
|
pred@1958
|
37 |
} |
|
pred@1958
|
38 |
|
|
pred@1958
|
39 |
HookSingleEntityOutput(ent, "OnLightOn", OutputHook, true); |
|
pred@1958
|
40 |
HookSingleEntityOutput(ent, "OnLightOff", OutputHook, true); |
|
pred@1958
|
41 |
|
|
pred@1958
|
42 |
AcceptEntityInput(ent, "LightOff", ent, ent); |
|
pred@1958
|
43 |
AcceptEntityInput(ent, "LightOn", ent, ent); |
|
pred@1958
|
44 |
|
|
pred@1958
|
45 |
AcceptEntityInput(ent, "LightOff", ent, ent); |
|
pred@1958
|
46 |
AcceptEntityInput(ent, "LightOn", ent, ent); |
|
pred@1958
|
47 |
|
|
pred@1958
|
48 |
HookSingleEntityOutput(ent, "OnLightOn", OutputHook, false); |
|
pred@1958
|
49 |
HookSingleEntityOutput(ent, "OnLightOff", OutputHook, false); |
|
pred@1958
|
50 |
|
|
pred@1958
|
51 |
AcceptEntityInput(ent, "LightOff", ent, ent); |
|
pred@1958
|
52 |
AcceptEntityInput(ent, "LightOn", ent, ent); |
|
pred@1958
|
53 |
AcceptEntityInput(ent, "LightOff", ent, ent); |
|
pred@1958
|
54 |
AcceptEntityInput(ent, "LightOn", ent, ent); |
|
pred@1958
|
55 |
|
|
pred@1958
|
56 |
//Comment these out (and reload the plugin heaps) to test for leaks on plugin unload |
|
pred@1960
|
57 |
UnhookSingleEntityOutput(ent, "OnLightOn", OutputHook); |
|
pred@1960
|
58 |
UnhookSingleEntityOutput(ent, "OnLightOff", OutputHook); |
|
pred@1958
|
59 |
} |