Splitters part 1

This commit is contained in:
Rendo 2025-10-16 23:29:49 +05:00
commit 3c0777f4fd
9 changed files with 150 additions and 2 deletions

View file

@ -31,9 +31,12 @@ func _draw() -> void:
## dv : Vector2 - get position in tiles [br]
func get_relative(dv : Vector2) -> Structure:
if get_parent() is GridController:
return get_parent().get_at(global_position+dv*Globals.GRID_SIZE)
return get_parent().get_at(relative_tile_as_global(dv))
return null
func relative_tile_as_global(dv: Vector2) -> Vector2:
return global_position+dv*Globals.GRID_SIZE
## Check structure is in zone and does not collide with any other structures [br]
## Returns true if structure is in zone and does not collide with any other structure [br]
## Returns false if structure is not in zone or does not collide with any other structure