From 105de0d1203de08aaf87c9ba2c93f9513211de59 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 26 Dec 2023 23:34:55 +0000 Subject: [PATCH] Add rotation to scope in two torque functions --- src/Dodge/Item/Weapon/TriggerType.hs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 8d6326e86..2c95909f2 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -601,6 +601,7 @@ torqueBeforeAtLeast minTorque exTorque 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 @@ -608,19 +609,30 @@ torqueBeforeAtLeast minTorque exTorque feff item cr w rot' | rot < 0 = 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. withTorqueAfter :: ChainEffect 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 - | otherwise = set randGen g $ over (cWorld . lWorld . creatures . ix cid . crDir) (+ 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 + | cid == 0 = w + & feff item cr + & wCam . camRot +~ rot + & rotateScope + & randGen .~ g + | otherwise = w + & cWorld . lWorld . creatures . ix cid . crDir +~ rot + & randGen .~ g where cid = _crID cr (rot, g) = randomR (- torque, torque) $ _randGen w torque = fromMaybe 0 $ item ^? itParams . torqueAfter - - rotateScope = id + rotateScope = fromMaybe id $ do + i <- yourScopeInvID w + return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot -- rotateScope = pointerYourItem . itScope . scopePos %~ rotateV rot sideEffectOnFrame ::