Class: Pathfinding::Request
Overview
Class that describe a pathfinding request
A request has three caracteristics :
- Character : the character summonning the request
- Target : the target to reach
- Priority : The priority of the request between others
Algorithm steps 1st step : Initialization
Creation of the variables (#initialize)
2nde step: Search
Calculate NODES_PER_FRAME nodes per frame to optimize the process (#update_search)
Nodes are calculated in #calculate_node with A* algorithm
Once a path is found, or all possibilies are studied, the request start watching
3rd step : Watch
The Request look for obstacles on the path and restart the search (reload) if there is one
Instance Attribute Summary collapse
-
#character ⇒ Game_Character
readonly
The character which needs a path.
-
#need_update ⇒ Boolean
readonly
Indicate if the request needs update or not.
Class Method Summary collapse
-
.load(data)
(Class method) Load the requests from the given argument.
Instance Method Summary collapse
-
#backtrace(tx, ty, tz) ⇒ Array<Integer>
Calculate the path from the given node.
-
#calculate_node ⇒ Object
Calculate a node and return it if a path is found.
-
#finished? ⇒ Boolean
Indicate if the request is ended.
-
#initialize(character, target, tries, tags) ⇒ Request
constructor
Create the request.
-
#process_result(result)
Process the result of the node calculation.
-
#reload? ⇒ Boolean
Indicate if the request is to reload.
-
#save ⇒ Array<Object>
Gather the data ready to be saved.
-
#searching? ⇒ Boolean
Indicate if the request is search for path.
-
#send_path(path)
Make the character following the found path.
-
#stucked? ⇒ Boolean
Detect if the character is stucked.
-
#update(operation_counter, is_first_update) ⇒ Integer
Update the requests and return the number of performed actions.
-
#update_reload(is_first_update)
Reload the request.
-
#update_search(operation_counter) ⇒ Integer
Update the request search and return the new remaining node count.
-
#update_wait(is_first_update)
Update the request when waiting before retrying to find path.
-
#update_watch(is_first_update)
Update the request when looking for obstacles.
-
#waiting? ⇒ Boolean
Indicate if the request is watching for obstacle.
-
#watching? ⇒ Boolean
Inidicate if the request is waiting for new try.
Constructor Details
#initialize(character, target, tries, tags) ⇒ Request
Create the request
3574 3575 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3574 def initialize(character, target, tries, ) end |
Instance Attribute Details
#character ⇒ Game_Character (readonly)
The character which needs a path
3565 3566 3567 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3565 def character @character end |
#need_update ⇒ Boolean (readonly)
Indicate if the request needs update or not
3568 3569 3570 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3568 def need_update @need_update end |
Class Method Details
.load(data)
(Class method) Load the requests from the given argument
3645 3646 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3645 def self.load(data) end |
Instance Method Details
#backtrace(tx, ty, tz) ⇒ Array<Integer>
Calculate the path from the given node
3637 3638 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3637 def backtrace(tx, ty, tz) end |
#calculate_node ⇒ Object
Calculate a node and return it if a path is found
3630 3631 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3630 def calculate_node end |
#finished? ⇒ Boolean
Indicate if the request is ended
3594 3595 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3594 def finished? end |
#process_result(result)
Process the result of the node calculation
3609 3610 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3609 def process_result(result) end |
#reload? ⇒ Boolean
Indicate if the request is to reload
3590 3591 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3590 def reload? end |
#save ⇒ Array<Object>
Gather the data ready to be saved
3641 3642 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3641 def save end |
#searching? ⇒ Boolean
Indicate if the request is search for path
3578 3579 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3578 def searching? end |
#send_path(path)
Make the character following the found path
3622 3623 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3622 def send_path(path) end |
#stucked? ⇒ Boolean
Detect if the character is stucked
3626 3627 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3626 def stucked? end |
#update(operation_counter, is_first_update) ⇒ Integer
Update the requests and return the number of performed actions
3600 3601 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3600 def update(operation_counter, is_first_update) end |
#update_reload(is_first_update)
Reload the request
3618 3619 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3618 def update_reload(is_first_update) end |
#update_search(operation_counter) ⇒ Integer
Update the request search and return the new remaining node count
3605 3606 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3605 def update_search(operation_counter) end |
#update_wait(is_first_update)
Update the request when waiting before retrying to find path
3615 3616 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3615 def update_wait(is_first_update) end |
#update_watch(is_first_update)
Update the request when looking for obstacles
3612 3613 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3612 def update_watch(is_first_update) end |
#waiting? ⇒ Boolean
Indicate if the request is watching for obstacle
3582 3583 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3582 def waiting? end |
#watching? ⇒ Boolean
Inidicate if the request is waiting for new try
3586 3587 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3586 def watching? end |