TE BREAKMODEL

From Sven Co-op
Jump to navigation Jump to search

Spawns multiple rotating models with gravity, collisions, fadeout, particle trails, and sound effects. Models are spawned from random locations inside a box.

This is the effect used when you destroy a func_breakable.

TE_BREAKMODEL
void te_breakmodel(Vector pos, Vector size, Vector velocity, 
	uint8 speedNoise=16, string model="models/hgibs.mdl", 
	uint8 count=8, uint8 life=0, uint8 flags=20,
	NetworkMessageDest msgType=MSG_BROADCAST, edict_t@ dest=null)
{
	NetworkMessage m(msgType, NetworkMessages::SVC_TEMPENTITY, dest);
	m.WriteByte(TE_BREAKMODEL);
	m.WriteCoord(pos.x);
	m.WriteCoord(pos.y);
	m.WriteCoord(pos.z);
	m.WriteCoord(size.x);
	m.WriteCoord(size.y);
	m.WriteCoord(size.z);
	m.WriteCoord(velocity.x);
	m.WriteCoord(velocity.y);
	m.WriteCoord(velocity.z);
	m.WriteByte(speedNoise);
	m.WriteShort(g_EngineFuncs.ModelIndex(model));
	m.WriteByte(count);
	m.WriteByte(life);
	m.WriteByte(flags);
	m.End();
}
  • Vector pos Center point for the effect
  • Vector size Radius of the box where the models spawn randomly inside
  • Vector velocity Speed and direction of the models
  • uint8 speedNoise Amount to randomize speed and direction
  • string model Model to display
  • uint8 count Number of models to spawn
  • uint8 life Time to display all models (seconds * 0.1)
  • uint8 flags Choose only one of the following flags:

1 : Glass sounds and models draw at 50% opacity
2 : Metal sounds
4 : Flesh sounds
8 : Wood sounds
64 : Rock sounds

The following flags can be enabled in addition to the flag selected above:
16 : Particle trails
32 : 50% opacity