This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
odyssey-old/Scenes/InEditorMap.gd

38 lines
1 KiB
GDScript3
Raw Normal View History

2020-09-11 09:29:06 +00:00
extends Node2D
var debug_areas = false
const ProbeElectricity = preload("res://Actors/Systems/Electricity/ElectricProbe.tscn")
onready var tilemaps = [ $tiles/base, $tiles/cables, $tiles/floor, $tiles/walls ]
onready var pois = $pois
func _ready():
pass
# Run autotile conversions and generate occlusions
#$tiles/walls.run_conversions()
# Electricity setup
#make_electric_probes($tiles/cables, "Wire")
# Tileset related functions
func make_electric_probes(tilemap: TileMap, tile_name: String):
var tile_id = tilemap.tile_set.find_tile_by_name(tile_name)
for cell in tilemap.get_used_cells_by_id(tile_id):
var coord = tilemap.map_to_world(cell)
var probe = ProbeElectricity.instance()
probe.position = coord
tilemap.add_child(probe)
func get_pois(type_filter, class_filter) -> Array:
var filtered = []
for child in $pois.get_children():
if type_filter != null and child.poitype != type_filter:
continue
if class_filter != null and child.poiclass != class_filter:
continue
filtered.append(child)
return filtered