Implement tracking rockets
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
module Dodge.Item.Weapon.Remote
|
||||
( pointToItem
|
||||
, retireRemoteProj
|
||||
, setRemoteScope
|
||||
, setRemoteBombScope
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Geometry
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -31,3 +34,19 @@ retireRemoteProj resetFire itid t pjid w = setScope w
|
||||
. scopePos .~ (pos -.- _crPos (_creatures w' IM.! cid))
|
||||
_ -> w'
|
||||
pos = fromMaybe (V2 0 0) $ w ^? props . ix pjid . pjPos
|
||||
|
||||
setRemoteBombScope :: Int -> Prop -> World -> World
|
||||
setRemoteBombScope itid pj w' = case _itemPositions w' IM.! itid of
|
||||
InInv cid invid
|
||||
-> w' & creatures . ix cid . crInv . ix invid . itScope
|
||||
. scopePos .~ (_pjPos pj -.- _crPos (_creatures w' IM.! cid))
|
||||
& creatures . ix cid . crInv . ix invid . itUse . useAim . aimZoom
|
||||
.~ (defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5})
|
||||
_ -> w'
|
||||
|
||||
setRemoteScope :: Int -> Prop -> World -> World
|
||||
setRemoteScope itid pj w' = case w' ^? itemPositions . ix itid of
|
||||
Just (InInv cid' invid )
|
||||
-> w' & creatures . ix cid' . crInv . ix invid . itScope
|
||||
. scopePos .~ (_pjPos pj -.- _crPos (_creatures w' IM.! cid'))
|
||||
_ -> w'
|
||||
|
||||
Reference in New Issue
Block a user