Merge commit 'd2581afd26d1976cdfe4f44c89df49a772524d1e' into HEAD
This commit is contained in:
@@ -10,7 +10,9 @@ static func describe(instance: Variant) -> Dictionary:
|
||||
if not ids.has(id):
|
||||
ids.append(id)
|
||||
ids.sort_custom(func(a: StringName, b: StringName) -> bool: return String(a) < String(b))
|
||||
return {&"operation": int(instance.operation_state), &"people": ids,
|
||||
return {&"state": int(instance.state), &"state_name": FacilityInstance.State.keys()[instance.state],
|
||||
&"reasons": instance.state_reasons.duplicate(),
|
||||
&"operation": int(instance.operation_state), &"people": ids,
|
||||
&"count": ids.size(), &"limit": int(instance.customer_capacity),
|
||||
&"staff": instance.active_staff_ids.duplicate(), &"suspension": StringName(instance.suspension_reason)}
|
||||
|
||||
@@ -50,3 +52,52 @@ static func label(data: Dictionary, visible_count: int) -> String:
|
||||
if count > visible_count:
|
||||
value += "(他%d人)" % (count - visible_count)
|
||||
return value
|
||||
|
||||
|
||||
static func business_label(data: Dictionary) -> String:
|
||||
if data.is_empty():
|
||||
return ""
|
||||
if int(data[&"operation"]) == FacilityInstance.OperationState.SUSPENDED:
|
||||
return "休止・摘発" if data[&"suspension"] == &"RAIDED" else "休止・破壊"
|
||||
match int(data[&"state"]):
|
||||
FacilityInstance.State.BROKEN: return "破損"
|
||||
FacilityInstance.State.NO_ACCESS: return "通路なし"
|
||||
FacilityInstance.State.NO_POWER: return "魔力なし"
|
||||
FacilityInstance.State.NO_STAFF: return "職員不足"
|
||||
FacilityInstance.State.CLOSED: return "営業停止"
|
||||
FacilityInstance.State.DEGRADED: return "低下運転"
|
||||
FacilityInstance.State.OPEN: return "営業中"
|
||||
return String(data[&"state_name"])
|
||||
|
||||
|
||||
static func queue_label(count: int, overflow: int) -> String:
|
||||
return "待ち%d人" % count + ("(他%d人)" % overflow if overflow > 0 else "")
|
||||
|
||||
|
||||
static func elevator_label(shaft: Dictionary) -> String:
|
||||
var count := (shaft[&"boarded"] as Array).size()
|
||||
var capacity := int(shaft[&"capacity"])
|
||||
var value := "%d/%d人" % [count, capacity]
|
||||
if capacity > 0 and count >= capacity:
|
||||
value = "満員 " + value
|
||||
if not bool(shaft[&"operational"]):
|
||||
value = "停止 " + value
|
||||
else:
|
||||
value = "運転 " + value
|
||||
var phase := String(shaft.get(&"phase", &"IDLE"))
|
||||
var doors_open := bool(shaft[&"operational"]) and phase in ["IDLE", "BOARDING", "ALIGHTING"]
|
||||
return value + (" 開 " if doors_open else " 閉 ") + phase
|
||||
|
||||
|
||||
static func supply_label(requests: Array[Dictionary]) -> String:
|
||||
# These are requests, never invented stock quantities. Preserve actual states.
|
||||
var states: Dictionary = {}
|
||||
for request: Dictionary in requests:
|
||||
var state := String(request[&"state"])
|
||||
states[state] = int(states.get(state, 0)) + 1
|
||||
var names: Array = states.keys()
|
||||
names.sort()
|
||||
var parts: PackedStringArray = []
|
||||
for state: String in names:
|
||||
parts.append("%s:%d" % [state, states[state]])
|
||||
return "物資依頼 " + " / ".join(parts)
|
||||
|
||||
Reference in New Issue
Block a user