Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nosoop
Last active July 1, 2019 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nosoop/08774339937179d0022a541b05b51c8c to your computer and use it in GitHub Desktop.
Save nosoop/08774339937179d0022a541b05b51c8c to your computer and use it in GitHub Desktop.
"Games"
{
"tf"
{
"Addresses"
{
"CTraceFilterObject::ShouldHitEntity()::TFBotCollideWithBuildings"
{
"signature" "CTraceFilterObject::ShouldHitEntity()"
"linux"
{
"offset" "422" // 0x1A6
}
}
}
"Signatures"
{
"CTraceFilterObject::ShouldHitEntity()"
{
"library" "server"
"linux" "@_ZN18CTraceFilterObject15ShouldHitEntityEP13IHandleEntityi"
}
}
}
}
/**
* Patches collisions so TFBots can't hide inside their buildings.
* Thanks @Deathreus for the disassembly snooping.
*/
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
public void OnPluginStart() {
Handle hGameConf = LoadGameConfigFile("tf2.engineer_bot_collide_sentry");
if (!hGameConf) {
SetFailState("Failed to load gamedata (tf2.engineer_bot_collide_sentry).");
}
Address patch = GameConfGetAddress(hGameConf, "CTraceFilterObject::ShouldHitEntity()::TFBotCollideWithBuildings");
// yolo patch the jump that checks CBasePlayer::IsBotOfType() and performs additional checks
StoreToAddress(patch, 0x70, NumberType_Int8);
delete hGameConf;
}
@nosoop
Copy link
Author

nosoop commented Jan 5, 2019

Implementation of the patch using my new Source Scramble extension and manager plugin to do most of the heavy lifting:

"Games"
{
	"tf"
	{
		"MemPatches"
		{
			"CTraceFilterObject::ShouldHitEntity()::TFBotCollideWithBuildings"
			{
				"signature" "CTraceFilterObject::ShouldHitEntity()"
				"linux"
				{
					"offset"	"1A6h"
					"verify"	"\x75"
					"patch"		"\x70"
				}
				"windows"
				{
					"offset"	"9Ah"
					"verify"	"\x74"
					"patch"		"\x71"
				}
			}
		}
		
		"Signatures"
		{
			"CTraceFilterObject::ShouldHitEntity()"
			{
				"library"		"server"
				"linux"			"@_ZN18CTraceFilterObject15ShouldHitEntityEP13IHandleEntityi"
				"windows"		"\x55\x8B\xEC\x51\x8B\xC1\x8B\x0D\x2A\x2A\x2A\x2A"
			}
		}
		
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment