Feature/evolution #1
@@ -7,7 +7,7 @@ signal unlock_item(item_id: String)
|
|||||||
|
|
||||||
var current_year: float = 0
|
var current_year: float = 0
|
||||||
var current_speed: int = 1
|
var current_speed: int = 1
|
||||||
var current_speed_in_years:float = 1
|
var current_speed_in_years: float = 1
|
||||||
|
|
||||||
var entities: Dictionary[String, OwniverseEntity] = {}
|
var entities: Dictionary[String, OwniverseEntity] = {}
|
||||||
var entity_groups: Dictionary[String, Array] = {}
|
var entity_groups: Dictionary[String, Array] = {}
|
||||||
@@ -46,12 +46,12 @@ func _auto_production(year_delta: float) -> void:
|
|||||||
var _cycle_production = {"S": 0.0, "H": 0.0}
|
var _cycle_production = {"S": 0.0, "H": 0.0}
|
||||||
for entity: OwniverseEntity in auto_production:
|
for entity: OwniverseEntity in auto_production:
|
||||||
if current_amount[entity.id] == 0:
|
if current_amount[entity.id] == 0:
|
||||||
continue
|
continue
|
||||||
_cycle_production[entity.product_per_year_type] += \
|
_cycle_production[entity.product_per_year_type] += \
|
||||||
current_amount[entity.id] * entity.product_per_year_amount * year_delta
|
current_amount[entity.id] * entity.product_per_year_amount * year_delta
|
||||||
|
|
||||||
for item in _cycle_production:
|
for item in _cycle_production:
|
||||||
_count_amount(item, _cycle_production[item])
|
_count_amount(item, _cycle_production[item])
|
||||||
|
|
||||||
|
|
||||||
func _get_distribution(source: Dictionary) -> Dictionary:
|
func _get_distribution(source: Dictionary) -> Dictionary:
|
||||||
@@ -79,7 +79,7 @@ func produce(item_id: String, amount: float) -> void:
|
|||||||
return
|
return
|
||||||
if _entity.cost[elem] == 0: continue
|
if _entity.cost[elem] == 0: continue
|
||||||
|
|
||||||
entity_transaction[elem] = -amount * _entity.cost[elem]
|
entity_transaction[elem] = - amount * _entity.cost[elem]
|
||||||
|
|
||||||
for elem in entity_transaction:
|
for elem in entity_transaction:
|
||||||
_process_enitity(elem, entity_transaction[elem])
|
_process_enitity(elem, entity_transaction[elem])
|
||||||
@@ -124,7 +124,7 @@ func _count_amount(entity_id: String, amount: float) -> void:
|
|||||||
items_to_update[entity_id] = current_amount[entity_id]
|
items_to_update[entity_id] = current_amount[entity_id]
|
||||||
|
|
||||||
func _check_locked_items() -> void:
|
func _check_locked_items() -> void:
|
||||||
for entity:OwniverseEntity in locked_entities:
|
for entity: OwniverseEntity in locked_entities:
|
||||||
for elem in entity.unlock:
|
for elem in entity.unlock:
|
||||||
if cumulative_amount[elem] < entity.unlock[elem]:
|
if cumulative_amount[elem] < entity.unlock[elem]:
|
||||||
continue
|
continue
|
||||||
@@ -156,7 +156,6 @@ func change_speed(delta: int) -> int:
|
|||||||
|
|
||||||
func load_data() -> bool:
|
func load_data() -> bool:
|
||||||
#var _is_succesfull = false
|
#var _is_succesfull = false
|
||||||
|
|
||||||
var game_data: Dictionary = SaveManager.load_data("owniverse", "qwerty")
|
var game_data: Dictionary = SaveManager.load_data("owniverse", "qwerty")
|
||||||
if game_data == {}:
|
if game_data == {}:
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user