Refactor shells
This commit is contained in:
@@ -39,8 +39,8 @@ upProjectile pu pj = case pu of
|
||||
StartSpinPU t cid spinamount
|
||||
| time == t -> trySpinByCID cid spinamount pj
|
||||
| otherwise -> id
|
||||
RemoteDirectionPU st et mscreenid
|
||||
| act st et -> pjRemoteSetDirection mscreenid pj
|
||||
RemoteDirectionPU st et
|
||||
| act st et -> pjRemoteSetDirection (pj ^? prjType . rocketHoming) pj
|
||||
| otherwise -> id
|
||||
ReduceSpinPU x -> reduceSpinBy x (_prjID pj)
|
||||
DestroyPU mitid 0 -> destroyProjectile mitid (_prjID pj)
|
||||
@@ -156,14 +156,14 @@ trySpinByCID cid i pj w = w & cWorld . lWorld . projectiles . ix pjid . prjSpin
|
||||
spinFactor = 5 * (6 - fromIntegral i)
|
||||
|
||||
-- note this only allows YOU to remotely track projectiles
|
||||
pjRemoteSetDirection :: ProjectileHoming -> Projectile -> World -> World
|
||||
pjRemoteSetDirection :: Maybe ProjectileHoming -> Projectile -> World -> World
|
||||
pjRemoteSetDirection ph pj w = case ph of
|
||||
HomeUsingRemoteScreen screenid
|
||||
Just (HomeUsingRemoteScreen screenid)
|
||||
| lw ^? creatures . ix 0 . crManipulation . manObject . imSelectedItem
|
||||
== lw ^? itemLocations . ix (_unNInt screenid) . ilInvID ->
|
||||
w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjDir
|
||||
.~ (w ^. wCam . camRot) + argV (w ^. input . mousePos)
|
||||
HomeUsingTargeting itid
|
||||
Just (HomeUsingTargeting itid)
|
||||
| Just tp <- w ^? pointerToItemID itid . itTargeting . itTgPos . _Just ->
|
||||
w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjDir
|
||||
%~ turnTo 0.2 (_prjPos pj) tp
|
||||
@@ -171,16 +171,6 @@ pjRemoteSetDirection ph pj w = case ph of
|
||||
where
|
||||
lw = w ^. cWorld . lWorld
|
||||
|
||||
--pjRemoteSetDirection mscreenid pj w = fromMaybe w $ do
|
||||
-- screenid <- fmap _unNInt mscreenid
|
||||
-- let newdir
|
||||
-- | w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem
|
||||
-- == w ^? cWorld . lWorld . itemLocations . ix screenid . ilInvID
|
||||
-- = (w ^. wCam . camRot) + argV (_mousePos (_input w))
|
||||
-- | otherwise = _prjDir pj
|
||||
-- turntonewdir = magV (_prjAcc pj) *.* unitVectorAtAngle newdir
|
||||
-- return $ w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc .~ turntonewdir
|
||||
|
||||
reduceSpinBy :: Float -> Int -> World -> World
|
||||
reduceSpinBy x pjid = cWorld . lWorld . projectiles . ix pjid . prjSpin *~ x
|
||||
|
||||
@@ -189,7 +179,6 @@ decTimMvVel pj =
|
||||
cWorld . lWorld . projectiles . ix pjid
|
||||
%~ ( (prjTimer -~ 1)
|
||||
. (prjPos %~ (+.+ vel))
|
||||
-- . (prjAcc %~ rotateV rot)
|
||||
. (prjDir +~ rot)
|
||||
)
|
||||
where
|
||||
@@ -207,7 +196,7 @@ explodeShell ::
|
||||
explodeShell controlid mdetid screenid pj w =
|
||||
w
|
||||
& cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [DestroyPU screenid 30]
|
||||
& cWorld . lWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile
|
||||
-- & cWorld . lWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile
|
||||
& usePayload (_prjPayload pj) (_prjPos pj) (_prjVel pj)
|
||||
& stopSoundFrom (ShellSound pjid)
|
||||
& updatedetonator
|
||||
|
||||
Reference in New Issue
Block a user