/*
* Stops the entity from receiving events of type e_type
* until no instances of f are running for that entity.
*
* f: The function to be waited for.
* e_type: The type of events to be disabled.
*/
void event_lock(void* f,fixed e_type)
{
if (!my)
return;
my->emask &= ~e_type;
while (proc_status2(f,me) != 0)
wait(1);
my->emask |= e_type;
}
function this_event()
{
if(event_type == EVENT_IMPACT)
{
beep();
event_lock(this_event, ENABLE_IMPACT);
wait(my.skill88);
}
}
// OR
function call_out_to_wait(ENTITY* event_ent)
{
ENTITY ent_event_ent =event_ent;
wait(my.skill88);
...do more stuff....;
}
function this_event()
{
if(event_type == EVENT_IMPACT);
{
beep();
call_out_to_wait(you);
}
}