Add machine direction to turret direction
This commit is contained in:
@@ -1159,7 +1159,8 @@ mcShootLaser _ mc =
|
||||
shootLaser (MachinePrimarySound (_mcID mc)) (DamageLaser 11) 1 pos dir yellow
|
||||
where
|
||||
pos = _mcPos mc +.+ 20 *.* unitVectorAtAngle dir
|
||||
dir = mc ^?! mcType . mctTurret . tuDir
|
||||
dir = (mc ^?! mcType . mctTurret . tuDir)
|
||||
+ mc ^. mcDir
|
||||
|
||||
mcShootAuto :: Item -> Machine -> World -> World
|
||||
mcShootAuto itm mc w
|
||||
|
||||
@@ -21,7 +21,7 @@ import qualified Quaternion as Q
|
||||
|
||||
turretItemOffset :: Item -> Turret -> Machine -> Point3 -> Point3
|
||||
turretItemOffset it tu mc =
|
||||
rotate3 (_tuDir tu - _mcDir mc) . (+.+.+ V3 0 0 shoulderHeight)
|
||||
rotate3 (_tuDir tu + _mcDir mc) . (+.+.+ V3 0 0 shoulderHeight)
|
||||
. transToHandle it
|
||||
|
||||
transToHandle :: Item -> Point3 -> Point3
|
||||
|
||||
@@ -85,6 +85,7 @@ updateTurret rotSpeed mc w =
|
||||
-- (elecDams, dams) = partition isElectrical $ _mcDamage mc
|
||||
-- dam = sum $ map _dmAmount dams
|
||||
-- elecDam = sum $ map _dmAmount elecDams
|
||||
mcdir = _mcDir mc
|
||||
doTurn
|
||||
| seesYou =
|
||||
cWorld
|
||||
@@ -94,7 +95,7 @@ updateTurret rotSpeed mc w =
|
||||
. mcType
|
||||
. mctTurret
|
||||
. tuDir
|
||||
%~ turnTo rotSpeed mcpos ypos
|
||||
%~ ((subtract mcdir) . turnTo rotSpeed mcpos ypos . (+mcdir))
|
||||
| otherwise = id
|
||||
closeFireAngle = seesYou -- && angleVV (ypos -.- mcpos) (unitVectorAtAngle mcdir) < 1
|
||||
updateFiringStatus
|
||||
|
||||
@@ -30,9 +30,12 @@ damMatSideEffect dm = \case
|
||||
defDamageMaterial :: Damage -> ECW -> World -> (Int,World)
|
||||
defDamageMaterial dm _ = (dm ^. dmAmount,)
|
||||
|
||||
laserSpark x y -- = makeSpark FireSpark x y
|
||||
= id
|
||||
|
||||
damageStone :: Damage -> ECW -> World -> (Int,World)
|
||||
damageStone dm ecw w = case dm of
|
||||
Lasering _ p t -> f 0 $ makeSpark FireSpark (outTo p t) (rdir p t)
|
||||
Lasering _ p t -> f 0 $ laserSpark (outTo p t) (rdir p t)
|
||||
Piercing _ p t ->
|
||||
f dmam $ makeSpark NormalSpark (outTo p t) (rdir p t)
|
||||
. makeDustAt Stone 200 (addZ 20 (outTo p t))
|
||||
@@ -64,7 +67,7 @@ damageStone dm ecw w = case dm of
|
||||
|
||||
damageMetal :: Damage -> ECW -> World -> (Int,World)
|
||||
damageMetal dm ecw w = case dm of
|
||||
Lasering _ p t -> f 0 $ makeSpark FireSpark (outTo p t) (rdir p t)
|
||||
Lasering _ p t -> f 0 $ laserSpark (outTo p t) (rdir p t)
|
||||
Piercing _ p t -> f dmam $
|
||||
makeSpark NormalSpark (outTo p t) (rdir p t)
|
||||
. randsound p [tingS, ting1S, ting2S, ting3S, ting4S, ting5S]
|
||||
|
||||
+23
-12
@@ -172,25 +172,36 @@ lasCenRunClose' = do
|
||||
|
||||
lasCenRunClose :: (RandomGen g) => State g (MetaTree Room String)
|
||||
lasCenRunClose = do
|
||||
r <-
|
||||
roomRectAutoLights 250 250
|
||||
a <- takeOne [3*pi/2]--,pi/4]
|
||||
laspos <- takeOne [V2 60 190, V2 65 185]
|
||||
r <- shuffleLinks =<<
|
||||
(roomRectAutoLights 250 250
|
||||
<&> rmPmnts
|
||||
<>~ [ putLasTurret 0.02 & plSpot .~ PS (V2 220 20) 0
|
||||
, inlinkwall 70 (rectNSWE 10 (-10) (-10) 30)
|
||||
, inlinkwall 125 (rectNSWE 55 (-55) (-10) 10)
|
||||
, inlinkwall 180 (rectNSWE 10 (-10) (-30) 10)
|
||||
, outlinkwall 70 (rectNSWE 10 (-10) (-30) 10)
|
||||
, outlinkwall 125 (rectNSWE 55 (-55) (-10) 10)
|
||||
, outlinkwall 180 (rectNSWE 10 (-10) (-10) 30)
|
||||
<>~ [ putLasTurret 0.02 & plSpot .~ PS laspos a
|
||||
-- <>~ [ putLasTurret 0.02 & plSpot .~ PS (V2 65 185) 0
|
||||
-- <>~ [ putLasTurret 0.02 & plSpot .~ PS (V2 70 180) 0
|
||||
, awall (V2 35 100) (rectWH 10 60) -- (rectNSWE 80 (-40) (-30) (-10))
|
||||
, awall (V2 150 215) (rectWH 60 10) -- (rectNSWE 80 (-40) (-30) (-10))
|
||||
]
|
||||
<&> rmLinks %~ setInLinks (memtest (FromEdge West 0) (OnEdge South))
|
||||
<&> rmLinks %~ setOutLinks (memtest (FromEdge East 0) (OnEdge North))
|
||||
<&> rmLinks %~ setInLinks
|
||||
(etest
|
||||
(memtest (FromEdge West 0) (OnEdge South))
|
||||
(memtest (FromEdge South 0) (OnEdge West))
|
||||
)
|
||||
<&> rmLinks %~ setOutLinks
|
||||
(etest
|
||||
(memtest (FromEdge East 0) (OnEdge North))
|
||||
(memtest (FromEdge North 0) (OnEdge East))
|
||||
)
|
||||
)
|
||||
rToOnward "lasCenRunClose" $ return $ cleatOnward r
|
||||
where
|
||||
awall x v = heightWallPS (PS x 0) 30 v
|
||||
etest f g x = f x || g x
|
||||
memtest a b x = let y = _rlType x
|
||||
in a `S.member` y && b `S.member` y
|
||||
linkwall f x = heightWallPS
|
||||
(resetPLUse $ rprBoolShift (const . f) (shiftInBy x <&> (,S.singleton UsedPosLow)))
|
||||
(resetPLUse $ rprBoolShift (const . f) (shiftByV2 x <&> (,S.singleton UsedPosLow)))
|
||||
30
|
||||
inlinkwall = linkwall isInLnk
|
||||
outlinkwall = linkwall isOutLnk
|
||||
|
||||
@@ -32,7 +32,8 @@ import Data.Foldable
|
||||
import Data.Monoid
|
||||
|
||||
testStringInit :: Universe -> [String]
|
||||
testStringInit _ = mempty
|
||||
testStringInit _ = []
|
||||
--testStringInit u = map show (u ^.. uvWorld . cWorld . lWorld . machines . traverse . mcDir)
|
||||
--testStringInit u = map show
|
||||
-- (u ^.. uvWorld . cWorld . lWorld . machines . traverse .mcType . _McDistributer)
|
||||
-- <>
|
||||
|
||||
Reference in New Issue
Block a user