extends Node class_name Owniverse var g_datetime: float = 0 var g_speed: int = 1 var g_speed_in_years = 1 var entities: Dictionary[String, OwniverseEntity] = {} var items_to_update: Dictionary[String, float] = {} var cumulative_amount: Dictionary[String, float] = {} #region Production func produce(item_id: String, amount: int) -> void: if item_id == "S" or item_id == 'H': entities[item_id].amount += 1 _process_enitity(item_id, amount) func automated_production() -> void: pass # add to all lists func _process_enitity(item_id: String, amount: int) -> void: items_to_update[item_id] = entities[item_id].amount func _count_cumulative(item_id: String, amount: int) -> void: if cumulative_amount.has(item_id): cumulative_amount[item_id] += amount else: cumulative_amount[item_id] = amount #endregion func init_enitities() -> void: for entity_id in Global.OwniverseEntities: var entity = OwniverseEntity.new() entity.init_entity(Global.OwniverseEntities[entity_id]) entities[entity_id] = entity func add_time_delta(delta) -> float: var year_delta:float = delta * g_speed_in_years # all ownivewrse activity should be called here g_datetime += year_delta return g_datetime func change_speed(delta: int) -> int: g_speed = clamp(g_speed + delta, 1, Global.SPEED_LIMIT) g_speed_in_years = pow(10, g_speed-1) return g_speed