Add sweep to laser turret
This commit is contained in:
@@ -67,24 +67,15 @@ updateTurret rotSpeed mc w =
|
|||||||
. ix mcid
|
. ix mcid
|
||||||
. mcType
|
. mcType
|
||||||
. mctTurretStun %~ (max 0 . subtract 1)
|
. mctTurretStun %~ (max 0 . subtract 1)
|
||||||
-- dodamage =
|
|
||||||
-- cWorld
|
|
||||||
-- . lWorld
|
|
||||||
-- . machines
|
|
||||||
-- . ix mcid
|
|
||||||
-- %~ ( (mcDamage .~ [Electrical (min 2500 $ max 0 (elecDam - 10))])
|
|
||||||
-- . (mcHP -~ dam)
|
|
||||||
-- )
|
|
||||||
elecDamBranch
|
elecDamBranch
|
||||||
| mc ^?! mcType . mctTurretStun < 1 = updateFiringStatus . doTurn
|
| mc ^?! mcType . mctTurretStun < 1 = updateFiringStatus . doTurn
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
mcid = _mcID mc
|
mcid = _mcID mc
|
||||||
ypos = you w ^. crPos . _xy
|
ypos = you w ^. crPos . _xy
|
||||||
|
aimpos = ypos + offset * vNormal (normalize (ypos - mcpos))
|
||||||
|
offset = 10 * sin (fromIntegral (w ^. cWorld . cClock) / (pi * 10))
|
||||||
mcpos = _mcPos mc
|
mcpos = _mcPos mc
|
||||||
seesYou = hasLOSIndirect mcpos ypos w
|
seesYou = hasLOSIndirect mcpos ypos w
|
||||||
-- (elecDams, dams) = partition isElectrical $ _mcDamage mc
|
|
||||||
-- dam = sum $ map _dmAmount dams
|
|
||||||
-- elecDam = sum $ map _dmAmount elecDams
|
|
||||||
mcdir = _mcDir mc
|
mcdir = _mcDir mc
|
||||||
doTurn
|
doTurn
|
||||||
| seesYou =
|
| seesYou =
|
||||||
@@ -95,7 +86,7 @@ updateTurret rotSpeed mc w =
|
|||||||
. mcType
|
. mcType
|
||||||
. mctTurret
|
. mctTurret
|
||||||
. tuDir
|
. tuDir
|
||||||
%~ ((subtract mcdir) . turnTo rotSpeed mcpos ypos . (+mcdir))
|
%~ ((subtract mcdir) . turnTo rotSpeed mcpos aimpos . (+mcdir))
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
closeFireAngle = seesYou -- && angleVV (ypos -.- mcpos) (unitVectorAtAngle mcdir) < 1
|
closeFireAngle = seesYou -- && angleVV (ypos -.- mcpos) (unitVectorAtAngle mcdir) < 1
|
||||||
updateFiringStatus
|
updateFiringStatus
|
||||||
@@ -111,11 +102,6 @@ updateTurret rotSpeed mc w =
|
|||||||
. tuFireTime
|
. tuFireTime
|
||||||
%~ (max 0 . subtract 1)
|
%~ (max 0 . subtract 1)
|
||||||
|
|
||||||
--isElectrical :: Damage -> Bool
|
|
||||||
--isElectrical dm = case dm of
|
|
||||||
-- Electrical{} -> True
|
|
||||||
-- _ -> False
|
|
||||||
|
|
||||||
mcUseItem :: Machine -> World -> World
|
mcUseItem :: Machine -> World -> World
|
||||||
mcUseItem mc w = fromMaybe w $ do
|
mcUseItem mc w = fromMaybe w $ do
|
||||||
tu <- mc ^? mcType . mctTurret
|
tu <- mc ^? mcType . mctTurret
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ tutAnoTree = do
|
|||||||
-- , return . tToBTree "door" $ treePost [corridor, cleatOnward door]
|
-- , return . tToBTree "door" $ treePost [corridor, cleatOnward door]
|
||||||
, corDoor
|
, corDoor
|
||||||
-- , tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
|
-- , tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
|
||||||
, lasCenRunClose
|
, lasCenRunClose'
|
||||||
-- , passthroughLockKeyLists lockRoomKeyItems itemRooms
|
-- , passthroughLockKeyLists lockRoomKeyItems itemRooms
|
||||||
, tToBTree "door" . return <$> return (cleatOnward door)
|
, tToBTree "door" . return <$> return (cleatOnward door)
|
||||||
, tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
|
, tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
|
||||||
|
|||||||
Reference in New Issue
Block a user