Cleanup
This commit is contained in:
@@ -27,8 +27,6 @@ import Dodge.Default
|
||||
import Dodge.FloatFunction
|
||||
import Dodge.FloorItem
|
||||
import Dodge.Inventory
|
||||
import Dodge.ItEffect
|
||||
--import Dodge.Inventory.Add
|
||||
import Dodge.Path
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.WallCreatureCollisions
|
||||
|
||||
@@ -24,7 +24,6 @@ import Dodge.Data.DoubleTree
|
||||
import Dodge.Data.World
|
||||
import Dodge.DoubleTree
|
||||
import Dodge.Euse
|
||||
import Dodge.ItEffect
|
||||
import Dodge.Item.Grammar
|
||||
import Dodge.Item.HeldOffset
|
||||
import Dodge.Prop.Gib
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
module Dodge.Data.Item (
|
||||
module Dodge.Data.Item,
|
||||
module Dodge.Data.Item.Effect,
|
||||
--module Dodge.Data.Item.Effect,
|
||||
module Dodge.Data.Item.Misc,
|
||||
module Dodge.Data.Item.Params,
|
||||
module Dodge.Data.Item.Use,
|
||||
@@ -18,7 +18,7 @@ import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Item.Combine
|
||||
import Dodge.Data.Item.Effect
|
||||
--import Dodge.Data.Item.Effect
|
||||
import Dodge.Data.Item.Location
|
||||
import Dodge.Data.Item.Misc
|
||||
import Dodge.Data.Item.Params
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Item.Effect (
|
||||
module Dodge.Data.Item.Effect,
|
||||
module Dodge.Data.BlBl,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.BlBl
|
||||
|
||||
data ItEffect = ItEffect
|
||||
{ _ieInv :: ItInvEffect --Item -> Creature -> World -> World
|
||||
, _ieOnInsert :: ItInvEffect
|
||||
, _ieOnDrop :: ItInvEffect --Item -> Creature -> World -> World
|
||||
}
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data ItInvEffect
|
||||
= NoInvEffect
|
||||
| EffectRootNotroot ItInvEffect ItInvEffect
|
||||
| CreateShieldWall
|
||||
| RemoveShieldWall
|
||||
| EffectWhileRoot ItInvEffect
|
||||
| EffectWhileAttached ItInvEffect
|
||||
| ItemUseToggle BlBl
|
||||
| ItemCancelExamineInventory
|
||||
| ItemCopierUpdate
|
||||
| ItemReduceWarmTime
|
||||
| ItemSetWarmTime Int
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data ItDropEffect = NoDropEffect
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
makeLenses ''ItEffect
|
||||
deriveJSON defaultOptions ''ItInvEffect
|
||||
deriveJSON defaultOptions ''ItDropEffect
|
||||
deriveJSON defaultOptions ''ItEffect
|
||||
@@ -55,7 +55,5 @@ data AmmoParams
|
||||
makeLenses ''ItemUse
|
||||
makeLenses ''AttachParams
|
||||
makeLenses ''AmmoParams
|
||||
--makeLenses ''UseFocus
|
||||
--deriveJSON defaultOptions ''AmmoParams
|
||||
deriveJSON defaultOptions ''AttachParams
|
||||
deriveJSON defaultOptions ''ItemUse
|
||||
|
||||
@@ -24,11 +24,3 @@ defaultHeldItem =
|
||||
|
||||
defaultCraftItem :: Item
|
||||
defaultCraftItem = defaultHeldItem & itUse .~ UseNothing
|
||||
|
||||
defaultItEffect :: ItEffect
|
||||
defaultItEffect =
|
||||
ItEffect
|
||||
{ _ieInv = NoInvEffect
|
||||
, _ieOnInsert = NoInvEffect
|
||||
, _ieOnDrop = NoInvEffect
|
||||
}
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
|
||||
module Dodge.ItEffect (
|
||||
doInvEffect,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.BlBl
|
||||
import Dodge.Data.World
|
||||
import Dodge.Euse
|
||||
import Dodge.Inventory.Path
|
||||
import Dodge.Inventory.SelectionList
|
||||
import Dodge.Item.Location
|
||||
|
||||
doInvEffect :: ItInvEffect -> Item -> Creature -> World -> World
|
||||
doInvEffect = \case
|
||||
NoInvEffect -> const $ const id
|
||||
EffectRootNotroot f g -> rootNotrootEff f g
|
||||
CreateShieldWall -> createShieldWall
|
||||
RemoveShieldWall -> removeShieldWall
|
||||
EffectWhileRoot f -> rootNotrootEff f NoInvEffect
|
||||
EffectWhileAttached f -> effectWhileAttached f
|
||||
ItemUseToggle f -> \itm _ ->
|
||||
pointerToItemID (itm ^. itID) . itUse . useToggle %~ doBlBl f
|
||||
ItemCancelExamineInventory -> \_ _ -> cancelExamineInventory
|
||||
ItemCopierUpdate -> copierItemUpdate
|
||||
--ItemReduceWarmTime -> \itm _ -> pointerToItem itm . itUse . heldDelay . warmTime
|
||||
ItemReduceWarmTime -> \itm _ -> pointerToItem itm . itParams . wTime
|
||||
%~ (max 0 . subtract 1)
|
||||
-- use of pointerToItemID rather than pointerToItem because the item
|
||||
-- location is changing
|
||||
--ItemSetWarmTime x -> \itm _ -> pointerToItemID (_itID itm) . itUse . heldDelay . warmTime
|
||||
ItemSetWarmTime x -> \itm _ -> pointerToItemID (_itID itm) . itParams . wTime
|
||||
.~ x
|
||||
|
||||
copierItemUpdate :: Item -> Creature -> World -> World
|
||||
copierItemUpdate itm cr w = fromMaybe w $ do
|
||||
x <- itm ^? itScroll . itsInt
|
||||
invid <- itm ^? itLocation . ilInvID
|
||||
ip <- itm ^? itType . ibtPathing
|
||||
i <- getInventoryPath x ip invid cr
|
||||
itm' <- cr ^? crInv . ix i
|
||||
v <- getItemValue itm' w cr
|
||||
return $ w & pointerToItem itm . itUse . uValue .~ v
|
||||
|
||||
cancelExamineInventory :: World -> World
|
||||
cancelExamineInventory = hud . hudElement . subInventory %~ f
|
||||
where
|
||||
f ExamineInventory = NoSubInventory
|
||||
f x = x
|
||||
|
||||
rootNotrootEff :: ItInvEffect -> ItInvEffect -> Item -> Creature -> World -> World
|
||||
rootNotrootEff f g it
|
||||
| it ^? itLocation . ilIsRoot == Just True = doInvEffect f it
|
||||
| otherwise = doInvEffect g it
|
||||
|
||||
effectWhileAttached :: ItInvEffect -> Item -> Creature -> World -> World
|
||||
effectWhileAttached f it
|
||||
| it ^? itLocation . ilIsAttached == Just True = doInvEffect f it
|
||||
| otherwise = const id
|
||||
|
||||
--timeScrollEffect :: Item -> Creature -> World -> World
|
||||
--timeScrollEffect itm _ w = w & timeFlow .~ ScrollTimeFlow
|
||||
-- { _scrollSmoothing = 0
|
||||
-- , _reverseAmount = itm ^?! itUse . leftConsumption . wpCharge
|
||||
-- , _futureWorlds = []
|
||||
-- }
|
||||
|
||||
--setItemCharge :: Int -> Item -> Creature -> World -> World
|
||||
--setItemCharge i itm cr w =
|
||||
-- w & ptrWpCharge %~ const i
|
||||
-- where
|
||||
-- invid = _ilInvID $ _itLocation itm
|
||||
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||
--
|
||||
--chargeIfInInventory :: Item -> Creature -> World -> World
|
||||
--chargeIfInInventory itm cr w =
|
||||
-- w & ptrWpCharge %~ (min maxcharge . (+ 1))
|
||||
-- where
|
||||
-- invid = _ilInvID $ _itLocation itm
|
||||
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||
-- maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
|
||||
--
|
||||
--chargeIfEquipped :: Item -> Creature -> World -> World
|
||||
--chargeIfEquipped itm cr w
|
||||
-- | invid `IM.member` (w ^. cWorld . lWorld . imHotkeys) = w &
|
||||
-- ptrWpCharge %~ (min maxcharge . (+ 1))
|
||||
-- | otherwise = w & ptrWpCharge .~ 0
|
||||
-- where
|
||||
-- invid = _ilInvID $ _itLocation itm
|
||||
-- ptrWpCharge = cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itUse . leftConsumption . wpCharge
|
||||
-- maxcharge = itm ^?! itUse . leftConsumption . wpMaxCharge
|
||||
@@ -13,23 +13,15 @@ module Dodge.Item.Held.Utility (
|
||||
import Control.Lens
|
||||
import Dodge.Data.Item
|
||||
import Dodge.Default.Item
|
||||
--import Linear
|
||||
|
||||
flatShield :: Item
|
||||
flatShield =
|
||||
defaultHeldItem
|
||||
-- & itEffect . ieInv .~ EffectRootNotroot CreateShieldWall RemoveShieldWall
|
||||
& itType .~ HELD FLATSHIELD
|
||||
flatShield = defaultHeldItem & itType .~ HELD FLATSHIELD
|
||||
|
||||
keyCard :: Int -> Item
|
||||
keyCard n = defaultHeldItem & itType .~ HELD (KEYCARD n)
|
||||
|
||||
torch :: Item
|
||||
torch =
|
||||
defaultHeldItem
|
||||
& itType .~ HELD TORCH
|
||||
-- & itUse . heldMuzzles . ix 0 . mzPos . _x .~ 10
|
||||
-- & itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
torch = defaultHeldItem & itType .~ HELD TORCH
|
||||
|
||||
-- | Sends out pulses that display walls.
|
||||
detector :: Detector -> Item
|
||||
@@ -42,20 +34,10 @@ unsafeBlinker :: Item
|
||||
unsafeBlinker = blinker & itType .~ HELD BLINKERUNSAFE
|
||||
|
||||
rewinder :: Item
|
||||
rewinder =
|
||||
blinker
|
||||
& itType .~ HELD REWINDER
|
||||
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleRewind
|
||||
-- & itUse . heldMuzzles . ix 0 . mzAmmoPerShot .~ UseExactly 100000
|
||||
rewinder = blinker & itType .~ HELD REWINDER
|
||||
|
||||
timeStopper :: Item
|
||||
timeStopper =
|
||||
blinker
|
||||
& itType .~ HELD TIMESTOPPER
|
||||
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleStopper
|
||||
timeStopper = blinker & itType .~ HELD TIMESTOPPER
|
||||
|
||||
timeScroller :: Item
|
||||
timeScroller =
|
||||
timeStopper
|
||||
& itType .~ HELD TIMESCROLLER
|
||||
-- & itUse . heldMuzzles . ix 0 . mzEffect .~ MuzzleScroller
|
||||
timeScroller = timeStopper & itType .~ HELD TIMESCROLLER
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Room.Warning where
|
||||
|
||||
import Dodge.Data.BlBl
|
||||
import Color
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
|
||||
Reference in New Issue
Block a user