Add sweep to laser turret

This commit is contained in:
2026-03-16 12:13:37 +00:00
parent 1af6148615
commit 8d4efb1f8e
2 changed files with 4 additions and 18 deletions
+3 -17
View File
@@ -67,24 +67,15 @@ updateTurret rotSpeed mc w =
. ix mcid
. mcType
. mctTurretStun %~ (max 0 . subtract 1)
-- dodamage =
-- cWorld
-- . lWorld
-- . machines
-- . ix mcid
-- %~ ( (mcDamage .~ [Electrical (min 2500 $ max 0 (elecDam - 10))])
-- . (mcHP -~ dam)
-- )
elecDamBranch
| mc ^?! mcType . mctTurretStun < 1 = updateFiringStatus . doTurn
| otherwise = id
mcid = _mcID mc
ypos = you w ^. crPos . _xy
aimpos = ypos + offset * vNormal (normalize (ypos - mcpos))
offset = 10 * sin (fromIntegral (w ^. cWorld . cClock) / (pi * 10))
mcpos = _mcPos mc
seesYou = hasLOSIndirect mcpos ypos w
-- (elecDams, dams) = partition isElectrical $ _mcDamage mc
-- dam = sum $ map _dmAmount dams
-- elecDam = sum $ map _dmAmount elecDams
mcdir = _mcDir mc
doTurn
| seesYou =
@@ -95,7 +86,7 @@ updateTurret rotSpeed mc w =
. mcType
. mctTurret
. tuDir
%~ ((subtract mcdir) . turnTo rotSpeed mcpos ypos . (+mcdir))
%~ ((subtract mcdir) . turnTo rotSpeed mcpos aimpos . (+mcdir))
| otherwise = id
closeFireAngle = seesYou -- && angleVV (ypos -.- mcpos) (unitVectorAtAngle mcdir) < 1
updateFiringStatus
@@ -111,11 +102,6 @@ updateTurret rotSpeed mc w =
. tuFireTime
%~ (max 0 . subtract 1)
--isElectrical :: Damage -> Bool
--isElectrical dm = case dm of
-- Electrical{} -> True
-- _ -> False
mcUseItem :: Machine -> World -> World
mcUseItem mc w = fromMaybe w $ do
tu <- mc ^? mcType . mctTurret
+1 -1
View File
@@ -55,7 +55,7 @@ tutAnoTree = do
-- , return . tToBTree "door" $ treePost [corridor, cleatOnward door]
, corDoor
-- , tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)
, lasCenRunClose
, lasCenRunClose'
-- , passthroughLockKeyLists lockRoomKeyItems itemRooms
, tToBTree "door" . return <$> return (cleatOnward door)
, tToBTree "cor" . return <$> shuffleLinks (cleatOnward corridor)