Module: Pathfinding::Target

Defined in:
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00710 Pathfinding_targets.rb

Overview

Module that describe the pathfinding targets. There is different type of targets :

  • Coords : reach a specific point in the map

    find_path to:[x, y, [,z]] [, radius: Integer]
    
  • Character : reach a game character object in the map

    find_path to:get_character(Integer)[, radius: Integer]
    
  • Charcater_Reject : flee the given charcater :

    find_path to:get_character(Integer), type: :Character_Reject[, radius: Integer]
    
  • Border : reach the border of the map (:north, :south, :east, :west)

    find_path to: Symbol, type: :Border[, radius: Integer]
    

Each target can be tested by the reached? method

Defined Under Namespace

Classes: Border, Character, Character_Reject, Coords

Class Method Summary collapse

Class Method Details

.get(type, *data) ⇒ Object

Convert the raw data to a target object

Parameters:

  • data (Array)

    data to convert

Returns:



17
18
19
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00710 Pathfinding_targets.rb', line 17

def self.get(type, *data)
  return const_defined?(type) ? const_get(type).new(*data) : nil 
end

.load(data) ⇒ Object

Convert the saved data to a target object with

Parameters:

  • data (Array)

    data to convert, must be create by the target object

Returns:



24
25
26
27
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00710 Pathfinding_targets.rb', line 24

def self.load(data)
  type = data.shift
  return const_defined?(type) ? const_get(type).load(data) : nil
end