Skip to content

Commit 1fa6e96

Browse files
authored
l4d2_uncommon_blocker: Restore m_mobRush (SirPlease#883)
Fix: - Fixed "small-sized" mobs involving uncommon zombies.
1 parent 5a4cc81 commit 1fa6e96

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed
98 Bytes
Binary file not shown.

addons/sourcemod/scripting/l4d2_uncommon_blocker.sp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
/* -----------------------------------------------------------------------------------------------------------------------------------------------------
22
* Changelog:
33
* ---------
4+
* 2.3: (17.01.2025) (Forgetest)
5+
* Fix:
6+
* - Fixed "small-sized" mobs involving uncommon zombies.
7+
*
48
* 2.2: (24.10.2021) (A1m`)
59
* 1. Fixed: in some cases we received the coordinates of the infected 0.0.0, now the plugin always gets the correct coordinates.
610
*
@@ -96,7 +100,7 @@ public Plugin myinfo =
96100
name = "Uncommon Infected Blocker",
97101
author = "Tabun, A1m`",
98102
description = "Blocks uncommon infected from ruining your day.",
99-
version = "2.2",
103+
version = "2.3",
100104
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
101105
};
102106

@@ -166,10 +170,13 @@ void OnNextFrame(int iEntity)
166170
}
167171

168172
float fLocation[3];
169-
GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fLocation); // get location
173+
GetEntPropVector(iEntity, Prop_Data, "m_vecAbsOrigin", fLocation); // get location
174+
// @Forgetest: "m_vecOrigin" is not world origin
175+
176+
bool mobRush = GetEntProp(iEntity, Prop_Send, "m_mobRush") == 1;
170177

171178
#if DEBUG
172-
PrintToChatAll("2 Blocked uncommon infected! Entity: %d, location: %.0f %.0f %.0f.", EntRefToEntIndex(iEntity), fLocation[0], fLocation[1], fLocation[2]);
179+
PrintToChatAll("2 Blocked uncommon infected! Entity: %d, location: %.0f %.0f %.0f, mobRush: %s.", EntRefToEntIndex(iEntity), fLocation[0], fLocation[1], fLocation[2], mobRush ? "true" : "false");
173180
#endif
174181

175182
// kill the uncommon infected
@@ -179,10 +186,10 @@ void OnNextFrame(int iEntity)
179186
AcceptEntityInput(iEntity, "Kill");
180187
#endif
181188

182-
SpawnNewInfected(fLocation); // spawn infected in location instead
189+
SpawnNewInfected(fLocation, mobRush); // spawn infected in location instead
183190
}
184191

185-
void SpawnNewInfected(const float fLocation[3])
192+
void SpawnNewInfected(const float fLocation[3], bool mobRush)
186193
{
187194
int iInfected = CreateEntityByName("infected");
188195
if (iInfected < 1) {
@@ -203,8 +210,11 @@ void SpawnNewInfected(const float fLocation[3])
203210

204211
TeleportEntity(iInfected, fLocation, NULL_VECTOR, NULL_VECTOR);
205212

213+
if (mobRush)
214+
SetEntProp(iInfected, Prop_Send, "m_mobRush", mobRush);
215+
206216
#if DEBUG
207-
PrintToChatAll("Spawned new infected! Entity: %d, location: %.0f %.0f %.0f.", iInfected, fLocation[0], fLocation[1], fLocation[2]);
217+
PrintToChatAll("Spawned new infected! Entity: %d, location: %.0f %.0f %.0f, mobRush: %s.", iInfected, fLocation[0], fLocation[1], fLocation[2], mobRush ? "true" : "false");
208218
#endif
209219
}
210220

0 commit comments

Comments
 (0)