diff options
| author | realtradam <[email protected]> | 2021-06-12 03:15:59 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-06-12 03:15:59 -0400 |
| commit | 795cb85e284d6adc83d8a8770e1e2406322f4034 (patch) | |
| tree | 1fe065f7f5ecfaf9bc34638cc5a5dd7fe848eb3e /deprecated/systems/00_update_levels.rb | |
| parent | 6e9ff64fec30779eb894a617af95ce7815e3d1ca (diff) | |
| download | FelECS-795cb85e284d6adc83d8a8770e1e2406322f4034.tar.gz FelECS-795cb85e284d6adc83d8a8770e1e2406322f4034.zip | |
file cleanup
Diffstat (limited to 'deprecated/systems/00_update_levels.rb')
| -rw-r--r-- | deprecated/systems/00_update_levels.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/deprecated/systems/00_update_levels.rb b/deprecated/systems/00_update_levels.rb new file mode 100644 index 0000000..6f3a056 --- /dev/null +++ b/deprecated/systems/00_update_levels.rb @@ -0,0 +1,34 @@ +class Systems + class UpdateLevels + @co = Components::Overworld + def self.run + @co.data[:add].each do |id| + @co.data[:add].delete(id) + if !(Components::Sprite.id & Entity.signatures[id]).zero? + @co.data[:grid][@co.data[id].x][@co.data[id].y] = {} if @co.data[:grid][@co.data[id].x][@co.data[id].y].nil? + #@co.data[:grid][@co.data[id].x][@co.data[id].y].merge!({ player: true }) + puts @co.data[:grid][@co.data[id].x][@co.data[id].y].inspect + elsif !(Components::Map.id & Entity.signatures[id]).zero? + if Components::Map.data[id].json['tilesets'].last['source'].split('/').last.delete('\\').delete_suffix('.tsx') == 'hitbox' + Components::Map.data[id].json['layers'].each do |layer| + layer['chunks'].each do |chunk| + chunk['data'].each_slice(chunk['width']).with_index do |row, row_index| + row.each_with_index do |tile, column_index| + if tile.to_i == Components::Map.data[id].json['tilesets'].last['firstgid'].to_i + @co.data[:grid][column_index][row_index] = {} if @co.data[:grid][column_index][row_index].nil? + @co.data[:grid][column_index][row_index].merge!({ hitbox: true }) + end + end + end + end + end + end + end + puts @co.data[:grid] + end + Components::Overworld.data[:remove].each do |id| + Components::Overworld.data[:remove].delete(id) + end + end + end +end |
