Add core simulation modules for owniverse mechanics
- Introduced `life_evolution.gd` to manage life evolution processes. - Implemented `manual_production.gd` for handling production mechanics, including resource management and production steps. - Created `object_batches.gd` to manage batches of objects, including scaling and appending batches. - Developed `object_ledger.gd` for tracking physical amounts, available resources, and binding ownerships. - Added `simulation_module.gd` as a base class for simulation modules, providing a weak reference to the world. - Established `stellar_rules.gd` for managing stellar evolution and destruction mechanics. - Introduced `universe_environment.gd` to calculate environmental parameters based on the current state of the universe.
This commit is contained in:
+11
-11
@@ -28,10 +28,10 @@ func run() -> void:
|
||||
world.state.stats.total_amount["C0.0"] = 3.0
|
||||
var before: Dictionary = world.state.duplicate(true)
|
||||
stage._refresh_universe_ui()
|
||||
var counts: Dictionary = world.get_item_amounts()
|
||||
var counts: Dictionary = world.presentation.amounts(world.state, world.catalog)
|
||||
check(counts.EON1 == 12.0 and counts.EON2 == 4.0 and counts.LP == 16.0, "Individual eons and their total include bound planets")
|
||||
check(counts["C0.0"] == 3.0 and counts.C0 == 3.0 and counts.Planet == 19.0, "Civilization detail does not double the planetary total")
|
||||
check(world.get_item_amounts(true).EON1 == 12.0 and world.get_item_amounts(true).LP == 16.0, "Historical counts retain individual and aggregate values")
|
||||
check(world.presentation.amounts(world.state, world.catalog, true).EON1 == 12.0 and world.presentation.amounts(world.state, world.catalog, true).LP == 16.0, "Historical counts retain individual and aggregate values")
|
||||
check(world.state == before, "Presentation does not modify simulation state")
|
||||
var pending: Array = ["EON1", "EON2", "EON3", "C0.0"]
|
||||
var pending_before: Array = pending.duplicate()
|
||||
@@ -40,16 +40,16 @@ func run() -> void:
|
||||
for id in ["EON1", "EON2", "LP", "C0.0", "C0"]:
|
||||
check(decision.visible.has(id), "Unlock projection includes detail and alias: " + id)
|
||||
check(pending == pending_before and world.state == before, "Unlock evaluation leaves inputs untouched")
|
||||
var snapshot: Dictionary = world.items_to_update.duplicate()
|
||||
world.defer_item_updates = true
|
||||
var snapshot: Dictionary = world.presentation.pending_amounts.duplicate()
|
||||
world.presentation.deferred_updates = true
|
||||
world.state.amount.EON1 += 1.0
|
||||
world.refresh_item_amounts()
|
||||
check(world.item_amounts_dirty and world.items_to_update == snapshot, "Deferred refresh retains pending snapshot")
|
||||
world.refresh_item_amounts(true)
|
||||
check(not world.item_amounts_dirty and world.items_to_update.EON1 == 13.0, "Forced refresh publishes latest amounts")
|
||||
world.presentation.refresh(world.state, world.catalog)
|
||||
check(world.presentation.dirty and world.presentation.pending_amounts == snapshot, "Deferred refresh retains pending snapshot")
|
||||
world.presentation.refresh(world.state, world.catalog, true)
|
||||
check(not world.presentation.dirty and world.presentation.pending_amounts.EON1 == 13.0, "Forced refresh publishes latest amounts")
|
||||
world.state.amount.EON1 -= 1.0
|
||||
world.defer_item_updates = false
|
||||
world.refresh_item_amounts()
|
||||
world.presentation.deferred_updates = false
|
||||
world.presentation.refresh(world.state, world.catalog)
|
||||
for id in ["EON1", "EON2", "LP", "C0.0", "C0"]:
|
||||
check(stage.owniverse_items[id].visible, "Unlock both levels: " + id)
|
||||
check(stage.owniverse_items[id].description.text != "", "Populate the icon counter: " + id)
|
||||
@@ -61,7 +61,7 @@ func run() -> void:
|
||||
world.state.binds.RD.EON2 = 0.0
|
||||
stage._refresh_universe_ui()
|
||||
check(stage.owniverse_items.EON2.visible and stage.owniverse_items.EON2.description.text == "", "Previously reached stage stays unlocked after extinction with no stale count")
|
||||
for entity in world.entities.values(): entity.free()
|
||||
for entity in world.catalog.entities.values(): entity.free()
|
||||
world.free()
|
||||
scene.free()
|
||||
print("Life icons: %d checks, %d failures" % [checks, failures])
|
||||
|
||||
Reference in New Issue
Block a user