Add rotate to scope for (hopefully) all torque functions
This commit is contained in:
@@ -580,10 +580,14 @@ torqueBefore torque feff item cr w
|
||||
& randGen .~ g
|
||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||
& wCam . camRot +~ rot
|
||||
& rotateScope
|
||||
| otherwise = feff item cr $ set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) w
|
||||
where
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
rotateScope = fromMaybe id $ do
|
||||
i <- yourScopeInvID w
|
||||
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
|
||||
{- | Rotates a creature with minimum rotation
|
||||
Rotates the player creature before applying the effect, other creatures after.
|
||||
@@ -645,11 +649,14 @@ sideEffectOnFrame i sf f it cr w =
|
||||
|
||||
torqueSideEffect :: Float -> Item -> Creature -> World -> World
|
||||
torqueSideEffect torque _ cr w
|
||||
| cid == 0 = set randGen g $ over (wCam . camRot) (+ rot) w
|
||||
| cid == 0 = set randGen g . rotateScope $ over (wCam . camRot) (+ rot) w
|
||||
| otherwise = set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) w
|
||||
where
|
||||
cid = _crID cr
|
||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||
rotateScope = fromMaybe id $ do
|
||||
i <- yourScopeInvID w
|
||||
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||
|
||||
-- pump the updated creature into the chain in later frames
|
||||
repeatOnFrames :: [Int] -> HeldMod -> ChainEffect
|
||||
|
||||
Reference in New Issue
Block a user