Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Vehicle/Turret Weapon Tracers #145

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions scripting/include/srccoop/blackmesa/deathnotice.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
char g_pDnDisplayList[][2][] =
{
// NPCS.
{ "npc_abrams", "Tank" },
{ "npc_abrams", "HECU Abrams" },
{ "npc_alien_controller", "Alien Controller" },
{ "npc_alien_grunt", "Alien Grunt" },
{ "npc_alien_grunt_elite", "Elite Alien Grunt" },
{ "npc_alien_grunt_melee", "Alien Grunt" },
{ "npc_alien_slave", "Alien Slave" },
{ "npc_alien_slave_dummy", "Alien Slave" },
{ "npc_apache", "Apache" },
{ "npc_apache", "HECU Apache" },
{ "npc_barnacle", "Barnacle" },
{ "npc_beneathticle", "Underwater Barnacle" },
{ "npc_boid", "Boid" },
Expand Down Expand Up @@ -49,7 +49,7 @@ char g_pDnDisplayList[][2][] =
{ "npc_human_security", "Security Guard" },
{ "npc_ichthyosaur", "Ichthyosaur" },
{ "npc_kleiner", "Dr. Kliener" },
{ "npc_lav", "LAV" },
{ "npc_lav", "HECU LAV" },
{ "npc_leech", "Leech" },
{ "npc_nihilanth", "Nihilanth" },
{ "npc_osprey", "Osprey" },
Expand All @@ -62,7 +62,7 @@ char g_pDnDisplayList[][2][] =
{ "npc_sentry_ceiling", "Turret" },
{ "npc_sentry_ground", "Turret" },
{ "npc_snark", "Snark" },
{ "npc_sniper", "Marine Sniper" },
{ "npc_sniper", "HECU Sniper" },
{ "npc_tentacle", "Alien Tentacle" },
{ "npc_vortigaunt", "Alien Slave" },
{ "npc_xen_grunt", "Alien Grunt" },
Expand Down
26 changes: 22 additions & 4 deletions scripting/include/srccoop/blackmesa/entitypatch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,34 @@ public MRESReturn Hook_PropChargerThinkPost(int _this)

//------------------------------------------------------
// TE - BlackMesa Shot
// Fix npc_sniper tracers hard crashing some client configurations
// Fix npc_sniper tracers hard crashing some client configurations and
// hides the tracers of certain npcs due to incorrect firing position
//------------------------------------------------------
public Action BlackMesaFireBulletsTEHook(const char[] szTEName, const int[] iClients, int iNumClients, float flDelay)
{
// Prevent crashes from `npc_sniper` on certain client configurations.
int iAmmoId = TE_ReadNum("m_iAmmoID");
if (iAmmoId == AMMO_SNIPERROUND)
{
TE_WriteNum("m_bDoTracers", 0);
return Plugin_Changed;
}

// TE will crash all clients without a valid entity.
CBaseEntity pEntity = CBaseEntity(TE_ReadNum("m_iEntityIndex"));
if (pEntity == NULL_CBASEENTITY)
return Plugin_Changed;

char szClassname[MAX_CLASSNAME];
if (!pEntity.GetClassname(szClassname, sizeof(szClassname)))
return Plugin_Changed;

// Hide tracers of broken npcs.
// TODO:
// Instead of hiding the tracers, they should be displayed correctly.
if (strcmp(szClassname, "npc_sentry_ground") == 0 ||
strcmp(szClassname, "npc_sentry_ceiling") == 0 ||
strcmp(szClassname, "npc_abrams") == 0 ||
strcmp(szClassname, "npc_lav") == 0)
return Plugin_Changed;

return Plugin_Continue;
}

Expand Down