Add FireEntityOutput native. (#587)
* AcceptEntityOutput native * define fix * MSVC fix and renamed native * Added requested changes. * tab/space fix
This commit is contained in:
		
							parent
							
								
									61f46845bd
								
							
						
					
					
						commit
						08238a8036
					
				@ -4,6 +4,7 @@ import os
 | 
			
		||||
project = SM.HL2Project(builder, 'sdktools.ext')
 | 
			
		||||
project.sources += [
 | 
			
		||||
  'extension.cpp',
 | 
			
		||||
  'variant-t.cpp',
 | 
			
		||||
  'inputnatives.cpp',
 | 
			
		||||
  'output.cpp',
 | 
			
		||||
  'outputnatives.cpp',
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
 * vim: set ts=4 :
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 * SourceMod SDKTools Extension
 | 
			
		||||
 * Copyright (C) 2004-2010 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * Copyright (C) 2004-2017 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software; you can redistribute it and/or modify it under
 | 
			
		||||
@ -38,6 +38,7 @@
 | 
			
		||||
#include "vglobals.h"
 | 
			
		||||
#include "tempents.h"
 | 
			
		||||
#include "vsound.h"
 | 
			
		||||
#include "variant-t.h"
 | 
			
		||||
#include "output.h"
 | 
			
		||||
#include "hooks.h"
 | 
			
		||||
#include "gamerulesnatives.h"
 | 
			
		||||
@ -114,6 +115,7 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
 | 
			
		||||
	sharesys->AddNatives(myself, g_TRNatives);
 | 
			
		||||
	sharesys->AddNatives(myself, g_StringTableNatives);
 | 
			
		||||
	sharesys->AddNatives(myself, g_VoiceNatives);
 | 
			
		||||
	sharesys->AddNatives(myself, g_VariantTNatives);
 | 
			
		||||
	sharesys->AddNatives(myself, g_EntInputNatives);
 | 
			
		||||
	sharesys->AddNatives(myself, g_TeamNatives);
 | 
			
		||||
	sharesys->AddNatives(myself, g_EntOutputNatives);
 | 
			
		||||
 | 
			
		||||
@ -30,12 +30,10 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "extension.h"
 | 
			
		||||
#include "variant-t.h"
 | 
			
		||||
#include <datamap.h>
 | 
			
		||||
 | 
			
		||||
#define SIZEOF_VARIANT_T		20
 | 
			
		||||
 | 
			
		||||
ICallWrapper *g_pAcceptInput = NULL;
 | 
			
		||||
unsigned char g_Variant_t[SIZEOF_VARIANT_T] = {0};
 | 
			
		||||
 | 
			
		||||
#define ENTINDEX_TO_CBASEENTITY(ref, buffer) \
 | 
			
		||||
	buffer = gamehelpers->ReferenceToEntity(ref); \
 | 
			
		||||
@ -44,26 +42,6 @@ unsigned char g_Variant_t[SIZEOF_VARIANT_T] = {0};
 | 
			
		||||
		return pContext->ThrowNativeError("Entity %d (%d) is not a CBaseEntity", gamehelpers->ReferenceToIndex(ref), ref); \
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* Hack to init the variant_t object for the first time */
 | 
			
		||||
class VariantFirstTimeInit
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
	VariantFirstTimeInit()
 | 
			
		||||
	{
 | 
			
		||||
		*(unsigned int *)(&g_Variant_t[12]) = INVALID_EHANDLE_INDEX;
 | 
			
		||||
	}
 | 
			
		||||
} g_VariantFirstTimeInit;
 | 
			
		||||
 | 
			
		||||
inline void _init_variant_t()
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	*(int *)vptr = 0;
 | 
			
		||||
	vptr += sizeof(int)*3;
 | 
			
		||||
	*(unsigned long *)vptr = INVALID_EHANDLE_INDEX;
 | 
			
		||||
	vptr += sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_VOID;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t AcceptEntityInput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
@ -139,136 +117,8 @@ static cell_t AcceptEntityInput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
	return (ret) ? 1 : 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantBool(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	*(bool *)vptr = (params[1]) ? true : false;
 | 
			
		||||
	vptr += sizeof(int)*3 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_BOOLEAN;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantString(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	char *str;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	pContext->LocalToString(params[1], &str);
 | 
			
		||||
 | 
			
		||||
	*(string_t *)vptr = MAKE_STRING(str);
 | 
			
		||||
	vptr += sizeof(int)*3 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_STRING;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantInt(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	*(int *)vptr = params[1];
 | 
			
		||||
	vptr += sizeof(int)*3 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_INTEGER;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantFloat(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	*(float *)vptr = sp_ctof(params[1]);
 | 
			
		||||
	vptr += sizeof(int)*3 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_FLOAT;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantVector3D(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	cell_t *val;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	pContext->LocalToPhysAddr(params[1], &val);
 | 
			
		||||
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[0]);
 | 
			
		||||
	vptr += sizeof(float);
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[1]);
 | 
			
		||||
	vptr += sizeof(float);
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[2]);
 | 
			
		||||
	vptr += sizeof(float) + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_VECTOR;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantPosVector3D(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	cell_t *val;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	pContext->LocalToPhysAddr(params[1], &val);
 | 
			
		||||
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[0]);
 | 
			
		||||
	vptr += sizeof(float);
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[1]);
 | 
			
		||||
	vptr += sizeof(float);
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[2]);
 | 
			
		||||
	vptr += sizeof(float) + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_POSITION_VECTOR;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantColor(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	cell_t *val;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	pContext->LocalToPhysAddr(params[1], &val);
 | 
			
		||||
 | 
			
		||||
	*(unsigned char *)vptr = val[0];
 | 
			
		||||
	vptr += sizeof(unsigned char);
 | 
			
		||||
	*(unsigned char *)vptr = val[1];
 | 
			
		||||
	vptr += sizeof(unsigned char);
 | 
			
		||||
	*(unsigned char *)vptr = val[2];
 | 
			
		||||
	vptr += sizeof(unsigned char);
 | 
			
		||||
	*(unsigned char *)vptr = val[3];
 | 
			
		||||
	vptr += sizeof(unsigned char) + sizeof(int)*2 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_COLOR32;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantEntity(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	CBaseEntity *pEntity;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
	CBaseHandle bHandle;
 | 
			
		||||
 | 
			
		||||
	ENTINDEX_TO_CBASEENTITY(params[1], pEntity);
 | 
			
		||||
	bHandle = reinterpret_cast<IHandleEntity *>(pEntity)->GetRefEHandle();
 | 
			
		||||
 | 
			
		||||
	vptr += sizeof(int)*3;
 | 
			
		||||
	*(unsigned long *)vptr = (unsigned long)(bHandle.ToInt());
 | 
			
		||||
	vptr += sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_EHANDLE;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sp_nativeinfo_t g_EntInputNatives[] =
 | 
			
		||||
{
 | 
			
		||||
	{"AcceptEntityInput",			AcceptEntityInput},
 | 
			
		||||
	{"SetVariantBool",				SetVariantBool},
 | 
			
		||||
	{"SetVariantString",			SetVariantString},
 | 
			
		||||
	{"SetVariantInt",				SetVariantInt},
 | 
			
		||||
	{"SetVariantFloat",				SetVariantFloat},
 | 
			
		||||
	{"SetVariantVector3D",			SetVariantVector3D},
 | 
			
		||||
	{"SetVariantPosVector3D",		SetVariantPosVector3D},
 | 
			
		||||
	{"SetVariantColor",				SetVariantColor},
 | 
			
		||||
	{"SetVariantEntity",			SetVariantEntity},
 | 
			
		||||
	{NULL,							NULL},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
 * vim: set ts=4 :
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 * SourceMod SDKTools Extension
 | 
			
		||||
 * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * Copyright (C) 2004-2017 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software; you can redistribute it and/or modify it under
 | 
			
		||||
@ -30,9 +30,19 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "extension.h"
 | 
			
		||||
#include "variant-t.h"
 | 
			
		||||
#include "output.h"
 | 
			
		||||
 | 
			
		||||
// HookSingleEntityOutput(ent, const String:output[], function, bool:once);
 | 
			
		||||
ICallWrapper *g_pFireOutput = NULL;
 | 
			
		||||
 | 
			
		||||
#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); \
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
// HookSingleEntityOutput(int ent, const char[] output, EntityOutput function, bool once);
 | 
			
		||||
cell_t HookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	if (!g_OutputManager.IsEnabled())
 | 
			
		||||
@ -97,7 +107,7 @@ cell_t HookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HookEntityOutput(const String:classname[], const String:output[], function);
 | 
			
		||||
// HookEntityOutput(const char[] classname, const char[] output, EntityOutput function);
 | 
			
		||||
cell_t HookEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	if (!g_OutputManager.IsEnabled())
 | 
			
		||||
@ -160,7 +170,7 @@ cell_t HookEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnHookEntityOutput(const String:classname[], const String:output[], EntityOutput:callback);
 | 
			
		||||
// UnHookEntityOutput(const char[] classname, const char[] output, EntityOutput callback);
 | 
			
		||||
cell_t UnHookEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	if (!g_OutputManager.IsEnabled())
 | 
			
		||||
@ -211,7 +221,7 @@ cell_t UnHookEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnHookSingleEntityOutput(entity, const String:output[], EntityOutput:callback);
 | 
			
		||||
// UnHookSingleEntityOutput(int entity, const char[] output, EntityOutput callback);
 | 
			
		||||
cell_t UnHookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	if (!g_OutputManager.IsEnabled())
 | 
			
		||||
@ -269,11 +279,133 @@ cell_t UnHookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void *FindOutputPointerByName(CBaseEntity *pEntity, const char *outputname)
 | 
			
		||||
{
 | 
			
		||||
	datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
 | 
			
		||||
 | 
			
		||||
	while (pMap)
 | 
			
		||||
	{
 | 
			
		||||
		for (int i=0; i<pMap->dataNumFields; i++)
 | 
			
		||||
		{
 | 
			
		||||
			if (pMap->dataDesc[i].flags & FTYPEDESC_OUTPUT)
 | 
			
		||||
			{
 | 
			
		||||
				if (strcmp(pMap->dataDesc[i].externalName,outputname) == 0)
 | 
			
		||||
				{
 | 
			
		||||
					return reinterpret_cast<void *>((unsigned char*)pEntity + GetTypeDescOffs(&pMap->dataDesc[i]));
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		pMap = pMap->baseMap;
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FireEntityOutput(int ent, const char[] output, int activator, float delay);
 | 
			
		||||
static cell_t FireEntityOutput(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	if (!g_pFireOutput)
 | 
			
		||||
	{
 | 
			
		||||
		void *addr;
 | 
			
		||||
		if (!g_pGameConf->GetMemSig("FireOutput", &addr) || !addr)
 | 
			
		||||
		{
 | 
			
		||||
			return pContext->ThrowNativeError("\"FireEntityOutput\" not supported by this mod");
 | 
			
		||||
		}
 | 
			
		||||
#ifdef PLATFORM_WINDOWS
 | 
			
		||||
		int iMaxParam = 8;
 | 
			
		||||
		//Instead of being one param, MSVC broke variant_t param into 5 params..
 | 
			
		||||
		PassInfo pass[8];
 | 
			
		||||
		pass[0].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[0].type = PassType_Basic;
 | 
			
		||||
		pass[0].size = sizeof(int);
 | 
			
		||||
		pass[1].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[1].type = PassType_Basic;
 | 
			
		||||
		pass[1].size = sizeof(int);
 | 
			
		||||
		pass[2].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[2].type = PassType_Basic;
 | 
			
		||||
		pass[2].size = sizeof(int);
 | 
			
		||||
		pass[3].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[3].type = PassType_Basic;
 | 
			
		||||
		pass[3].size = sizeof(int);
 | 
			
		||||
		pass[4].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[4].type = PassType_Basic;
 | 
			
		||||
		pass[4].size = sizeof(int);
 | 
			
		||||
		pass[5].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[5].type = PassType_Basic;
 | 
			
		||||
		pass[5].size = sizeof(CBaseEntity *);
 | 
			
		||||
		pass[6].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[6].type = PassType_Basic;
 | 
			
		||||
		pass[6].size = sizeof(CBaseEntity *);
 | 
			
		||||
		pass[7].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[7].type = PassType_Basic;
 | 
			
		||||
		pass[7].size = sizeof(float);
 | 
			
		||||
#else
 | 
			
		||||
		int iMaxParam = 4;
 | 
			
		||||
 | 
			
		||||
		PassInfo pass[4];
 | 
			
		||||
		pass[0].type = PassType_Object;
 | 
			
		||||
		pass[0].flags = PASSFLAG_BYVAL|PASSFLAG_OCTOR|PASSFLAG_ODTOR|PASSFLAG_OASSIGNOP;
 | 
			
		||||
		pass[0].size = SIZEOF_VARIANT_T;
 | 
			
		||||
		pass[1].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[1].type = PassType_Basic;
 | 
			
		||||
		pass[1].size = sizeof(CBaseEntity *);
 | 
			
		||||
		pass[2].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[2].type = PassType_Basic;
 | 
			
		||||
		pass[2].size = sizeof(CBaseEntity *);
 | 
			
		||||
		pass[3].flags = PASSFLAG_BYVAL;
 | 
			
		||||
		pass[3].type = PassType_Basic;
 | 
			
		||||
		pass[3].size = sizeof(float);
 | 
			
		||||
#endif
 | 
			
		||||
		if (!(g_pFireOutput = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, iMaxParam)))
 | 
			
		||||
		{
 | 
			
		||||
			return pContext->ThrowNativeError("\"FireEntityOutput\" wrapper failed to initialize.");
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	CBaseEntity *pActivator, *pCaller;
 | 
			
		||||
	void *pOutput = NULL;
 | 
			
		||||
	
 | 
			
		||||
	char *outputname;
 | 
			
		||||
	unsigned char vstk[sizeof(void *) + sizeof(CBaseEntity *)*2 + SIZEOF_VARIANT_T + sizeof(float)];
 | 
			
		||||
	unsigned char *vptr = vstk;
 | 
			
		||||
 | 
			
		||||
	ENTINDEX_TO_CBASEENTITY(params[1], pCaller);
 | 
			
		||||
	pContext->LocalToString(params[2], &outputname);
 | 
			
		||||
	
 | 
			
		||||
	if ((pOutput = FindOutputPointerByName(pCaller,outputname)))
 | 
			
		||||
	{
 | 
			
		||||
		if (params[3] == -1)
 | 
			
		||||
		{
 | 
			
		||||
			pActivator = NULL;
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			ENTINDEX_TO_CBASEENTITY(params[3], pActivator);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		*(void **)vptr = pOutput;
 | 
			
		||||
		vptr += sizeof(void *);
 | 
			
		||||
		memcpy(vptr, g_Variant_t, SIZEOF_VARIANT_T);
 | 
			
		||||
		vptr += SIZEOF_VARIANT_T;
 | 
			
		||||
		*(CBaseEntity **)vptr = pActivator;
 | 
			
		||||
		vptr += sizeof(CBaseEntity *);
 | 
			
		||||
		*(CBaseEntity **)vptr = pCaller;
 | 
			
		||||
		vptr += sizeof(CBaseEntity *);
 | 
			
		||||
		*(float *)vptr = sp_ctof(params[4]);
 | 
			
		||||
 | 
			
		||||
		g_pFireOutput->Execute(vstk, NULL);
 | 
			
		||||
 | 
			
		||||
		_init_variant_t();
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return pContext->ThrowNativeError("Couldn't find %s output on %i entity!", outputname, params[1]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sp_nativeinfo_t g_EntOutputNatives[] =
 | 
			
		||||
{
 | 
			
		||||
	{"HookEntityOutput",			HookEntityOutput},
 | 
			
		||||
	{"UnhookEntityOutput",			UnHookEntityOutput},
 | 
			
		||||
	{"HookSingleEntityOutput",		HookSingleEntityOutput},
 | 
			
		||||
	{"UnhookSingleEntityOutput",	UnHookSingleEntityOutput},
 | 
			
		||||
	{"FireEntityOutput",			FireEntityOutput},
 | 
			
		||||
	{NULL,							NULL},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										186
									
								
								extensions/sdktools/variant-t.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										186
									
								
								extensions/sdktools/variant-t.cpp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,186 @@
 | 
			
		||||
/**
 | 
			
		||||
 * vim: set ts=4 :
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 * SourceMod SDKTools Extension
 | 
			
		||||
 * Copyright (C) 2004-2017 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software; you can redistribute it and/or modify it under
 | 
			
		||||
 * the terms of the GNU General Public License, version 3.0, as published by the
 | 
			
		||||
 * Free Software Foundation.
 | 
			
		||||
 * 
 | 
			
		||||
 * This program is distributed in the hope that it will be useful, but WITHOUT
 | 
			
		||||
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
 * details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License along with
 | 
			
		||||
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * As a special exception, AlliedModders LLC gives you permission to link the
 | 
			
		||||
 * code of this program (as well as its derivative works) to "Half-Life 2," the
 | 
			
		||||
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
 | 
			
		||||
 * by the Valve Corporation.  You must obey the GNU General Public License in
 | 
			
		||||
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
 | 
			
		||||
 * this exception to all derivative works.  AlliedModders LLC defines further
 | 
			
		||||
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
 | 
			
		||||
 * or <http://www.sourcemod.net/license.php>.
 | 
			
		||||
 *
 | 
			
		||||
 * Version: $Id$
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "extension.h"
 | 
			
		||||
#include "variant-t.h"
 | 
			
		||||
#include <datamap.h>
 | 
			
		||||
 | 
			
		||||
unsigned char g_Variant_t[SIZEOF_VARIANT_T] = {0};
 | 
			
		||||
 | 
			
		||||
#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); \
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
/* Hack to init the variant_t object for the first time */
 | 
			
		||||
class VariantFirstTimeInit
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
	VariantFirstTimeInit()
 | 
			
		||||
	{
 | 
			
		||||
		*(unsigned int *)(&g_Variant_t[12]) = INVALID_EHANDLE_INDEX;
 | 
			
		||||
	}
 | 
			
		||||
} g_VariantFirstTimeInit;
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantBool(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	*(bool *)vptr = (params[1]) ? true : false;
 | 
			
		||||
	vptr += sizeof(int)*3 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_BOOLEAN;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantString(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	char *str;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	pContext->LocalToString(params[1], &str);
 | 
			
		||||
 | 
			
		||||
	*(string_t *)vptr = MAKE_STRING(str);
 | 
			
		||||
	vptr += sizeof(int)*3 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_STRING;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantInt(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	*(int *)vptr = params[1];
 | 
			
		||||
	vptr += sizeof(int)*3 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_INTEGER;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantFloat(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	*(float *)vptr = sp_ctof(params[1]);
 | 
			
		||||
	vptr += sizeof(int)*3 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_FLOAT;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantVector3D(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	cell_t *val;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	pContext->LocalToPhysAddr(params[1], &val);
 | 
			
		||||
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[0]);
 | 
			
		||||
	vptr += sizeof(float);
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[1]);
 | 
			
		||||
	vptr += sizeof(float);
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[2]);
 | 
			
		||||
	vptr += sizeof(float) + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_VECTOR;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantPosVector3D(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	cell_t *val;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	pContext->LocalToPhysAddr(params[1], &val);
 | 
			
		||||
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[0]);
 | 
			
		||||
	vptr += sizeof(float);
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[1]);
 | 
			
		||||
	vptr += sizeof(float);
 | 
			
		||||
	*(float *)vptr = sp_ctof(val[2]);
 | 
			
		||||
	vptr += sizeof(float) + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_POSITION_VECTOR;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantColor(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	cell_t *val;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	pContext->LocalToPhysAddr(params[1], &val);
 | 
			
		||||
 | 
			
		||||
	*(unsigned char *)vptr = val[0];
 | 
			
		||||
	vptr += sizeof(unsigned char);
 | 
			
		||||
	*(unsigned char *)vptr = val[1];
 | 
			
		||||
	vptr += sizeof(unsigned char);
 | 
			
		||||
	*(unsigned char *)vptr = val[2];
 | 
			
		||||
	vptr += sizeof(unsigned char);
 | 
			
		||||
	*(unsigned char *)vptr = val[3];
 | 
			
		||||
	vptr += sizeof(unsigned char) + sizeof(int)*2 + sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_COLOR32;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static cell_t SetVariantEntity(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
{
 | 
			
		||||
	CBaseEntity *pEntity;
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
	CBaseHandle bHandle;
 | 
			
		||||
 | 
			
		||||
	ENTINDEX_TO_CBASEENTITY(params[1], pEntity);
 | 
			
		||||
	bHandle = reinterpret_cast<IHandleEntity *>(pEntity)->GetRefEHandle();
 | 
			
		||||
 | 
			
		||||
	vptr += sizeof(int)*3;
 | 
			
		||||
	*(unsigned long *)vptr = (unsigned long)(bHandle.ToInt());
 | 
			
		||||
	vptr += sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_EHANDLE;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sp_nativeinfo_t g_VariantTNatives[] =
 | 
			
		||||
{
 | 
			
		||||
	{"SetVariantBool",				SetVariantBool},
 | 
			
		||||
	{"SetVariantString",			SetVariantString},
 | 
			
		||||
	{"SetVariantInt",				SetVariantInt},
 | 
			
		||||
	{"SetVariantFloat",				SetVariantFloat},
 | 
			
		||||
	{"SetVariantVector3D",			SetVariantVector3D},
 | 
			
		||||
	{"SetVariantPosVector3D",		SetVariantPosVector3D},
 | 
			
		||||
	{"SetVariantColor",				SetVariantColor},
 | 
			
		||||
	{"SetVariantEntity",			SetVariantEntity},
 | 
			
		||||
	{NULL,							NULL},
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										57
									
								
								extensions/sdktools/variant-t.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								extensions/sdktools/variant-t.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,57 @@
 | 
			
		||||
/**
 | 
			
		||||
 * vim: set ts=4 :
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 * SourceMod SDKTools Extension
 | 
			
		||||
 * Copyright (C) 2004-2017 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software; you can redistribute it and/or modify it under
 | 
			
		||||
 * the terms of the GNU General Public License, version 3.0, as published by the
 | 
			
		||||
 * Free Software Foundation.
 | 
			
		||||
 * 
 | 
			
		||||
 * This program is distributed in the hope that it will be useful, but WITHOUT
 | 
			
		||||
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
 * details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License along with
 | 
			
		||||
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * As a special exception, AlliedModders LLC gives you permission to link the
 | 
			
		||||
 * code of this program (as well as its derivative works) to "Half-Life 2," the
 | 
			
		||||
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
 | 
			
		||||
 * by the Valve Corporation.  You must obey the GNU General Public License in
 | 
			
		||||
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
 | 
			
		||||
 * this exception to all derivative works.  AlliedModders LLC defines further
 | 
			
		||||
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
 | 
			
		||||
 * or <http://www.sourcemod.net/license.php>.
 | 
			
		||||
 *
 | 
			
		||||
 * Version: $Id$
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_VARIANT_T_H_
 | 
			
		||||
#define _INCLUDE_SOURCEMOD_EXTENSION_VARIANT_T_H_
 | 
			
		||||
 | 
			
		||||
#define SIZEOF_VARIANT_T		20
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file variant-t.h
 | 
			
		||||
 * @brief SDK Tools extension gamerules natives header.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
extern unsigned char g_Variant_t[SIZEOF_VARIANT_T];
 | 
			
		||||
 | 
			
		||||
extern sp_nativeinfo_t g_VariantTNatives[];
 | 
			
		||||
 | 
			
		||||
inline void _init_variant_t()
 | 
			
		||||
{
 | 
			
		||||
	unsigned char *vptr = g_Variant_t;
 | 
			
		||||
 | 
			
		||||
	*(int *)vptr = 0;
 | 
			
		||||
	vptr += sizeof(int)*3;
 | 
			
		||||
	*(unsigned long *)vptr = INVALID_EHANDLE_INDEX;
 | 
			
		||||
	vptr += sizeof(unsigned long);
 | 
			
		||||
	*(fieldtype_t *)vptr = FIELD_VOID;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif //_INCLUDE_SOURCEMOD_EXTENSION_VARIANT_T_H_
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * vim: set ts=4 :
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * SourceMod (C)2004-2017 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of the SourceMod/SourcePawn SDK.
 | 
			
		||||
@ -46,6 +46,7 @@
 | 
			
		||||
#include <sdktools_tempents>
 | 
			
		||||
#include <sdktools_tempents_stocks>
 | 
			
		||||
#include <sdktools_voice>
 | 
			
		||||
#include <sdktools_variant_t>
 | 
			
		||||
#include <sdktools_entinput>
 | 
			
		||||
#include <sdktools_entoutput>
 | 
			
		||||
#include <sdktools_hooks>
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * vim: set ts=4 :
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * SourceMod (C)2004-2017 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of the SourceMod/SourcePawn SDK.
 | 
			
		||||
@ -49,60 +49,3 @@
 | 
			
		||||
 * @error		Invalid entity index or no mod support.
 | 
			
		||||
 */
 | 
			
		||||
native bool AcceptEntityInput(int dest, const char[] input, int activator=-1, int caller=-1, int outputid=0);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a bool value in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param val		Input value.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantBool(bool val);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a string in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param str		Input string.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantString(const char[] str);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets an integer value in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param val		Input value.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantInt(int val);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a floating point value in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param val		Input value.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantFloat(float val);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a 3D vector in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param vec		Input vector.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantVector3D(const float vec[3]);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a 3D position vector in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param vec		Input position vector.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantPosVector3D(const float vec[3]);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a color in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param color		Input color.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantColor(const int color[4]);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets an entity in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param entity	Entity index.
 | 
			
		||||
 * @error		Invalid entity index.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantEntity(int entity);
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * vim: set ts=4 :
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * SourceMod (C)2004-2017 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of the SourceMod/SourcePawn SDK.
 | 
			
		||||
@ -93,3 +93,16 @@ native void HookSingleEntityOutput(int entity, const char[] output, EntityOutput
 | 
			
		||||
 * @error				Entity Outputs disabled	or Invalid Entity index.	
 | 
			
		||||
 */
 | 
			
		||||
native bool UnhookSingleEntityOutput(int entity, const char[] output, EntityOutput callback);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Fire a named output on an entity.  
 | 
			
		||||
 *
 | 
			
		||||
 * After completion (successful or not), the current global variant is re-initialized.
 | 
			
		||||
 *
 | 
			
		||||
 * @param caller	Entity index from where the output is fired.
 | 
			
		||||
 * @param output	Output name.
 | 
			
		||||
 * @param activator	Entity index which initiated the sequence of actions (-1 for a NULL entity).
 | 
			
		||||
 * @param delay		Delay before firing the output.
 | 
			
		||||
 * @error		Invalid entity index or no mod support.
 | 
			
		||||
 */
 | 
			
		||||
native void FireEntityOutput(int caller, const char[] output, int activator=-1, float delay=0.0);
 | 
			
		||||
							
								
								
									
										93
									
								
								plugins/include/sdktools_variant_t.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								plugins/include/sdktools_variant_t.inc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,93 @@
 | 
			
		||||
/**
 | 
			
		||||
 * vim: set ts=4 :
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 * SourceMod (C)2004-2017 AlliedModders LLC.  All rights reserved.
 | 
			
		||||
 * =============================================================================
 | 
			
		||||
 *
 | 
			
		||||
 * This file is part of the SourceMod/SourcePawn SDK.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software; you can redistribute it and/or modify it under
 | 
			
		||||
 * the terms of the GNU General Public License, version 3.0, as published by the
 | 
			
		||||
 * Free Software Foundation.
 | 
			
		||||
 * 
 | 
			
		||||
 * This program is distributed in the hope that it will be useful, but WITHOUT
 | 
			
		||||
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
 * details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License along with
 | 
			
		||||
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 *
 | 
			
		||||
 * As a special exception, AlliedModders LLC gives you permission to link the
 | 
			
		||||
 * code of this program (as well as its derivative works) to "Half-Life 2," the
 | 
			
		||||
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
 | 
			
		||||
 * by the Valve Corporation.  You must obey the GNU General Public License in
 | 
			
		||||
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
 | 
			
		||||
 * this exception to all derivative works.  AlliedModders LLC defines further
 | 
			
		||||
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
 | 
			
		||||
 * or <http://www.sourcemod.net/license.php>.
 | 
			
		||||
 *
 | 
			
		||||
 * Version: $Id$
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if defined _sdktools_variant_t_included
 | 
			
		||||
  #endinput
 | 
			
		||||
#endif
 | 
			
		||||
#define _sdktools_variant_t_included
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a bool value in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param val		Input value.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantBool(bool val);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a string in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param str		Input string.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantString(const char[] str);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets an integer value in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param val		Input value.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantInt(int val);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a floating point value in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param val		Input value.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantFloat(float val);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a 3D vector in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param vec		Input vector.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantVector3D(const float vec[3]);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a 3D position vector in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param vec		Input position vector.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantPosVector3D(const float vec[3]);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets a color in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param color		Input color.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantColor(const int color[4]);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Sets an entity in the global variant object.
 | 
			
		||||
 *
 | 
			
		||||
 * @param entity	Entity index.
 | 
			
		||||
 * @error		Invalid entity index.
 | 
			
		||||
 */
 | 
			
		||||
native void SetVariantEntity(int entity);
 | 
			
		||||
@ -331,6 +331,7 @@ CopyFiles('plugins/include', 'addons/sourcemod/scripting/include',
 | 
			
		||||
    'sdktools.inc',
 | 
			
		||||
    'sdktools_client.inc',
 | 
			
		||||
    'sdktools_engine.inc',
 | 
			
		||||
    'sdktools_variant_t.inc',
 | 
			
		||||
    'sdktools_entinput.inc',
 | 
			
		||||
    'sdktools_entoutput.inc',
 | 
			
		||||
    'sdktools_functions.inc',
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user