Name refactor
This commit is contained in:
parent
6f56fffb59
commit
e1cdf38dfb
21 changed files with 44 additions and 40 deletions
|
@ -1,28 +0,0 @@
|
|||
extends Node2D
|
||||
|
||||
class_name EntityHolder
|
||||
|
||||
const GRID_SIZE : Vector2 = Vector2(16,16)
|
||||
|
||||
@export var building_zone : BuildZone
|
||||
var constructions : Array[Construction]
|
||||
|
||||
func _ready() -> void:
|
||||
constructions.resize(building_zone.get_capacity())
|
||||
|
||||
func add_construction(construction : Construction) -> bool:
|
||||
var construction_dp = construction.get_dimension_points()
|
||||
for point in construction_dp:
|
||||
if constructions[building_zone.indexify_global_point(construction.global_position + point)]:
|
||||
return false
|
||||
construction.reparent(self)
|
||||
construction.global_position = building_zone.get_placement_position(construction.global_position)
|
||||
for point in construction_dp:
|
||||
constructions[building_zone.indexify_global_point(construction.global_position + point)] = construction
|
||||
return true
|
||||
|
||||
func get_at(point : Vector2) -> Construction:
|
||||
return constructions[building_zone.indexify_global_point(point)]
|
||||
|
||||
func is_point_occupied(point : Vector2) -> bool:
|
||||
return get_at(point) != null
|
Loading…
Add table
Add a link
Reference in a new issue