Allow for equipment items to set a minimum view distance

This commit is contained in:
2022-06-05 01:50:18 +01:00
parent 5e144b1cd5
commit 65fcea0f50
13 changed files with 76 additions and 61 deletions
+3 -3
View File
@@ -73,8 +73,8 @@ toggleEquipmentAt rbops invid cr w = case rbops ^? opAllocateEquipment of
crpoint = creatures . ix (_crID cr)
itmat i = _crInv cr IM.! i
itm = itmat (_crInvSel cr)
onequip itm' = (_eqOnEquip . _itUse) itm' itm'
onremove itm' = (_eqOnRemove . _itUse) itm' itm'
onequip itm' = (_eqOnEquip . _eqEq . _itUse) itm' itm'
onremove itm' = (_eqOnRemove . _eqEq . _itUse) itm' itm'
useLeftItem :: Int -> World -> World
useLeftItem cid w
@@ -88,7 +88,7 @@ useLeftItem cid w
where
cr = _creatures w IM.! cid
itmShouldBeUsed = isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . cUse)
|| ( isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . eqUse)
|| ( isJust (cr ^? crInv . ix (_crInvSel cr) . itUse . eqEq . eqUse)
&& _crLeftInvSel cr /= Just (_crInvSel cr)
)
-- TODO determine itmShouldBeUsed with reference to config options
+1 -1
View File
@@ -200,7 +200,7 @@ useUpdate = (useHammer . hammerPosition %~ moveHammerUp)
. (useDelay . rateTime %~ decreaseToZero)
useEquipment :: Creature -> Int -> World -> World
useEquipment cr i = _eqUse (_itUse itm) itm cr
useEquipment cr i = _eqUse (_eqEq $ _itUse itm) itm cr
where
itm = _crInv cr IM.! i
-- a map updating all inventory items
+1 -3
View File
@@ -54,9 +54,7 @@ wasdWithAiming w speed cr
isReloading = _posture (_crStance cr) == Reloading
mouseDir = case cr ^? crInv . ix (_crInvSel cr) . itScope . scopePos of
Just _ -> argV $ mouseWorldPos w -.- _crPos cr
-- Just p -> normalizeAngle $ argV
-- $ p +.+ 2 / _cameraZoom w *.* rotateV (_cameraRot w) (_mousePos w)
_ -> normalizeAngle $ argV (_mousePos w) + _cameraRot w
_ -> argV (_mousePos w) + _cameraRot w
wasdM :: SDL.Scancode -> Point2
wasdM scancode = case scancode of