Add rotation to scope in two torque functions
This commit is contained in:
@@ -601,6 +601,7 @@ torqueBeforeAtLeast minTorque exTorque feff item cr w
|
|||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
& cWorld . lWorld . creatures . ix cid . crDir +~ rot'
|
& cWorld . lWorld . creatures . ix cid . crDir +~ rot'
|
||||||
& wCam . camRot +~ rot'
|
& wCam . camRot +~ rot'
|
||||||
|
& rotateScope
|
||||||
| otherwise = feff item cr $ set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot') w
|
| otherwise = feff item cr $ set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot') w
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
@@ -608,19 +609,30 @@ torqueBeforeAtLeast minTorque exTorque feff item cr w
|
|||||||
rot'
|
rot'
|
||||||
| rot < 0 = rot - minTorque
|
| rot < 0 = rot - minTorque
|
||||||
| otherwise = rot + minTorque
|
| otherwise = rot + minTorque
|
||||||
|
rotateScope = fromMaybe id $ do
|
||||||
|
i <- yourScopeInvID w
|
||||||
|
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||||
|
|
||||||
-- | Rotate a randomly creature after applying an effect.
|
-- | Rotate a randomly creature after applying an effect.
|
||||||
withTorqueAfter :: ChainEffect
|
withTorqueAfter :: ChainEffect
|
||||||
withTorqueAfter feff item cr w
|
withTorqueAfter feff item cr w
|
||||||
-- | cid == 0 = rotateScope $ set randGen g $ over cameraRot (+rot) $ feff item cr w
|
-- | cid == 0 = rotateScope . set randGen g $ over (wCam . camRot) (+ rot) $ feff item cr w
|
||||||
| cid == 0 = rotateScope . set randGen g $ over (wCam . camRot) (+ rot) $ feff item cr w
|
-- | otherwise = set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) $ feff item cr w
|
||||||
| otherwise = set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ rot) $ feff item cr w
|
| cid == 0 = w
|
||||||
|
& feff item cr
|
||||||
|
& wCam . camRot +~ rot
|
||||||
|
& rotateScope
|
||||||
|
& randGen .~ g
|
||||||
|
| otherwise = w
|
||||||
|
& cWorld . lWorld . creatures . ix cid . crDir +~ rot
|
||||||
|
& randGen .~ g
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
(rot, g) = randomR (- torque, torque) $ _randGen w
|
(rot, g) = randomR (- torque, torque) $ _randGen w
|
||||||
torque = fromMaybe 0 $ item ^? itParams . torqueAfter
|
torque = fromMaybe 0 $ item ^? itParams . torqueAfter
|
||||||
|
rotateScope = fromMaybe id $ do
|
||||||
rotateScope = id
|
i <- yourScopeInvID w
|
||||||
|
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot
|
||||||
-- rotateScope = pointerYourItem . itScope . scopePos %~ rotateV rot
|
-- rotateScope = pointerYourItem . itScope . scopePos %~ rotateV rot
|
||||||
|
|
||||||
sideEffectOnFrame ::
|
sideEffectOnFrame ::
|
||||||
|
|||||||
Reference in New Issue
Block a user