Make aimStance record into function

This commit is contained in:
2025-06-03 15:19:35 +01:00
parent 589603e474
commit a17961eac7
20 changed files with 297 additions and 262 deletions
+4 -3
View File
@@ -24,8 +24,7 @@ module Dodge.Creature.Test (
crSafeDistFromTarg,
) where
--import MaybeHelp
--import Control.Applicative
import Dodge.Item.AimStance
import Control.Lens
import Data.List (find)
import Data.Maybe
@@ -92,7 +91,9 @@ crInAimStance as cr = crIsAiming cr && mitstance == Just as
where
mitstance = do
i <- cr ^? crManipulation . manObject . imRootSelectedItem
cr ^? crInv . ix i . itUse . heldAim . aimStance
itm <- cr ^? crInv . ix i
return $ aStance itm
--cr ^? crInv . ix i . itUse . heldAim . aimStance
oneH :: Creature -> Bool
oneH = crInAimStance OneHand
+2 -1
View File
@@ -2,6 +2,7 @@ module Dodge.Creature.YourControl (
yourControl,
) where
import Dodge.Item.AimStance
import Control.Monad
import qualified Data.Map.Strict as M
import Data.Maybe
@@ -134,7 +135,7 @@ setAimPosture = (crStance . posture .~ Aiming) . doAimTwist (- twoHandTwistAmoun
doAimTwist :: Float -> Creature -> Creature
doAimTwist x cr = fromMaybe cr $ do
itRef <- cr ^? crManipulation . manObject . imRootSelectedItem
astance <- cr ^? crInv . ix itRef . itUse . heldAim . aimStance
astance <- fmap aStance $ cr ^? crInv . ix itRef
guard $ astance == TwoHandOver || astance == TwoHandUnder
return $ cr & crDir +~ x
+3 -7
View File
@@ -28,7 +28,7 @@ import Dodge.Data.Item.Targeting
import Dodge.Data.Item.Use.Consumption
import Dodge.Data.Item.Use.Equipment
import Geometry.Data
import Sound.Data
--import Sound.Data
data ItemUse
= UseHeld
@@ -82,13 +82,9 @@ data HeldParams
= DefaultHeldParams
| GasSprayParams
{ _gasCreation :: GasCreate
-- , _recoil :: Float
, _torqueAfter :: Float
, _randomOffset :: Float
, _sidePush :: Float
, _bulGunSound :: Maybe (SoundID, Int) -- if the int is 0, play sound on new channel
-- if >0, continue playing sound for
-- given time
, _weaponInvLock :: Int
, _weaponRepeat :: [Int]
}
@@ -100,7 +96,7 @@ data HeldParams
, _torqueAfter :: Float
, _randomOffset :: Float
, _sidePush :: Float
, _bulGunSound :: Maybe (SoundID, Int) -- if the int is 0, play sound on new channel
-- , _bulGunSound :: Maybe (SoundID, Int) -- if the int is 0, play sound on new channel
-- if >0, continue playing sound for
-- given time
, _weaponInvLock :: Int
@@ -120,7 +116,7 @@ data AimParams = AimParams
, _aimTurnSpeed :: Float
, _aimRange :: Float
, _aimZoom :: ItZoom
, _aimStance :: AimStance
-- , _aimStance :: AimStance
, _aimHandlePos :: V2 Float
, _aimMuzzles :: [Muzzle]
}
+2 -2
View File
@@ -4,7 +4,7 @@ module Dodge.Default.Item.Use (
module Dodge.Default.Item.Use.Equipment,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
--import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Data.Item.Use
import Dodge.Default.Item.Use.AimParams
import Dodge.Default.Item.Use.Equipment
@@ -35,7 +35,7 @@ defaultHeldUse = UseHeld
, _torqueAfter = 0.2
, _randomOffset = 0
, _sidePush = 0
, _bulGunSound = Just (tap3S, 0)
-- , _bulGunSound = Just (tap3S, 0)
, _weaponInvLock = 0
, _weaponRepeat = []
}
-1
View File
@@ -13,7 +13,6 @@ defaultAimParams =
, _aimTurnSpeed = 1
, _aimRange = 0
, _aimZoom = defaultItZoom
, _aimStance = OneHand
, _aimHandlePos = V2 3 0
, _aimMuzzles =
[ Muzzle
+50 -8
View File
@@ -8,6 +8,7 @@ module Dodge.HeldUse (
mcUseHeld,
) where
import Sound.Data
import Color
import Control.Applicative
import Control.Monad
@@ -187,7 +188,7 @@ applyInvLock itm cr = case itm ^? itUse . heldParams . weaponInvLock of
applySoundCME :: Item -> Creature -> World -> World
applySoundCME itm cr = fromMaybe id $ do
(soundid, x) <- itm ^? itUse . heldParams . bulGunSound . _Just
(soundid, x) <- bgunSound itm
return $
if x > 0
then soundContinue (CrWeaponSound cid 0) (_crPos cr) soundid (Just x)
@@ -198,7 +199,6 @@ applySoundCME itm cr = fromMaybe id $ do
applyRecoil :: Item -> Creature -> World -> World
applyRecoil itm cr = cWorld . lWorld . creatures . ix (_crID cr) %~ pushback
where
-- recoilAmount = fromMaybe 0 $ itm ^? itUse . heldParams . recoil
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((- recoilAmount itm) / _crMass cr) 0))
recoilAmount :: Item -> Float
@@ -247,6 +247,54 @@ recoilAmount itm
BLINKERUNSAFE -> 0
| otherwise = 0
-- if the int is 0, play sound on new channel
-- if >0, continue playing sound for given time
bgunSound :: Item -> Maybe (SoundID,Int)
bgunSound itm
| HELD hit <- itm ^. itType = case hit of
BANGSTICK _ -> Just (tap3S, 0)
REWINDER -> Nothing
TIMESTOPPER -> Nothing
TIMESCROLLER -> Nothing
PISTOL -> Just (tap3S, 0)
MACHINEPISTOL -> Just (tap1S, 0)
AUTOPISTOL -> Just (tap1S, 0)
SMG -> Just (tap1S, 0)
BANGCONE -> Just (bangEchoS,0)
BLUNDERBUSS -> Just (bangEchoS,0)
GRAPECANNON _ -> Just (bangEchoS,0)
MINIGUNX _ -> Just (mini1S,2)
VOLLEYGUN _ -> Just (tap3S, 0)
RIFLE -> Just (tap3S, 0)
ALTERIFLE -> Just (tap3S, 0)
AUTORIFLE -> Just (tap3S, 0)
BURSTRIFLE -> Just (tap3S, 0)
BANGROD -> Just (bangEchoS,0)
ELEPHANTGUN -> Just (bangEchoS,0)
AMR -> Just (bangEchoS,0)
AUTOAMR -> Just (bangEchoS,0)
SNIPERRIFLE -> Just (bangEchoS,0)
FLAMESPITTER -> Nothing
FLAMETHROWER -> Nothing
FLAMETORRENT -> Nothing
FLAMEWALL -> Nothing
BLOWTORCH -> Nothing
SPARKGUN -> Nothing
TESLAGUN -> Nothing
LASER -> Nothing
TRACTORGUN -> Nothing
RLAUNCHER -> Just (tap4S, 0)
RLAUNCHERX _ -> Just (tap4S, 0)
GLAUNCHER -> Just (tap4S, 0)
POISONSPRAYER -> Just (foamSprayLoopS,5)
SHATTERGUN -> Nothing
TORCH -> Nothing
FLATSHIELD -> Nothing
KEYCARD _ -> Nothing
BLINKER -> Nothing
BLINKERUNSAFE -> Nothing
| otherwise = Nothing
applySidePush :: Float -> Creature -> World -> World
applySidePush 0 _ w = w
applySidePush maxSide cr w =
@@ -545,13 +593,8 @@ removeAmmoFromMag x mid cr = fromMaybe id $ do
-~ x
getBulletType ::
-- LabelDoubleTree ComposeLinkType Item ->
LabelDoubleTree ComposeLinkType Item ->
-- Muzzle ->
-- Creature ->
-- World ->
Maybe Bullet
--getBulletType itmtree magtree mz cr w =
getBulletType magtree =
magtree ^? ldtValue . itConsumables . magParams . ampBullet
-- <&> buTrajectory .~ btraj
@@ -598,7 +641,6 @@ shootBullet ::
World ->
World
shootBullet itmtree cr (mz, x, magtree) w = fromMaybe w $ do
-- thebullet <- getBulletType itmtree magtree mz cr w
thebullet <- getBulletType magtree
return $ foldl' (&) w (replicate x (makeBullet' thebullet (itmtree ^. ldtValue) cr mz))
+3 -1
View File
@@ -7,6 +7,7 @@ module Dodge.Item.Grammar (
allInvLocs,
) where
import Dodge.Item.AimStance
import Control.Applicative
import qualified Data.IntMap.Strict as IM
import Data.Maybe
@@ -125,7 +126,8 @@ extraWeaponLinks itm = case itm ^. itType of
extraWeaponLinksBelow :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
extraWeaponLinksBelow itm
| Just TwoHandUnder <- itm ^? itUse . heldAim . aimStance
-- | Just TwoHandUnder <- itm ^? itUse . heldAim . aimStance
| TwoHandUnder <- aStance itm
= [(UnderBarrelSlotSF,UnderBarrelSlotLink)]
| otherwise = []
-3
View File
@@ -23,7 +23,6 @@ teslaGun =
& itParams .~ teslaParams
& itUse . heldDelay .~ NoDelay
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 10 0
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ TeslaGunFlare
@@ -61,7 +60,6 @@ laser =
}
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat
& itType .~ HELD LASER
-- previous attractionPower values: 1, -1, -10, 0
@@ -75,7 +73,6 @@ tractorGun =
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ NoFlare
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleTractor
& itType .~ HELD TRACTORGUN
+1 -4
View File
@@ -25,7 +25,6 @@ defaultBangCane =
& itUse . heldParams . torqueAfter .~ 0.1
& itUse . heldDelay . rateMax .~ 6
-- & itUse . heldMods .~ BangCaneMod
& itUse . heldAim . aimStance .~ OneHand
-- & itUse . heldAim . aimHandlePos .~ 5
volleyGun :: Int -> Item
@@ -33,7 +32,6 @@ volleyGun i =
defaultBangCane
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles .~ getZipList
(ZipList [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 6]
@@ -54,7 +52,6 @@ volleyGun i =
rifle :: Item
rifle =
defaultBangCane
& itUse . heldAim . aimStance .~ TwoHandUnder
& itType .~ HELD RIFLE
& itUse . heldAim . aimWeight .~ 6
& itUse . heldAim . aimRange .~ 1
@@ -100,7 +97,7 @@ miniGunX i =
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itAmmoSlots .~ singleAmmo BeltBulletAmmo
& itUse . heldParams . bulGunSound ?~ (mini1S,2)
-- & itUse . heldParams . bulGunSound ?~ (mini1S,2)
& itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimMuzzles
.~ replicate i
+9 -10
View File
@@ -1,10 +1,12 @@
module Dodge.Item.Held.Cone where
module Dodge.Item.Held.Cone (
bangCone,
blunderbuss,
grapeCannon,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Control.Lens
import Dodge.Data.Item
import Dodge.Default.Item
--import Dodge.Reloading.Action
import Geometry.Data
import Linear
@@ -12,22 +14,20 @@ bangCone :: Item
bangCone =
defaultBulletWeapon
& itUse . heldDelay . rateMax .~ 20
& itUse . heldAim . aimMuzzles
.~ replicate 15
(Muzzle (V2 15 0) 0 0.5 0 NoFlare MuzzleShootBullet (UseExactly 1) 0)
& itUse . heldAim . aimMuzzles
.~ replicate
15
(Muzzle (V2 15 0) 0 0.5 0 NoFlare MuzzleShootBullet (UseExactly 1) 0)
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ BasicFlare
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
-- & itUse . heldParams . recoil .~ 150
& itUse . heldParams . torqueAfter .~ 0.1
& itUse . heldParams . randomOffset .~ 12
& itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
& itType .~ HELD BANGCONE
blunderbuss :: Item
blunderbuss =
bangCone
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimWeight .~ 6
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 30
@@ -37,6 +37,5 @@ grapeCannon :: Int -> Item
grapeCannon i =
blunderbuss
& itType .~ HELD (GRAPECANNON i)
-- & itUse . heldParams . recoil .~ (150 + fromIntegral i * 50)
& itUse . heldParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
& itUse . heldParams . randomOffset .~ (12 + 4 * fromIntegral i)
+23 -19
View File
@@ -1,13 +1,15 @@
module Dodge.Item.Held.Launcher where
module Dodge.Item.Held.Launcher (
rLauncher,
rLauncherX,
gLauncher,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Control.Applicative
import Dodge.Default.Item
--import Dodge.Reloading.Action
import Control.Lens
import Dodge.Data.Item
import qualified IntMapHelp as IM
import Dodge.Default.Item
import Geometry.Data
import qualified IntMapHelp as IM
rLauncher :: Item
rLauncher =
@@ -15,7 +17,6 @@ rLauncher =
& itUse . heldDelay . rateMax .~ 20
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandOver
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleRLauncher
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 20 0
@@ -23,12 +24,14 @@ rLauncher =
& itType .~ HELD RLAUNCHER
& itUse . heldParams . muzVel .~ ConstFloat 0
& itUse . heldParams . rifling .~ ConstFloat 0
-- & itUse . heldParams . recoil .~ 0
-- & itUse . heldParams . recoil .~ 0
& itUse . heldParams . torqueAfter .~ 0
& itUse . heldParams . bulGunSound ?~ (tap4S, 0)
-- & itUse . heldParams . bulGunSound ?~ (tap4S, 0)
gLauncher :: Item
gLauncher = rLauncher
gLauncher =
rLauncher
& itType .~ HELD GLAUNCHER
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleGLauncher
@@ -36,14 +39,15 @@ rLauncherX :: Int -> Item
rLauncherX i =
rLauncher
& itType .~ HELD (RLAUNCHERX i)
& itUse . heldAim . aimMuzzles .~ getZipList
(ZipList [Muzzle (V2 20 0) a 0 | a <- angles]
<*> ZipList [0..]
<*> pure NoFlare
<*> pure MuzzleRLauncher
<*> pure (UseExactly 1)
<*> pure 0
)
& itAmmoSlots .~ IM.fromList [(j,LauncherAmmo) | j <- [0..i-1]]
& itUse . heldAim . aimMuzzles
.~ getZipList
( ZipList [Muzzle (V2 20 0) a 0 | a <- angles]
<*> ZipList [0 ..]
<*> pure NoFlare
<*> pure MuzzleRLauncher
<*> pure (UseExactly 1)
<*> pure 0
)
& itAmmoSlots .~ IM.fromList [(j, LauncherAmmo) | j <- [0 .. i -1]]
where
angles = take i [0,2*pi/ fromIntegral i ..]
angles = take i [0, 2 * pi / fromIntegral i ..]
+2 -4
View File
@@ -7,7 +7,7 @@ module Dodge.Item.Held.Rod (
-- machineGun,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
--import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Data.Item
import Dodge.Default
--import Dodge.Item.Weapon.Bullet
@@ -21,12 +21,11 @@ bangRod =
& itUse . heldParams . rifling .~ ConstFloat 1
-- & itUse . heldParams . recoil .~ 50
& itUse . heldParams . torqueAfter .~ 0.3
& itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
-- & itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
& itUse . heldDelay . rateMax .~ 12
& itType .~ HELD BANGROD
& itUse . heldAim . aimWeight .~ 8
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 30 0
@@ -37,7 +36,6 @@ elephantGun :: Item
elephantGun =
bangRod
& itType .~ HELD ELEPHANTGUN
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0.05
-- & itUse . heldParams . recoil .~ 50
+3 -5
View File
@@ -7,7 +7,7 @@ module Dodge.Item.Held.SprayGuns (
flameWall,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
--import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Data.Item
import Dodge.Default.Item
--import Dodge.Reloading.Action
@@ -24,13 +24,12 @@ poisonSprayer =
& itUse . heldParams . torqueAfter .~ 0
& itUse . heldParams . randomOffset .~ 0
& itUse . heldParams . sidePush .~ 0
& itUse . heldParams . bulGunSound ?~ (foamSprayLoopS,5)
-- & itUse . heldParams . bulGunSound ?~ (foamSprayLoopS,5)
flameSpitter :: Item
flameSpitter =
flameThrower
& itType .~ HELD FLAMESPITTER
& itUse . heldAim . aimStance .~ OneHand
& itUse . heldDelay .~ FixedRate{_rateMax = 3, _rateTimeLastUsed = 0}
& itUse . heldParams . weaponInvLock .~ 10
& itUse . heldParams . weaponRepeat .~ [1..9]
@@ -76,7 +75,6 @@ flameThrower =
& itUse . heldDelay .~ NoDelay
& itUse . heldAim . aimWeight .~ 5
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0 0 NoFlare
MuzzleNozzle
{ _nzPressure = ConstFloat 4
@@ -95,7 +93,7 @@ flameThrower =
, _torqueAfter = 0
, _randomOffset = 0
, _sidePush = 25
, _bulGunSound = Nothing
-- , _bulGunSound = Nothing
, _weaponInvLock = 0
, _weaponRepeat = mempty
}
+1 -2
View File
@@ -59,7 +59,7 @@ autoPistol :: Item
autoPistol =
pistol
& itUse . heldTriggerType .~ AutoTrigger
& itUse . heldParams . bulGunSound ?~ (tap1S, 0)
-- & itUse . heldParams . bulGunSound ?~ (tap1S, 0)
& itType .~ HELD AUTOPISTOL
machinePistol :: Item
@@ -73,7 +73,6 @@ smg :: Item
smg =
autoPistol -- & some parameter affecting stability
& itType .~ HELD SMG
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 20 0
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldParams . torqueAfter .~ 0.05
-2
View File
@@ -23,8 +23,6 @@ flatShield =
& itEffect . ieInv .~ EffectRootNotroot CreateShieldWall RemoveShieldWall
& itUse . heldAim . aimWeight .~ 5
& itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimStance .~ TwoHandFlat
-- & itUse . heldAim . aimHandlePos .~ 0
& itType .~ HELD FLATSHIELD
keyCard :: Int -> Item
-1
View File
@@ -14,4 +14,3 @@ shatterGun =
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleShatter
& itUse . heldAim . aimStance .~ TwoHandFlat
+12 -11
View File
@@ -6,6 +6,7 @@ module Dodge.Item.HeldOffset (
heldItemOrient2D,
) where
import Dodge.Item.AimStance
import qualified Quaternion as Q
import Data.Maybe
import Dodge.Data.Creature
@@ -52,11 +53,12 @@ heldItemRelativeOrient itm cr (p,q)
handPos = case cr ^? crStance . carriage of
Just (Walking x LeftForward) -> f x * 50 -2
_ -> 0 - 2
isOneHand =
itm ^? itUseAimStance == Just OneHand
|| isNothing (itm ^? itUseAimStance)
isTwoHandFlat = itm ^? itUseAimStance == Just TwoHandFlat
itUseAimStance = itUse . heldAim . aimStance
isOneHand = aStance itm == OneHand
-- itm ^? itUseAimStance == Just OneHand
-- || isNothing (itm ^? itUseAimStance)
isTwoHandFlat = aStance itm == TwoHandFlat
--itm ^? itUseAimStance == Just TwoHandFlat
--itUseAimStance = itUse . heldAim . aimStance
f i = 0.1 * fromIntegral (sLen - i) / fromIntegral sLen
sLen = _strideLength $ _crStance cr
@@ -67,12 +69,11 @@ aimingWeaponZeroPos cr it =
-- the position of a weapon handle
aimingWeaponHandlePos :: Creature -> Item -> Point2
aimingWeaponHandlePos _ it = case it ^? itUse . heldAim . aimStance of
Just TwoHandUnder -> V2 (-2) 0
Just TwoHandOver -> V2 (-7) 0
Just OneHand -> V2 10 (-2)
Just TwoHandFlat -> V2 10 0
Nothing -> 0
aimingWeaponHandlePos _ it = case aStance it of
TwoHandUnder -> V2 (-2) 0
TwoHandOver -> V2 (-7) 0
OneHand -> V2 10 (-2)
TwoHandFlat -> V2 10 0
heldItemOffset :: Item -> Creature -> Point3 -> Point3
heldItemOffset itm cr p = fst (heldItemRelativeOrient itm cr (p,Q.qID))
+31 -27
View File
@@ -1,14 +1,17 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Item.Info
( itemInfo
) where
import Dodge.Item.InvSize
module Dodge.Item.Info (
itemInfo,
) where
import Data.Char
--import qualified Data.Map.Strict as M
import Dodge.Data.Item
import Dodge.Item.AimStance
import Dodge.Item.InvSize
--import Dodge.Module.Info
import LensHelp
--import StringHelp
itemInfo :: Item -> String
@@ -29,14 +32,14 @@ itmBaseInfo itm = case itm ^. itType of
DETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius."
ATTACH t -> attachInfo t
AMMOMAG t -> ammoMagInfo t
-- TARGETING {_ibtTargeting :: TargetingType}
-- BULLETMOD {_ibtBulletMod :: BulletMod}
-- STICKYMOD
-- ITEMSCAN
-- MAPPER
-- INTROSCAN {_ibtIntroScanType :: IntroScanType}
-- DETECTOR {_ibtDetector :: Detector}
-- ARHUD
-- TARGETING {_ibtTargeting :: TargetingType}
-- BULLETMOD {_ibtBulletMod :: BulletMod}
-- STICKYMOD
-- ITEMSCAN
-- MAPPER
-- INTROSCAN {_ibtIntroScanType :: IntroScanType}
-- DETECTOR {_ibtDetector :: Detector}
-- ARHUD
_ -> "THIS SHOULD NOT BE DISPLAYED"
ammoMagInfo :: AmmoMagType -> String
@@ -56,12 +59,12 @@ attachInfo = \case
JOYSTICK -> "A control device. Can be used to control certain projectiles. "
GIMBAL -> "A device that can stabilize moving objects. "
GYROSCOPE -> "A device that can sustain angular velocity. "
-- UNDERBARRELSLOT
-- REMOTEDETONATOR
-- SMOKEREDUCER
-- HOMINGMODULE
-- AUGMENTEDHUD
-- SHELLPAYLOAD {}
-- UNDERBARRELSLOT
-- REMOTEDETONATOR
-- SMOKEREDUCER
-- HOMINGMODULE
-- AUGMENTEDHUD
-- SHELLPAYLOAD {}
_ -> "INCOMPLETE, TODO FINISH"
showInt :: Int -> String
@@ -98,7 +101,7 @@ heldInfo hit = case hit of
MINIGUNX i -> over _head toUpper (showInt i) ++ " gun barrels that revolve rapidly around a central stick. Requires considerable time to warm up, but has an extremely rapid rate of fire. It is also extremely difficult to stabilise."
VOLLEYGUN i -> over _head toUpper (showInt i) ++ " gun barrels lined up to be roughly parallel. Each barrel requires a separate magazine. All barrels must be loaded to fire."
RIFLE -> "A firearm with a mid length barrel that requires reloading after each shot."
-- REPEATER -> "A firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
-- REPEATER -> "A firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
AUTORIFLE -> "A firearm automatically fed by a magazine. The entire magazine must be replaced when reloading the weapon."
ALTERIFLE -> "A firearm with a mid length barrel that requires reloading after each shot. Alternates between two magazines."
BURSTRIFLE -> "A firearm that rapidly fires three projectiles from its magazine. The entire magazine must be replaced when reloading the weapon."
@@ -107,7 +110,7 @@ heldInfo hit = case hit of
AMR -> "An antimateriel rifle, designed to disable military equipment. Its long barrel is fed by a magazine that must be replaced when reloading the weapon."
AUTOAMR -> "An automatic antimateriel rifle, designed to disable military equipment. Its long barrel is fed by a magazine that must be replaced when reloading the weapon."
SNIPERRIFLE -> "A firearm designed with long range capability in mind. Its long barrel requires reloading after each shot."
-- MACHINEGUN -> "A heavy firearm whose rate of fire increases during a barrage."
-- MACHINEGUN -> "A heavy firearm whose rate of fire increases during a barrage."
FLAMESPITTER -> "A weapon that globs out burning fuel."
FLAMETHROWER -> "A weapon that squirts out burning fuel."
FLAMETORRENT -> "A weapon that streams out burning fuel in a torrent."
@@ -120,10 +123,10 @@ heldInfo hit = case hit of
GLAUNCHER -> "A large tube that can launch projectiles."
RLAUNCHER -> "A large tube that can launch self propelled projectiles. Moving the tube after launch will cause the projectile to spin."
RLAUNCHERX i -> over _head toUpper (showInt i) ++ " tubes that can launch self propelled projectiles. Tubes that do not face forward launch their projecitles at an angle."
-- REMOTELAUNCHER -> "A large tube that can launch self propelled projectiles. Contains a transmitter allowing for remote control of launched projectiles."
-- REMOTELAUNCHER -> "A large tube that can launch self propelled projectiles. Contains a transmitter allowing for remote control of launched projectiles."
POISONSPRAYER -> "A weapon that releases noxious gases."
SHATTERGUN -> "A seismic device that shatters hard items in its line of fire."
-- FORCEFIELDGUN -> "A device that produces a durable forcefield."
-- FORCEFIELDGUN -> "A device that produces a durable forcefield."
TORCH -> "A stick with a light on the end."
FLATSHIELD -> "A panel of metal that blocks unwanted objects from the front of the user."
KEYCARD i -> "A keycard. It is labelled " ++ show i ++ "."
@@ -197,9 +200,10 @@ craftInfo fit = case fit of
MICROPHONE -> "A device that measures air vibration."
CREATURESENSOR -> "A device for detecting living beings."
WIRE -> "A small thin object that conducts electricity."
-- BATTERY -> "A store of electical potential energy."
-- BATTERY -> "A store of electical potential energy."
FUELCELL -> "A devices that converts chemical energy into electricity."
PORTABLEFUSION -> "A miniature nuclear reactor."
-- GASINJECTOR -> "A device that can inject small quantities of gas into objects."
-- ENERGYBALLCRAFT ebt -> "A device that can create " ++ addIndefiniteArticle (displayEnergyBallType ebt) ++ " effect."
-- FRAGMODULE -> "A device that converts projectiles into fragmentation projectiles."
@@ -222,15 +226,15 @@ detectorInfo d = case d of
itmUsageInfo :: Item -> String
itmUsageInfo itm = case itm ^. itType of
HELD _ -> heldPositionInfo itm
-- LEFT _ ->
-- "This item can be equipped" ++ itmEquipSiteInfo itm
-- ++ ". When equipped, it can be activated."
-- LEFT _ ->
-- "This item can be equipped" ++ itmEquipSiteInfo itm
-- ++ ". When equipped, it can be activated."
EQUIP _ -> "This item can be equipped " ++ itmEquipSiteInfo itm ++ "."
CRAFT _ -> ""
_ -> "THIS SHOULD NOT BE DISPLAYED"
heldPositionInfo :: Item -> String
heldPositionInfo = maybe undefined aimStanceInfo . (^? itUse . heldAim . aimStance)
heldPositionInfo = aimStanceInfo . aStance
aimStanceInfo :: AimStance -> String
aimStanceInfo as = case as of