* Add SetCollisionGroup native * Add newline to end of file * Fix gamedata locations * Remove extra spaces * Fix gamedata formatting * Add Windows signature for CS:GO * Fix native doc comment * Revert formatting change * Change references of client -> entity * Moved CallWrapper into method * typofix Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
This commit is contained in:
parent
3b2fa89926
commit
a9d3cf4574
@ -41,10 +41,18 @@
|
|||||||
#include <iclient.h>
|
#include <iclient.h>
|
||||||
#include "iserver.h"
|
#include "iserver.h"
|
||||||
#include "am-string.h"
|
#include "am-string.h"
|
||||||
|
#include <sm_argbuffer.h>
|
||||||
|
|
||||||
SourceHook::List<ValveCall *> g_RegCalls;
|
SourceHook::List<ValveCall *> g_RegCalls;
|
||||||
SourceHook::List<ICallWrapper *> g_CallWraps;
|
SourceHook::List<ICallWrapper *> g_CallWraps;
|
||||||
|
|
||||||
|
#define ENTINDEX_TO_CBASEENTITY(ref, buffer) \
|
||||||
|
buffer = gamehelpers->ReferenceToEntity(ref); \
|
||||||
|
if (!buffer) \
|
||||||
|
{ \
|
||||||
|
return pContext->ThrowNativeError("Entity %d (%d) is not a CBaseEntity", gamehelpers->ReferenceToIndex(ref), ref); \
|
||||||
|
}
|
||||||
|
|
||||||
inline void InitPass(ValvePassInfo &info, ValveType vtype, PassType type, unsigned int flags, unsigned int decflags=0)
|
inline void InitPass(ValvePassInfo &info, ValveType vtype, PassType type, unsigned int flags, unsigned int decflags=0)
|
||||||
{
|
{
|
||||||
info.decflags = decflags;
|
info.decflags = decflags;
|
||||||
@ -1491,6 +1499,45 @@ static cell_t GivePlayerAmmo(IPluginContext *pContext, const cell_t *params)
|
|||||||
return ammoGiven;
|
return ammoGiven;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCollisionGroup(int entity, int collisionGroup)
|
||||||
|
static cell_t SetCollisionGroup(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
static ICallWrapper *pSetCollisionGroup = NULL;
|
||||||
|
if (!pSetCollisionGroup)
|
||||||
|
{
|
||||||
|
void *addr;
|
||||||
|
if (!g_pGameConf->GetMemSig("SetCollisionGroup", &addr) || !addr)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("\"SetCollisionGroup\" not supported by this mod");
|
||||||
|
}
|
||||||
|
PassInfo pass[2];
|
||||||
|
// Entity
|
||||||
|
pass[0].type = PassType_Basic;
|
||||||
|
pass[0].flags = PASSFLAG_BYVAL;
|
||||||
|
pass[0].size = sizeof(CBaseEntity *);
|
||||||
|
|
||||||
|
// Collision Group
|
||||||
|
pass[1].type = PassType_Basic;
|
||||||
|
pass[1].flags = PASSFLAG_BYVAL;
|
||||||
|
pass[1].size = sizeof(int);
|
||||||
|
|
||||||
|
if (!(pSetCollisionGroup = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 2)))
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("\"SetCollisionGroup\" wrapper failed to initialize");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CBaseEntity *pEntity;
|
||||||
|
ENTINDEX_TO_CBASEENTITY(params[1], pEntity);
|
||||||
|
|
||||||
|
ArgBuffer<CBaseEntity *, int> vstk(pEntity, params[2]);
|
||||||
|
|
||||||
|
pSetCollisionGroup->Execute(vstk, nullptr);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
sp_nativeinfo_t g_Natives[] =
|
sp_nativeinfo_t g_Natives[] =
|
||||||
{
|
{
|
||||||
{"ExtinguishEntity", ExtinguishEntity},
|
{"ExtinguishEntity", ExtinguishEntity},
|
||||||
@ -1522,5 +1569,6 @@ sp_nativeinfo_t g_Natives[] =
|
|||||||
{"SetClientName", SetClientName},
|
{"SetClientName", SetClientName},
|
||||||
{"GetPlayerResourceEntity", GetPlayerResourceEntity},
|
{"GetPlayerResourceEntity", GetPlayerResourceEntity},
|
||||||
{"GivePlayerAmmo", GivePlayerAmmo},
|
{"GivePlayerAmmo", GivePlayerAmmo},
|
||||||
|
{"SetCollisionGroup", SetCollisionGroup},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
@ -181,6 +181,12 @@
|
|||||||
"linux64" "\x55\x48\x89\xE5\x41\x57\x41\x56\x49\x89\xF6\x41\x55\x41\x54\x49\x89\xCC\x53"
|
"linux64" "\x55\x48\x89\xE5\x41\x57\x41\x56\x49\x89\xF6\x41\x55\x41\x54\x49\x89\xCC\x53"
|
||||||
"mac64" "\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x41\x54\x53\x48\x81\xEC\x88\x01\x00\x00\xF3\x0F\x11\x85\x8C\xFE\xFF\xFF"
|
"mac64" "\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x41\x54\x53\x48\x81\xEC\x88\x01\x00\x00\xF3\x0F\x11\x85\x8C\xFE\xFF\xFF"
|
||||||
}
|
}
|
||||||
|
"SetCollisionGroup"
|
||||||
|
{
|
||||||
|
"library" "server"
|
||||||
|
"windows" "\x55\x8B\xEC\x53\x8B\xD9\x56\x57\x8B\x7D\x08\x39\xBB\x54\x01\x00\x00\x74\x40\x80\x79\x58\x00\x74"
|
||||||
|
"linux" "\x55\x89\xE5\x83\xEC\x18\x89\x5D\xF8\x8B\x5D\x08\x89\x75\xFC\x8B\x75\x0C\x39\xB3\x5C\x01\x00\x00"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,12 @@
|
|||||||
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
||||||
"mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
"mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
||||||
}
|
}
|
||||||
|
"SetCollisionGroup"
|
||||||
|
{
|
||||||
|
"library" "server"
|
||||||
|
"windows" "\x55\x8b\xec\x53\x8b\x5d\x08\x56\x57\x8b\xf9\x39\x9f\xe0\x01\x00\x00\x74\x4f\x8b"
|
||||||
|
"linux" "@_ZN11CBaseEntity17SetCollisionGroupEi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +127,12 @@
|
|||||||
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
||||||
"mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
"mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
|
||||||
}
|
}
|
||||||
|
"SetCollisionGroup"
|
||||||
|
{
|
||||||
|
"library" "server"
|
||||||
|
"windows" "\x55\x8B\xEC\x53\x8B\x5D\x08\x56\x57\x8B\xF9\x39\x9F\xF0\x01\x00\x00"
|
||||||
|
"linux" "@_ZN11CBaseEntity17SetCollisionGroupEi"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,3 +351,12 @@ native void SetClientName(int client, const char[] name);
|
|||||||
* @error Lack of mod support.
|
* @error Lack of mod support.
|
||||||
*/
|
*/
|
||||||
native int GivePlayerAmmo(int client, int amount, int ammotype, bool suppressSound=false);
|
native int GivePlayerAmmo(int client, int amount, int ammotype, bool suppressSound=false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes an entity's collision group (CBaseEntity::SetCollisionGroup).
|
||||||
|
*
|
||||||
|
* @param entity The entity index.
|
||||||
|
* @param collisionGroup Collision group to use.
|
||||||
|
* @error Invalid entity or lack of mod support.
|
||||||
|
*/
|
||||||
|
native void SetCollisionGroup(int entity, int collisionGroup);
|
||||||
|
Loading…
Reference in New Issue
Block a user