tracker: sticky selection and Ctrl+Home walk-to; walltones: conventional volume
Tracker selection now survives a rescan. The scan is rebuilt every turn and both lists are distance-sorted, so holding a bare index meant one step by the player silently re-pointed the selection at a different rat. The tracker now remembers identity instead -- the actor table for creatures, coordinates for tiles -- and re-derives the indices in reanchor() after each rescan. Selection is dropped only when the thing genuinely stops being reported (out of FoV, killed, picked up), and the existing clamp then falls back to the nearest. Ctrl+Home walks to the selection, reusing the exact shape of the game's own click-to-path in ingame.mousepressed: calculatePathFromPlayer, then either bufferInput or playerInput for a one-step path. Interruptions and threatened- player truncation therefore behave the way a mouse click does. Most things worth tracking stand on impassable tiles, which calculatePathFromPlayer refuses outright, so we fall back to the cheapest of the 8 neighbours and say "next to" rather than "to". Guarded on states.getCurrent() == "ingame": elsewhere the input buffer belongs to another state and feeding it moves would be a bug. Wall tones now follow the usual proximity convention -- a near wall is loud, one out at radius is quiet. It was inverted, which read backwards in play since a nearby wall is the more urgent fact. config.louderWhenFurther still flips it. Testbed covers both: selection identity across a forced rescan, and that Ctrl+Home moves the player without breaking out of the map. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
6380998376
commit
81a209b600
+10
-14
@@ -15,9 +15,9 @@
|
||||
--
|
||||
-- i.e. 0.4 world units per tile, listener floating 4 units above the map plane.
|
||||
--
|
||||
-- If we simply placed each tone at its wall's real position, OpenAL would
|
||||
-- attenuate it by distance -- so a far wall would be QUIETER. That directly
|
||||
-- fights the requested behaviour (far wall = louder). It would also be feeble
|
||||
-- If we simply placed each tone at its wall's real position, OpenAL's own
|
||||
-- attenuation curve would decide the volume for us -- unpredictable, and tied to
|
||||
-- whatever distance model the game happens to set. It would also be feeble
|
||||
-- directionally: with the listener 4 units up and a wall 5 tiles out (2.0 units),
|
||||
-- the vertical offset dominates and the pan collapses toward centre.
|
||||
--
|
||||
@@ -46,17 +46,12 @@ local config = {
|
||||
-- constant attenuation, not the perceived direction.
|
||||
sourceRadius = 1.0,
|
||||
|
||||
-- Volume at the near and far ends of the range.
|
||||
nearVolume = 0.25,
|
||||
farVolume = 1.0,
|
||||
-- Volume for a wall you are standing next to, and for one out at `radius`.
|
||||
nearVolume = 1.0,
|
||||
farVolume = 0.25,
|
||||
|
||||
-- As requested: a wall further away is LOUDER.
|
||||
--
|
||||
-- Flagging this because it inverts the usual convention -- most proximity cues
|
||||
-- get louder as you approach, and a nearby wall is the more urgent fact. If it
|
||||
-- reads backwards in play, set this to false and near walls become the loud
|
||||
-- ones; nothing else needs to change.
|
||||
louderWhenFurther = true,
|
||||
-- Set true to invert: a wall further away becomes the louder one.
|
||||
louderWhenFurther = false,
|
||||
}
|
||||
|
||||
walltones.config = config
|
||||
@@ -134,10 +129,11 @@ local function volumeFor(distance)
|
||||
local t = (distance - 1) / math.max(1, config.radius - 1)
|
||||
t = math.max(0, math.min(1, t))
|
||||
|
||||
if not config.louderWhenFurther then
|
||||
if config.louderWhenFurther then
|
||||
t = 1 - t
|
||||
end
|
||||
|
||||
-- t is now 0 at the loud end, 1 at the quiet end.
|
||||
return config.nearVolume + (config.farVolume - config.nearVolume) * t
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user