circle-exclamation
STILL WORKING ON DOCS

keyboardModular Input System

This system makes sure that all relevant player inputs — especially custom/mod keys — reach the interacted object every frame during holds. No need to hardcode specific keys in core scripts; everything is forwarded dynamically.

Core Concept

  • All actions starting with CustomI_ (from your Input Action Asset) are automatically tracked.

  • Button-type actions that are pressed are collected into a priority stack (_activeInputStack).

    • First pressed key → index 0 (highest priority)

    • Later pressed keys → added to the end

    • Released keys → removed from the stack

  • Value-type actions (like mouse delta CustomI_MouseVector2) are read fresh every frame.

  • During any hold interaction (OnHoldUpdate), the full current state is bundled into InteractionPacket.Inputs.

This means the object always knows:

  • Which custom keys are currently held

  • In which order they were pressed (useful for combos or priority)

  • Current mouse movement delta

  • Any analog values if you added them

Input Forwarding Table (Common Cases)

Input Name

Type

Typical Purpose during Hold

How the object reads it in OnInteract

Sent every frame?

CustomI_Interact

Button

Main hold/carry button (usually E)

Usually not read directly — controls hold lifecycle tags (OnHoldStart/Update/Released)

No (lifecycle only)

CustomI_MouseRightClick

Button

Enter rotation / alt mode

packet.Inputs.Any(x => x.KeyName == "CustomI_MouseRightClick")

Yes

CustomI_MouseVector2

Value

Mouse delta for rotation / aiming

var mouse = packet.Inputs.Find(x => x.KeyName == "CustomI_MouseVector2"); Vector2 delta = mouse.VectorValue;

Yes

CustomI_Deneme

Button

Throw / quick action (example binding: Q)

packet.Inputs.Any(i => i.KeyName == "CustomI_Deneme") → instant throw or special behavior

Yes

CustomI_Cum / mod keys

Button

Easter eggs, mode switches, glow, sound…

packet.Inputs.Any(x => x.KeyName == "CustomI_YourKeyName")

Yes

CustomI_AnalogTrigger

Value

Future: pressure-sensitive hold strength

float strength = packet.Inputs.Find(x => x.KeyName == "CustomI_AnalogTrigger")?.FloatValue ?? 0f;

Yes (if added)

Practical Example: Reading Inputs in OnHoldUpdate

Why the Priority Stack Exists

  • Lets objects implement input priority or combo detection if desired Example: First Q → throw light / Second Q (while still holding E) → throw hard

  • Prevents spamming / conflicting actions — oldest input usually wins

  • Debug overlay shows the current stack order (yellow = top priority)

Quick Summary – What Gets Sent

  • Every OnHoldUpdate packet contains the full current state

  • Buttons → only if currently pressed (with press order)

  • Mouse delta → fresh Vector2 every frame

  • No performance hit — list is usually 2–6 items max

This design keeps the system extremely mod-friendly: Add a new CustomI_SuperJump key in Input Actions → every holdable object can immediately react to it without touching PlayerInteraction.cs.

Last updated