TE_BSPDECAL - baso88/SC_AngelScript GitHub Wiki
Applies a decal to a world surface. This effect is used by the game when infodecals with targetnames are used/fired. (The implementation bellow emulates this behaviour.)
Parameters
Type | Name | Description |
---|---|---|
CBaseEntity@ | ent | Target entity |
API Function
No API function exists as of SC 5.10
NetworkMessage Function
void te_bspdecal( CBaseEntity@ ent, NetworkMessageDest msgType=MSG_BROADCAST,
edict_t@ dest=null )
{
// Center location of the decal. It needs to be witnin a few units of a surface.
Vector pos = ent.pev.origin;
TraceResult tr;
g_Utility.TraceLine( pos - Vector(5,5,5), pos + Vector(5,5,5),
ignore_monsters, ent.edict(), tr );
int entIdx = g_EntityFuncs.EntIndex( tr.pHit );
// create the message
NetworkMessage m(msgType, NetworkMessages::SVC_TEMPENTITY, dest);
m.WriteByte(TE_BSPDECAL);
m.WriteCoord(pos.x);
m.WriteCoord(pos.y);
m.WriteCoord(pos.z);
m.WriteShort(ent.pev.skin); // texture index of precached decal texture name
m.WriteShort(entIdx); // entity index
// [optional - only included if previous short is non-zero (not the world)]
if ( entIdx != 0 )
m.WriteShort( g_EntityFuncs.Instance( tr.pHit ).pev.modelindex );
// index of model of above entity
m.End();
}