module Dodge.Item.Weapon.Remote ( setRemoteScope, setRemoteBombScope, ) where import Control.Lens import Dodge.Data.World import Dodge.Default import Geometry setRemoteBombScope :: Int -> Prop -> World -> World setRemoteBombScope itid pj w = case w ^?! cWorld . lWorld . itemLocations . ix itid of InInv cid invid -> w & cWorld . lWorld . creatures . ix cid . crInv . ix invid . itScope . scopePos .~ (_prPos pj -.- (w ^?! cWorld . lWorld . creatures . ix cid . crPos)) & cWorld . lWorld . creatures . ix cid . crInv . ix invid . itUse . heldAim . aimZoom .~ (defaultItZoom{_izMax = 0.5, _izMin = 0.5}) _ -> w setRemoteScope :: Int -> Point2 -> World -> World setRemoteScope itid pos w = case w ^? cWorld . lWorld . itemLocations . ix itid of Just (InInv cid' invid) -> w & cWorld . lWorld . creatures . ix cid' . crInv . ix invid . itScope . scopePos .~ (pos -.- (w ^?! cWorld . lWorld . creatures . ix cid' . crPos)) _ -> w