Rethink item ammo to item consumables, start item type datatype
This commit is contained in:
+11
-9
@@ -45,7 +45,7 @@ handleEvent e = case eventPayload e of
|
||||
MouseMotionEvent mmev -> return . handleMouseMotionEvent mmev
|
||||
MouseButtonEvent mbev -> return . handleMouseButtonEvent mbev
|
||||
MouseWheelEvent mwev -> return . handleMouseWheelEvent mwev
|
||||
WindowSizeChangedEvent sev -> return . handleResizeEvent sev
|
||||
WindowSizeChangedEvent sev -> handleResizeEvent sev
|
||||
WindowMovedEvent mev -> return . handleWindowMoveEvent mev
|
||||
_ -> return . Just
|
||||
|
||||
@@ -74,8 +74,10 @@ handleWindowMoveEvent mev u = Just $ u
|
||||
P (V2 x y) = windowMovedEventPosition mev
|
||||
|
||||
{- | Resets the world window size, and resizes the fbo that gets the light map drawn into it. -}
|
||||
handleResizeEvent :: WindowSizeChangedEventData -> Universe -> Maybe Universe
|
||||
handleResizeEvent sev u = Just $ u
|
||||
-- using a sideeffect here for the io change seems to work better, more testing
|
||||
-- later may be a good idea
|
||||
handleResizeEvent :: WindowSizeChangedEventData -> Universe -> IO (Maybe Universe)
|
||||
handleResizeEvent sev u = return . Just $ u
|
||||
& config . windowX .~ fromIntegral x
|
||||
& config . windowY .~ fromIntegral y
|
||||
& uvWorld . sideEffects %~ sideEffectUpdatePreload divRes x y
|
||||
@@ -83,7 +85,7 @@ handleResizeEvent sev u = Just $ u
|
||||
x = fromIntegral x'
|
||||
y = fromIntegral y'
|
||||
V2 x' y' = windowSizeChangedEventSize sev
|
||||
divRes = u ^. config . resolution_factor
|
||||
divRes = resFactorNum $ u ^. config . resolution_factor
|
||||
|
||||
handlePressedMouseButton :: MouseButton -> Universe -> Maybe Universe
|
||||
handlePressedMouseButton but w
|
||||
@@ -123,14 +125,14 @@ wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
|
||||
invKeyDown = ScancodeCapsLock `S.member` _keys w
|
||||
|
||||
moveYourAmmoSel :: Int -> World -> World
|
||||
moveYourAmmoSel i w = case yourItem w ^? wpAmmo . aoType. amPjParams of
|
||||
moveYourAmmoSel i w = case yourItem w ^? itConsumption . aoType. amPjParams of
|
||||
Just l -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
|
||||
. wpAmmo . aoType. amParamSel %~ (`mod` length l) . subtract i
|
||||
. itConsumption . aoType. amParamSel %~ (`mod` length l) . subtract i
|
||||
_ -> w
|
||||
moveYourAmmoParam :: Int -> World -> World
|
||||
moveYourAmmoParam i w = case yourItem w ^? wpAmmo . aoType. amPjParams . ix paramid . pjMaxParam of
|
||||
moveYourAmmoParam i w = case yourItem w ^? itConsumption . aoType. amPjParams . ix paramid . pjMaxParam of
|
||||
Just n -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
|
||||
. wpAmmo . aoType. amPjParams . ix paramid . pjIntParam %~ (`mod` n) . (+ i)
|
||||
. itConsumption . aoType. amPjParams . ix paramid . pjIntParam %~ (`mod` n) . (+ i)
|
||||
_ -> w
|
||||
where
|
||||
paramid = _amParamSel $ _aoType $ _wpAmmo $ yourItem w
|
||||
paramid = _amParamSel $ _aoType $ _itConsumption $ yourItem w
|
||||
|
||||
Reference in New Issue
Block a user