function bullet_handle()
{
switch (event_type)
{
case EVENT_BLOCK:
wait(1);
ptr_remove(me);
return;
case EVENT_ENTITY:
//wait(1);
//ent_remove(me);
return;
}
}
function move_bullet()
{
//set(my,INVISIBLE);
while(enet_ent_globpointer(my) == -1) {wait(1);} //wait until the entity gets a global pointer
enet_send_angle(enet_ent_globpointer(my),-1);
my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // make entity sensitive for block and entity collision
my.event = bullet_handle;
while(1)
{
c_move(my, vector(60 * time_step, 0, 0), nullvector, 0);
wait(1);
}
}
function shootWeapon()
{
if(mouse_left == ON)
{
ENTITY* bullet;
VECTOR* temp;
if(players[cl_id] != NULL)
{
vec_set(temp,vector(20,0,29));
vec_rotate(temp,vector(players[cl_id].pan,camera.tilt,players[cl_id].roll));
vec_add(temp,players[cl_id].x);
bullet = enet_ent_create(_str("Bullet.mdl"),temp,_str("move_bullet"));
bullet.pan = players[cl_id].pan;
bullet.tilt = camera.tilt;
}
}
}