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