Refactor: update SPEED_LIMIT type, comment out signal, and enhance evolution logic
This commit is contained in:
+17
-10
@@ -1,10 +1,12 @@
|
||||
extends Node
|
||||
class_name Owniverse
|
||||
|
||||
var evolution: OwniverseEvolution = OwniverseEvolution.new()
|
||||
|
||||
signal unlock_item(item_id: String)
|
||||
|
||||
var current_year: float = 0
|
||||
var current_speed: float = 1
|
||||
var current_speed: int = 1
|
||||
var current_speed_in_years:float = 1
|
||||
|
||||
var entities: Dictionary[String, OwniverseEntity] = {}
|
||||
@@ -31,21 +33,26 @@ func cycle(year_delta: float) -> void:
|
||||
|
||||
_check_locked_items()
|
||||
|
||||
#print(_get_distribution(current_amount))
|
||||
#var v = _get_distribution(current_amount)
|
||||
evolution.update_distribution(current_amount)
|
||||
|
||||
#for k in current_amount:
|
||||
#if current_amount[k] != 0:
|
||||
#print(k, "|", current_amount[k])
|
||||
|
||||
|
||||
#region auto production and evolution
|
||||
|
||||
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:
|
||||
if current_amount[entity.id] == 0:
|
||||
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
|
||||
|
||||
for item in cycle_production:
|
||||
_count_amount(item, cycle_production[item])
|
||||
for item in _cycle_production:
|
||||
_count_amount(item, _cycle_production[item])
|
||||
|
||||
|
||||
func _entity_evolution(year_delta: float) -> void:
|
||||
@@ -140,8 +147,8 @@ func add_time_delta(delta) -> float:
|
||||
return current_year
|
||||
|
||||
|
||||
func change_speed(delta: int) -> float:
|
||||
current_speed = clamp(current_speed + delta, 1, Global.SPEED_LIMIT)
|
||||
func change_speed(delta: int) -> int:
|
||||
current_speed = clampi(current_speed + delta, 1, Global.SPEED_LIMIT)
|
||||
current_speed_in_years = pow(10, current_speed - 1)
|
||||
return current_speed
|
||||
|
||||
@@ -210,6 +217,6 @@ func init_enitities() -> void:
|
||||
|
||||
#if entity.event_group != "":
|
||||
#entity_event_groups.append(entity.id)
|
||||
print(entity_groups)
|
||||
print(entity_event_groups)
|
||||
#print(entity_groups)
|
||||
#print(entity_event_groups)
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user