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
-2
View File
@@ -33,8 +33,6 @@ import Dodge.Data.Material
import Geometry.Data
import qualified IntMapHelp as IM
--import MaybeHelp
data Creature = Creature
{ _crPos :: Point2
, _crOldPos :: Point2
+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
+10 -10
View File
@@ -72,19 +72,19 @@ showEquipItem eit = case eit of
itemNumberDisplay :: Creature -> ComposedItem -> [String]
itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
(_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
(WeaponTargetingSF,_,_)
_ | EQUIP WRIST_ECG <- itm ^. itType
-> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
-- (_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
-- (WeaponTargetingSF,_,_)
_ | WeaponTargetingSF <- ci ^. _2
-> [maybe "" (const "!TARG!") (itm ^? itTargeting . itTgPos . _Just)]
_ | hasammo -> [maybe "" shortShow
$ itm ^? itConsumables . magLoadStatus . iaLoaded]
(_,UseHeld{},_) -> []
-- (_,UseHotkey{_leftConsumption=lc},_) -> [showAutoRechargeProgress lc]
(_,UseEquip{},_) -> mempty
(_,UseNothing,_) -> []
(_,UseAttach (APInt i),_) -> [show i]
(_,UseAttach {},_) -> []
(_,UseScope OpticScope {_opticZoom = x},_) -> [shortShow x]
(_,UseBulletMod {},_) -> mempty
--(_,UseAttach (APInt i),_) -> [show i]
_ | UseAttach (APInt i) <- itm ^. itUse -> [show i]
_ | UseScope OpticScope {_opticZoom = x} <- itm ^. itUse -> [shortShow x]
-- (_,UseScope OpticScope {_opticZoom = x},_) -> [shortShow x]
(_,_,_) -> mempty
where
itm = ci ^. _1
hasammo = isJust $ itm ^? itConsumables . magLoadStatus . iaLoaded
+1 -3
View File
@@ -29,9 +29,7 @@ torch =
& itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 10
& itAmmoSlots .~ singleAmmo ElectricalAmmo
{- |
Sends out pulses that display walls.
-}
{- | Sends out pulses that display walls. -}
detector :: Detector -> Item
detector dt =
defaultHeldItem