Cleanup
This commit is contained in:
@@ -56,7 +56,7 @@ activateDetonator det _ w = foldl' remoteDetonate w
|
|||||||
|
|
||||||
remoteDetonate :: World -> Int -> World
|
remoteDetonate :: World -> Int -> World
|
||||||
remoteDetonate w pjid = w
|
remoteDetonate w pjid = w
|
||||||
& cWorld . lWorld . projectiles . ix pjid . prjTimer .~ 0
|
& cWorld . lWorld . projectiles . ix pjid . pjTimer .~ 0
|
||||||
|
|
||||||
useLocation :: LocationLDT ItemLink ComposedItem -> UseFocus
|
useLocation :: LocationLDT ItemLink ComposedItem -> UseFocus
|
||||||
useLocation loc
|
useLocation loc
|
||||||
|
|||||||
@@ -15,17 +15,17 @@ import Geometry.Data
|
|||||||
|
|
||||||
data Projectile
|
data Projectile
|
||||||
= Shell
|
= Shell
|
||||||
{ _prjPos :: Point2
|
{ _pjPos :: Point2
|
||||||
, _prjVel :: Point2
|
, _pjVel :: Point2
|
||||||
, _prjDir :: Float
|
, _pjDir :: Float
|
||||||
, _prjSpin :: Float
|
, _pjSpin :: Float
|
||||||
, _prjID :: Int
|
, _pjID :: Int
|
||||||
, _prjPayload :: Payload
|
, _pjPayload :: Payload
|
||||||
, _prjTimer :: Int
|
, _pjTimer :: Int
|
||||||
, _prjZ :: Float
|
, _pjZ :: Float
|
||||||
, _prjZVel :: Float
|
, _pjZVel :: Float
|
||||||
, _prjUpdates :: [ProjectileUpdate]
|
, _pjUpdates :: [ProjectileUpdate]
|
||||||
, _prjType :: ProjectileType
|
, _pjType :: ProjectileType
|
||||||
}
|
}
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
|||||||
+8
-11
@@ -299,8 +299,8 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
|
|||||||
MuzzleLaser -> shootLaser itmtree cr mz w
|
MuzzleLaser -> shootLaser itmtree cr mz w
|
||||||
MuzzleTesla -> shootTeslaArc itm cr mz w
|
MuzzleTesla -> shootTeslaArc itm cr mz w
|
||||||
MuzzleTractor -> shootTractorBeam cr w
|
MuzzleTractor -> shootTractorBeam cr w
|
||||||
MuzzleRLauncher -> createProjectileR magtree mz itmtree cr w
|
MuzzleRLauncher -> createProjectileR itmtree magtree mz cr w
|
||||||
MuzzleGLauncher -> createProjectile Grenade magtree mz itmtree cr w
|
MuzzleGLauncher -> createProjectile Grenade magtree mz cr w
|
||||||
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
|
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
|
||||||
MuzzleShatter -> shootShatter itm cr w
|
MuzzleShatter -> shootShatter itm cr w
|
||||||
MuzzleDetector -> itemDetectorEffect itm cr w
|
MuzzleDetector -> itemDetectorEffect itm cr w
|
||||||
@@ -608,17 +608,17 @@ determineProjectileTracking magtree itmtree = fromMaybe NoHoming $
|
|||||||
|
|
||||||
createProjectileR ::
|
createProjectileR ::
|
||||||
LabelDoubleTree ComposeLinkType Item ->
|
LabelDoubleTree ComposeLinkType Item ->
|
||||||
Muzzle ->
|
|
||||||
LabelDoubleTree ComposeLinkType Item ->
|
LabelDoubleTree ComposeLinkType Item ->
|
||||||
|
Muzzle ->
|
||||||
Creature ->
|
Creature ->
|
||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
createProjectileR magtree muz itmtree =
|
createProjectileR itmtree magtree =
|
||||||
createProjectile
|
createProjectile
|
||||||
(Rocket
|
(Rocket
|
||||||
(determineProjectileTracking magtree itmtree)
|
(determineProjectileTracking magtree itmtree)
|
||||||
smoke
|
smoke
|
||||||
) magtree muz itmtree
|
) magtree
|
||||||
where
|
where
|
||||||
smoke
|
smoke
|
||||||
| isJust $ lookup SmokeReducerLink (magtree ^. ldtLeft) = Just ReducedRocketSmoke
|
| isJust $ lookup SmokeReducerLink (magtree ^. ldtLeft) = Just ReducedRocketSmoke
|
||||||
@@ -628,23 +628,20 @@ createProjectile ::
|
|||||||
ProjectileType ->
|
ProjectileType ->
|
||||||
LabelDoubleTree ComposeLinkType Item ->
|
LabelDoubleTree ComposeLinkType Item ->
|
||||||
Muzzle ->
|
Muzzle ->
|
||||||
LabelDoubleTree ComposeLinkType Item ->
|
|
||||||
Creature ->
|
Creature ->
|
||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
createProjectile pjtype magtree muz itmtree cr = fromMaybe failsound $ do
|
createProjectile pjtype magtree muz cr = fromMaybe failsound $ do
|
||||||
magid <- magtree ^? ldtValue . itLocation . ilInvID
|
magid <- magtree ^? ldtValue . itLocation . ilInvID
|
||||||
ammoitem <- cr ^? crInv . ix magid
|
ammoitem <- cr ^? crInv . ix magid
|
||||||
let homing = determineProjectileTracking magtree itmtree
|
let rdetonate = (^. ldtValue . itID) <$>
|
||||||
rdetonate = (^. ldtValue . itID) <$>
|
|
||||||
lookup RemoteDetonatorLink (magtree ^. ldtLeft)
|
lookup RemoteDetonatorLink (magtree ^. ldtLeft)
|
||||||
rscreen = (^. ldtValue . itID) <$>
|
rscreen = (^. ldtValue . itID) <$>
|
||||||
lookup RemoteScreenLink (magtree ^. ldtLeft)
|
lookup RemoteScreenLink (magtree ^. ldtLeft)
|
||||||
aparams <- ((magtree ^? ldtLeft) >>= lookup AmmoPayloadLink >>= (^? ldtValue . itType . ibtAttach . shellPayload))
|
aparams <- ((magtree ^? ldtLeft) >>= lookup AmmoPayloadLink >>= (^? ldtValue . itType . ibtAttach . shellPayload))
|
||||||
<|> ammoitem ^? itConsumables . magParams . ampPayload
|
<|> ammoitem ^? itConsumables . magParams . ampPayload
|
||||||
return $
|
return $
|
||||||
--createShell homing rdetonate rscreen issmokeless pjtype aparams muz cr
|
createShell rdetonate rscreen pjtype aparams muz cr
|
||||||
createShell homing rdetonate rscreen pjtype aparams muz cr
|
|
||||||
. startthesound
|
. startthesound
|
||||||
where
|
where
|
||||||
-- the sound should be moved to the projectile firing
|
-- the sound should be moved to the projectile firing
|
||||||
|
|||||||
@@ -13,36 +13,32 @@ import qualified IntMapHelp as IM
|
|||||||
import LensHelp
|
import LensHelp
|
||||||
|
|
||||||
-- assumes the mscreen is in your inventory
|
-- assumes the mscreen is in your inventory
|
||||||
createShell :: RocketHoming
|
createShell ::Maybe (NewInt ItmInt)
|
||||||
-> Maybe (NewInt ItmInt)
|
-> Maybe (NewInt ItmInt)
|
||||||
-> Maybe (NewInt ItmInt)
|
|
||||||
-- -> Bool
|
|
||||||
-> ProjectileType
|
-> ProjectileType
|
||||||
-> Payload -> Muzzle -> Creature -> World -> World
|
-> Payload -> Muzzle -> Creature -> World -> World
|
||||||
--createShell homing mdetonator mscreen smokestatus pjtype payload muz cr w = w
|
createShell mdetonator mscreen pjtype payload muz cr w = w
|
||||||
createShell homing mdetonator mscreen pjtype payload muz cr w = w
|
|
||||||
& updatescreen
|
& updatescreen
|
||||||
& updatedetonator
|
& updatedetonator
|
||||||
& cWorld . lWorld . projectiles . at i
|
& cWorld . lWorld . projectiles . at i
|
||||||
?~ Shell
|
?~ Shell
|
||||||
{ _prjPos = pos
|
{ _pjPos = pos
|
||||||
, _prjZ = 20
|
, _pjZ = 20
|
||||||
, _prjZVel = 5
|
, _pjZVel = 5
|
||||||
, _prjVel = rotateV dir (V2 speed 0) + cr ^. crPos - cr ^. crOldPos
|
, _pjVel = rotateV dir (V2 speed 0) + cr ^. crPos - cr ^. crOldPos
|
||||||
, _prjID = i
|
, _pjID = i
|
||||||
-- , _prjAcc = rotateV dir (V2 3 0)
|
, _pjDir = dir
|
||||||
, _prjDir = dir
|
, _pjSpin = 0
|
||||||
, _prjSpin = 0
|
, _pjPayload = payload
|
||||||
, _prjPayload = payload
|
, _pjTimer = lifespan
|
||||||
, _prjTimer = lifespan
|
, _pjUpdates =
|
||||||
, _prjUpdates =
|
|
||||||
[ CollisionEffectPU mdetonator mscreen
|
[ CollisionEffectPU mdetonator mscreen
|
||||||
, TimePU
|
, TimePU
|
||||||
, StartSpinPU (lifespan - 15) (_crID cr) spinamount
|
, StartSpinPU (lifespan - 15) (_crID cr) spinamount
|
||||||
, RemoteDirectionPU (lifespan - thrustdelay) 0
|
, RemoteDirectionPU (lifespan - thrustdelay) 0
|
||||||
, ReduceSpinPU (1 - spindrag * 2 / 200)
|
, ReduceSpinPU (1 - spindrag * 2 / 200)
|
||||||
] <> thrustorgrav
|
] <> thrustorgrav
|
||||||
, _prjType = pjtype
|
, _pjType = pjtype
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
speed = case pjtype of
|
speed = case pjtype of
|
||||||
|
|||||||
@@ -13,18 +13,18 @@ import ShapePicture
|
|||||||
|
|
||||||
drawProjectile :: Projectile -> SPic
|
drawProjectile :: Projectile -> SPic
|
||||||
drawProjectile pj
|
drawProjectile pj
|
||||||
| Just DestroyPU{} <- pj ^? prjUpdates . ix 0 = mempty
|
| Just DestroyPU{} <- pj ^? pjUpdates . ix 0 = mempty
|
||||||
| Just NoHoming <- pj ^? prjType . rkHoming =
|
| Just NoHoming <- pj ^? pjType . rkHoming =
|
||||||
drawShell Nothing pj
|
drawShell Nothing pj
|
||||||
| Just _ <- pj ^? prjType . rkHoming =
|
| Just _ <- pj ^? pjType . rkHoming =
|
||||||
drawRemoteShell pj
|
drawRemoteShell pj
|
||||||
| otherwise = drawShell Nothing pj
|
| otherwise = drawShell Nothing pj
|
||||||
|
|
||||||
drawShell :: Maybe Color -> Projectile -> SPic
|
drawShell :: Maybe Color -> Projectile -> SPic
|
||||||
drawShell mcol pj =
|
drawShell mcol pj =
|
||||||
translateSPz (_prjZ pj)
|
translateSPz (_pjZ pj)
|
||||||
. uncurryV translateSPxy (_prjPos pj)
|
. uncurryV translateSPxy (_pjPos pj)
|
||||||
$ rotateSP (_prjDir pj) $
|
$ rotateSP (_pjDir pj) $
|
||||||
shellShape :!: thelight
|
shellShape :!: thelight
|
||||||
where
|
where
|
||||||
thelight =
|
thelight =
|
||||||
@@ -43,4 +43,4 @@ drawRemoteShell pj
|
|||||||
col
|
col
|
||||||
| t > (-99) = green
|
| t > (-99) = green
|
||||||
| otherwise = red
|
| otherwise = red
|
||||||
t = _prjTimer pj
|
t = _pjTimer pj
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ import NewInt
|
|||||||
import RandomHelp
|
import RandomHelp
|
||||||
|
|
||||||
updateProjectile :: Projectile -> World -> World
|
updateProjectile :: Projectile -> World -> World
|
||||||
updateProjectile pj w = foldl' (\w' pu -> upProjectile pu pj w') w (_prjUpdates pj)
|
updateProjectile pj w = foldl' (flip $ upProjectile pj) w (_pjUpdates pj)
|
||||||
|
|
||||||
upProjectile :: ProjectileUpdate -> Projectile -> World -> World
|
upProjectile :: Projectile -> ProjectileUpdate -> World -> World
|
||||||
upProjectile pu pj = case pu of
|
upProjectile pj pu = case pu of
|
||||||
CollisionEffectPU mdetonatorid mscreenid ->
|
CollisionEffectPU mdetonatorid mscreenid ->
|
||||||
shellCollisionCheck
|
shellCollisionCheck
|
||||||
mdetonatorid
|
mdetonatorid
|
||||||
@@ -33,51 +33,51 @@ upProjectile pu pj = case pu of
|
|||||||
pj
|
pj
|
||||||
TimePU -> decTimMvVel pj
|
TimePU -> decTimMvVel pj
|
||||||
ThrustPU st et
|
ThrustPU st et
|
||||||
| act st et -> doThrust pj (pj ^? prjType . rkSmoke . _Just)
|
| act st et -> doThrust pj (pj ^? pjType . rkSmoke . _Just)
|
||||||
| otherwise -> id
|
| otherwise -> id
|
||||||
StartSpinPU t cid spinamount
|
StartSpinPU t cid spinamount
|
||||||
| time == t -> trySpinByCID cid spinamount pj
|
| time == t -> trySpinByCID cid spinamount pj
|
||||||
| otherwise -> id
|
| otherwise -> id
|
||||||
RemoteDirectionPU st et
|
RemoteDirectionPU st et
|
||||||
| act st et -> pjRemoteSetDirection (pj ^? prjType . rkHoming) pj
|
| act st et -> pjRemoteSetDirection (pj ^? pjType . rkHoming) pj
|
||||||
| otherwise -> id
|
| otherwise -> id
|
||||||
ReduceSpinPU x -> reduceSpinBy x (_prjID pj)
|
ReduceSpinPU x -> reduceSpinBy x (_pjID pj)
|
||||||
DestroyPU mitid 0 -> destroyProjectile mitid (_prjID pj)
|
DestroyPU mitid 0 -> destroyProjectile mitid (_pjID pj)
|
||||||
-- the following requires that this is at the top of the update list, which is
|
-- the following requires that this is at the top of the update list, which is
|
||||||
-- not ideal
|
-- not ideal
|
||||||
DestroyPU _ _ -> cWorld . lWorld . projectiles . ix (_prjID pj) . prjUpdates . ix 0 . pjuTimer -~ 1
|
DestroyPU _ _ -> cWorld . lWorld . projectiles . ix (_pjID pj) . pjUpdates . ix 0 . pjuTimer -~ 1
|
||||||
ApplyGravityPU -> applyGravityPU pj
|
ApplyGravityPU -> applyGravityPU pj
|
||||||
where
|
where
|
||||||
time = _prjTimer pj
|
time = _pjTimer pj
|
||||||
act st et = time <= st && time >= et
|
act st et = time <= st && time >= et
|
||||||
|
|
||||||
applyGravityPU :: Projectile -> World -> World
|
applyGravityPU :: Projectile -> World -> World
|
||||||
applyGravityPU pj w
|
applyGravityPU pj w
|
||||||
| newz <= 0 && abs (pj ^. prjZVel) < 1 =
|
| newz <= 0 && abs (pj ^. pjZVel) < 1 =
|
||||||
w
|
w
|
||||||
& topj . prjVel %~ decvel
|
& topj . pjVel %~ decvel
|
||||||
& topj . prjSpin %~ decspin
|
& topj . pjSpin %~ decspin
|
||||||
| newz < 0 =
|
| newz < 0 =
|
||||||
w & topj . prjZ .~ 0
|
w & topj . pjZ .~ 0
|
||||||
& topj . prjZVel %~ bouncez
|
& topj . pjZVel %~ bouncez
|
||||||
& topj . prjVel %~ decvel
|
& topj . pjVel %~ decvel
|
||||||
& topj . prjSpin %~ decspin
|
& topj . pjSpin %~ decspin
|
||||||
& soundStart (ShellSound (pj ^. prjID)) (pj ^. prjPos) click1S Nothing
|
& soundStart (ShellSound (pj ^. pjID)) (pj ^. pjPos) click1S Nothing
|
||||||
| otherwise =
|
| otherwise =
|
||||||
w & topj . prjZ .~ newz
|
w & topj . pjZ .~ newz
|
||||||
& topj . prjZVel -~ 0.5
|
& topj . pjZVel -~ 0.5
|
||||||
where
|
where
|
||||||
topj = cWorld . lWorld . projectiles . ix (pj ^. prjID)
|
topj = cWorld . lWorld . projectiles . ix (pj ^. pjID)
|
||||||
bouncez z
|
bouncez z
|
||||||
| z < -1 = -0.5 * z
|
| z < -1 = -0.5 * z
|
||||||
| otherwise = 0
|
| otherwise = 0
|
||||||
decvel v
|
decvel v
|
||||||
| magV v > 1 = rotateV (5 * pj ^. prjSpin) $ 0.8 * v
|
| magV v > 1 = rotateV (5 * pj ^. pjSpin) $ 0.8 * v
|
||||||
| otherwise = 0
|
| otherwise = 0
|
||||||
decspin x
|
decspin x
|
||||||
| abs x < 0.01 = 0
|
| abs x < 0.01 = 0
|
||||||
| otherwise = x * 0.9
|
| otherwise = x * 0.9
|
||||||
newz = pj ^. prjZ + pj ^. prjZVel
|
newz = pj ^. pjZ + pj ^. pjZVel
|
||||||
|
|
||||||
--shellCollisionCheck :: (Projectile -> World -> World) -> Projectile -> World -> World
|
--shellCollisionCheck :: (Projectile -> World -> World) -> Projectile -> World -> World
|
||||||
shellCollisionCheck ::
|
shellCollisionCheck ::
|
||||||
@@ -87,14 +87,13 @@ shellCollisionCheck ::
|
|||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
shellCollisionCheck detid screenid pj w
|
shellCollisionCheck detid screenid pj w
|
||||||
| anythingHitCirc 2 oldPos newPos w = g
|
| anythingHitCirc 2 oldPos (oldPos + _pjVel pj) w = g
|
||||||
| time <= 0 = g
|
| time <= 0 = g
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
where
|
where
|
||||||
g = explodeShell detid screenid pj w
|
g = explodeShell detid screenid pj w
|
||||||
time = _prjTimer pj
|
time = _pjTimer pj
|
||||||
oldPos = _prjPos pj
|
oldPos = _pjPos pj
|
||||||
newPos = oldPos +.+ _prjVel pj
|
|
||||||
|
|
||||||
destroyProjectile :: Maybe (NewInt ItmInt) -> Int -> World -> World
|
destroyProjectile :: Maybe (NewInt ItmInt) -> Int -> World -> World
|
||||||
destroyProjectile mitid pjid w =
|
destroyProjectile mitid pjid w =
|
||||||
@@ -112,10 +111,10 @@ doThrust :: Projectile -> Maybe RocketSmoke -> World -> World
|
|||||||
doThrust pj smoke w =
|
doThrust pj smoke w =
|
||||||
w
|
w
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
& cWorld . lWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)
|
& cWorld . lWorld . projectiles . ix i . pjVel %~ (\v -> accel +.+ frict *.* v)
|
||||||
& soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
|
& soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
|
||||||
-- & makeFlamelet (oldPos -.- vel) (vel + 2 * rotateV (pi + sparkD) accel) 3 10
|
-- & makeFlamelet (oldPos -.- vel) (vel + 2 * rotateV (pi + sparkD) accel) 3 10
|
||||||
& makeFlamelet oldPos (vel +.+ rotateV (pi + sparkD) accel) 3 10
|
& makeFlamelet (oldPos -.- vel) (vel +.+ rotateV (pi + sparkD) accel) 3 10
|
||||||
& shellTrailCloud
|
& shellTrailCloud
|
||||||
lifetime
|
lifetime
|
||||||
trailfadetime
|
trailfadetime
|
||||||
@@ -126,10 +125,10 @@ doThrust pj smoke w =
|
|||||||
| smoke == Just ReducedRocketSmoke = (50, 200)
|
| smoke == Just ReducedRocketSmoke = (50, 200)
|
||||||
| otherwise = (300, 500)
|
| otherwise = (300, 500)
|
||||||
trailfadetime = fst . randomR (100, 300) $ _randGen w
|
trailfadetime = fst . randomR (100, 300) $ _randGen w
|
||||||
accel = rotateV (pj ^. prjDir) (V2 3 0)
|
accel = rotateV (pj ^. pjDir) (V2 3 0)
|
||||||
i = _prjID pj
|
i = _pjID pj
|
||||||
oldPos = _prjPos pj
|
oldPos = _pjPos pj
|
||||||
vel = _prjVel pj
|
vel = _pjVel pj
|
||||||
newPos = oldPos +.+ vel
|
newPos = oldPos +.+ vel
|
||||||
(frict, g) = randomR (0.6, 0.9) $ _randGen w
|
(frict, g) = randomR (0.6, 0.9) $ _randGen w
|
||||||
(sparkD, _) = randomR (-0.2, 0.2) $ _randGen w
|
(sparkD, _) = randomR (-0.2, 0.2) $ _randGen w
|
||||||
@@ -143,10 +142,10 @@ trySpinByCID ::
|
|||||||
Projectile ->
|
Projectile ->
|
||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
trySpinByCID cid i pj w = w & cWorld . lWorld . projectiles . ix pjid . prjSpin .~ newSpin
|
trySpinByCID cid i pj w = w & cWorld . lWorld . projectiles . ix pjid . pjSpin .~ newSpin
|
||||||
where
|
where
|
||||||
pjid = _prjID pj
|
pjid = _pjID pj
|
||||||
dir = argV $ _prjVel pj
|
dir = argV $ _pjVel pj
|
||||||
newSpin = case w ^? cWorld . lWorld . creatures . ix cid of
|
newSpin = case w ^? cWorld . lWorld . creatures . ix cid of
|
||||||
Just cr -> negate $ min 0.2 $ max (-0.2) $ normalizeAnglePi (dir - _crDir cr) / spinFactor
|
Just cr -> negate $ min 0.2 $ max (-0.2) $ normalizeAnglePi (dir - _crDir cr) / spinFactor
|
||||||
_ -> 0
|
_ -> 0
|
||||||
@@ -158,30 +157,29 @@ pjRemoteSetDirection ph pj w = case ph of
|
|||||||
Just (HomeUsingRemoteScreen screenid)
|
Just (HomeUsingRemoteScreen screenid)
|
||||||
| lw ^? creatures . ix 0 . crManipulation . manObject . imSelectedItem
|
| lw ^? creatures . ix 0 . crManipulation . manObject . imSelectedItem
|
||||||
== lw ^? itemLocations . ix (_unNInt screenid) . ilInvID ->
|
== lw ^? itemLocations . ix (_unNInt screenid) . ilInvID ->
|
||||||
w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjDir
|
w & cWorld . lWorld . projectiles . ix (_pjID pj) . pjDir
|
||||||
.~ (w ^. wCam . camRot) + argV (w ^. input . mousePos)
|
.~ (w ^. wCam . camRot) + argV (w ^. input . mousePos)
|
||||||
Just (HomeUsingTargeting itid)
|
Just (HomeUsingTargeting itid)
|
||||||
| Just tp <- w ^? pointerToItemID itid . itTargeting . itTgPos . _Just ->
|
| Just tp <- w ^? pointerToItemID itid . itTargeting . itTgPos . _Just ->
|
||||||
w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjDir
|
w & cWorld . lWorld . projectiles . ix (_pjID pj) . pjDir
|
||||||
%~ turnTo 0.2 (_prjPos pj) tp
|
%~ turnTo 0.2 (_pjPos pj) tp
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
lw = w ^. cWorld . lWorld
|
lw = w ^. cWorld . lWorld
|
||||||
|
|
||||||
reduceSpinBy :: Float -> Int -> World -> World
|
reduceSpinBy :: Float -> Int -> World -> World
|
||||||
reduceSpinBy x pjid = cWorld . lWorld . projectiles . ix pjid . prjSpin *~ x
|
reduceSpinBy x pjid = cWorld . lWorld . projectiles . ix pjid . pjSpin *~ x
|
||||||
|
|
||||||
decTimMvVel :: Projectile -> World -> World
|
decTimMvVel :: Projectile -> World -> World
|
||||||
decTimMvVel pj =
|
decTimMvVel pj =
|
||||||
cWorld . lWorld . projectiles . ix pjid
|
cWorld . lWorld . projectiles . ix (_pjID pj)
|
||||||
%~ ( (prjTimer -~ 1)
|
%~ ( (pjTimer -~ 1)
|
||||||
. (prjPos %~ (+.+ vel))
|
. (pjPos %~ (+.+ vel))
|
||||||
. (prjDir +~ rot)
|
. (pjDir +~ rot)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
rot = _prjSpin pj
|
rot = _pjSpin pj
|
||||||
vel = _prjVel pj
|
vel = _pjVel pj
|
||||||
pjid = _prjID pj
|
|
||||||
|
|
||||||
explodeShell ::
|
explodeShell ::
|
||||||
Maybe (NewInt ItmInt) ->
|
Maybe (NewInt ItmInt) ->
|
||||||
@@ -191,14 +189,12 @@ explodeShell ::
|
|||||||
World
|
World
|
||||||
explodeShell mdetid screenid pj w =
|
explodeShell mdetid screenid pj w =
|
||||||
w
|
w
|
||||||
& cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [DestroyPU screenid 30]
|
& cWorld . lWorld . projectiles . ix pjid . pjUpdates .~ [DestroyPU screenid 30]
|
||||||
& usePayload (_prjPayload pj) (_prjPos pj) (_prjVel pj)
|
& usePayload (_pjPayload pj) (_pjPos pj) (_pjVel pj)
|
||||||
& stopSoundFrom (ShellSound pjid)
|
& stopSoundFrom (ShellSound pjid)
|
||||||
& updatedetonator
|
& updatedetonator
|
||||||
where
|
where
|
||||||
updatedetonator = fromMaybe id $ do
|
updatedetonator = fromMaybe id $ do
|
||||||
detid <- mdetid
|
detid <- mdetid
|
||||||
return $ pointerToItemID detid . itUse . uaParams . apProjectiles %~ delete pjid
|
return $ pointerToItemID detid . itUse . uaParams . apProjectiles %~ delete pjid
|
||||||
deleteif (Just x) | x == pjid = Nothing
|
pjid = pj ^. pjID
|
||||||
deleteif x = x
|
|
||||||
pjid = pj ^. prjID
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ worldSPic :: Configuration -> Universe -> SPic
|
|||||||
worldSPic cfig u =
|
worldSPic cfig u =
|
||||||
(mempty :!: extraPics cfig u)
|
(mempty :!: extraPics cfig u)
|
||||||
<> foldup drawProp' (filtOn _prPos _props)
|
<> foldup drawProp' (filtOn _prPos _props)
|
||||||
<> foldup drawProjectile (filtOn _prjPos _projectiles)
|
<> foldup drawProjectile (filtOn _pjPos _projectiles)
|
||||||
<> foldup (shiftDraw _blPos _blDir (drawBlock . _blDraw)) (filtOn _blPos _blocks)
|
<> foldup (shiftDraw _blPos _blDir (drawBlock . _blDraw)) (filtOn _blPos _blocks)
|
||||||
<> foldup (shiftDraw _fsPos _fsDir (const _fsSPic)) (filtOn _fsPos _foregroundShapes)
|
<> foldup (shiftDraw _fsPos _fsDir (const _fsSPic)) (filtOn _fsPos _foregroundShapes)
|
||||||
<> foldup (shiftDraw' _cpPos _cpDir _cpSPic) (filtOn _cpPos _corpses)
|
<> foldup (shiftDraw' _cpPos _cpDir _cpSPic) (filtOn _cpPos _corpses)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ testStringInit :: Universe -> [String]
|
|||||||
testStringInit u =
|
testStringInit u =
|
||||||
[show (u ^?! uvWorld . cWorld . lWorld . creatures . ix 0 . crPos)]
|
[show (u ^?! uvWorld . cWorld . lWorld . creatures . ix 0 . crPos)]
|
||||||
<>
|
<>
|
||||||
map show (u ^.. uvWorld . cWorld . lWorld . projectiles . each . prjPos)
|
map show (u ^.. uvWorld . cWorld . lWorld . projectiles . each . pjPos)
|
||||||
--testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles
|
--testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles
|
||||||
-- (map (show . _ebPos) $ u ^. uvWorld . cWorld . lWorld . energyBalls)
|
-- (map (show . _ebPos) $ u ^. uvWorld . cWorld . lWorld . energyBalls)
|
||||||
-- <>
|
-- <>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ moveZoomCamera cfig theinput cr w campos =
|
|||||||
mremotepos = do
|
mremotepos = do
|
||||||
i <- cr ^? crManipulation . manObject . imSelectedItem
|
i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||||
j <- cr ^? crInv . ix i . itUse . uaParams . apLinkedProjectile . _Just
|
j <- cr ^? crInv . ix i . itUse . uaParams . apLinkedProjectile . _Just
|
||||||
w ^? cWorld . lWorld . projectiles . ix j . prjPos
|
w ^? cWorld . lWorld . projectiles . ix j . pjPos
|
||||||
docamrot = rotateV (campos ^. camRot)
|
docamrot = rotateV (campos ^. camRot)
|
||||||
offset = fromMaybe noscopeoffset $ do
|
offset = fromMaybe noscopeoffset $ do
|
||||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ doDebugTestF7 = uvIOEffects %~ \f u -> do
|
|||||||
doDebugTestF8 :: Universe -> Universe
|
doDebugTestF8 :: Universe -> Universe
|
||||||
doDebugTestF8 = uvIOEffects %~ \f u -> do
|
doDebugTestF8 = uvIOEffects %~ \f u -> do
|
||||||
appendFile "log/proj" $ show
|
appendFile "log/proj" $ show
|
||||||
(u ^?! uvWorld . cWorld . lWorld . projectiles . ix 5 . prjPos) ++ "/n"
|
(u ^?! uvWorld . cWorld . lWorld . projectiles . ix 5 . pjPos) ++ "/n"
|
||||||
putStrLn "log/proj written"
|
putStrLn "log/proj written"
|
||||||
f u
|
f u
|
||||||
doDebugTestF10 :: Universe -> Universe
|
doDebugTestF10 :: Universe -> Universe
|
||||||
|
|||||||
Reference in New Issue
Block a user