ludic/packages/ludic.aim/use.ludic
Orkuncakilkaya 19fcf60599 wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
  1804 vars into 126 states, 64 into lets; 23498 edits in 460 files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 15:31:34 +03:00

15 lines
799 B
Text

# use.ludic - the thing the use key should act on. The ray comes first and proximity is its fallback,
# never its override:
# under the crosshair and in reach -> that, whatever else is nearer
# under the crosshair and too far -> NOTHING (the prompt says why), within AIM_USE_MAX
# nothing of that kind aimed at -> the nearest thing in reach
# A player looking at something who presses the key has said which thing they mean.
export const AIM_USE_THIS: int = 0
export const AIM_USE_NOTHING: int = 1
export const AIM_USE_NEAREST: int = 2
export function aim_use(aim_st: AimState, kind: int) -> int {
if aim_st.am_kind == kind and aim_st.am_reach { return AIM_USE_THIS }
if aim_st.am_kind == kind and aim_st.am_dist < AIM_USE_MAX { return AIM_USE_NOTHING }
return AIM_USE_NEAREST
}