I have two plugins that use two different custom entities to think.
In the first code:
Code:
new ent = fm_create_entity("info_target");
set_pev(ent, pev_classname, "PPloop");
RegisterHamFromEntity(Ham_Think, ent, "PartyLoop", 1);
set_pev(ent, pev_nextthink, get_gametime()+1.0);
Second code:
Code:
if( !pev_valid(hill) )
hill = fm_create_entity("info_target");
set_pev(hill, pev_classname, "PPHill");
set_pev(hill, pev_iuser1, HILL_TIME);
if( HamThink == HamHook:-1 )
HamThink = RegisterHamFromEntity(Ham_Think, hill, "HillThink", 1);
else
EnableHamForward( HamThink );
set_pev(hill, pev_nextthink, get_gametime()+1.0);
However, the second HamThink is being passed the entity from the first HamThink.
Code:
public HillThink( ent )
{
if( ent != hill ){
new name[32];
pev(ent, pev_classname, name, 31);
client_print(0, print_chat, "%d is a hill apparently. class %s", ent, name );
return;
}
//...
}
It prints:
82 is a hill apparently. class PPloop
Obviously I can do a classname check to get around this problem, but IMO it should not be doing this.
Have I misinterpreted RegisterHamFromEntity, after changing the classname do I need a delay before RegisterHamFromEntity, or is it just whacky?