Continue work on projectiles
This commit is contained in:
@@ -41,16 +41,6 @@ doGravityPU pj
|
||||
|
||||
applyGravityPU :: Projectile -> World -> World
|
||||
applyGravityPU pj w
|
||||
-- | newz <= 0 && abs (pj ^. pjZVel) < 1 =
|
||||
-- w
|
||||
-- & topj . pjVel %~ decvel
|
||||
-- & topj . pjSpin %~ decspin
|
||||
-- | newz < 0 =
|
||||
-- w & topj . pjZ .~ 0
|
||||
-- & topj . pjZVel %~ bouncez
|
||||
-- & topj . pjVel %~ decvel
|
||||
-- & topj . pjSpin %~ decspin
|
||||
-- & soundStart (ShellSound (pj ^. pjID)) (pj ^. pjPos) click1S Nothing
|
||||
| _pjZ pj < 1 && abs (norm $ _pjVel pj `v2z` _pjZVel pj) < 1 = w
|
||||
& topj . pjVel .~ 0
|
||||
| otherwise =
|
||||
@@ -58,15 +48,6 @@ applyGravityPU pj w
|
||||
& topj . pjZVel -~ 0.5
|
||||
where
|
||||
topj = cWorld . lWorld . projectiles . ix (pj ^. pjID)
|
||||
bouncez z
|
||||
| z < -1 = -0.5 * z
|
||||
| otherwise = 0
|
||||
decvel v
|
||||
| magV v > 1 = rotateV (5 * pj ^. pjSpin) $ 0.8 * v
|
||||
| otherwise = 0
|
||||
decspin x
|
||||
| abs x < 0.01 = 0
|
||||
| otherwise = x * 0.9
|
||||
newz = pj ^. pjZ + pj ^. pjZVel
|
||||
|
||||
-- consider pushing any hit creature back
|
||||
@@ -102,6 +83,23 @@ shellHitWall p' n wl pj w
|
||||
p = xyV3 p'
|
||||
hitline = normalizeV $ uncurry (-) $ _wlLine wl
|
||||
|
||||
shellHitCreature :: Point3 -> Point3 -> Creature -> Projectile -> World -> World
|
||||
shellHitCreature p' n cr pj w
|
||||
| Just GStick <- pj ^? pjType . gnHitEffect =
|
||||
w
|
||||
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjType
|
||||
.~ Grenade
|
||||
( GStuckCreature
|
||||
(cr ^. crID)
|
||||
(rotate3z (- cr ^. crDir) (p' - ((cr ^. crPos)`v2z`0)))
|
||||
(pj ^. pjDir - cr ^. crDir)
|
||||
)
|
||||
& soundOriginIDsAt (ShellSound (pj ^. pjID)) [slapS, slap1S] (pj ^. pjPos)
|
||||
| otherwise = w & cWorld . lWorld . projectiles . ix (_pjID pj) . pjPos .~ p
|
||||
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjTimer .~ 0
|
||||
where
|
||||
p = xyV3 p'
|
||||
|
||||
shellHitFloor :: Point3 -> Point3 -> Projectile -> World -> World
|
||||
shellHitFloor p' n pj w
|
||||
| z < 1 && abs (norm $ _pjVel pj `v2z` zvel) < 1 = w
|
||||
@@ -271,8 +269,8 @@ moveProjectile pj w
|
||||
= shellHitWall p n wl pj w
|
||||
| (p,Just (n,OFloor)) <- collide3 (p `v2z` (_pjZ pj)) ((p + _pjVel pj)`v2z` (_pjZ pj + _pjZVel pj) ) w
|
||||
= shellHitFloor p n pj w
|
||||
| (p,Just po) <- collide3 (p `v2z` (_pjZ pj)) ((p + _pjVel pj)`v2z` (_pjZ pj + _pjZVel pj) ) w
|
||||
= tryShellBounce p po pj w
|
||||
| (p,Just (n,OCreature cr)) <- collide3 (p `v2z` (_pjZ pj)) ((p + _pjVel pj)`v2z` (_pjZ pj + _pjZVel pj) ) w
|
||||
= shellHitCreature p n cr pj w
|
||||
| otherwise =
|
||||
w
|
||||
& cWorld . lWorld . projectiles . ix (pj ^. pjID) . pjSpin *~ 0.99
|
||||
|
||||
@@ -2681,7 +2681,7 @@ anythingHitCirc src/Dodge/Base/Collide.hs 298;" f
|
||||
applyCME src/Dodge/HeldUse.hs 378;" f
|
||||
applyCreatureDamage src/Dodge/Creature/Damage.hs 13;" f
|
||||
applyEventIO src/Loop.hs 89;" f
|
||||
applyGravityPU src/Dodge/Projectile/Update.hs 41;" f
|
||||
applyGravityPU src/Dodge/Projectile/Update.hs 42;" f
|
||||
applyIndividualDamage src/Dodge/Creature/Damage.hs 16;" f
|
||||
applyInvLock src/Dodge/HeldUse.hs 444;" f
|
||||
applyMagnetsToBul src/Dodge/Bullet.hs 30;" f
|
||||
@@ -3257,7 +3257,7 @@ destroyMatS src/Dodge/Material/Sound.hs 7;" f
|
||||
destroyMcType src/Dodge/Machine/Destroy.hs 21;" f
|
||||
destroyMount src/Dodge/Block.hs 100;" f
|
||||
destroyMounts src/Dodge/Block.hs 97;" f
|
||||
destroyProjectile src/Dodge/Projectile/Update.hs 141;" f
|
||||
destroyProjectile src/Dodge/Projectile/Update.hs 175;" f
|
||||
detV src/Geometry/Vector.hs 93;" f
|
||||
detector src/Dodge/Item/Held/Utility.hs 27;" f
|
||||
detectorColor src/Dodge/Item/Draw/SPic.hs 465;" f
|
||||
@@ -3295,7 +3295,7 @@ doAfterPlacements src/Dodge/Layout.hs 83;" f
|
||||
doAimTwist src/Dodge/Creature/YourControl.hs 140;" f
|
||||
doAnyEquipmentEffect src/Dodge/Creature/State.hs 223;" f
|
||||
doBackspace src/Dodge/Update/Input/Text.hs 31;" f
|
||||
doBarrelSpin src/Dodge/Projectile/Update.hs 191;" f
|
||||
doBarrelSpin src/Dodge/Projectile/Update.hs 225;" f
|
||||
doBlBl src/Dodge/BlBl.hs 5;" f
|
||||
doBlSh src/Dodge/Block/Draw.hs 14;" f
|
||||
doBounce src/Dodge/Base/Collide.hs 66;" f
|
||||
@@ -3326,7 +3326,7 @@ doDrawing src/Dodge/Render.hs 35;" f
|
||||
doDrawing' src/Dodge/Render.hs 46;" f
|
||||
doFloatFloat src/Dodge/FloatFunction.hs 5;" f
|
||||
doGenFloat src/Dodge/HeldUse.hs 1212;" f
|
||||
doGravityPU src/Dodge/Projectile/Update.hs 35;" f
|
||||
doGravityPU src/Dodge/Projectile/Update.hs 36;" f
|
||||
doHeldUseEffect src/Dodge/HeldUse.hs 354;" f
|
||||
doInPlacements src/Dodge/Layout.hs 92;" f
|
||||
doIndividualPlacements src/Dodge/Layout.hs 117;" f
|
||||
@@ -3362,7 +3362,7 @@ doTerminalCommandEffect src/Dodge/Terminal.hs 135;" f
|
||||
doTestDrawing src/Dodge/Render.hs 42;" f
|
||||
doTextInputOver src/Dodge/Update/Input/Text.hs 15;" f
|
||||
doTextInputOverUniverse src/Dodge/Update/Input/Text.hs 12;" f
|
||||
doThrust src/Dodge/Projectile/Update.hs 163;" f
|
||||
doThrust src/Dodge/Projectile/Update.hs 197;" f
|
||||
doTimeScroll src/Dodge/Update.hs 208;" f
|
||||
doTmTm src/Dodge/TmTm.hs 6;" f
|
||||
doTmWdWd src/Dodge/WorldEffect.hs 99;" f
|
||||
@@ -3592,7 +3592,7 @@ expandPolyByFixed src/Dodge/LevelGen/StaticWalls.hs 97;" f
|
||||
expandPolyCorners src/Dodge/LevelGen/StaticWalls.hs 103;" f
|
||||
expandToSquare src/Dodge/LevelGen/StaticWalls/Deprecated.hs 83;" f
|
||||
expireAndDamage src/Dodge/Bullet.hs 186;" f
|
||||
explodeShell src/Dodge/Projectile/Update.hs 261;" f
|
||||
explodeShell src/Dodge/Projectile/Update.hs 297;" f
|
||||
explosionS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 556;" f
|
||||
explosiveBarrel src/Dodge/Creature/Inanimate.hs 25;" f
|
||||
extTrigLitPos src/Dodge/Placement/Instance/Button.hs 84;" f
|
||||
@@ -4341,10 +4341,10 @@ moveCombineSel src/Dodge/Update/Scroll.hs 114;" f
|
||||
moveInverseShockwave src/Dodge/Shockwave/Update.hs 44;" f
|
||||
moveLSThen src/Dodge/Placement/Instance/LightSource.hs 30;" f
|
||||
movePenBullet src/Dodge/Bullet.hs 201;" f
|
||||
moveProjectile src/Dodge/Projectile/Update.hs 232;" f
|
||||
moveProjectile src/Dodge/Projectile/Update.hs 266;" f
|
||||
moveRoomBy src/Dodge/Room/Link.hs 53;" f
|
||||
moveShockwave src/Dodge/Shockwave/Update.hs 15;" f
|
||||
moveStuckGrenade src/Dodge/Projectile/Update.hs 229;" f
|
||||
moveStuckGrenade src/Dodge/Projectile/Update.hs 263;" f
|
||||
moveToSideFirstOutLink src/Dodge/Room/Warning.hs 55;" f
|
||||
moveWall src/Dodge/Wall/Move.hs 29;" f
|
||||
moveWallID src/Dodge/Wall/Move.hs 24;" f
|
||||
@@ -4508,7 +4508,7 @@ pipe src/Dodge/Item/Craftable.hs 32;" f
|
||||
pistol src/Dodge/Item/Held/Stick.hs 40;" f
|
||||
pistolCrit src/Dodge/Creature/PistolCrit.hs 12;" f
|
||||
pistolerRoom src/Dodge/Room/Room.hs 321;" f
|
||||
pjRemoteSetDirection src/Dodge/Projectile/Update.hs 208;" f
|
||||
pjRemoteSetDirection src/Dodge/Projectile/Update.hs 242;" f
|
||||
plBlock src/Dodge/Placement/PlaceSpot/Block.hs 18;" f
|
||||
plDoor src/Dodge/Placement/PlaceSpot/TriggerDoor.hs 22;" f
|
||||
plLineBlock src/Dodge/Placement/PlaceSpot/Block.hs 50;" f
|
||||
@@ -5039,9 +5039,10 @@ shapeVerxSize src/Shape/Parameters.hs 10;" f
|
||||
shatterGun src/Dodge/Item/Held/Weapons.hs 8;" f
|
||||
shatterGunSPic src/Dodge/Item/Draw/SPic.hs 324;" f
|
||||
shatterWall src/Dodge/Item/Weapon/Shatter.hs 26;" f
|
||||
shellExplosionCheck src/Dodge/Projectile/Update.hs 70;" f
|
||||
shellHitFloor src/Dodge/Projectile/Update.hs 102;" f
|
||||
shellHitWall src/Dodge/Projectile/Update.hs 81;" f
|
||||
shellExplosionCheck src/Dodge/Projectile/Update.hs 63;" f
|
||||
shellHitCreature src/Dodge/Projectile/Update.hs 95;" f
|
||||
shellHitFloor src/Dodge/Projectile/Update.hs 116;" f
|
||||
shellHitWall src/Dodge/Projectile/Update.hs 74;" f
|
||||
shellMag src/Dodge/Item/Ammo.hs 49;" f
|
||||
shellModule src/Dodge/Item/Scope.hs 123;" f
|
||||
shellShape src/Dodge/Projectile/Draw.hs 34;" f
|
||||
@@ -5094,9 +5095,9 @@ showEquipItem src/Dodge/Item/Display.hs 107;" f
|
||||
showInt src/Dodge/Item/Info.hs 75;" f
|
||||
showIntsString src/Dodge/Tree/Compose.hs 129;" f
|
||||
showInventoryPathing src/Dodge/Item/Display.hs 86;" f
|
||||
showManObj src/Dodge/TestString.hs 66;" f
|
||||
showManObj src/Dodge/TestString.hs 65;" f
|
||||
showTerminalError src/Dodge/Debug/Terminal.hs 78;" f
|
||||
showTimeFlow src/Dodge/TestString.hs 89;" f
|
||||
showTimeFlow src/Dodge/TestString.hs 88;" f
|
||||
shrinkPolyOnEdges src/Geometry/Polygon.hs 142;" f
|
||||
shrinkVert src/Geometry/Polygon.hs 146;" f
|
||||
shuffle src/RandomHelp.hs 49;" f
|
||||
@@ -5362,7 +5363,7 @@ tone440sawtoothquietS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 448;" f
|
||||
topInvW src/Dodge/ListDisplayParams.hs 51;" f
|
||||
topPrismEdgeIndices src/Shader/Poke.hs 335;" f
|
||||
topPrismIndices src/Shader/Poke.hs 410;" f
|
||||
topTestPart src/Dodge/TestString.hs 62;" f
|
||||
topTestPart src/Dodge/TestString.hs 61;" f
|
||||
torch src/Dodge/Item/Held/Utility.hs 23;" f
|
||||
torchShape src/Dodge/Item/Draw/SPic.hs 290;" f
|
||||
torqueAmount src/Dodge/HeldUse.hs 597;" f
|
||||
@@ -5439,10 +5440,10 @@ tryPutFloorItemIDInInv src/Dodge/Inventory/Add.hs 26;" f
|
||||
tryPutItemInInv src/Dodge/Inventory/Add.hs 42;" f
|
||||
tryPutItemInInvAt src/Dodge/Inventory/Add.hs 32;" f
|
||||
trySeedFromClipboard src/Dodge/Menu.hs 91;" f
|
||||
tryShellBounce src/Dodge/Projectile/Update.hs 107;" f
|
||||
trySpin src/Dodge/Projectile/Update.hs 151;" f
|
||||
tryShellBounce src/Dodge/Projectile/Update.hs 141;" f
|
||||
trySpin src/Dodge/Projectile/Update.hs 185;" f
|
||||
trySynthBullet src/Dodge/Creature/State.hs 249;" f
|
||||
tryThrust src/Dodge/Projectile/Update.hs 157;" f
|
||||
tryThrust src/Dodge/Projectile/Update.hs 191;" f
|
||||
tryUseParent src/Dodge/Creature/State.hs 227;" f
|
||||
turnTo src/Dodge/Movement/Turn.hs 8;" f
|
||||
turret src/Dodge/Placement/Instance/Turret.hs 35;" f
|
||||
@@ -5547,7 +5548,7 @@ updateObjCatMaybes src/Dodge/Update.hs 578;" f
|
||||
updateObjMapMaybe src/Dodge/Update.hs 571;" f
|
||||
updatePastWorlds src/Dodge/Update.hs 441;" f
|
||||
updatePreload src/Preload/Update.hs 20;" f
|
||||
updateProjectile src/Dodge/Projectile/Update.hs 26;" f
|
||||
updateProjectile src/Dodge/Projectile/Update.hs 27;" f
|
||||
updateProp src/Dodge/Prop/Update.hs 11;" f
|
||||
updatePulse src/Dodge/Creature/Update.hs 39;" f
|
||||
updatePulseBall src/Dodge/Update.hs 467;" f
|
||||
|
||||
Reference in New Issue
Block a user