Remove creature hammer, may have broken equipment/combining
This commit is contained in:
@@ -3,7 +3,7 @@ module Dodge.Creature.Impulse.UseItem (
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
--import Control.Monad
|
||||
import Data.Maybe
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.DoubleTree
|
||||
@@ -36,10 +36,10 @@ useSelectedItem crid w = (worldEventFlags . at InventoryChange ?~ ()) . fromMayb
|
||||
heldEffect (bimap _iatType fst3 usedloc) cr w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
RemoteDetonatorSF -> do
|
||||
guard (_crHammerPosition cr == HammerUp)
|
||||
return $ activateDetonator usedloc w
|
||||
& pointerToItem itm . itUse . heldHammer .~ HammerDown
|
||||
_ | isJust $ itm ^? itUse . uequipEffect -> do
|
||||
guard (_crHammerPosition cr == HammerUp)
|
||||
-- guard (_crHammerPosition cr == HammerUp)
|
||||
invid' <- itm ^? itLocation . ilInvID
|
||||
return $ toggleEquipmentAt invid' cr w
|
||||
_ -> Nothing
|
||||
|
||||
@@ -123,8 +123,8 @@ poisonSPic = over _1 $ overColSH (mixColors 0.5 0.5 green . normalizeColor)
|
||||
internalCreatureUpdate :: Creature -> World -> World
|
||||
internalCreatureUpdate cr =
|
||||
cWorld . lWorld . creatures . ix (_crID cr)
|
||||
%~ ( (crHammerPosition %~ moveHammerUp)
|
||||
. updateMovement
|
||||
%~ ( --(crHammerPosition %~ moveHammerUp).
|
||||
updateMovement
|
||||
)
|
||||
|
||||
{- | Drop items according to the creature state.
|
||||
|
||||
@@ -2,7 +2,6 @@ module Dodge.Creature.YourControl (
|
||||
yourControl,
|
||||
) where
|
||||
|
||||
import NewInt
|
||||
import Control.Monad
|
||||
import Data.Foldable
|
||||
import qualified Data.Map.Strict as M
|
||||
@@ -20,35 +19,34 @@ import Dodge.Item.Grammar
|
||||
import Dodge.WASD
|
||||
import Geometry
|
||||
import LensHelp
|
||||
import NewInt
|
||||
import qualified SDL
|
||||
|
||||
-- | The AI equivalent for your control.
|
||||
yourControl :: Creature -> World -> World
|
||||
yourControl _ w
|
||||
| inTextInputFocus w = w
|
||||
| not intopinv =
|
||||
w & cWorld . lWorld . creatures . ix 0 %~ wasdWithAiming w
|
||||
| otherwise =
|
||||
| Just NoSubInventory{} <- w ^? hud . hudElement . subInventory =
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix 0
|
||||
%~ (wasdWithAiming w . mouseActionsCr (w ^. input . mouseButtons))
|
||||
%~ (wasdWithAiming w . mouseActionsCr pkeys)
|
||||
& pressedMBEffectsTopInventory pkeys
|
||||
& handleHotkeys
|
||||
| otherwise =
|
||||
w & cWorld . lWorld . creatures . ix 0 %~ wasdWithAiming w
|
||||
where
|
||||
pkeys = w ^. input . mouseButtons
|
||||
intopinv = fromMaybe False $ do
|
||||
subinv <- w ^? hud . hudElement . subInventory
|
||||
Just $ case subinv of
|
||||
NoSubInventory{} -> True
|
||||
_ -> False
|
||||
|
||||
handleHotkeys :: World -> World
|
||||
handleHotkeys w
|
||||
| SDL.ScancodeLShift `M.member` _pressedKeys (_input w)
|
||||
|| SDL.ScancodeRShift `M.member` _pressedKeys (_input w) =
|
||||
foldl' tryAssignHotkey w allHotkeys
|
||||
| otherwise = foldl' useHotkey w
|
||||
(M.intersection thehotkeys (M.filter (== InitialPress) (w ^. input . pressedKeys)))
|
||||
| otherwise =
|
||||
foldl'
|
||||
useHotkey
|
||||
w
|
||||
(M.intersection thehotkeys (M.filter (== InitialPress) (w ^. input . pressedKeys)))
|
||||
where
|
||||
thehotkeys = M.mapKeys hotkeyToScancode $ w ^. cWorld . lWorld . hotkeys
|
||||
|
||||
@@ -176,12 +174,13 @@ mouseActionsCr pkeys
|
||||
pressedMBEffectsTopInventory :: M.Map SDL.MouseButton Int -> World -> World
|
||||
pressedMBEffectsTopInventory pkeys w
|
||||
| Just ltime <- pkeys ^? ix SDL.ButtonLeft
|
||||
, Just rtime <- pkeys ^? ix SDL.ButtonRight
|
||||
, ltime <= rtime && inTopInv
|
||||
= youhammerdown $ useSelectedItem 0 w
|
||||
, Just rtime <- pkeys ^? ix SDL.ButtonRight
|
||||
, ltime <= rtime && inTopInv =
|
||||
--youhammerdown $
|
||||
useSelectedItem 0 w
|
||||
| otherwise = w
|
||||
where
|
||||
youhammerdown = set (cWorld . lWorld . creatures . ix 0 . crHammerPosition) HammerDown
|
||||
-- youhammerdown = set (cWorld . lWorld . creatures . ix 0 . crHammerPosition) HammerDown
|
||||
inTopInv = case w ^. hud . hudElement of
|
||||
DisplayInventory{_subInventory = NoSubInventory{}} -> True
|
||||
_ -> False
|
||||
|
||||
Reference in New Issue
Block a user