Skip to content

Commit

Permalink
Saferoom GhostSpawn: Minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
jensewe committed Oct 8, 2023
1 parent 298e33a commit 40b7d00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Binary file modified addons/sourcemod/plugins/fixes/l4d_fix_saferoom_ghostspawn.smx
Binary file not shown.
10 changes: 8 additions & 2 deletions addons/sourcemod/scripting/l4d_fix_saferoom_ghostspawn.sp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <sourcemod>
#include <left4dhooks>

#define PLUGIN_VERSION "2.0"
#define PLUGIN_VERSION "2.0.1"

public Plugin myinfo =
{
Expand All @@ -16,6 +16,7 @@ public Plugin myinfo =
};

int g_iOffs_LastSurvivorLeftStartArea;
Address gpTheDirector;

public void OnPluginStart()
{
Expand All @@ -41,6 +42,11 @@ void LateLoad()
}
}

public void OnAllPluginsLoaded()
{
gpTheDirector = L4D_GetPointer(POINTER_DIRECTOR);
}

public void L4D_OnEnterGhostState(int client)
{
if (!IsClientInGame(client) || IsFakeClient(client))
Expand Down Expand Up @@ -105,7 +111,7 @@ void SDK_OnPreThink_Post(int client)

bool HasLastSurvivorLeftStartArea()
{
return LoadFromAddress(L4D_GetPointer(POINTER_DIRECTOR) + view_as<Address>(g_iOffs_LastSurvivorLeftStartArea), NumberType_Int8);
return LoadFromAddress(gpTheDirector + view_as<Address>(g_iOffs_LastSurvivorLeftStartArea), NumberType_Int8);
}

bool NavArea_IsOverlapping(Address area, const float pos[3], float tolerance = 100.0)
Expand Down

0 comments on commit 40b7d00

Please sign in to comment.