Refactor code structure for improved readability and maintainability
This commit is contained in:
+5
-5
@@ -4,8 +4,8 @@ class_name Owniverse
|
||||
signal unlock_item(item_id: String)
|
||||
|
||||
var current_year: float = 0
|
||||
var current_speed: int = 1
|
||||
var current_speed_in_years:int = 1
|
||||
var current_speed: float = 1
|
||||
var current_speed_in_years:float = 1
|
||||
|
||||
var entities: Dictionary[String, OwniverseEntity] = {}
|
||||
var entity_groups: Dictionary[String, Array] = {}
|
||||
@@ -86,8 +86,8 @@ func produce(item_id: String, amount: float) -> void:
|
||||
|
||||
func automated_production(_delta: float) -> void:
|
||||
for entity_id in auto_production:
|
||||
var entity = entities[entity_id]
|
||||
var amount_to_produce = int(entity.amount * entity.product_per_year_amount * _delta)
|
||||
var _entity = entities[entity_id]
|
||||
var _amount_to_produce = int(_entity.amount * _entity.product_per_year_amount * _delta)
|
||||
|
||||
|
||||
func get_available_to_produce(item_id: String) -> float:
|
||||
@@ -140,7 +140,7 @@ func add_time_delta(delta) -> float:
|
||||
return current_year
|
||||
|
||||
|
||||
func change_speed(delta: int) -> int:
|
||||
func change_speed(delta: int) -> float:
|
||||
current_speed = clamp(current_speed + delta, 1, Global.SPEED_LIMIT)
|
||||
current_speed_in_years = pow(10, current_speed - 1)
|
||||
return current_speed
|
||||
|
||||
Reference in New Issue
Block a user