So uhm basicly what you did was removed everything you didn't understand, slowed down the proccessing and removed a whole bunch of checks that really need to be there. (invisable, for instance). And after all that still use my screwed up zaxis formula!
There needs tobe a zone flag (indoor/outdoor) it's not there yet.
There needs tobe a zAgro added to npc_types.
You check the zone flag when you spawn a mob from the db, if the mob has a no zAgro set (-1 for default, 0 none ect) it gets a default formula.
In an outdoor zone z agro is basicly agro radius extended around to make a sphere, you can set the zAgro of an npc so it will not extend thru floors. For example if you wanted to remove the chain agro from a Guard in the top of a tower when the lower one was pulled, Or makeing the bandits on the highpass ramp agro from far ahead on the path, and not agro people walking up the gorge (they aren't paratroopers afterall). You need this for zones like blackburrow, city of mist and cazicthule.
If its an indoor zone it will get another default, something like 5-10 should keep most mobs from comeing thru floors and ceilings. In these zones you may want to tweak the zAgro up for mobs guarding stairs and ramps. Then you can do fun stuff like only agro an pc standing outside tormax with that uber rare spawn dog that agros from below >=)
anyways..
Code:
distZ = sender->DistZ(mob);
and
Code:
float Mob::DistZ(Mob* other){
return sqrt((double)(pow(other->z_pos-z_pos, 2)));
}
or
Code:
distZ = sender->Dist(mob) - sender->DistNoZ(mob);
Is what you were looking for