-
Notifications
You must be signed in to change notification settings - Fork 9
/
l4d2_Witch_Double_Startle_Fix.sp
71 lines (57 loc) · 2.03 KB
/
l4d2_Witch_Double_Startle_Fix.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Fixes for gamebreaking bugs and stupid gameplay aspects
* Copyright (C) 2019 LuxLuma [email protected]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#pragma newdecls required
#define PLUGIN_VERSION "1.0"
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
if(GetEngineVersion() != Engine_Left4Dead2)
{
strcopy(error, err_max, "Plugin only supports Left 4 Dead 2");
return APLRes_SilentFailure;
}
return APLRes_Success;
}
public Plugin myinfo =
{
name = "修复 Witch 吃惊时间太长",
author = "Lux",
description = "Fixes witch when wandering playing startle twice by forcing the NextThink to end the startle.",
version = PLUGIN_VERSION,
url = "forums.alliedmods.net/showthread.php?p=2647014"
};
public void OnPluginStart()
{
CreateConVar("witch_double_start_fix", PLUGIN_VERSION, "", FCVAR_NOTIFY|FCVAR_DONTRECORD);
}
public void OnEntityCreated(int iEntity, const char[] sClassname)
{
if(sClassname[0] != 'w' || !StrEqual(sClassname, "witch", false))
return;
SDKHook(iEntity, SDKHook_Think, OnThink);
}
public void OnThink(int iWitch)
{
if(GetEntProp(iWitch, Prop_Data, "m_iHealth") < 1)
return;
if(GetEntProp(iWitch, Prop_Send, "m_nSequence", 2) == 30)
SetEntPropFloat(iWitch, Prop_Send, "m_flCycle", 1.0);
}