Map Utilities
yolkbot/util provides various map-related utilities.
yolkbot/util provides various map-related utilities. These are useful for things that would usually take a few extra lines to do yourself.
fetchMap
This fetches a map from the game and returns it. This is useful for getting map data without having to do it yourself.
It will store maps in ~/.yolkbot/maps
(your homedir). It bases maps off their hashes, which change if the maps change. Hashes are provided by shell. If you call fetchMap
with a map that is in the map cache, it will return the cached map instead of fetching it again. You can bypass this by passing a random string (i.e. Math.random().toString()
) as the second argument.
initKotcZones
This initializes the KOTC zones on a mapData. This is for advanced users who want to get custom KOTC zones for a map.
This is called internally by yolkbot and stored in bot.game.map.zones
. You should not need to call this yourself unless you are creating an advanced program.
It takes an input of an array of DYNAMIC.capture-zone.none
cells (so an array of x/y/z objects) and returns an array similar to this:
This continues. The activeZone
prop refers to a result index, so if activeZone
is 0
, the cells included in the coop are result[0]
.
For example, to run this on Greenhouse: