TE PROJECTILE

From Sven Co-op
Jump to navigation Jump to search

Shoots a model in some direction. The model has no gravity and kills itself after colliding with an entity or the world.

TE_PROJECTILE
void te_projectile(Vector pos, Vector velocity, CBaseEntity@ owner=null, 
	string model="models/grenade.mdl", uint8 life=1, 
	NetworkMessageDest msgType=MSG_BROADCAST, edict_t@ dest=null)
{
	int ownerId = owner is null ? 0 : owner.entindex();
	NetworkMessage m(msgType, NetworkMessages::SVC_TEMPENTITY, dest);
	m.WriteByte(TE_PROJECTILE);
	m.WriteCoord(pos.x);
	m.WriteCoord(pos.y);
	m.WriteCoord(pos.z);
	m.WriteCoord(velocity.x);
	m.WriteCoord(velocity.y);
	m.WriteCoord(velocity.z);
	m.WriteShort(g_EngineFuncs.ModelIndex(model));
	m.WriteByte(life);
	m.WriteByte(ownerId);
	m.End();
}
  • Vector pos Center point for the effect
  • Vector velocity Speed and direction of the model
  • CBaseEntity@ owner If set, the projectile will not collide with this entity.
  • string model Model to display
  • uint8 life Time to display model (seconds * 0.1)