Eight tickets. The last one is the interesting one. #166 - PLAINER DIALOG. Every spoken line rewritten: the nine prologue lines and all twenty quest brief/done pairs. Mostly splitting em-dash subclauses into sentences and dropping the literary register ("hulls" -> "ships", "That is our hands back" -> "That frees us for other work"). Same meaning, same voice. #167 - NOTHING ANNOUNCED TWICE. Quests carry an `important` flag; seven of the twenty have it, and they are the search for the World Ship. A quest handed out with its goal ALREADY met is now credited in silence unless it is one of those - no brief, no answer, both signals still fired and the index still moved, so it appears ticked in the objectives panel. The chain used to stop the game to set a task the player had already done, then stop it again to congratulate them on it. #168 - THE KEYBOARD CAN ANSWER A DIALOG. The rule the ticket asks for (still arriving, show it all; already whole, move on) was already the rule for a click since #149, but a key press reached the banner and did nothing - and this game is played with WASD and a mouse. Touch, click and key now go through one door. Modifiers alone and auto-repeat echoes are not presses. #169 - A LOADING SCREEN. A press raises a cover, and the load happens after it has been on screen for a frame, so the wait is something the player is watching. Deliberately still a blocking load: load_threaded_request() comes back FAILED for these scenes, reporting text-parse errors that load() does not produce, because the global class names and preloads they reach each other through are not resolvable off the loading thread. A progress bar is not worth a menu that sometimes refuses to start the game, and the web build ships with thread support off anyway. Further presses while loading are ignored - on the web a button fires on PRESS, so an impatient double tap costs nothing to make and used to build the world twice. #170 - THE PICTURE BEFORE THE CAPTION. The prologue's first line was up before the scene had finished arriving, so the game opened STOPPED (#128) over a convoy nobody had seen yet. It flies for three seconds first. #171 - THE CONTROLS FOLLOW WHAT IS BEING HELD. is_touchscreen_available() asks whether a touch COULD arrive, and in a browser that is yes on any laptop whose panel reports touch support - so the web build put thumb sticks over a screen being played with a mouse, and switched mouse aiming off on the machine it exists for. The reading is now the last input actually used, it lives in GameState so the sticks and the guns cannot disagree, and it is two-way: nothing can strand a tablet, because the gesture that needs the controls is the gesture that brings them back. A touch suppresses mouse evidence for a second, so the click Godot manufactures out of a tap is not mistaken for a mouse. #172 - AIM AT A PLACE. Every gun was handed the same direction, so a fleet firing at something threw a sheet of parallel bolts past either side of it and only the middle hull could hit - worse the wider the formation. Guns now take a POINT and each hull works out its own heading to it, so the fleet's fire converges. The mouse already had a place and was flattening it into a bearing; a pushed stick names the point at the guns' reach along it, so touch loses nothing. The assist (#89) still bends a shot onto an enemy, now per hull and around that hull's own heading. The aim guide stops at the point and marks it. #173 - AND THE ONE THAT EXPLAINS ITSELF. "In the web export version the fleet can not store any resources" is not a web bug. It is the third time the Godot editor's .tres writer has quietly dropped a property it thought was default-valued: InterceptorVesselDefinition losing `capabilities` leaves cargo_capacity at 20 and takes away the "cargo" claim that fleet_cargo_capacity() actually gates on, so the hold is zero and nothing can be mined or carried. That is the symptom, word for word. test_definitions_intact caught it in the suite. What it could not do is catch it in a BUILD - an export is taken from the working tree at whatever moment the editor last touched it, which is exactly when the damage is done and exactly where nobody is running tests. The checks move to core/CatalogCheck.gd and now run at startup in every build as well as in the test, from the same function. On the web push_error lands in the on-page log web_shell.html mirrors, which is the only error a phone can read. The tree is intact today, so a fresh export should restore the hold. The point of the change is that the next time it is not, the build says so. Full suite green at 154/154. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139MmxRAJSUe1j77kftAWv3
145 lines
5.5 KiB
GDScript
145 lines
5.5 KiB
GDScript
extends SceneTree
|
|
|
|
# Headless test: run with
|
|
# godot --headless -s res://tests/test_desktop_hides_touch_controls.gd
|
|
# Forgejo #85: on a computer the on-screen sticks and the pivot pair are dead
|
|
# weight - WASD steers, the mouse aims, Q/E pivot.
|
|
# Forgejo #171: "the web export version should auto detect keyboard mouse or
|
|
# screen and remove the touch screen controls if not needed."
|
|
#
|
|
# #85 asked DisplayServer.is_touchscreen_available() and, if it said yes, kept
|
|
# the controls for ever. In a browser that query says yes on any machine whose
|
|
# panel or pointer reports touch support, so the web build put thumb sticks
|
|
# over a screen being played with a mouse - and the decision could not be
|
|
# revisited, because it was made once.
|
|
#
|
|
# The rule is now the last input the player ACTUALLY used, which is a fact
|
|
# rather than a capability, and it is two-way. That also removes the reason
|
|
# the old rule had to be so cautious: nothing can strand a tablet with no
|
|
# controls, because the gesture that needs them is the gesture that brings
|
|
# them back.
|
|
#
|
|
# Covers:
|
|
# A. they all start visible, so this is testing a change and not a default
|
|
# B. a keyboard takes all four away, together
|
|
# C. a touch brings all four back, together - on any device, whatever the
|
|
# display claims
|
|
# D. a mouse takes them away again, so the detection is not one-shot
|
|
# E. the manufactured event is not believed: Godot makes a mouse click out
|
|
# of every touch, and one arriving straight after a touch must not read
|
|
# as "this player has a mouse"
|
|
# F. the two consumers agree - the same reading gates mouse aiming, so the
|
|
# sticks and the guns can never disagree about what is being held
|
|
|
|
const CONTROLS: Array = ["UI/Joystick", "UI/FireStick", "UI/PivotCWButton", "UI/PivotCCWButton"]
|
|
|
|
var game_state: Node
|
|
var main: Node
|
|
var controller: Node
|
|
var mouse: Node
|
|
var stage: int = 0
|
|
var elapsed: float = 0.0
|
|
|
|
|
|
func _initialize() -> void:
|
|
game_state = root.get_node("GameState")
|
|
game_state.reset_progression()
|
|
main = load("res://world/Main.tscn").instantiate()
|
|
root.add_child(main)
|
|
current_scene = main
|
|
controller = main.get_node("GameController") if main.has_node("GameController") else main
|
|
mouse = main.get_node_or_null("MouseCombatController")
|
|
|
|
|
|
func _all_visible() -> bool:
|
|
for path in CONTROLS:
|
|
if not main.get_node(path).visible:
|
|
return false
|
|
return true
|
|
|
|
|
|
func _any_visible() -> bool:
|
|
for path in CONTROLS:
|
|
if main.get_node(path).visible:
|
|
return true
|
|
return false
|
|
|
|
|
|
# A touch far enough in the past that the grace window has expired. Ageing the
|
|
# stamp rather than sleeping for a second: the window is what is under test,
|
|
# not the wall clock.
|
|
func _forget_touch() -> void:
|
|
game_state.last_touch_msec = -1
|
|
|
|
|
|
func _process(delta: float) -> bool:
|
|
elapsed += delta
|
|
if stage != 0:
|
|
return false
|
|
if elapsed < 0.3:
|
|
return false
|
|
stage = 1
|
|
|
|
# --- A. everything starts on --------------------------------------
|
|
if not _all_visible():
|
|
return _fail("a touch control was already hidden before any input")
|
|
print("all four touch controls start visible")
|
|
|
|
# --- B. a keyboard takes them away --------------------------------
|
|
_forget_touch()
|
|
controller._note_keyboard()
|
|
if _any_visible():
|
|
return _fail("using a keyboard left a touch control on screen")
|
|
if game_state.pointer_is_touch:
|
|
return _fail("a keyboard did not change the reading to \"not touch\"")
|
|
print("using a keyboard hides all four together")
|
|
|
|
# --- C. and a touch brings them back ------------------------------
|
|
# The case the old one-shot rule could not do at all, and the reason the
|
|
# new rule is safe to apply on every platform rather than only where the
|
|
# display says there is no touchscreen.
|
|
controller._note_touch()
|
|
if not _all_visible():
|
|
return _fail("touching the screen did not bring the touch controls back")
|
|
if not game_state.pointer_is_touch:
|
|
return _fail("a touch did not change the reading to \"touch\"")
|
|
print("a touch brings all four back")
|
|
|
|
# --- E. the manufactured click is not believed --------------------
|
|
# Godot turns every touch into a click (emulate_mouse_from_touch), so the
|
|
# click below is what a phone produces one frame after the touch above.
|
|
# Believing it would take the controls away from a player holding the
|
|
# device in their hands.
|
|
controller._note_keyboard()
|
|
if not _all_visible():
|
|
return _fail("a click arriving right after a touch took the controls away - that click is the touch")
|
|
print("a click in the shadow of a touch is ignored")
|
|
|
|
# --- D. a real mouse, later, does take them away ------------------
|
|
_forget_touch()
|
|
controller._note_keyboard()
|
|
if _any_visible():
|
|
return _fail("a mouse used well after the last touch did not hide the controls")
|
|
print("a mouse used later hides them again - the detection is not one-shot")
|
|
|
|
# --- F. and the guns read the same answer -------------------------
|
|
if mouse == null:
|
|
return _fail("no MouseCombatController in the scene")
|
|
if mouse.pointer_mode != mouse.PointerMode.AUTO:
|
|
return _fail("the scene ships with an overridden pointer mode, so what a real device does is not what was tested")
|
|
if not mouse.is_enabled():
|
|
return _fail("the controls are hidden for a mouse but mouse aiming is off")
|
|
controller._note_touch()
|
|
if mouse.is_enabled():
|
|
return _fail("a touch put the thumb controls back but left mouse firing armed - a tap would fire the guns")
|
|
print("mouse aiming follows the same reading the controls do")
|
|
|
|
print("TEST_DESKTOP_HIDES_TOUCH_CONTROLS: PASS")
|
|
quit(0)
|
|
return true
|
|
|
|
|
|
func _fail(message: String) -> bool:
|
|
print("TEST_DESKTOP_HIDES_TOUCH_CONTROLS: FAIL (%s)" % message)
|
|
quit(1)
|
|
return true
|