Add business pricing and closure controls with compatible digest optimization

This commit is contained in:
Takeshi
2026-09-09 12:04:12 +09:00
parent 071e338e82
commit b3b82ef03e
35 changed files with 2203 additions and 59 deletions
+35
View File
@@ -666,6 +666,41 @@ func enter_queue(
return {&"ok": true, &"patience_remaining": guest.patience_remaining}
## Closure asks the guest to choose again, without charging a patience penalty.
## The callback releases the owning facility request and inventory reservations.
func release_queue_for_replanning(
guest_id: StringName,
absolute_minute: int,
release_callback: Callable = Callable()
) -> Dictionary:
if _external_mutation_blocked:
return _error_result("Guest mutation is blocked while committed notifications are delivered.")
var guest := get_guest(guest_id)
if guest == null or guest.state != GuestRuntimeType.State.QUEUING:
return _error_result("Guest is not in a queue.")
if not _transition_is_available(guest, GuestRuntimeType.State.DECIDING, absolute_minute):
return _error_result("Guest cannot atomically replan the queue in this tick.")
var facility_id := guest.target_facility_id
var request_id := guest.queue_request_id
if facility_id.is_empty() or request_id.is_empty():
return _error_result("Queued guest is missing a facility or request.")
if release_callback.is_valid():
var external_result: Variant = release_callback.call(guest_id, facility_id, request_id)
if not _callback_succeeded(external_result):
return _error_result("Facility queue removal failed; guest state was not changed.")
guest.target_facility_id = &""
guest.queue_request_id = &""
guest.path_handle = null
_apply_transition(guest, GuestRuntimeType.State.DECIDING, absolute_minute, &"FACILITY_CLOSED")
last_error = ""
return {
&"ok": true,
&"facility_id": facility_id,
&"request_id": request_id,
&"patience_remaining": guest.patience_remaining,
}
func tick_queue_patience(
guest_id: StringName,
absolute_minute: int,