Unify key press and mouse button press timings

Both now use Ints for presses.
Still no release timer for keyboard events.
This commit is contained in:
2025-07-28 23:16:05 +01:00
parent ea35753744
commit 81f88c32e9
15 changed files with 52 additions and 58 deletions
+7 -7
View File
@@ -15,13 +15,13 @@ import Dodge.Item.Grammar
import Dodge.Item.Location
import qualified IntMapHelp as IM
useItem :: Int -> PressType -> World -> Maybe World
useItem :: Int -> Int -> World -> Maybe World
useItem invid pt w = fmap (worldEventFlags . at InventoryChange ?~ ()) $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
itmloc <- invIndents (_crInv cr) ^? ix invid . _2
useItemLoc cr itmloc pt w
useItemLoc :: Creature -> LocationDT OItem -> PressType -> World -> Maybe World
useItemLoc :: Creature -> LocationDT OItem -> Int -> World -> Maybe World
useItemLoc cr loc pt w
| aimuse
, fromMaybe False $ loc ^? locDT . dtValue . _1 . itLocation . ilIsAttached
@@ -30,19 +30,19 @@ useItemLoc cr loc pt w
| GadgetPlatformSF <- sf =
return $ gadgetEffect pt loc cr w
| RemoteDetonatorSF <- sf
, pt == InitialPress =
, pt == 0 =
return $ activateDetonator ldt w
| ITEMSCAN <- itm ^. itType
, pt == InitialPress =
, pt == 0 =
return $ toggleExamineInv w
| MAPPER <- itm ^. itType
, pt == InitialPress =
, pt == 0 =
return $ toggleMapperInv itm w
| Just b <- itm ^? itUse . useToggle
, pt == InitialPress =
, pt == 0 =
return $ w & pointerToItem itm . itUse . useToggle .~ not b
| isJust $ itm ^? itType . ibtEquip
, pt == InitialPress
, pt == 0
, Just invid' <- itm ^? itLocation . ilInvID =
return $ toggleEquipmentAt invid' cr w
| otherwise = (\loc' -> useItemLoc cr loc' pt w) =<< locUp' loc