Record original-alignment implementation and traceability checkpoint
Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
This commit is contained in:
@@ -51,12 +51,16 @@ var _excavated: Dictionary = {}
|
||||
var _support_capacity: Dictionary = {}
|
||||
var _support_anchors: Dictionary = {}
|
||||
var _dirty_cells: Dictionary = {}
|
||||
var _snapshot_geometry: Dictionary = {}
|
||||
var _snapshot_geometry_revision := -1
|
||||
|
||||
|
||||
func reset(bounds: Variant) -> bool:
|
||||
var normalized := _normalize_bounds(bounds)
|
||||
if normalized.is_empty():
|
||||
return false
|
||||
_snapshot_geometry.clear()
|
||||
_snapshot_geometry_revision = -1
|
||||
_bounds = normalized
|
||||
_occupants.clear()
|
||||
_entity_cells.clear()
|
||||
@@ -298,11 +302,15 @@ func is_support_anchor(cell: Vector3i) -> bool:
|
||||
|
||||
## Validates connected structural components touched by the proposed cells.
|
||||
## Existing structural occupant kinds contribute their configured capacity/load.
|
||||
func validate_support(cells: Array, weight_per_cell := 1) -> Dictionary:
|
||||
func validate_support(cells: Array, weight_per_cell := 1, entity_weights: Dictionary = {}) -> Dictionary:
|
||||
var base_report := _validate_cells(cells)
|
||||
var errors: Array[StringName] = base_report[&"errors"].duplicate()
|
||||
if weight_per_cell <= 0:
|
||||
_add_error(errors, ERROR_INVALID_WEIGHT)
|
||||
# Optional definition weights are read-only and apply to existing occupants.
|
||||
for id: Variant in entity_weights:
|
||||
if typeof(id) not in [TYPE_STRING, TYPE_STRING_NAME] or not _entity_cells.has(id) or typeof(entity_weights[id]) != TYPE_INT or int(entity_weights[id]) <= 0:
|
||||
_add_error(errors, ERROR_INVALID_WEIGHT)
|
||||
var proposed: Array[Vector3i] = base_report[&"valid_cells"].duplicate()
|
||||
proposed.sort_custom(_cell_less)
|
||||
var result := {
|
||||
@@ -325,7 +333,7 @@ func validate_support(cells: Array, weight_per_cell := 1) -> Dictionary:
|
||||
structural_set[cell] = true
|
||||
for entity_id: StringName in _sorted_entity_ids():
|
||||
var kind: StringName = _entity_kinds[entity_id]
|
||||
if _kind_support_capacity(kind) <= 0 and _kind_weight(kind) <= 0 and not _kind_is_anchor(kind):
|
||||
if _kind_support_capacity(kind) <= 0 and int(entity_weights.get(entity_id, _kind_weight(kind))) <= 0 and not _kind_is_anchor(kind):
|
||||
continue
|
||||
for occupied_cell: Vector3i in _entity_cells[entity_id]:
|
||||
structural_set[occupied_cell] = true
|
||||
@@ -351,7 +359,7 @@ func validate_support(cells: Array, weight_per_cell := 1) -> Dictionary:
|
||||
component_proposed.append(component_cell)
|
||||
required += weight_per_cell
|
||||
if _occupants.has(component_cell) and not proposed_set.has(component_cell):
|
||||
required += _kind_weight(get_occupant_kind(component_cell))
|
||||
required += int(entity_weights.get(get_occupant(component_cell), _kind_weight(get_occupant_kind(component_cell))))
|
||||
capacity += get_support_capacity(component_cell)
|
||||
anchored = anchored or is_support_anchor(component_cell)
|
||||
component_proposed.sort_custom(_cell_less)
|
||||
@@ -393,6 +401,22 @@ func consume_dirty_cells() -> Array[Vector3i]:
|
||||
|
||||
|
||||
func create_snapshot() -> Dictionary:
|
||||
# Geometry only changes through world mutations. Dirty-cell consumption and
|
||||
# public revision counters are sampled separately on every read.
|
||||
if _snapshot_geometry_revision != revision or _snapshot_geometry.is_empty():
|
||||
_snapshot_geometry = _create_geometry_snapshot()
|
||||
_snapshot_geometry_revision = revision
|
||||
var snapshot := _snapshot_geometry.duplicate(true)
|
||||
snapshot[&"dirty_cells"] = get_dirty_cells()
|
||||
snapshot[&"revisions"] = {
|
||||
&"world": revision, &"occupancy": occupancy_revision,
|
||||
&"walkability": walkability_revision, &"excavation": excavation_revision,
|
||||
&"support": support_revision,
|
||||
}
|
||||
return snapshot
|
||||
|
||||
|
||||
func _create_geometry_snapshot() -> Dictionary:
|
||||
var occupancies: Array[Dictionary] = []
|
||||
for entity_id: StringName in _sorted_entity_ids():
|
||||
occupancies.append({
|
||||
@@ -426,14 +450,6 @@ func create_snapshot() -> Dictionary:
|
||||
&"walkable_cells": _sorted_dictionary_cells(_walkable),
|
||||
&"excavation_overrides": excavation_overrides,
|
||||
&"support": support_entries,
|
||||
&"dirty_cells": get_dirty_cells(),
|
||||
&"revisions": {
|
||||
&"world": revision,
|
||||
&"occupancy": occupancy_revision,
|
||||
&"walkability": walkability_revision,
|
||||
&"excavation": excavation_revision,
|
||||
&"support": support_revision,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -548,6 +564,8 @@ func restore_snapshot(snapshot: Dictionary) -> bool:
|
||||
):
|
||||
return false
|
||||
|
||||
_snapshot_geometry.clear()
|
||||
_snapshot_geometry_revision = -1
|
||||
_bounds = new_bounds
|
||||
_occupants = new_occupants
|
||||
_entity_cells = new_entity_cells
|
||||
|
||||
Reference in New Issue
Block a user