Sha256: 1ca94f28fdb8d3626838172bc0f0f84214bb4a6913867f1bd4f36b87f3a232b8

Contents?: true

Size: 710 Bytes

Versions: 6

Compression:

Stored size: 710 Bytes

Contents

module GameMachine
  module Commands
    class GridCommands

      attr_reader :aoe_grid, :grid
      def initialize
        @aoe_grid = Grid.find_or_create('aoe')
        @grid = Grid.find_or_create('default')
      end

      def find_by_id(id)
        grid.get(id)
      end

      def get_neighbors_for(id,entity_type='player')
        grid.getNeighborsFor(id,entity_type)
      end

      def neighbors(x,y,type='player')
        grid.neighbors(x,y,type)
      end

      def remove(id)
        grid.remove(id)
        aoe_grid.remove(id)
      end

      def track(id,x,y,z,entity_type='npc')
        grid.set(id,x,y,z,entity_type)
        aoe_grid.set(id,x,y,z,entity_type)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
game_machine-1.0.4 lib/game_machine/commands/grid_commands.rb
game_machine-1.0.2 lib/game_machine/commands/grid_commands.rb
game_machine-0.0.11 lib/game_machine/commands/grid_commands.rb
game_machine-0.0.10 lib/game_machine/commands/grid_commands.rb
game_machine-0.0.9 lib/game_machine/commands/grid_commands.rb
game_machine-0.0.8 lib/game_machine/commands/grid_commands.rb