forked from UNLOZE/sm-plugins
PropSpawner: Remove collision between func_clip_vphysics and plugin spawned props
This commit is contained in:
@@ -9,6 +9,12 @@
|
|||||||
"linux" "414"
|
"linux" "414"
|
||||||
"windows" "413"
|
"windows" "413"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"ForceVPhysicsCollide"
|
||||||
|
{
|
||||||
|
"linux" "160"
|
||||||
|
"windows" "159"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@ ArrayList g_aNotifyList;
|
|||||||
int g_aPlayerPropColor[MAXPLAYERS + 1][3];
|
int g_aPlayerPropColor[MAXPLAYERS + 1][3];
|
||||||
|
|
||||||
Handle g_PlayerUseSetup = INVALID_HANDLE;
|
Handle g_PlayerUseSetup = INVALID_HANDLE;
|
||||||
|
Handle g_ForceVPhysicsCollideSetup = INVALID_HANDLE;
|
||||||
|
|
||||||
enum struct NotifyListData
|
enum struct NotifyListData
|
||||||
{
|
{
|
||||||
@@ -116,6 +117,17 @@ public void OnPluginStart()
|
|||||||
g_PlayerUseSetup = DHookCreate(PlayerUseOffset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, PlayerUse_Hook);
|
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;
|
delete gd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +146,12 @@ public void OnPluginStart()
|
|||||||
HookEvent("round_end", Event_RoundEnd);
|
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)
|
public void OnEntityDestroyed(int entity)
|
||||||
{
|
{
|
||||||
// Safety net: if a tracked prop is removed by any means other than DeleteProp()
|
// 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)
|
public void OnClientPutInServer(int client)
|
||||||
{
|
{
|
||||||
g_aPlayerPropColor[client] = {255, 255, 255};
|
g_aPlayerPropColor[client] = {255, 255, 255};
|
||||||
DHookEntity(g_PlayerUseSetup, false, client);
|
if (g_PlayerUseSetup != INVALID_HANDLE)
|
||||||
DHookEntity(g_PlayerUseSetup, true, client, INVALID_FUNCTION, PlayerUse_HookPost);
|
{
|
||||||
|
DHookEntity(g_PlayerUseSetup, false, client);
|
||||||
|
DHookEntity(g_PlayerUseSetup, true, client, INVALID_FUNCTION, PlayerUse_HookPost);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnRainbowTimer(Handle timer, any data)
|
void OnRainbowTimer(Handle timer, any data)
|
||||||
@@ -949,3 +970,17 @@ bool UsePushFilter(int entity, int contentsMask)
|
|||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user