Skip to content
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
46 changes: 46 additions & 0 deletions addons/sourcemod/gamedata/l4d_fix_prop_los.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"Games"
{
"#default"
{
"Functions"
{
"l4d_fix_prop_los::CBaseProp::CalculateBlockLOS"
{
"signature" "CBaseProp::CalculateBlockLOS"
"callconv" "thiscall"
"return" "void"
"this" "entity"
}
}
}

"left4dead"
{
"Signatures"
{
"CBaseProp::CalculateBlockLOS"
{
"library" "server"
"linux" "@_ZN9CBaseProp17CalculateBlockLOSEv"
"windows" "\x83\xEC\x0C\x53\x55\x8B\xE9\x8B\x85\x2A\x2A\x2A\x2A\x8B"
// 83 EC 0C 53 55 8B E9 8B 85 ? ? ? ? 8B
}
}
}

"left4dead2"
{
"Signatures"
{
"CBaseProp::CalculateBlockLOS"
{
"library" "server"
"linux" "@_ZN9CBaseProp17CalculateBlockLOSEv"
"windows" "\x55\x8B\xEC\x83\xEC\x10\x53\x8B\xD9\x8B\x83\x2A\x2A\x2A\x2A\x8B"
// 55 8B EC 83 EC 10 53 8B D9 8B 83 ? ? ? ? 8B
// Search string "ai_addon_thrownprojectile"
// Called inside
}
}
}
}
Binary file not shown.
49 changes: 49 additions & 0 deletions addons/sourcemod/scripting/l4d_fix_prop_los.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <dhooks>

#define PLUGIN_VERSION "1.0"

public Plugin myinfo =
{
name = "[L4D & 2] Fix Prop LOS",
author = "Forgetest",
description = "Fix thin/small 'prop_*' entity not blocking LOS.",
version = PLUGIN_VERSION,
url = "https://github.com/Target5150/MoYu_Server_Stupid_Plugins",
}

methodmap GameDataWrapper < GameData {
public GameDataWrapper(const char[] file) {
GameData gd = new GameData(file);
if (!gd) SetFailState("Missing gamedata \"%s\"", file);
return view_as<GameDataWrapper>(gd);
}
public DynamicDetour CreateDetourOrFail(
const char[] name,
DHookCallback preHook = INVALID_FUNCTION,
DHookCallback postHook = INVALID_FUNCTION) {
DynamicDetour hSetup = DynamicDetour.FromConf(this, name);
if (!hSetup)
SetFailState("Missing detour setup \"%s\"", name);
if (preHook != INVALID_FUNCTION && !hSetup.Enable(Hook_Pre, preHook))
SetFailState("Failed to pre-detour \"%s\"", name);
if (postHook != INVALID_FUNCTION && !hSetup.Enable(Hook_Post, postHook))
SetFailState("Failed to post-detour \"%s\"", name);
return hSetup;
}
}

public void OnPluginStart()
{
GameDataWrapper gd = new GameDataWrapper("l4d_fix_prop_los");
delete gd.CreateDetourOrFail("l4d_fix_prop_los::CBaseProp::CalculateBlockLOS", DTR_CalculateBlockLOS);
delete gd;
}

MRESReturn DTR_CalculateBlockLOS(int entity)
{
return MRES_Supercede;
}
1 change: 1 addition & 0 deletions cfg/generalfixes.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ sm plugins load fixes/l4d2_fix_rocket_pull.smx
sm plugins load optional/l4d_return_thrown_items.smx
sm plugins load fixes/l4d_prop_touching_rules.smx
sm plugins load fixes/l4d2_fix_tank_rock_handoff.smx
sm plugins load fixes/l4d_fix_prop_los.smx

// Anti-Cheat.
sm plugins load optional/l4d2_block_autoaim.smx // Sort of a cheat..?
Expand Down
Loading