added state change function
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40564
This commit is contained in:
parent
ec62fb6892
commit
de588c77b9
@ -437,8 +437,40 @@ static cell_t SetEntDataEnt(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
||||
{
|
||||
return engine->GetChangeAccessor( (const edict_t *)this );
|
||||
}
|
||||
|
||||
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
||||
|
||||
static cell_t ChangeEdictState(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
edict_t *pEdict = GetEdict(params[1]);
|
||||
|
||||
if (!pEdict)
|
||||
{
|
||||
return pContext->ThrowNativeError("Edict %d is invalid", params[1]);
|
||||
}
|
||||
|
||||
if (!g_pSharedChangeInfo)
|
||||
{
|
||||
g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo();
|
||||
}
|
||||
|
||||
if (params[2])
|
||||
{
|
||||
pEdict->StateChanged(params[2]);
|
||||
} else {
|
||||
pEdict->StateChanged();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(entityNatives)
|
||||
{
|
||||
{"ChangeEdictState", ChangeEdictState},
|
||||
{"CreateEdict", CreateEdict},
|
||||
{"GetEdictClassname", GetEdictClassname},
|
||||
{"GetEdictFlags", GetEdictFlags},
|
||||
|
@ -151,6 +151,19 @@ native bool:GetEntityNetClass(edict, String:clsname[], maxlength);
|
||||
* size will cause undefined behaviour or even crash.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marks an entity as state changed. This can be useful if you set an offset
|
||||
* and wish for it to be immediately changed over the network. By default this
|
||||
* is not done for offset setting functions.
|
||||
*
|
||||
* @param edict Index to the edict.
|
||||
* @param offset Offset to mark as changed. If 0,
|
||||
* the entire edict is marked as changed.
|
||||
* @noreturn
|
||||
* @error Invalid entity or offset out of bounds.
|
||||
*/
|
||||
native ChangeEdictState(edict, offset = 0);
|
||||
|
||||
/**
|
||||
* Peeks into an entity's object data and retrieves the integer value at
|
||||
* the given offset.
|
||||
|
Loading…
Reference in New Issue
Block a user