Skip to content

Commit

Permalink
Zonemod 2.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
SirPlease committed Sep 15, 2023
1 parent b47d17d commit 521638a
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This is mainly a project that focuses on reworking the very outdated platform fo
It will contain both much needed fixes that are simply unable to be implemented on the older sourcemod versions as well as incompatible and outdated files being updated to working versions.

> **Included Matchmodes:**
* **Zonemod 2.8.4**
* **Zonemod 2.8.7**
* **Zonemod Hunters**
* **Zonemod Retro**
* **NeoMod 0.4a**
Expand Down
6 changes: 3 additions & 3 deletions addons/sourcemod/configs/matchmodes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
{
"zonemod"
{
"name" "ZoneMod 2.8.6"
"name" "ZoneMod 2.8.7"
}
"zoneretro"
{
"name" "ZoneMod Retro 2.8.6"
"name" "ZoneMod Retro 2.8.7"
}
"zm3v3"
{
Expand Down Expand Up @@ -109,7 +109,7 @@
{
"zonehunters"
{
"name" "ZoneHunters 2.8.6"
"name" "ZoneHunters 2.8.7"
}
"zh3v3"
{
Expand Down
Binary file modified addons/sourcemod/plugins/optional/l4d2_godframes_control_merge.smx
Binary file not shown.
94 changes: 77 additions & 17 deletions addons/sourcemod/scripting/l4d2_godframes_control_merge.sp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ ConVar
g_hSmoker = null,
g_hJockey = null,
g_hCharger = null,
g_hChargerStagger = null,
g_hChargerFlags = null,
g_hSpitFlags = null,
g_hCommonFlags = null,
g_hGodframeGlows = null,
Expand Down Expand Up @@ -92,7 +94,11 @@ bool

//fake godframes
float
g_fFakeGodframeEnd[MAXPLAYERS + 1] = {0.0, ...};
g_fFakeGodframeEnd[MAXPLAYERS + 1] = {0.0, ...},
g_fFakeChargeGodframeEnd[MAXPLAYERS + 1] = {0.0, ...};

Handle
g_hTimer[MAXPLAYERS + 1] = {null, ...};

int
g_iLastSI[MAXPLAYERS + 1] = {0, ...},
Expand All @@ -115,8 +121,8 @@ public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int iErr
public Plugin myinfo =
{
name = "L4D2 Godframes Control combined with FF Plugins",
author = "Stabby, CircleSquared, Tabun, Visor, dcx, Sir, Spoon, A1m`",
version = "0.6.8",
author = "Stabby, CircleSquared, Tabun, Visor, dcx, Sir, Spoon, A1m`, Sir",
version = "0.6.9",
description = "Allows for control of what gets godframed and what doesnt along with integrated FF Support from l4d2_survivor_ff (by dcx and Visor) and l4d2_shotgun_ff (by Visor)"
};

Expand All @@ -135,6 +141,8 @@ public void OnPluginStart()
g_hJockey = CreateConVar("gfc_jockey_duration", "0.0", "How long should godframes after a ride last?", _, true, 0.0, true, 3.0);
g_hSmoker = CreateConVar("gfc_smoker_duration", "0.0", "How long should godframes after a pull or choke last?", _, true, 0.0, true, 3.0);
g_hCharger = CreateConVar("gfc_charger_duration", "2.1", "How long should godframes after a pummel last?", _, true, 0.0, true, 3.0);
g_hChargerStagger = CreateConVar("gfc_charger_stagger_extra_time", "0.0", "Additional godframe time before damage from ChargerFlags is allowed.", _, true, 0.0, true, 3.0);
g_hChargerFlags = CreateConVar("gfc_charger_stagger_flags", "0", "What will be affected by extra charger stagger protection time. 1 - Common. 2 - Spit.", _, true, 0.0, true, 3.0);
g_hSpitFlags = CreateConVar("gfc_spit_zc_flags", "6", "Which classes will be affected by extra spit protection time. 1 - Hunter. 2 - Smoker. 4 - Jockey. 8 - Charger.", _, true, 0.0, true, 15.0);
g_hCommonFlags= CreateConVar("gfc_common_zc_flags", "0", "Which classes will be affected by extra common protection time. 1 - Hunter. 2 - Smoker. 4 - Jockey. 8 - Charger.", _, true, 0.0, true, 15.0);

Expand Down Expand Up @@ -169,6 +177,10 @@ public void OnPluginStart()
HookEvent("pounce_end", PostSurvivorRelease);
HookEvent("jockey_ride_end", PostSurvivorRelease);
HookEvent("charger_pummel_end", PostSurvivorRelease);

//Pass over stuff on passover to and from bots
HookEvent("bot_player_replace", Event_Replaced);
HookEvent("player_bot_replace", Event_Replaced);

HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);

Expand All @@ -194,7 +206,9 @@ public void Event_RoundStart(Event hEvent, const char[] sEventName, bool bDontBr
{
for (int i = 1; i <= MaxClients; i++) { //clear both fake and real just because
g_fFakeGodframeEnd[i] = 0.0;
g_fFakeChargeGodframeEnd[i] = 0.0;
g_bBuckshot[i] = false;
if (g_hTimer[i] != null) delete g_hTimer[i];
}
}

Expand Down Expand Up @@ -223,15 +237,41 @@ public void PostSurvivorRelease(Event hEvent, const char[] sEventName, bool bDon
g_iLastSI[iVictim] = 8;
}

if (g_fFakeGodframeEnd[iVictim] > fNow && g_hGodframeGlows.BoolValue) {
// make player transparent/red while godframed
SetEntityRenderMode(iVictim, RENDER_GLOW);
SetEntityRenderColor(iVictim, 255, 0, 0, 200);

CreateTimer(g_fFakeGodframeEnd[iVictim] - fNow, Timed_ResetGlow, iVictim, TIMER_FLAG_NO_MAPCHANGE);
SetGodFrameGlows(iVictim);
}

public void L4D2_OnStagger_Post(int client, int source)
{
// Charger Impact handling, source is always null.
if (IsValidSurvivor(client) && source == -1 && g_hChargerStagger.FloatValue > 0.0)
{
float fNow = GetGameTime();

// In case of multi-charger configs/modes.
if (g_fFakeChargeGodframeEnd[client] > fNow)
fNow = g_fFakeChargeGodframeEnd[client];

g_fFakeChargeGodframeEnd[client] = fNow += g_hChargerStagger.FloatValue;
}
}

public void Event_Replaced(Event hEvent, char[] name, bool dontBroadcast)
{
bool bBotReplaced = (!strncmp(name, "b", 1));
int replaced = bBotReplaced ? GetClientOfUserId(hEvent.GetInt("bot")) : GetClientOfUserId(hEvent.GetInt("player"));
int replacer = bBotReplaced ? GetClientOfUserId(hEvent.GetInt("player")) : GetClientOfUserId(hEvent.GetInt("bot"));

g_fFakeGodframeEnd[replacer] = g_fFakeGodframeEnd[replaced];
g_fFakeChargeGodframeEnd[replacer] = g_fFakeChargeGodframeEnd[replaced];
g_iLastSI[replacer] = g_iLastSI[replaced];

// Use 500 IQ to re-create 'accurate' timer on the replacer.
if (g_hTimer[replaced] != null) delete g_hTimer[replaced];
float fRemainingFakeGodFrames = g_fFakeGodframeEnd[replacer] - GetGameTime();
if (fRemainingFakeGodFrames > 0.0)
SetGodFrameGlows(replacer);
}

public void OnClientPutInServer(int iClient)
{
SDKHook(iClient, SDKHook_OnTakeDamage, OnTakeDamage);
Expand Down Expand Up @@ -287,12 +327,22 @@ public Action OnTakeDamage(int iVictim, int &iAttacker, int &iInflictor, float &

float fTimeLeft = g_fFakeGodframeEnd[iVictim] - GetGameTime();

if (StrEqual(sClassname, "infected") && (g_iLastSI[iVictim] & g_hCommonFlags.IntValue)){ //commons
if (StrEqual(sClassname, "infected") && (g_iLastSI[iVictim] & g_hCommonFlags.IntValue)) { //commons
fTimeLeft += g_hCommon.FloatValue;

if (1 & g_hChargerFlags.IntValue && fTimeLeft <= 0.0) {
float charginTime = g_fFakeChargeGodframeEnd[iVictim] - GetGameTime();
fTimeLeft = charginTime > 0.0 ? charginTime : fTimeLeft;
}
}

if (StrEqual(sClassname, "insect_swarm") && (g_iLastSI[iVictim] & g_hSpitFlags.IntValue)) { //spit
fTimeLeft += g_hSpit.FloatValue;

if (2 & g_hChargerFlags.IntValue && fTimeLeft <= 0.0) {
float charginTime = g_fFakeChargeGodframeEnd[iVictim] - GetGameTime();
fTimeLeft = charginTime > 0.0 ? charginTime : fTimeLeft;
}
}

if (IsValidSurvivor(iAttacker)) { //friendly fire
Expand Down Expand Up @@ -967,13 +1017,23 @@ public int Native_GiveClientGodFrames(Handle hPlugin, int iNumParams)
g_fFakeGodframeEnd[iClient] = fNow + fGodFrameTime; //godFrameTime
g_iLastSI[iClient] = iAttackerClass; //attackerClass

if (g_fFakeGodframeEnd[iClient] > fNow && g_hGodframeGlows.BoolValue) {
// make player transparent/red while godframed
SetEntityRenderMode(iClient, RENDER_GLOW);
SetEntityRenderColor(iClient, 255, 0, 0, 200);

CreateTimer(g_fFakeGodframeEnd[iClient] - fNow, Timed_ResetGlow, iClient, TIMER_FLAG_NO_MAPCHANGE);
}
SetGodFrameGlows(iClient);

return 1;
}

void SetGodFrameGlows(int client)
{
float fNow = GetGameTime();
if (g_fFakeGodframeEnd[client] > fNow && g_hGodframeGlows.BoolValue)
{
// make player transparent/red while godframed
SetEntityRenderMode(client, RENDER_GLOW);
SetEntityRenderColor(client, 255, 0, 0, 200);

if (g_hTimer[client] != null)
delete g_hTimer[client];

g_hTimer[client] = CreateTimer(g_fFakeGodframeEnd[client] - fNow, Timed_ResetGlow, client, TIMER_FLAG_NO_MAPCHANGE);
}
}
2 changes: 1 addition & 1 deletion cfg/cfgogl/zh1v1/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "1v1 [Zone]Hunters v2.8.6"
l4d_ready_cfg_name "1v1 [Zone]Hunters v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand Down
2 changes: 1 addition & 1 deletion cfg/cfgogl/zh2v2/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "2v2 [Zone]Hunters v2.8.6"
l4d_ready_cfg_name "2v2 [Zone]Hunters v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand Down
2 changes: 1 addition & 1 deletion cfg/cfgogl/zh3v3/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "3v3 [Zone]Hunters v2.8.6"
l4d_ready_cfg_name "3v3 [Zone]Hunters v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand Down
2 changes: 1 addition & 1 deletion cfg/cfgogl/zm1v1/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "1v1 Zonemod v2.8.6"
l4d_ready_cfg_name "1v1 Zonemod v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand Down
2 changes: 1 addition & 1 deletion cfg/cfgogl/zm2v2/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "2v2 Zonemod v2.8.6"
l4d_ready_cfg_name "2v2 Zonemod v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand Down
2 changes: 1 addition & 1 deletion cfg/cfgogl/zm3v3/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "3v3 Zonemod v2.8.6"
l4d_ready_cfg_name "3v3 Zonemod v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand Down
2 changes: 1 addition & 1 deletion cfg/cfgogl/zonehunters/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "[Zone]Hunters v2.8.6"
l4d_ready_cfg_name "[Zone]Hunters v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand Down
6 changes: 3 additions & 3 deletions cfg/cfgogl/zonemod/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "ZoneMod v2.8.6"
l4d_ready_cfg_name "ZoneMod v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand All @@ -17,8 +17,8 @@ confogl_addcvar confogl_pills_limit 2 // Limits the number of pain pills on each

// ZoneMod 4v4 Cvars
confogl_addcvar z_common_limit 30
confogl_addcvar z_ghost_delay_min 15
confogl_addcvar z_ghost_delay_max 15
confogl_addcvar z_ghost_delay_min 16
confogl_addcvar z_ghost_delay_max 16
confogl_addcvar z_mega_mob_size 50
confogl_addcvar z_mob_spawn_min_size 15
confogl_addcvar z_mob_spawn_max_size 15
Expand Down
1 change: 1 addition & 0 deletions cfg/cfgogl/zonemod/shared_plugins.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ sm plugins load optional/panel_text.smx
sm plugins load optional/spechud.smx
sm plugins load optional/slots_vote.smx
sm plugins load optional/witch_and_tankifier.smx
sm plugins load optional/l4d2_magnum_incap.smx

// Letzzzz go.
sm plugins load confoglcompmod.smx
Expand Down
5 changes: 5 additions & 0 deletions cfg/cfgogl/zonemod/shared_settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ confogl_addcvar infected_fire_immunity 3
// [l4d2_nosecondchances.smx]
confogl_addcvar bot_kick_delay 0

// [l4d2_magnum_incap.smx]
confogl_addcvar l4d2_replace_magnum_incap 2

// [l4d2_saferoom_item_remove.smx]
confogl_addcvar sm_safeitemkill_saferooms 3
confogl_addcvar sm_safeitemkill_items 13
Expand Down Expand Up @@ -160,6 +163,8 @@ confogl_addcvar gfc_jockey_duration 0
confogl_addcvar gfc_smoker_duration 0
confogl_addcvar gfc_charger_duration 2.1 // frames: 85, fps 30, length: 2.833
confogl_addcvar gfc_long_charger_duration 3.1 // wall-slam: 3.867, ground-slam: 3.967
confogl_addcvar gfc_charger_stagger_extra_time 0.5
confogl_addcvar gfc_charger_stagger_flags 2
confogl_addcvar gfc_common_zc_flags 9
confogl_addcvar gfc_spit_zc_flags 6
confogl_addcvar gfc_godframe_glows 1
Expand Down
2 changes: 1 addition & 1 deletion cfg/cfgogl/zoneretro/confogl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// =======================================================================================

// ReadyUp Cvars
l4d_ready_cfg_name "ZoneMod Retro v2.8.6"
l4d_ready_cfg_name "ZoneMod Retro v2.8.7"

// Confogl Cvars
confogl_addcvar mp_gamemode "versus" // Force Versus for the config.
Expand Down

0 comments on commit 521638a

Please sign in to comment.