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
3696 3697 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3696 def initialize(character, target, tries, ) end |
Instance Attribute Details
#character ⇒ Game_Character (readonly)
The character which needs a path
3687 3688 3689 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3687 def character @character end |
#need_update ⇒ Boolean (readonly)
Indicate if the request needs update or not
3690 3691 3692 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3690 def need_update @need_update end |
Class Method Details
.load(data)
(Class method) Load the requests from the given argument
3767 3768 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3767 def self.load(data) end |
Instance Method Details
#backtrace(tx, ty, tz) ⇒ Array<Integer>
Calculate the path from the given node
3759 3760 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3759 def backtrace(tx, ty, tz) end |
#calculate_node ⇒ Object
Calculate a node and return it if a path is found
3752 3753 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3752 def calculate_node end |
#finished? ⇒ Boolean
Indicate if the request is ended
3716 3717 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3716 def finished? end |
#process_result(result)
Process the result of the node calculation
3731 3732 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3731 def process_result(result) end |
#reload? ⇒ Boolean
Indicate if the request is to reload
3712 3713 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3712 def reload? end |
#save ⇒ Array<Object>
Gather the data ready to be saved
3763 3764 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3763 def save end |
#searching? ⇒ Boolean
Indicate if the request is search for path
3700 3701 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3700 def searching? end |
#send_path(path)
Make the character following the found path
3744 3745 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3744 def send_path(path) end |
#stucked? ⇒ Boolean
Detect if the character is stucked
3748 3749 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3748 def stucked? end |
#update(operation_counter, is_first_update) ⇒ Integer
Update the requests and return the number of performed actions
3722 3723 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3722 def update(operation_counter, is_first_update) end |
#update_reload(is_first_update)
Reload the request
3740 3741 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3740 def update_reload(is_first_update) end |
#update_search(operation_counter) ⇒ Integer
Update the request search and return the new remaining node count
3727 3728 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3727 def update_search(operation_counter) end |
#update_wait(is_first_update)
Update the request when waiting before retrying to find path
3737 3738 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3737 def update_wait(is_first_update) end |
#update_watch(is_first_update)
Update the request when looking for obstacles
3734 3735 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3734 def update_watch(is_first_update) end |
#waiting? ⇒ Boolean
Indicate if the request is watching for obstacle
3704 3705 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3704 def waiting? end |
#watching? ⇒ Boolean
Inidicate if the request is waiting for new try
3708 3709 |
# File 'docs/4_Systems_003_Map_Engine.rb', line 3708 def watching? end |