diff --git a/PropSpawner/gamedata/PropSpawner.txt b/PropSpawner/gamedata/PropSpawner.txt index 7451d47..d94464d 100644 --- a/PropSpawner/gamedata/PropSpawner.txt +++ b/PropSpawner/gamedata/PropSpawner.txt @@ -9,6 +9,12 @@ "linux" "414" "windows" "413" } + + "ForceVPhysicsCollide" + { + "linux" "160" + "windows" "159" + } } } } \ No newline at end of file diff --git a/PropSpawner/scripting/PropSpawner.sp b/PropSpawner/scripting/PropSpawner.sp index 7fe3170..82319ef 100644 --- a/PropSpawner/scripting/PropSpawner.sp +++ b/PropSpawner/scripting/PropSpawner.sp @@ -33,6 +33,7 @@ ArrayList g_aNotifyList; int g_aPlayerPropColor[MAXPLAYERS + 1][3]; Handle g_PlayerUseSetup = INVALID_HANDLE; +Handle g_ForceVPhysicsCollideSetup = INVALID_HANDLE; enum struct NotifyListData { @@ -116,6 +117,17 @@ public void OnPluginStart() g_PlayerUseSetup = DHookCreate(PlayerUseOffset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, PlayerUse_Hook); } + int ForceVPhysicsCollideOffset = gd.GetOffset("ForceVPhysicsCollide"); + if (ForceVPhysicsCollideOffset == -1) + { + LogError("PropSpawner: Missing \"ForceVPhysicsCollide\" offset in gamedata file"); + } + else + { + g_ForceVPhysicsCollideSetup = DHookCreate(ForceVPhysicsCollideOffset, HookType_Entity, ReturnType_Bool, ThisPointer_CBaseEntity, ForceVPhysicsCollide_Hook); + DHookAddParam(g_ForceVPhysicsCollideSetup, HookParamType_CBaseEntity); + } + delete gd; } @@ -134,6 +146,12 @@ public void OnPluginStart() HookEvent("round_end", Event_RoundEnd); } +public void OnEntityCreated(int entity, const char[] classname) +{ + if (StrEqual(classname, "func_clip_vphysics") && g_ForceVPhysicsCollideSetup != INVALID_HANDLE) + DHookEntity(g_ForceVPhysicsCollideSetup, false, entity); +} + public void OnEntityDestroyed(int entity) { // Safety net: if a tracked prop is removed by any means other than DeleteProp() @@ -801,8 +819,11 @@ int FindInNotifyList(int client) public void OnClientPutInServer(int client) { g_aPlayerPropColor[client] = {255, 255, 255}; - DHookEntity(g_PlayerUseSetup, false, client); - DHookEntity(g_PlayerUseSetup, true, client, INVALID_FUNCTION, PlayerUse_HookPost); + if (g_PlayerUseSetup != INVALID_HANDLE) + { + DHookEntity(g_PlayerUseSetup, false, client); + DHookEntity(g_PlayerUseSetup, true, client, INVALID_FUNCTION, PlayerUse_HookPost); + } } void OnRainbowTimer(Handle timer, any data) @@ -949,3 +970,17 @@ bool UsePushFilter(int entity, int contentsMask) return true; } + +// No convar for this one rn, didn't find it necessary +MRESReturn ForceVPhysicsCollide_Hook(int pThis, DHookReturn hReturn, DHookParam hParams) +{ + int ent = hParams.Get(1); + // Also only works with sm_propspawner_notify_shot 1 cause of this + if (g_aSpawnedProps.FindValue(ent) != -1) + { + hReturn.Value = false; + return MRES_Supercede; + } + + return MRES_Ignored; +}