class_name GridNode extends Node2D @export var vine : Vine @export var location : Vector2 : set(new_loc): location = Global.vec_mod(new_loc, Grid.num_collumns, true) update_position() @export var offset : Vector2 : set(new_offset): offset = new_offset update_position() @export var depth : int func _get(property: StringName) -> Variant: if property == "position": return position if property == "global_position": return global_position return null func _set(property: StringName, value: Variant) -> bool: if property == "global_position": location = Grid.get_location_from_world_pos(value) offset = Grid.get_offset_from_world_pos(value) update_position() return true if property == "position": update_position() return false return false func update_position(): global_position = Grid.get_world_position(location, offset) func _enter_grid() -> void: update_position() func _init(_vine = null, _location = Vector2.ZERO, _offset = Vector2.ZERO, _depth = 0): vine = _vine location = _location offset = _offset depth = _depth