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:
@@ -269,6 +269,12 @@ func add_stress(amount: int) -> int:
|
||||
return stress
|
||||
|
||||
|
||||
func get_effective_daily_wage() -> int:
|
||||
# Preserve historical stored wages for exact save round trips; UNIQUE
|
||||
# characters accrue no new upkeep under original section 6.1.
|
||||
return 0 if employment_kind == EmploymentKind.UNIQUE else daily_wage
|
||||
|
||||
|
||||
func get_employment_kind_name() -> StringName:
|
||||
return StringName(EmploymentKind.keys()[employment_kind])
|
||||
|
||||
|
||||
@@ -50,6 +50,16 @@ var _item_releaser := Callable()
|
||||
var _travel_estimator := Callable()
|
||||
var _external_task_driver := Callable()
|
||||
var _attendance_driver := Callable()
|
||||
var _arrival_driver := Callable()
|
||||
|
||||
# Optional scheduler policy: zero delegates work progression to Runtime.
|
||||
var _work_progress_driver: Callable
|
||||
func configure_work_progress_driver(driver: Callable) -> void:
|
||||
_work_progress_driver = driver
|
||||
|
||||
|
||||
func configure_arrival_driver(driver: Callable) -> void:
|
||||
_arrival_driver = driver
|
||||
|
||||
|
||||
func configure_callbacks(
|
||||
@@ -170,7 +180,7 @@ func get_daily_payroll_rows() -> Array[Dictionary]:
|
||||
rows.append({
|
||||
&"staff_id": staff.staff_id,
|
||||
&"employment_kind": staff.get_employment_kind_name(),
|
||||
&"daily_wage": staff.daily_wage,
|
||||
&"daily_wage": staff.get_effective_daily_wage(),
|
||||
})
|
||||
return rows
|
||||
|
||||
@@ -193,7 +203,7 @@ func get_payroll_obligations() -> Array[Dictionary]:
|
||||
&"staff_id": staff_id,
|
||||
&"payroll_status": &"ACTIVE",
|
||||
&"employment_kind": staff.get_employment_kind_name(),
|
||||
&"daily_wage": staff.daily_wage,
|
||||
&"daily_wage": staff.get_effective_daily_wage(),
|
||||
&"unpaid_wages": staff.unpaid_wages,
|
||||
}
|
||||
for staff_id: StringName in _sorted_keys(_departed_payroll):
|
||||
@@ -730,6 +740,8 @@ func begin_task(task_id: StringName, absolute_minute: int = -1) -> CommandResult
|
||||
return _conflict("Task cannot begin from its current state.")
|
||||
if staff.state not in [StaffRuntimeType.State.MOVING_TO_TASK, StaffRuntimeType.State.AVAILABLE]:
|
||||
return _conflict("Staff cannot begin the reserved Task from its current state.")
|
||||
if _arrival_driver.is_valid() and not bool(_arrival_driver.call(task, staff, minute)):
|
||||
return _conflict("Task arrival was redirected or is no longer valid.")
|
||||
# Both state preconditions are checked before either side is mutated.
|
||||
var task_state_before: StaffTask.State = task.state
|
||||
var task_changed_at_before := task.state_changed_at
|
||||
@@ -829,7 +841,11 @@ func _advance_assigned_tasks(absolute_minute: int) -> Array[Dictionary]:
|
||||
StaffTaskType.State.WORKING:
|
||||
if is_externally_driven_task(task_id):
|
||||
continue
|
||||
var progress_result := progress_task(task.task_id, 1, absolute_minute)
|
||||
var units := 1
|
||||
if _work_progress_driver.is_valid():
|
||||
units = int(_work_progress_driver.call(task.task_id))
|
||||
if units <= 0: continue
|
||||
var progress_result := progress_task(task.task_id, units, absolute_minute)
|
||||
if progress_result.is_success():
|
||||
actions.append({
|
||||
&"task_id": task.task_id,
|
||||
@@ -878,6 +894,8 @@ func remove_staff(
|
||||
var staff := get_staff(staff_id)
|
||||
if staff == null:
|
||||
return _not_found("Staff", staff_id)
|
||||
if staff.employment_kind == StaffRuntimeType.EmploymentKind.UNIQUE:
|
||||
return _conflict("Unique Staff cannot be dismissed, sold or permanently removed.")
|
||||
if is_externally_driven_task(staff.current_task_id):
|
||||
return _conflict("Finish the employee external operation before removal.")
|
||||
var minute := current_minute if absolute_minute < 0 else absolute_minute
|
||||
@@ -921,6 +939,8 @@ func retire_staff(staff_id: StringName, absolute_minute: int = -1) -> CommandRes
|
||||
var staff := get_staff(staff_id)
|
||||
if staff == null:
|
||||
return _not_found("Staff", staff_id)
|
||||
if staff.employment_kind == StaffRuntimeType.EmploymentKind.UNIQUE:
|
||||
return _conflict("Unique Staff cannot be dismissed, sold or permanently removed.")
|
||||
if is_externally_driven_task(staff.current_task_id):
|
||||
return _conflict("Finish the employee external operation before retirement.")
|
||||
staff.is_retiring = true
|
||||
@@ -1409,7 +1429,8 @@ func _update_shift_states(absolute_minute: int, only_staff: StringName = &"", re
|
||||
staff.shift_id = &""
|
||||
if staff.assigned_facility_id == shift.assigned_facility_id:
|
||||
staff.assigned_facility_id = &""
|
||||
staff.transition_to(StaffRuntimeType.State.OFF_DUTY, &"SHIFT_ENDED", absolute_minute)
|
||||
if staff.can_take_shift():
|
||||
staff.transition_to(StaffRuntimeType.State.OFF_DUTY, &"SHIFT_ENDED", absolute_minute)
|
||||
shift.close(absolute_minute)
|
||||
shift_state_changed.emit(staff.staff_id, shift.shift_instance_id, staff.state)
|
||||
shift = null
|
||||
@@ -1550,7 +1571,7 @@ func _build_payroll_preview(day: int) -> Dictionary:
|
||||
# Daily close covers [0, day * 1440). A hire exactly on the end
|
||||
# boundary belongs to the next close; carried debt remains due now.
|
||||
var newly_accrued := (
|
||||
staff.daily_wage if staff.employment_effective_minute < period_end else 0
|
||||
staff.get_effective_daily_wage() if staff.employment_effective_minute < period_end else 0
|
||||
)
|
||||
if (
|
||||
prior < 0
|
||||
|
||||
@@ -20,6 +20,7 @@ var task_type: StringName = &""
|
||||
var priority := 0
|
||||
var created_at := 0
|
||||
var deadline_at := -1
|
||||
var rescue_facility_id: StringName = &""
|
||||
var target_entity_id: StringName = &""
|
||||
var target_cell := Vector3i.ZERO
|
||||
var required_role_tags: Array[StringName] = []
|
||||
@@ -53,6 +54,7 @@ func configure(
|
||||
priority = clampi(p_priority, 0, MAX_PRIORITY)
|
||||
created_at = maxi(p_created_at, 0)
|
||||
deadline_at = int(_value(options, &"deadline_at", -1))
|
||||
rescue_facility_id = StringName(_value(options, &"rescue_facility_id", &""))
|
||||
target_entity_id = StringName(_value(options, &"target_entity_id", &""))
|
||||
target_cell = _vector3i(_value(options, &"target_cell", Vector3i.ZERO))
|
||||
required_role_tags = _sorted_unique_names(_value(options, &"required_role_tags", []))
|
||||
@@ -224,6 +226,7 @@ func create_snapshot() -> Dictionary:
|
||||
&"priority": priority,
|
||||
&"created_at": created_at,
|
||||
&"deadline_at": deadline_at,
|
||||
&"rescue_facility_id": String(rescue_facility_id),
|
||||
&"target_entity_id": String(target_entity_id),
|
||||
&"target_cell": [target_cell.x, target_cell.y, target_cell.z],
|
||||
&"required_role_tags": _names_to_strings(required_role_tags),
|
||||
@@ -258,6 +261,7 @@ static func from_snapshot(snapshot: Dictionary) -> StaffTask:
|
||||
int(snapshot.get(&"created_at", 0)),
|
||||
{
|
||||
&"deadline_at": snapshot.get(&"deadline_at", -1),
|
||||
&"rescue_facility_id": snapshot.get(&"rescue_facility_id", ""),
|
||||
&"target_entity_id": snapshot.get(&"target_entity_id", ""),
|
||||
&"target_cell": snapshot.get(&"target_cell", []),
|
||||
&"required_role_tags": snapshot.get(&"required_role_tags", []),
|
||||
@@ -283,7 +287,8 @@ static func from_snapshot(snapshot: Dictionary) -> StaffTask:
|
||||
|
||||
static func _snapshot_shape_is_valid(snapshot: Dictionary) -> bool:
|
||||
return (
|
||||
not String(snapshot.get(&"task_id", "")).is_empty()
|
||||
(snapshot.get(&"rescue_facility_id", "") is String or snapshot.get(&"rescue_facility_id", "") is StringName)
|
||||
and not String(snapshot.get(&"task_id", "")).is_empty()
|
||||
and not String(snapshot.get(&"task_type", "")).is_empty()
|
||||
and snapshot.get(&"target_cell", null) is Array
|
||||
and snapshot.get(&"required_role_tags", null) is Array
|
||||
|
||||
Reference in New Issue
Block a user