Module ...
Handles actors field of view When an actor moves it computes a field of view and stores it in self.fov
When an other actor moves it can update the fov of seen actors
Functions
_M:computeFOV (radius, block, apply, force, no_store, cache) | Computes actor's FOV |
_M:computeFOVBeam (radius, dir, angle, block, apply, force, no_store, cache) | Computes actor's FOV as a beam |
_M:init (t) | Initialises stats with default values if needed |
_M:updateFOV (a, sqdist) | Update our fov to include the given actor at the given dist |
Functions
- _M:computeFOV (radius, block, apply, force, no_store, cache)
-
Computes actor's FOV
Parameters
- radius: the FOV radius, defaults to 20
- block: the property to look for FOV blocking, defaults to "block_sight"
- apply: an apply function that will be called on each seen grids, defaults to nil
- force: set to true to force a regeneration even if we did not move
- no_store: do not store FOV informations
- cache: if true it will use the cache given by the map, for the map actor. It can be used for other actors is they have the same block settings
- _M:computeFOVBeam (radius, dir, angle, block, apply, force, no_store, cache)
-
Computes actor's FOV as a beam
Parameters
- radius: the FOV radius, defaults to 20
- dir: the FOV beam direction (1,2,3,4,6,7,8,9)
- angle: the FOV beam spread
- block: the property to look for FOV blocking, defaults to "block_sight"
- apply: an apply function that will be called on each seen grids, defaults to nil
- force: set to true to force a regeneration even if we did not move
- no_store: do not store FOV informations
- cache: if true it will use the cache given by the map, for the map actor. It can be used for other actors is they have the same block settings
- _M:init (t)
-
Initialises stats with default values if needed
Parameters
- t:
- _M:updateFOV (a, sqdist)
-
Update our fov to include the given actor at the given dist
Parameters
- a: the actor to include
- sqdist: the squared distance to that actor