This commit is contained in:
2024-12-20 17:09:17 +00:00
parent d9aaa8cc05
commit 58635466ae
5 changed files with 34 additions and 69 deletions
+12 -38
View File
@@ -1,13 +1,17 @@
module Dodge.Euse
where
module Dodge.Euse (
createShieldWall,
removeShieldWall,
doItmCrWdWd,
useE,
) where
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Color
--import Control.Monad
import Data.Maybe
import Dodge.Creature.HandPos
import Dodge.Creature.Test
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Dodge.Data.World
import Dodge.Default.Wall
import Dodge.Item.HeldOffset
@@ -22,7 +26,7 @@ import LensHelp
doItmCrWdWd :: ItmCrWdWd -> Item -> Creature -> World -> World
doItmCrWdWd x itm cr = case x of
-- (ECamouflage vis) -> overCID (crCamouflage .~ vis) itm cr
-- (ECamouflage vis) -> overCID (crCamouflage .~ vis) itm cr
EonWristShield -> onEquipWristShield itm cr
EoffWristShield -> onRemoveWristShield itm cr
_ -> id
@@ -38,35 +42,6 @@ useE loc cr = case eo of
itm = loc ^. locLDT . ldtValue . _1
eo = itm ^? itUse . uequipEffect . eeUse
tryAttachBulletBelt :: Item -> Creature -> World -> World
tryAttachBulletBelt _ _ w = w
tryChargeBattery :: Item -> Creature -> World -> World
tryChargeBattery _ _ w = w
trySiphonFuel :: Item -> Creature -> World -> World
trySiphonFuel _ _ = id
--trySiphonFuel itm cr w = fromMaybe w $ do
-- eix <- itm ^? itLocation . ipInvID
-- hix <- cr ^? crManipulation . manObject . inInventory . ispItem
-- guard (cr ^? crManipulation . manObject . inInventory . iselAction == Just NoInvSelAction)
-- la <- cr ^? crInv . ix hix . itUse . heldConsumption
-- atype <- la ^? laAmmoType
-- guard (isGas atype)
-- amax <- la ^? laSource . _InternalSource . iaMax
-- acur <- la ^? laSource . _InternalSource . iaLoaded
-- guard (amax > acur)
-- return $
-- w & cWorld . lWorld . creatures . ix (_crID cr) . crInv
-- %~ ( (ix hix . itUse . heldConsumption . laSource . _InternalSource . iaLoaded +~ 1)
-- . (ix eix . itUse . equipEffect . eeUse . euseFuelAmount -~ 1)
-- )
isGas :: AmmoType -> Bool
isGas a = case a of
GasAmmo{} -> True
_ -> False
useMagShield :: Item -> Creature -> World -> World
useMagShield it cr w = w & cWorld . lWorld . magnets . at mgid ?~ themagnet
where
@@ -159,9 +134,10 @@ removeShieldWall it _ w = case it ^? itParams . flatShieldWlMIX . _Just of
createHeadLamp :: Item -> Creature -> World -> World
createHeadLamp _ cr =
cWorld . lWorld . lights .:~ LSParam
cWorld . lWorld . lights
.:~ LSParam
((_crPos cr `v2z` 0) +.+.+ rotate3 (_crDir cr) (translatePointToHead cr (V3 5 0 3)))
200
200
0.7
-- cWorld . lWorld . tempLightSources
@@ -171,5 +147,3 @@ createHeadLamp _ cr =
-- 0.7
-- ((_crPos cr `v2z` 0) +.+.+ rotate3 (_crDir cr) (translatePointToHead cr (V3 5 0 3)))
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
overCID f _ cr = cWorld . lWorld . creatures . ix (_crID cr) %~ f