two buildings working!
created research building base
This commit is contained in:
@@ -13,7 +13,7 @@ func _on_gained_resource(res: GameResource) -> void:
|
||||
func pickup(resource: GameResource) -> void:
|
||||
if not resources.has(resource):
|
||||
resources[resource] = 0
|
||||
var pickup_amount = min(resource.pickup_value, resource.storage_max - resources[resource])
|
||||
var pickup_amount = min(resource.pickup_value, get_resource_limit(resource) - resources[resource])
|
||||
if pickup_amount > 0:
|
||||
resources[resource] += pickup_amount
|
||||
var changed_resources := {
|
||||
@@ -34,6 +34,9 @@ func use_resources(cost: Dictionary) -> void:
|
||||
resources[res] -= cost[res]
|
||||
changed_resources[res] = -cost[res]
|
||||
changed_resource.emit(ResourceChangedSignal.new(changed_resources))
|
||||
|
||||
func get_resource_limit(resource: GameResource) -> int:
|
||||
return resource.storage_max * (1 + BuildingManager.get_storage_count_for_resource(resource))
|
||||
|
||||
#func _on_timer_timeout() -> void:
|
||||
#var corrupted_resources := Grid.get_corrupted_resources()
|
||||
|
||||
Reference in New Issue
Block a user