Here it is: EQEmu Water Detection beta, based on the 1070 code.
Zone patch:
http://www.rama.demon.co.uk/zone.patch
utils/AZone patch:
http://www.rama.demon.co.uk/azone.patch
Full Source Tree:
http://www.rama.demon.co.uk/EQEmu-0....tection.tar.gz
Water maps for all S3D zones (16MB):
http://www.rama.demon.co.uk/watermaps.tar.gz
It doesn't do a lot (anything) for Angelox's issue with bouncing mobs pathing through water in Dagnor's Cauldron,
which is what got me started down this road, but I think that is another issue, primarily mobs attempting
to path in the air above the water.
What these changes do are:
Amend azone to have an option to write out water maps (.wtr). These actually contain a copy of the BSP
tree from the WLD data in the S3D files with leaf nodes marked as to whether they are in water/lava.
Load these .wtr maps into the emulator.
Provide the ability to detect if a given co-ordinate is in water/lava.
Doesn't do BestZ calculation under water.
Add a new flag to the mob class indicating if it is in water or not. This is initialsed to false when
the mob is created set to true or false as appropriate in CalculatePosition2.
Turns flymode 1 on or off as mobs path into/out of water. This stops mobs falling
to the floor underwater. If you try Kedge/Powater before and after applying this patch, you will see
the difference.
I looked into also doing this as soon as the mob is spawned, rather than waiting for the waypoints to
kick in to avoid the initial 'fall to the floor', however I was unable to see an obvious way of doing
this due to the asynchronous way the spawns are qeueued up before being sent to the client.
I even tried setting all the unknown fields in the Spawn packet to 1s in the hope that there was a field
there which affected flymode, but didn't find anything.
I also altered the fishing code to use the water detection. The uses some constants relating to how
far in front and down from you the water has to be for you to be able to fish. These may need tweaking
a bit to match live. I noticed I left a debugging message in there which tells you the co-ords of the
end of your fishing line, which needs to come out.
You won't need to use azone if you download the water maps from the link above, just put the .wtr files
in your Maps directory.
If you want to use azone, to create a water map, supply the new -w parameter, e.g.
azone -w cauldron
Some S3D files which only have one type of special area, i.e. just water or just lava, don't tag the
region as to whether they are water or lava. In these cases, azone will default to tagging them as
water. The only exceptions I came across where:
arena (the firepots are flagged as lava)
lavastorm, fearplane (ring of fire), pofire, skyfire
In these cases, supply the -dl (default lava) flag to azone to mark these as lava, e.g.
azone -w -dl pofire
Comments:
The lava areas are included in the water maps, even though I don't know if there is any use for that.
The map could be optimised by pruning branches of the BSP tree that have no water/lava in them.
The walking of the BSP tree is currently done by recursion. This could be turned into a loop to avoid
some function call overhead.
If you don't have a .wtr map for a zone in your Maps directory, everything should just work as before.
This only works for zones in S3D format. If you are using a zone that has both S3D and EQG maps and
you are using the EQG version, don't use the .wtr map for that zone.
I did a search of the forums and couldn't find any information on where the BSP tree and special region
information is in the EQGs, hence no support.
You can find out whether you are in water or lava by using the #bestz command in-game.
If you try it, let me know your thoughts, bugs, suggestions.
I would add that Windcatcher's Openzone source and WLD documentation, along with the code that was already in Azone (FNW, Daeken_bb?) were the keys to getting this to work.