Roughed in some basic pathfinding, adapted from CitySim's

This commit is contained in:
2019-10-24 13:30:30 -05:00
parent cc040f718b
commit 75a03a7155
8 changed files with 265 additions and 27 deletions

View File

@@ -57,6 +57,15 @@ class IMICRTS
@players.find { |player| player.id == id }
end
def find_path(player:, entity:, goal:, travels_along: :ground, allow_diagonal: false, klass: IMICRTS::Pathfinder::BasePathfinder)
if klass.cached_path(entity, goal, travels_along)
puts "using a cached path!" if true#Setting.enabled?(:debug_mode)
return klass.cached_path(entity, goal, travels_along)
end
klass.new(director: self, entity: entity, goal: goal, travels_along: travels_along, allow_diagonal: allow_diagonal)
end
def record_order(order_id, *args)
if order = Order.get(order_id)
struct = order.struct(args)