Move held item scrolling into dedicated datatype

This commit is contained in:
2022-07-20 15:17:56 +01:00
parent 2755a4ffdd
commit 2c6e5e818a
10 changed files with 79 additions and 58 deletions
-27
View File
@@ -1,6 +1,5 @@
module Dodge.Item.Attachment
( charFiringStratI
, scrollCharMode
, changeFuse
) where
import Dodge.Data
@@ -13,32 +12,6 @@ import Data.Maybe
import qualified Data.IntMap.Strict as IM
scrollCharMode
:: Float -- ^ Amount scrolled
-> Creature
-> Item
-> Item
scrollCharMode x _
| x > 0 = incCharMode
| x < 0 = decCharMode
| otherwise = id
incCharMode
:: Item
-> Item
incCharMode = itAttachment . atCharMode %~ cycleL
where
cycleL (x :<| xs) = xs |> x
cycleL xs = xs
decCharMode
:: Item
-> Item
decCharMode = itAttachment . atCharMode %~ cycleR
where
cycleR (xs :|> x) = x <| xs
cycleR xs = xs
charFiringStratI
:: [(Char, ChainEffect)] -- ^ Different firing effects for different characters
-> ChainEffect
-1
View File
@@ -140,7 +140,6 @@ flatShield = defaultWeapon
, _aimHandlePos = 0
, _aimMuzPos = 0
}
, _heldScroll = \_ _ -> id
}
& itInvSize .~ 3
& itType . iyBase .~ HELD FLATSHIELD
+2 -2
View File
@@ -11,7 +11,7 @@ import Dodge.Reloading.Action
import Dodge.Default.Weapon
import Dodge.Item.Weapon.Bullet
import Dodge.Default
import Dodge.Item.Weapon.ZoomScope
--import Dodge.Item.Weapon.ZoomScope
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
@@ -91,7 +91,7 @@ sniperRifle = elephantGun
& itType . iyBase .~ HELD SNIPERRIFLE
& itParams . gunBarrels .~ SingleBarrel 0
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
& itUse . heldScroll .~ zoomLongGun
& itUse . heldScroll .~ HeldScrollZoom -- zoomLongGun
& itScope .~ ZoomScope (V2 0 0) 0 1 0.5 False
& itTargeting .~ targetLaser
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
+1 -1
View File
@@ -77,7 +77,7 @@ autoGun = defaultAutoGun
& itUse . useAim . aimRange .~ 1
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
& itUse . heldScroll .~ scrollCharMode
& itUse . heldScroll .~ HeldScrollCharMode
& itType . iyBase .~ HELD AUTOGUN
autoGunPic :: Item -> SPic
autoGunPic it = noPic $