P07-01-WX: 仕上がった天候の機能の受入:自然天候・雨・嵐・世界樹と成人客のマナ霧・上部の表示と予報・保存と移行(マナ炉の産出 120 を除く。P07-01 の補助の作業。原単位への加算 0)
This commit is contained in:
@@ -26,15 +26,23 @@ func _run() -> void:
|
||||
var straight := fixtures.new_fixture()
|
||||
var straight_runtime: Variant = straight[&"runtime"]
|
||||
var held_guest: Variant = straight_runtime.guest_service.get_guest(Fixture.HELD_GUEST)
|
||||
var held := {"hold": {}, "reason": &""}
|
||||
fixtures.play(straight, Fixture.FIRST_MINUTE, Fixture.LAST_MINUTE, func(_minute: int) -> void:
|
||||
var held := {"hold": {}, "reason": &"", "after": {}}
|
||||
fixtures.play(straight, Fixture.FIRST_MINUTE, Fixture.LAST_MINUTE, func(minute: int) -> void:
|
||||
if (held["hold"] as Dictionary).is_empty():
|
||||
held["hold"] = straight_runtime.weather.get_rain_hold(Fixture.HELD_GUEST)
|
||||
if StringName(held["reason"]).is_empty():
|
||||
held["reason"] = held_guest.exit_reason)
|
||||
held["reason"] = held_guest.exit_reason
|
||||
if minute == 363:
|
||||
_expect(straight_runtime.guest_service.get_guest(Fixture.HELD_GUEST) != null and held_guest.state == GuestRuntime.State.LEAVING
|
||||
and straight_runtime.weather.get_rain_hold(Fixture.HELD_GUEST) == Fixture.HOLD, "at 06:03 the held guest is still present and leaving with its hold")
|
||||
if minute == 364:
|
||||
_expect(straight_runtime.guest_service.get_guest(Fixture.HELD_GUEST) == null and straight_runtime.weather.get_rain_holds().is_empty(),
|
||||
"at 06:04 the held guest is gone and its hold left with it")
|
||||
if minute - 1 in Fixture.SAVE_MINUTES:
|
||||
held["after"][minute] = fixtures.state_bytes(straight_runtime))
|
||||
# The hold only moves the planned exit; every other current rule still applies,
|
||||
# so in this world without facilities the guest leaves for lack of one.
|
||||
_expect(held["hold"] == {"original_exit": 362, "extended_to": 602} and held_guest.planned_exit_at == 602 and held["reason"] == &"NO_SUITABLE_FACILITY",
|
||||
_expect(held["hold"] == Fixture.HOLD and held_guest.planned_exit_at == 602 and held["reason"] == &"NO_SUITABLE_FACILITY",
|
||||
"the guest due at 06:02 was held to 10:02 and still left by the current rules (%s)" % String(held["reason"]))
|
||||
_expect(straight[&"draws"][&"count"] == Fixture.DRAW_MINUTES.size() and straight_runtime.weather.get_last_draw_day() == 1, "the uninterrupted script draws day 1 once")
|
||||
var saving := fixtures.new_fixture()
|
||||
@@ -43,16 +51,39 @@ func _run() -> void:
|
||||
var saved_paths := {}
|
||||
fixtures.play(saving, Fixture.FIRST_MINUTE, Fixture.LAST_MINUTE, func(minute: int) -> void:
|
||||
if minute in Fixture.SAVE_MINUTES:
|
||||
if minute == 363:
|
||||
_expect(saving_runtime.guest_service.get_guest(Fixture.HELD_GUEST) != null and saving_runtime.weather.get_rain_holds() == {String(Fixture.HELD_GUEST): Fixture.HOLD}
|
||||
and saving_runtime.guest_service.get_guest(Fixture.HELD_GUEST).planned_exit_at == 602, "minute 363 saves the hold of the present held guest")
|
||||
if minute == 364:
|
||||
_expect(saving_runtime.guest_service.get_guest(Fixture.HELD_GUEST) == null and saving_runtime.weather.get_rain_holds().is_empty(), "minute 364 saves just after the held guest left, without its hold")
|
||||
if minute == 500:
|
||||
var held_present: bool = saving_runtime.guest_service.get_guest(Fixture.HELD_GUEST) != null
|
||||
_expect(saving_runtime.weather.get_kind() == &"rain" and (not held_present or not saving_runtime.weather.get_rain_hold(Fixture.HELD_GUEST).is_empty()), "minute 500 saves mid-rain with the hold of a present guest")
|
||||
_expect(saving_runtime.weather.get_kind() == &"rain", "minute 500 saves mid-rain")
|
||||
var path := Fixture.WRITER_SAVE % minute
|
||||
saved_states[minute] = fixtures.state_bytes(saving_runtime)
|
||||
_expect(bool(saving_runtime.save_to_path(path).get(&"ok", false)), "save file at minute %d" % minute)
|
||||
saved_paths[minute] = path)
|
||||
_expect(fixtures.state_bytes(saving_runtime) == fixtures.state_bytes(straight_runtime), "writing the save files leaves the weather state as without saving")
|
||||
var saves := _packages(Fixture.SAVE_MINUTES, saved_paths, saved_states, Fixture.WRITER_SAVE)
|
||||
var final_state := fixtures.state_bytes(straight_runtime)
|
||||
for minute: int in Fixture.SAVE_MINUTES:
|
||||
var reload := fixtures.new_fixture(false)
|
||||
var reload_runtime: Variant = reload[&"runtime"]
|
||||
_expect(bool(reload_runtime.load_from_path(str(saved_paths.get(minute, Fixture.WRITER_SAVE % minute))).get(&"ok", false))
|
||||
and fixtures.state_bytes(reload_runtime) == saved_states.get(minute, PackedByteArray()) and reload[&"clock"].absolute_minute == minute,
|
||||
"this process reloads the save file of minute %d exactly" % minute)
|
||||
if minute == 363:
|
||||
_expect(reload_runtime.weather.get_rain_holds() == {String(Fixture.HELD_GUEST): Fixture.HOLD} and reload_runtime.guest_service.get_guest(Fixture.HELD_GUEST).planned_exit_at == 602,
|
||||
"the reloaded minute 363 save keeps the one hold and the extended plan")
|
||||
fixtures.play(reload, minute, minute + 1, Callable())
|
||||
_expect(fixtures.state_bytes(reload_runtime) == held["after"].get(minute + 1, PackedByteArray()),
|
||||
"one minute after the minute %d reload equals the uninterrupted run (no second extension)" % minute)
|
||||
fixtures.play(reload, minute + 1, Fixture.LAST_MINUTE, Callable())
|
||||
_expect(fixtures.state_bytes(reload_runtime) == final_state, "the minute %d reload continues to the uninterrupted final state" % minute)
|
||||
fixtures.free_fixture(reload)
|
||||
var saves := _packages(Fixture.SAVE_MINUTES, saved_paths, saved_states, Fixture.WRITER_SAVE)
|
||||
var after := {}
|
||||
for minute: int in held["after"]:
|
||||
var bytes: PackedByteArray = held["after"][minute]
|
||||
after[str(minute)] = {"sha256": Fixture.sha256(bytes), "base64": Marshalls.raw_to_base64(bytes)}
|
||||
var fog := _fog_scene(fixtures)
|
||||
var handoff := {
|
||||
"schema": Fixture.HANDOFF_SCHEMA,
|
||||
@@ -62,6 +93,7 @@ func _run() -> void:
|
||||
"last_minute": Fixture.LAST_MINUTE,
|
||||
"straight_final_state_sha256": Fixture.sha256(final_state),
|
||||
"straight_final_state_base64": Marshalls.raw_to_base64(final_state),
|
||||
"after_states": after,
|
||||
"saves": saves,
|
||||
"fog": fog,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user