class
Rosegold::ManualControl
- Rosegold::ManualControl
- Reference
- Object
Overview
Transport-independent owner of gameplay input. While granted, a bounded snapshot stream from an outside controller drives the native physics and interaction paths and scripted gameplay writes are ignored. Revoking clears only the owner's input and completes the release on the next real PLAY tick.
Defined in:
rosegold/control/manual_control.crConstant Summary
-
MAX_LOOK_DELTA_DEGREES =
90.0_f32 -
MAX_TAPS =
4 -
RELEASE_WAIT =
1.second
Constructors
Instance Method Summary
-
#after_tick : Nil
A release completes only after a whole tick that began after the revoke.
- #before_tick : Nil
-
#bind_host(host : Host) : Nil
Binds host, first revoking any grant that belongs to a different host.
- #bound_host?(host : Host) : Bool
-
#clear(grant_id : UInt64) : Bool
Discards pending frames and one-shots and neutralizes held input now, keeping the grant and its sequence.
- #client : Client
-
#debug_until_returned : Symbol
Grants control and suspends only the calling fiber until the controller returns it.
-
#enforce_physics : Nil
Re-asserts the controller's movement state at the start of physics so keys a script obtained earlier cannot change it between interactions and physics.
-
#grant : UInt64 | Nil
Starts a grant and returns its id, or the live one if already granted.
-
#grant_id : UInt64 | Nil
Identity of the live grant; nil unless the controller currently owns input.
- #granted? : Bool
- #host_available? : Bool
- #host_enabled_or_unbound? : Bool
-
#ice_road? : Bool
Whether native ticks hold forward, sprint and jump after a cardinal snap.
-
#owns_input? : Bool
Whether the controller owns gameplay input or is still being released.
- #releasing? : Bool
-
#reset(reason : Reason = Reason::SessionChanged) : Nil
The single packet-free lifecycle transition for a world or connection change: no release tick can follow.
-
#return_to_script(grant_id : UInt64) : Bool
The controller's Return to script action.
-
#revoke(reason : Reason = Reason::Revoked, only_grant : UInt64 | Nil = nil) : Bool
Ends the grant.
-
#script_authority(operation : String) : UInt64 | Nil
Like
#script_write_allowed?, but returns a token for a write that yields or queues before it reaches the wire; check it with#script_authority?. -
#script_authority?(authority : UInt64) : Bool
Whether no grant or session reset happened since authority was taken and none owns input now.
-
#script_write_allowed?(operation : String) : Bool
Whether a scripted gameplay write may proceed.
-
#submit(grant_id : UInt64, sequence : UInt64, input : Input, deadline : Time::Instant | Nil = nil) : Bool
Queues input for the next tick.
-
#unbind_host(host : Host) : Nil
Detaches host; if it was the bound host, ends any grant as disabled.
-
#unresolved_inventory? : Bool
Whether the cursor holds a stack or the host reports unresolved inventory work.
Constructor Detail
Instance Method Detail
Binds host, first revoking any grant that belongs to a different host.
Discards pending frames and one-shots and neutralizes held input now, keeping the grant and its sequence.
Grants control and suspends only the calling fiber until the controller
returns it. Raises Cancelled when the grant ends any other way.
Re-asserts the controller's movement state at the start of physics so keys a script obtained earlier cannot change it between interactions and physics.
Starts a grant and returns its id, or the live one if already granted. Never waits: returns nil while a previous grant's release tick is outstanding, when the bound host is disabled, or when a cleanup callback revoked the new grant before it returned.
Identity of the live grant; nil unless the controller currently owns input.
The single packet-free lifecycle transition for a world or connection change: no release tick can follow. Samples unresolved inventory before clearing, then ends the debug waiter and any takeover exactly once.
Ends the grant. Held input is cleared at once; the release packets go out on the next real PLAY tick, and scripted writes stay gated until then. Returns false when nothing was granted or only_grant is stale.
Like #script_write_allowed?, but returns a token for a write that yields or
queues before it reaches the wire; check it with #script_authority?.
Whether no grant or session reset happened since authority was taken and none owns input now.
Whether a scripted gameplay write may proceed. A grant blocks it. A pending
release makes it wait up to RELEASE_WAIT for the release tick, except on
the packet reader or ticker, which never wait. A grant or session reset
during the wait refuses the write, even if the grant is released again.
Queues input for the next tick. Rejects a stale grant or sequence. When deadline passes before the tick that would use the frame, the held input is neutralized instead.
Detaches host; if it was the bound host, ends any grant as disabled.
Whether the cursor holds a stack or the host reports unresolved inventory work.