Files
Corupture/scripts/cell_data.gd
Eric 84de7fa6f1 #2 Collects resources
#8 Generates resources based on resource data
#10 Shows total resources and adjusts for new resources
2024-02-07 09:24:56 -06:00

29 lines
721 B
GDScript

class_name CellData
extends Node
@export var layer_info: Dictionary = {
Constants.TilemapLayers.CORRUPTION: false
}
var _pos: Vector2i
func _init(pos: Vector2i) -> void:
_pos = pos
func change_layer(layer: int, data: Variant) -> bool:
if layer_info.has(layer) and layer_info[layer] == data:
return false
layer_info[layer] = data
return true
func change_resource(data: GameResource) -> void:
layer_info[Constants.TilemapLayers.ENVIRONMENT] = data
func get_resource() -> GameResource:
return layer_info[Constants.TilemapLayers.ENVIRONMENT] as GameResource
func is_corrupted() -> bool:
return layer_info[Constants.TilemapLayers.CORRUPTION]
func has_layer(layer: int) -> bool:
return layer_info.has(layer)