internal reorganization
renamed edict to entity where appropriate --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40560
This commit is contained in:
parent
3b207f2cc9
commit
16eab8a091
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Version="8.00"
|
||||
Name="sourcemod_mm"
|
||||
ProjectGUID="{E39527CD-7CAB-4420-97CC-DA1B93B260BC}"
|
||||
RootNamespace="sourcemod_mm"
|
||||
@ -685,6 +685,10 @@
|
||||
RelativePath="..\smn_datapacks.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_entities.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\smn_filesystem.cpp"
|
||||
>
|
||||
|
@ -51,50 +51,6 @@ static cell_t IsDedicatedServer(IPluginContext *pContext, const cell_t *params)
|
||||
return engine->IsDedicatedServer();
|
||||
}
|
||||
|
||||
static cell_t GetEntityCount(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return engine->GetEntityCount();
|
||||
}
|
||||
|
||||
static cell_t IsValidEntity(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
edict_t *pEdict = engine->PEntityOfEntIndex(params[1]);
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Shouldn't be necessary... not sure though */
|
||||
return pEdict->IsFree() ? 0 : 1;
|
||||
}
|
||||
|
||||
static cell_t CreateEdict(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
edict_t *pEdict = engine->CreateEdict();
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return engine->IndexOfEdict(pEdict);
|
||||
}
|
||||
|
||||
static cell_t RemoveEdict(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
edict_t *pEdict = engine->PEntityOfEntIndex(params[1]);
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Edict %d is not a valid edict", params[1]);
|
||||
}
|
||||
|
||||
engine->RemoveEdict(pEdict);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t GetEngineTime(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
float fTime = engine->Time();
|
||||
@ -171,11 +127,6 @@ static cell_t GetGameDescription(IPluginContext *pContext, const cell_t *params)
|
||||
return numBytes;
|
||||
}
|
||||
|
||||
static cell_t GetMaxEntities(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return gpGlobals->maxEntities;
|
||||
}
|
||||
|
||||
static cell_t GetCurrentMap(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
size_t bytes;
|
||||
@ -185,20 +136,15 @@ static cell_t GetCurrentMap(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
REGISTER_NATIVES(halflifeNatives)
|
||||
{
|
||||
{"CreateEdict", CreateEdict},
|
||||
{"CreateFakeClient", CreateFakeClient},
|
||||
{"GetCurrentMap", GetCurrentMap},
|
||||
{"GetEngineTime", GetEngineTime},
|
||||
{"GetEntityCount", GetEntityCount},
|
||||
{"GetGameDescription", GetGameDescription},
|
||||
{"GetGameTime", GetGameTime},
|
||||
{"GetMaxEntities", GetMaxEntities},
|
||||
{"GetRandomFloat", GetRandomFloat},
|
||||
{"GetRandomInt", GetRandomInt},
|
||||
{"IsDedicatedServer", IsDedicatedServer},
|
||||
{"IsMapValid", IsMapValid},
|
||||
{"IsValidEntity", IsValidEntity},
|
||||
{"RemoveEdict", RemoveEdict},
|
||||
{"SetFakeClientConVar", SetFakeClientConVar},
|
||||
{"SetRandomSeed", SetRandomSeed},
|
||||
{NULL, NULL},
|
||||
|
66
plugins/include/entity.inc
Normal file
66
plugins/include/entity.inc
Normal file
@ -0,0 +1,66 @@
|
||||
/**
|
||||
* vim: set ts=4 :
|
||||
* ===============================================================
|
||||
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
|
||||
* ===============================================================
|
||||
*
|
||||
* This file is part of the SourceMod/SourcePawn SDK. This file may only be used
|
||||
* or modified under the Terms and Conditions of its License Agreement, which is found
|
||||
* in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins
|
||||
* may change at any time. To view the latest information, see:
|
||||
* http://www.sourcemod.net/license.php
|
||||
*
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#if defined _entity_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _entity_included
|
||||
|
||||
/**
|
||||
* Returns the maximum number of entities.
|
||||
*
|
||||
* @return Maximum number of entities.
|
||||
*/
|
||||
native GetMaxEntities();
|
||||
|
||||
/**
|
||||
* Returns the number of entities in the server.
|
||||
*
|
||||
* @return Number of entities in the server.
|
||||
*/
|
||||
native GetEntityCount();
|
||||
|
||||
/**
|
||||
* Returns whether or not an entity is valid. Returns false
|
||||
* if there is no matching CBaseEntity for this edict index.
|
||||
*
|
||||
* @param edict Index of the entity.
|
||||
* @return True if valid, false otherwise.
|
||||
*/
|
||||
native bool:IsValidEntity(edict);
|
||||
|
||||
/**
|
||||
* Returns whether or not an edict index is valid.
|
||||
*
|
||||
* @param edict Index of the edict.
|
||||
* @return True if valid, false otherwise.
|
||||
*/
|
||||
native bool:IsValidEdict(edict);
|
||||
|
||||
/**
|
||||
* Creates a new edict (the basis of a networkable entity)
|
||||
*
|
||||
* @return Index of the entity, 0 on failure.
|
||||
*/
|
||||
native CreateEdict();
|
||||
|
||||
/**
|
||||
* Removes an edict from the world.
|
||||
*
|
||||
* @param edict Index of the entity.
|
||||
* @noreturn
|
||||
* @error Invalid entity index.
|
||||
*/
|
||||
native RemoveEdict(edict);
|
@ -37,6 +37,7 @@ struct Plugin
|
||||
#include <bitbuffer>
|
||||
#include <sorting>
|
||||
#include <clients>
|
||||
#include <entity>
|
||||
|
||||
/**
|
||||
* Declare this as a struct in your plugin to expose its information.
|
||||
@ -173,37 +174,6 @@ native bool:IsMapValid(const String:map[]);
|
||||
*/
|
||||
native bool:IsDedicatedServer();
|
||||
|
||||
/**
|
||||
* Returns the number of entities in the server.
|
||||
*
|
||||
* @return Number of entities in the server.
|
||||
*/
|
||||
native GetEntityCount();
|
||||
|
||||
/**
|
||||
* Returns whether or not an entity is valid.
|
||||
*
|
||||
* @param entity Index of the entity.
|
||||
* @return True if valid, false otherwise.
|
||||
*/
|
||||
native bool:IsValidEntity(entity);
|
||||
|
||||
/**
|
||||
* Creates a new edict (the basis of a networkable entity)
|
||||
*
|
||||
* @return Index of the entity, 0 on failure.
|
||||
*/
|
||||
native CreateEdict();
|
||||
|
||||
/**
|
||||
* Removes an edict from the world.
|
||||
*
|
||||
* @param entity Index of the entity.
|
||||
* @noreturn
|
||||
* @error Invalid entity index.
|
||||
*/
|
||||
native RemoveEntity(entity);
|
||||
|
||||
/**
|
||||
* Returns a high-precision time value for profiling the engine.
|
||||
*
|
||||
@ -229,13 +199,6 @@ native Float:GetGameTime();
|
||||
*/
|
||||
native GetGameDescription(String:buffer[], maxlength, bool:original=false);
|
||||
|
||||
/**
|
||||
* Returns the maximum number of entities.
|
||||
*
|
||||
* @return Maximum number of entities.
|
||||
*/
|
||||
native GetMaxEntities();
|
||||
|
||||
/**
|
||||
* Returns the current map name.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user