Move towards moving muzzles out of records
This commit is contained in:
+39
-17
@@ -107,7 +107,7 @@ hammerCheck f pt it cr
|
||||
-- it -- & ldtValue . itUse . heldParams . weaponRepeat .~ []
|
||||
-- & ldtValue . itUse . heldFrame .~ x
|
||||
|
||||
g x = (x, WdWdBurstFireRepeats (_crID cr) (it ^?! ldtValue . itLocation . ilInvID))
|
||||
g x = (x, WdWdBurstFireRepetition (_crID cr) (it ^?! ldtValue . itLocation . ilInvID))
|
||||
|
||||
-- | Applies a world effect after an item use cooldown check.
|
||||
useTimeCheck :: ChainEffect
|
||||
@@ -136,26 +136,26 @@ useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
|
||||
|
||||
heldEffectMuzzles :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
heldEffectMuzzles t cr w =
|
||||
doHeldUseEffect t cr $
|
||||
uncurry (applyCME (_ldtValue t) cr) cmew
|
||||
doHeldUseEffect t cr .
|
||||
uncurry (applyCME (_ldtValue t) cr) .
|
||||
foldl' (useLoadedAmmo t cr) (CME 0 0 False, w) $ zip [0 ..] loadedmuzzles
|
||||
where
|
||||
-- & doWeaponRepetitions upitm cr
|
||||
|
||||
muzzles = t ^. ldtValue . itUse . heldMuzzles
|
||||
--(upitm, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
|
||||
(_, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
|
||||
cmew = foldl' (useLoadedAmmo t cr) (CME 0 0 False, w) $ zip [0 ..] loadedmuzzles
|
||||
|
||||
doHeldUseEffect :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
doHeldUseEffect t cr w = case t ^? ldtValue . itUse . heldUseEffect of
|
||||
Just (RandomiseMuzzleFrames x) -> fromMaybe w $ do
|
||||
doHeldUseEffect t cr w = case t ^. ldtValue . itType of
|
||||
HELD (VOLLEYGUN x) -> fromMaybe w $ do
|
||||
i <- t ^? ldtValue . itLocation . ilInvID
|
||||
let g = w ^. randGen
|
||||
(is, g') = runState (shuffle [0 .. x -1]) g
|
||||
return $
|
||||
w & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i . itUse . heldMuzzles %~ zipWith (\j mz -> mz & mzFrame .~ j) is
|
||||
& randGen .~ g'
|
||||
Just SwitchAlteRifle -> fromMaybe w $ do
|
||||
HELD ALTERIFLE -> fromMaybe w $ do
|
||||
i <- t ^? ldtValue . itLocation . ilInvID
|
||||
return $
|
||||
w
|
||||
@@ -165,8 +165,27 @@ doHeldUseEffect t cr w = case t ^? ldtValue . itUse . heldUseEffect of
|
||||
. ix 0
|
||||
. mzAmmoSlot
|
||||
%~ ((`mod` 2) . (+ 1))
|
||||
Just NoHeldUseEffect -> w
|
||||
Nothing -> w
|
||||
_ -> w
|
||||
--doHeldUseEffect t cr w = case t ^? ldtValue . itUse . heldUseEffect of
|
||||
-- Just (RandomiseMuzzleFrames x) -> fromMaybe w $ do
|
||||
-- i <- t ^? ldtValue . itLocation . ilInvID
|
||||
-- let g = w ^. randGen
|
||||
-- (is, g') = runState (shuffle [0 .. x -1]) g
|
||||
-- return $
|
||||
-- w & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i . itUse . heldMuzzles %~ zipWith (\j mz -> mz & mzFrame .~ j) is
|
||||
-- & randGen .~ g'
|
||||
-- Just SwitchAlteRifle -> fromMaybe w $ do
|
||||
-- i <- t ^? ldtValue . itLocation . ilInvID
|
||||
-- return $
|
||||
-- w
|
||||
-- & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i
|
||||
-- . itUse
|
||||
-- . heldMuzzles
|
||||
-- . ix 0
|
||||
-- . mzAmmoSlot
|
||||
-- %~ ((`mod` 2) . (+ 1))
|
||||
-- Just NoHeldUseEffect -> w
|
||||
-- Nothing -> w
|
||||
|
||||
---- need to be careful about inventory lock or item ids here
|
||||
--doWeaponRepetitions :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
@@ -603,19 +622,21 @@ walkNozzle mzid mz itm cr w = fromMaybe w $ do
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crInv
|
||||
. ix invid
|
||||
. itUse
|
||||
. heldMuzzles
|
||||
. ix mzid
|
||||
. mzEffect
|
||||
. nzCurrentWalkAngle
|
||||
.~ wa
|
||||
. itParams . nzAngle %~ f
|
||||
-- . itUse
|
||||
-- . heldMuzzles
|
||||
-- . ix mzid
|
||||
-- . mzEffect
|
||||
-- . nzCurrentWalkAngle
|
||||
-- .~ wa
|
||||
& randGen .~ g
|
||||
where
|
||||
nz = _mzEffect mz
|
||||
(walkamount, g) = randomR (- aspeed, aspeed) (_randGen w)
|
||||
aspeed = _nzWalkSpeed nz
|
||||
maxa = _nzMaxWalkAngle nz
|
||||
wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
|
||||
f x = min maxa $ max (negate maxa) (x + walkamount)
|
||||
-- wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
|
||||
|
||||
shootTractorBeam :: Creature -> World -> World
|
||||
shootTractorBeam cr w =
|
||||
@@ -935,7 +956,8 @@ useGasParams mmagid mz itm cr w =
|
||||
pos = _crPos cr + rotateV (_crDir cr) moff
|
||||
(a, g') = randomR (- inacc, inacc) g
|
||||
inacc = _mzInaccuracy mz
|
||||
dir = _crDir cr + mrot + a + _nzCurrentWalkAngle (_mzEffect mz)
|
||||
--dir = _crDir cr + mrot + a + _nzCurrentWalkAngle (_mzEffect mz)
|
||||
dir = _crDir cr + mrot + a + _nzAngle (_itParams itm)
|
||||
|
||||
gasType :: HeldItemType -> GasFuel -> Maybe GasCreate
|
||||
gasType hit _ = case hit of
|
||||
|
||||
Reference in New Issue
Block a user