Add life rules and implement tests for civilization and life states

- Introduced a new file `life_rules.txt` to define life progression and degradation rules.
- Created `test_civilization_state.gd` to validate the functionality of civilization rules and ethics.
- Added `test_life.gd` to test life evolution, including initialization, batch processing, and state validation.
- Implemented `civilization_state.gd` to manage civilization ethics and space civilization detachment logic.
- Ensured all tests check for expected outcomes and validate state integrity after operations.
This commit is contained in:
Kirill
2026-09-15 23:05:05 +03:00
parent cc2700d507
commit 5f3875bc14
16 changed files with 673 additions and 25 deletions
+7
View File
@@ -19,6 +19,8 @@ var Locale = "en"
var OwniverseEntities: Dictionary = {}
var OwniverseItems: Dictionary = {}
var Templates: Dictionary = {}
var LifeRules: Dictionary = {}
var CivilizationRules: Dictionary = {}
var batch_count: float = 40.0 # must be even not odd
@@ -67,6 +69,11 @@ func format_number(value: float, digits: int = 0) -> String:
func _ready() -> void:
for row: Dictionary in _read_from_csv("res://data/civilization_rules.txt").values():
if not CivilizationRules.has(row.stage):
CivilizationRules[row.stage] = {"home": row.home, "span": float(row.span), "stars": float(row.stars), "ethics": {}}
CivilizationRules[row.stage].ethics[row.ethic] = row
LifeRules = _read_from_csv("res://data/life_rules.txt")
OwniverseEntities = _read_from_csv("res://data/owniverse_entities.txt")
OwniverseItems = _read_from_csv("res://data/owniverse_items.txt")