Start restructuring Item datatype

This commit is contained in:
2021-11-27 12:48:23 +00:00
parent fe37f208da
commit bfdac2fad5
16 changed files with 56 additions and 55 deletions
+7 -7
View File
@@ -32,23 +32,23 @@ itemEffect
-> World -> World
itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w) itemEffect cr Consumable{_cnEffect=eff } w = maybe w (rmSelectedInvItem (_crID cr)) (eff (_crID cr) w)
itemEffect cr it w = case it ^? itUse of itemEffect cr it w = case it ^? itUse of
Just (Right eff) -> foldr ($) eff (_itUseModifiers it) it cr w Just (RightUse eff) -> foldr ($) eff (_itUseModifiers it) it cr w
Just (Left _ ) -> w & creatures . ix (_crID cr) . crLeftInvSel ?~ _crInvSel cr Just (LeftUse _ ) -> w & creatures . ix (_crID cr) . crLeftInvSel ?~ _crInvSel cr
Nothing -> w _ -> w
--this is ugly --this is ugly
useLeftItem :: Int -> World -> World useLeftItem :: Int -> World -> World
useLeftItem cid w = case _crInv cr IM.! crinvsel ^? itUse . _Left of useLeftItem cid w = case _crInv cr IM.! crinvsel ^? itUse . lUse of
Just f -> f cr crinvsel w & creatures . ix cid . crLeftInvSel ?~ crinvsel Just f -> f cr crinvsel w & creatures . ix cid . crLeftInvSel ?~ crinvsel
Nothing -> case _crLeftInvSel cr of Nothing -> case _crLeftInvSel cr of
Just invid -> case _itUse $ _crInv cr IM.! invid of Just invid -> case _itUse $ _crInv cr IM.! invid of
Left f -> f cr invid w LeftUse f -> f cr invid w
Right _ -> w & creatures . ix cid . crLeftInvSel .~ Nothing _ -> w & creatures . ix cid . crLeftInvSel .~ Nothing
Nothing -> case luse of Nothing -> case luse of
Nothing -> w Nothing -> w
Just (invid, f) -> f cr invid w & creatures . ix cid . crLeftInvSel ?~ invid Just (invid, f) -> f cr invid w & creatures . ix cid . crLeftInvSel ?~ invid
where where
crinvsel = _crInvSel cr crinvsel = _crInvSel cr
cr = _creatures w IM.! cid cr = _creatures w IM.! cid
luses = IM.mapMaybe (^? itUse . _Left) (_crInv cr) luses = IM.mapMaybe (^? itUse . lUse) (_crInv cr)
luse = listToMaybe $ IM.toList luses luse = listToMaybe $ IM.toList luses
+15 -14
View File
@@ -289,19 +289,20 @@ data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float,
data ItemPos data ItemPos
= InInv { _itCrId :: Int , _itInvId :: Int } = InInv { _itCrId :: Int , _itInvId :: Int }
| OnFloor { _itFlID :: Int } | OnFloor { _itFlID :: Int }
data Item' = Item' data ItemUse
{ _iName :: String = RightUse { _rUse :: Item -> Creature -> World -> World }
, _iIdentity :: ItemIdentity | LeftUse { _lUse :: Creature -> Int -> World -> World }
, _iType :: Item | NoUse
, _iID :: Int data ItemAmmo
, _itPos :: ItemPos = LoadbleAmmo
} { _aoType :: AmmoType
}
data Item data Item
= Weapon = Weapon
{ _itName :: String { _itName :: String
, _wpMaxAmmo :: Int , _wpMaxAmmo :: Int
, _wpLoadedAmmo :: Int , _wpLoadedAmmo :: Int
, _wpAmmo :: Ammo , _wpAmmo :: AmmoType
, _wpReloadTime :: Int , _wpReloadTime :: Int
, _wpReloadState :: Int , _wpReloadState :: Int
, _wpReloadType :: ReloadType , _wpReloadType :: ReloadType
@@ -311,8 +312,7 @@ data Item
, _wpCurCoolDown :: Int , _wpCurCoolDown :: Int
, _itUseRate :: Int , _itUseRate :: Int
, _itUseTime :: Int , _itUseTime :: Int
, _itUse :: Either (Creature -> Int -> World -> World) , _itUse :: ItemUse
(Item -> Creature -> World -> World)
, _itUseModifiers :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World] , _itUseModifiers :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
--, _itLeftClickUse :: Maybe (Creature -> Int -> World -> World) --, _itLeftClickUse :: Maybe (Creature -> Int -> World -> World)
, _wpSpread :: Float , _wpSpread :: Float
@@ -394,8 +394,7 @@ data Item
, _itFloorPict :: Item -> SPic , _itFloorPict :: Item -> SPic
, _twMaxRange :: Float , _twMaxRange :: Float
, _twAccuracy :: Float , _twAccuracy :: Float
, _itUse :: Either (Creature -> Int -> World -> World) , _itUse :: ItemUse
(Item -> Creature -> World -> World)
, _itUseRate :: Int , _itUseRate :: Int
, _itUseTime :: Int , _itUseTime :: Int
, _itUseModifiers :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World] , _itUseModifiers :: [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
@@ -509,7 +508,7 @@ type HitEffect = Particle
-> World -> World
-> (World,Maybe Particle) -> (World,Maybe Particle)
data Ammo data AmmoType
= ShellAmmo = ShellAmmo
{ _amPayload :: Point2 -> World -> World { _amPayload :: Point2 -> World -> World
, _amString :: String , _amString :: String
@@ -858,11 +857,13 @@ makeLenses ''Creature
makeLenses ''LightSource makeLenses ''LightSource
makeLenses ''TempLightSource makeLenses ''TempLightSource
makeLenses ''Item makeLenses ''Item
makeLenses ''ItemUse
makeLenses ''ItemPos makeLenses ''ItemPos
makeLenses ''ItEffect makeLenses ''ItEffect
makeLenses ''ItZoom makeLenses ''ItZoom
makeLenses ''FloorItem makeLenses ''FloorItem
makeLenses ''Ammo makeLenses ''ItemAmmo
makeLenses ''AmmoType
makeLenses ''PjParam makeLenses ''PjParam
makeLenses ''Prop makeLenses ''Prop
makeLenses ''Modification makeLenses ''Modification
+2 -2
View File
@@ -27,7 +27,7 @@ defaultGun = Weapon
, _wpCurCoolDown = 0 , _wpCurCoolDown = 0
, _itUseRate = 8 , _itUseRate = 8
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ \_ _ -> id , _itUse = RightUse $ \_ _ -> id
, _itUseModifiers = [] , _itUseModifiers = []
, _wpSpread = 0.02 , _wpSpread = 0.02
, _wpRange = 20 , _wpRange = 20
@@ -67,7 +67,7 @@ defaultAutoGun = defaultGun
{ _itInvDisplay = basicWeaponDisplay { _itInvDisplay = basicWeaponDisplay
, _itAimStance = TwoHandTwist , _itAimStance = TwoHandTwist
} }
defaultShellAmmo :: Ammo defaultShellAmmo :: AmmoType
defaultShellAmmo = ShellAmmo defaultShellAmmo = ShellAmmo
{ _amPayload = const id { _amPayload = const id
, _amString = "Shell" , _amString = "Shell"
+2 -2
View File
@@ -11,8 +11,8 @@ import Geometry
import Control.Lens import Control.Lens
useAmmoParams :: Either a (Item -> Creature -> World -> World) useAmmoParams :: ItemUse
useAmmoParams = Right $ \it -> let b = _wpAmmo it useAmmoParams = RightUse $ \it -> let b = _wpAmmo it
in withVelWthHiteff (_amBulVel b) (_amBulWth b) (_amBulEff b) in withVelWthHiteff (_amBulVel b) (_amBulWth b) (_amBulEff b)
useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World
+3 -3
View File
@@ -44,7 +44,7 @@ teslaGun = defaultGun
, _itUseRate = 0 , _itUseRate = 0
, _itAimStance = TwoHandFlat , _itAimStance = TwoHandFlat
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ const aTeslaArc , _itUse = RightUse $ const aTeslaArc
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheckI
@@ -77,7 +77,7 @@ lasGun = defaultAutoGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 0 , _itUseRate = 0
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ const aLaser , _itUse = RightUse $ const aLaser
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheckI
@@ -117,7 +117,7 @@ tractorGun = defaultAutoGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 0 , _itUseRate = 0
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right aTractorBeam , _itUse = RightUse aTractorBeam
, _itUseModifiers = , _itUseModifiers =
[ ammoUseCheckI [ ammoUseCheckI
] ]
+1 -1
View File
@@ -23,7 +23,7 @@ import Control.Monad.State
bezierGun :: Item bezierGun :: Item
bezierGun = defaultGun bezierGun = defaultGun
{ _itName = "B-GUN" { _itName = "B-GUN"
, _itUse = Right $ \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point , _itUse = RightUse $ \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheckI
+1 -1
View File
@@ -119,7 +119,7 @@ boosterGun = defaultGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 0 , _itUseRate = 0
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Left $ boostSelfL 10 , _itUse = LeftUse $ boostSelfL 10
, _wpSpread = 0.05 , _wpSpread = 0.05
, _wpRange = 20 , _wpRange = 20
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)] , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
+3 -3
View File
@@ -8,21 +8,21 @@ import Dodge.WorldEvent.HitEffect
import Dodge.Particle.Bullet.HitEffect import Dodge.Particle.Bullet.HitEffect
import Geometry.Data import Geometry.Data
basicBullet :: Ammo basicBullet :: AmmoType
basicBullet = BulletAmmo basicBullet = BulletAmmo
{ _amString = "BULLET" { _amString = "BULLET"
, _amBulEff = destroyOnImpact bulHitCr bulHitWall , _amBulEff = destroyOnImpact bulHitCr bulHitWall
, _amBulWth = 2 , _amBulWth = 2
, _amBulVel = V2 50 0 , _amBulVel = V2 50 0
} }
ltBullet :: Ammo ltBullet :: AmmoType
ltBullet = BulletAmmo ltBullet = BulletAmmo
{ _amString = "LTBULLET" { _amString = "LTBULLET"
, _amBulEff = destroyOnImpact bulHitCr bulHitWall , _amBulEff = destroyOnImpact bulHitCr bulHitWall
, _amBulWth = 2 , _amBulWth = 2
, _amBulVel = V2 40 0 , _amBulVel = V2 40 0
} }
hvBullet :: Ammo hvBullet :: AmmoType
hvBullet = BulletAmmo hvBullet = BulletAmmo
{ _amString = "HVBULLET" { _amString = "HVBULLET"
, _amBulEff = penWalls hvBulHitCr hvBulHitWall , _amBulEff = penWalls hvBulHitCr hvBulHitWall
+1 -1
View File
@@ -217,7 +217,7 @@ miniGun = defaultAutoGun
, _wpMaxWarmUp = 100 , _wpMaxWarmUp = 100
, _itUseRate = 0 , _itUseRate = 0
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ useAmmoParamsVelMod vm4 , _itUse = RightUse $ useAmmoParamsVelMod vm4
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, withWarmUpI crankSlowS , withWarmUpI crankSlowS
+1 -1
View File
@@ -28,7 +28,7 @@ lasDrones = defaultGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 20 , _itUseRate = 20
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right aDroneWithItemParams , _itUse = RightUse aDroneWithItemParams
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheckI
+5 -5
View File
@@ -34,7 +34,7 @@ grenade = Throwable
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)] , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
, _twMaxRange = 150 , _twMaxRange = 150
, _twAccuracy = 30 , _twAccuracy = 30
, _itUse = Right $ \_ -> throwGrenade makeExplosionAt , _itUse = RightUse $ \_ -> throwGrenade makeExplosionAt
, _itUseModifiers = , _itUseModifiers =
[ useTimeCheckI [ useTimeCheckI
] ]
@@ -227,7 +227,7 @@ remoteBomb = defaultThrowable
[(-3,-3),(-3,3),(3,3),(3,-3)] [(-3,-3),(-3,3),(3,3),(3,-3)]
, _twMaxRange = 150 , _twMaxRange = 150
, _twAccuracy = 30 , _twAccuracy = 30
, _itUse = Right $ const throwRemoteBomb , _itUse = RightUse $ const throwRemoteBomb
, _itUseModifiers = , _itUseModifiers =
[ hammerCheckI [ hammerCheckI
] ]
@@ -260,7 +260,7 @@ throwRemoteBomb cr w = setLocation
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE" resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTE"
removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> emptyBlank removePict = set (creatures . ix cid . crInv . ix j . itEquipPict) $ \ _ _ -> emptyBlank
resetFire = set (creatures . ix cid . crInv . ix j . itUse) resetFire = set (creatures . ix cid . crInv . ix j . itUse)
$ Right $ \_ -> explodeRemoteBomb itid i $ RightUse $ \_ -> explodeRemoteBomb itid i
p' = _crPos cr +.+ rotateV (_crDir cr) (V2 (_crRad cr) 0) p' = _crPos cr +.+ rotateV (_crDir cr) (V2 (_crRad cr) 0)
p | circOnSomeWall p' 4 w = _crPos cr +.+ rotateV (_crDir cr) (V2 (_crRad cr-4) 0) p | circOnSomeWall p' 4 w = _crPos cr +.+ rotateV (_crDir cr) (V2 (_crRad cr-4) 0)
| otherwise = p' | otherwise = p'
@@ -277,7 +277,7 @@ explodeRemoteBomb :: Int -> Int -> Creature -> World -> World
explodeRemoteBomb itid pjid cr w explodeRemoteBomb itid pjid cr w
= set (props . ix pjid . pjUpdate) (\_ -> retireRemoteBomb itid 30 pjid) = set (props . ix pjid . pjUpdate) (\_ -> retireRemoteBomb itid 30 pjid)
-- $ set (props . ix pjid . pjDraw) (\_ -> blank) -- $ set (props . ix pjid . pjDraw) (\_ -> blank)
$ set (creatures . ix cid . crInv . ix j . itUse) (Right $ \_ -> const id) $ set (creatures . ix cid . crInv . ix j . itUse) (RightUse $ \_ -> const id)
$ resetName $ resetName
$ resetPict $ resetPict
-- $ resetScope -- $ resetScope
@@ -305,7 +305,7 @@ retireRemoteBomb itid 0 pjid w = w
& pointToItem (_itemPositions w IM.! itid) %~ & pointToItem (_itemPositions w IM.! itid) %~
( (itAttachment . scopePos .~ V2 0 0) ( (itAttachment . scopePos .~ V2 0 0)
. (itZoom .~ defaultItZoom) . (itZoom .~ defaultItZoom)
. (itUse .~ (Right $ const throwRemoteBomb)) . (itUse .~ (RightUse $ const throwRemoteBomb))
) )
& props %~ IM.delete pjid & props %~ IM.delete pjid
retireRemoteBomb itid t pjid w = setScope w retireRemoteBomb itid t pjid w = setScope w
+5 -5
View File
@@ -43,7 +43,7 @@ launcher = defaultGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 20 , _itUseRate = 20
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right aRocketWithItemParams , _itUse = RightUse aRocketWithItemParams
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheckI
@@ -244,7 +244,7 @@ remoteLauncher = defaultGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 10 , _itUseRate = 10
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ const fireRemoteLauncher , _itUse = RightUse $ const fireRemoteLauncher
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
@@ -287,7 +287,7 @@ fireRemoteLauncher cr w = setLocation
newitid = IM.newKey $ _itemPositions w newitid = IM.newKey $ _itemPositions w
maybeitid = cr ^? crInv . ix j . itID . _Just maybeitid = cr ^? crInv . ix j . itID . _Just
resetFire = set (creatures . ix cid . crInv . ix j . itUse) resetFire = set (creatures . ix cid . crInv . ix j . itUse)
$ Right $ \_ _ -> explodeRemoteRocket itid i $ RightUse $ \_ _ -> explodeRemoteRocket itid i
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET" resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET"
setLocation :: World -> World setLocation :: World -> World
setLocation w' = case maybeitid of setLocation w' = case maybeitid of
@@ -347,7 +347,7 @@ explodeRemoteRocket
explodeRemoteRocket itid pjid w explodeRemoteRocket itid pjid w
= set (props . ix pjid . pjUpdate) (\_ -> retireRemoteRocket itid 30 pjid) = set (props . ix pjid . pjUpdate) (\_ -> retireRemoteRocket itid 30 pjid)
$ set (props . ix pjid . prDraw) (const mempty) $ set (props . ix pjid . prDraw) (const mempty)
$ set (itPoint . itUse) (Right $ \_ _ -> id) $ set (itPoint . itUse) (RightUse $ \_ _ -> id)
$ resetName $ resetName
$ makeExplosionAt (_pjPos (_props w IM.! pjid)) w $ makeExplosionAt (_pjPos (_props w IM.! pjid)) w
where where
@@ -379,7 +379,7 @@ remoteShellPic t
retireRemoteRocket :: Int -> Int -> Int -> World -> World retireRemoteRocket :: Int -> Int -> Int -> World -> World
retireRemoteRocket itid 0 pjid w = retireRemoteRocket itid 0 pjid w =
set (pointToItem (_itemPositions w IM.! itid) . itAttachment . scopePos) (V2 0 0) set (pointToItem (_itemPositions w IM.! itid) . itAttachment . scopePos) (V2 0 0)
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (Right $ const fireRemoteLauncher) $ set (pointToItem (_itemPositions w IM.! itid) . itUse) (RightUse $ const fireRemoteLauncher)
(w & props %~ IM.delete pjid) (w & props %~ IM.delete pjid)
retireRemoteRocket itid t pjid w = setScope w retireRemoteRocket itid t pjid w = setScope w
& props . ix pjid . pjUpdate .~ (\_ -> retireRemoteRocket itid (t-1) pjid) & props . ix pjid . pjUpdate .~ (\_ -> retireRemoteRocket itid (t-1) pjid)
+2 -2
View File
@@ -26,7 +26,7 @@ radar = defaultGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 120 , _itUseRate = 120
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ const aRadarPulse , _itUse = RightUse $ const aRadarPulse
, _itUseModifiers = , _itUseModifiers =
[ ammoUseCheckI [ ammoUseCheckI
] ]
@@ -51,7 +51,7 @@ sonar = defaultGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 120 , _itUseRate = 120
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ const aSonarPulse , _itUse = RightUse $ const aSonarPulse
, _itUseModifiers = , _itUseModifiers =
[ ammoUseCheckI [ ammoUseCheckI
] ]
+1 -1
View File
@@ -21,7 +21,7 @@ spawnGun cr = defaultGun
, _wpReloadTime = 80 , _wpReloadTime = 80
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 100 , _itUseRate = 100
, _itUse = Right $ \_ -> spawnCrNextTo cr , _itUse = RightUse $ \_ -> spawnCrNextTo cr
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
+2 -2
View File
@@ -40,7 +40,7 @@ poisonSprayer = defaultAutoGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 0 , _itUseRate = 0
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ const aGasCloud , _itUse = RightUse $ const aGasCloud
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheckI
@@ -66,7 +66,7 @@ flamer = defaultAutoGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 0 , _itUseRate = 0
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Right $ \_ -> randWalkAngle 0.2 0.01 aFlame , _itUse = RightUse $ \_ -> randWalkAngle 0.2 0.01 aFlame
, _itUseModifiers = , _itUseModifiers =
[ ammoUseCheckI [ ammoUseCheckI
, withSidePushI 5 , withSidePushI 5
+5 -5
View File
@@ -23,7 +23,7 @@ rewindGun = defaultGun
, _wpMaxAmmo = 0 , _wpMaxAmmo = 0
, _wpLoadedAmmo = 0 , _wpLoadedAmmo = 0
, _itEffect = ItRewindEffect rewindEffect [] , _itEffect = ItRewindEffect rewindEffect []
, _itUse = Left $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr , _itUse = LeftUse $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr
} }
rewindEffect :: ItEffect -> Creature -> Int -> World -> World rewindEffect :: ItEffect -> Creature -> Int -> World -> World
rewindEffect _ cr invid w rewindEffect _ cr invid w
@@ -59,7 +59,7 @@ shrinkGun = defaultGun
, _itUseRate = 0 , _itUseRate = 0
, _itUseTime = 0 , _itUseTime = 0
, _itAimStance = TwoHandFlat , _itAimStance = TwoHandFlat
, _itUse = Left $ \cr invid -> useShrinkGun (_crInv cr IM.! invid) cr , _itUse = LeftUse $ \cr invid -> useShrinkGun (_crInv cr IM.! invid) cr
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
@@ -96,7 +96,7 @@ blinkGun = defaultGun
, _wpReloadState = 0 , _wpReloadState = 0
, _itUseRate = 0 , _itUseRate = 0
, _itUseTime = 0 , _itUseTime = 0
, _itUse = Left $ hammerCheckL $ shootL aSelfL , _itUse = LeftUse $ hammerCheckL $ shootL aSelfL
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
@@ -118,12 +118,12 @@ aSelfL cr _ = blinkAction cr
effectGun :: String -> (Creature -> World -> World) -> Item effectGun :: String -> (Creature -> World -> World) -> Item
effectGun name eff = defaultGun effectGun name eff = defaultGun
{ _itName = name ++ "Gun" { _itName = name ++ "Gun"
, _itUse = Right $ const eff , _itUse = RightUse $ const eff
} }
autoEffectGun :: String -> (Creature -> World -> World) -> Item autoEffectGun :: String -> (Creature -> World -> World) -> Item
autoEffectGun name eff = defaultAutoGun autoEffectGun name eff = defaultAutoGun
{ _itName = name ++ "Gun" { _itName = name ++ "Gun"
, _itUse = Right $ const eff , _itUse = RightUse $ const eff
} }
forceFieldGun :: Item forceFieldGun :: Item
forceFieldGun = defaultGun forceFieldGun = defaultGun