This commit is contained in:
2024-12-24 21:25:23 +00:00
parent 81fd2131e0
commit 18b569ac89
4 changed files with 29 additions and 27 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
{ {
"_debug_booleans": [ "_debug_booleans": [
"Show_ms_frame", "Show_ms_frame",
"Show_sound", "Enable_debug",
"Select_creature" "Collision_test"
], ],
"_debug_view_clip_bounds": "NoRoomClipBoundaries", "_debug_view_clip_bounds": "NoRoomClipBoundaries",
"_gameplay_rotate_to_wall": true, "_gameplay_rotate_to_wall": true,
-2
View File
@@ -12,13 +12,11 @@ defaultBullet =
Bullet Bullet
{ _buEffect = DestroyBullet { _buEffect = DestroyBullet
, _buPayload = BulSpark , _buPayload = BulSpark
-- , _buTrajectory = BasicBulletTrajectory
, _buVel = V2 50 0 , _buVel = V2 50 0
, _buDrag = 1 , _buDrag = 1
, _buPos = 0 , _buPos = 0
, _buOldPos = 0 , _buOldPos = 0
, _buWidth = 2 , _buWidth = 2
-- , _buTimer = 100
, _buDamages = basicBulDams , _buDamages = basicBulDams
} }
+18 -14
View File
@@ -1,24 +1,24 @@
--{-# OPTIONS_GHC -Wno-unused-imports #-} --{-# OPTIONS_GHC -Wno-unused-imports #-}
module Dodge.Projectile.Update module Dodge.Projectile.Update (
( updateProjectile updateProjectile,
) where ) where
import Control.Monad
import Dodge.Movement.Turn
import NewInt
import Dodge.Payload
import Control.Lens import Control.Lens
import Control.Monad
import Data.Foldable
import Data.Maybe import Data.Maybe
import Dodge.Base import Dodge.Base
import Dodge.Data.World import Dodge.Data.World
import Dodge.EnergyBall import Dodge.EnergyBall
import Dodge.Item.Location import Dodge.Item.Location
import Dodge.Movement.Turn
import Dodge.Payload
import Dodge.SoundLogic import Dodge.SoundLogic
import Dodge.WorldEvent.Cloud import Dodge.WorldEvent.Cloud
import Geometry import Geometry
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import NewInt
import RandomHelp import RandomHelp
import Data.Foldable
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' (\w' pu -> upProjectile pu pj w') w (_prjUpdates pj)
@@ -46,8 +46,8 @@ upProjectile pu pj = case pu of
act st et = time <= st && time >= et act st et = time <= st && time >= et
shellCollisionEffect :: Maybe (NewInt ItmInt) -> Projectile -> World -> World shellCollisionEffect :: Maybe (NewInt ItmInt) -> Projectile -> World -> World
shellCollisionEffect mscreenid = shellCollisionCheck shellCollisionEffect mscreenid = shellCollisionCheck $
$ \pj -> explodeShell mscreenid (_prjID pj) \pj -> explodeShell mscreenid (_prjID pj)
shellCollisionCheck :: (Projectile -> World -> World) -> Projectile -> World -> World shellCollisionCheck :: (Projectile -> World -> World) -> Projectile -> World -> World
shellCollisionCheck f pj w shellCollisionCheck f pj w
@@ -61,7 +61,8 @@ shellCollisionCheck f pj w
newPos = oldPos +.+ _prjVel pj newPos = oldPos +.+ _prjVel pj
destroyProjectile :: Maybe (NewInt ItmInt) -> Int -> World -> World destroyProjectile :: Maybe (NewInt ItmInt) -> Int -> World -> World
destroyProjectile mitid pjid w = w & cWorld . lWorld . projectiles %~ IM.delete pjid destroyProjectile mitid pjid w =
w & cWorld . lWorld . projectiles %~ IM.delete pjid
& removelink & removelink
where where
removelink = fromMaybe id $ do removelink = fromMaybe id $ do
@@ -78,7 +79,9 @@ doThrust pj w =
& cWorld . lWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v) & cWorld . lWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)
& soundContinue (ShellSound i) newPos missileLaunchS (Just 1) & soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
& makeFlamelet (oldPos -.- vel) (vel +.+ rotateV (pi + sparkD) accel) 3 10 & makeFlamelet (oldPos -.- vel) (vel +.+ rotateV (pi + sparkD) accel) 3 10
& shellTrailCloud trailage trailfadetime & shellTrailCloud
trailage
trailfadetime
(addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos))) (addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)))
where where
trailage = fst . randomR (300, 500) $ _randGen w trailage = fst . randomR (300, 500) $ _randGen w
@@ -116,14 +119,15 @@ pjRemoteSetDirection ph pj w = case ph of
HomeUsingRemoteScreen screenid -> HomeUsingRemoteScreen screenid ->
let newdir let newdir
| w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem | w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem
== w ^? cWorld . lWorld . itemLocations . ix (_unNInt screenid) . ilInvID == w ^? cWorld . lWorld . itemLocations . ix (_unNInt screenid) . ilInvID =
= (w ^. wCam . camRot) + argV (_mousePos (_input w)) (w ^. wCam . camRot) + argV (_mousePos (_input w))
| otherwise = _prjDir pj | otherwise = _prjDir pj
in w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc in w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc
.~ magV (_prjAcc pj) *.* unitVectorAtAngle newdir .~ magV (_prjAcc pj) *.* unitVectorAtAngle newdir
HomeUsingTargeting itid -> fromMaybe w $ do HomeUsingTargeting itid -> fromMaybe w $ do
tp <- w ^? pointerToItemID itid . itTargeting . itTgPos . _Just tp <- w ^? pointerToItemID itid . itTargeting . itTgPos . _Just
return $ w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc return $
w & cWorld . lWorld . projectiles . ix (_prjID pj) . prjAcc
%~ vecTurnTo 0.2 (_prjPos pj) tp %~ vecTurnTo 0.2 (_prjPos pj) tp
--pjRemoteSetDirection mscreenid pj w = fromMaybe w $ do --pjRemoteSetDirection mscreenid pj w = fromMaybe w $ do
+1 -1
View File
@@ -26,7 +26,7 @@ import qualified IntMapHelp as IM
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
testStringInit :: Universe -> [String] testStringInit :: Universe -> [String]
testStringInit _ = [] 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)
-- <> -- <>
-- (foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . bullets) -- (foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . bullets)