diff --git a/addons/sourcemod/gamedata/l4d_fix_prop_los.txt b/addons/sourcemod/gamedata/l4d_fix_prop_los.txt new file mode 100644 index 000000000..af3843f45 --- /dev/null +++ b/addons/sourcemod/gamedata/l4d_fix_prop_los.txt @@ -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 + } + } + } +} \ No newline at end of file diff --git a/addons/sourcemod/plugins/fixes/l4d_fix_prop_los.smx b/addons/sourcemod/plugins/fixes/l4d_fix_prop_los.smx new file mode 100644 index 000000000..b3324d22c Binary files /dev/null and b/addons/sourcemod/plugins/fixes/l4d_fix_prop_los.smx differ diff --git a/addons/sourcemod/scripting/l4d_fix_prop_los.sp b/addons/sourcemod/scripting/l4d_fix_prop_los.sp new file mode 100644 index 000000000..236f88aba --- /dev/null +++ b/addons/sourcemod/scripting/l4d_fix_prop_los.sp @@ -0,0 +1,49 @@ +#pragma semicolon 1 +#pragma newdecls required + +#include +#include + +#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(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; +} \ No newline at end of file diff --git a/cfg/generalfixes.cfg b/cfg/generalfixes.cfg index 93ae3f08a..332b3907a 100644 --- a/cfg/generalfixes.cfg +++ b/cfg/generalfixes.cfg @@ -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..?