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:
Kirill
2026-09-29 20:23:20 +03:00
parent da03ba11c0
commit f2111a376a
42 changed files with 1681 additions and 1704 deletions
+38
View File
@@ -0,0 +1,38 @@
extends SceneTree
var checks: int = 0
var failures: int = 0
func _initialize() -> void:
call_deferred("run")
func check(condition: bool, message: String) -> void:
checks += 1
if not condition:
failures += 1
push_error(message)
func run() -> void:
var World = load("res://world/owniverse/owniverse.gd")
var first = World.new()
var second = World.new()
var names: Array = ["batches", "ledger", "production", "automatic", "stellar", "life", "environment", "evolution"]
var references: Array = []
for name in names:
check(first.get(name) != second.get(name), "World has its own " + name)
check(first.get(name).world == first, "Module refers to its owner: " + name)
references.append(weakref(first.get(name)))
first.state.amount.H = 123.0
first.presentation.pending_amounts.H = 123.0
check(not second.state.amount.has("H") and second.presentation.pending_amounts.is_empty(), "State and pending presentation are isolated")
first.free()
for reference in references:
check(reference.get_ref() == null, "Module is released with its world")
check(second.evolution.world == second, "Other world remains usable")
var snapshot: Dictionary = second.state.duplicate(true)
second.evolute(NAN)
second.evolute(-1.0)
check(second.state == snapshot, "Entry point rejects invalid time deltas")
second.free()
print("Module lifecycle: %d checks, %d failures" % [checks, failures])
quit(1 if failures else 0)