Class engine.generator.interface.ActorAI
Handles actors artificial intelligence (or dumbness ...
;)
Methods
engine.generator.interface.ActorAI:newAI (name, fct)
Define AI
engine.generator.interface.ActorAI:loadDefinition (dir)
Defines AIs Static!
engine.generator.interface.ActorAI:moveDirection (x, y, force)
Move one step to the given target if possible This tries the most direct route, if not available it checks sides and always tries to get closer
engine.generator.interface.ActorAI:clearAITarget ()
Responsible for clearing ai target if needed
engine.generator.interface.ActorAI:doAI ()
Main entry point for AIs
engine.generator.interface.ActorAI:getTarget (typ)
Returns the current target
engine.generator.interface.ActorAI:setTarget (target, last_seen)
Sets the current target
engine.generator.interface.ActorAI:aiSeeTargetPos (target)
Returns the seen coords of the target This will usually return the exact coords, but if the target is only partially visible (or not at all) it will return estimates, to throw the AI a bit off (up to 10 tiles error)
Methods
- engine.generator.interface.ActorAI:newAI (name, fct)
-
Define AI
Parameters:
- name
- fct
- engine.generator.interface.ActorAI:loadDefinition (dir)
-
Defines AIs
Static!
Parameters:
- dir
- engine.generator.interface.ActorAI:moveDirection (x, y, force)
-
Move one step to the given target if possible
This tries the most direct route, if not available it checks sides and always tries to get closer
Parameters:
- x
- y
- force
- engine.generator.interface.ActorAI:clearAITarget ()
- Responsible for clearing ai target if needed
- engine.generator.interface.ActorAI:doAI ()
- Main entry point for AIs
- engine.generator.interface.ActorAI:getTarget (typ)
-
Returns the current target
Parameters:
- typ
- engine.generator.interface.ActorAI:setTarget (target, last_seen)
-
Sets the current target
Parameters:
- target
- last_seen
- engine.generator.interface.ActorAI:aiSeeTargetPos (target)
-
Returns the seen coords of the target
This will usually return the exact coords, but if the target is only partially visible (or not at all)
it will return estimates, to throw the AI a bit off (up to 10 tiles error)
Parameters:
- target the target we are tracking
Returns:
- x coord to move/cast to
- y coord to move/cast to