Destruction of slime crits
This commit is contained in:
@@ -71,6 +71,7 @@ updateLivingCreature cr = case _crType cr of
|
|||||||
|
|
||||||
slimeCritUpdate :: Int -> World -> World
|
slimeCritUpdate :: Int -> World -> World
|
||||||
slimeCritUpdate cid w
|
slimeCritUpdate cid w
|
||||||
|
| r < 5 = w & cWorld . lWorld . creatures . ix cid . crHP .~ CrDestroyed Gibbed
|
||||||
| Just hitp <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmPos
|
| Just hitp <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmPos
|
||||||
, Just hitv <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmVector
|
, Just hitv <- w ^? cWorld . lWorld . creatures . ix cid . crDamage . ix 0 . dmVector
|
||||||
, Just (cr1,cr2) <- splitSlimeCrit hitp hitv cr
|
, Just (cr1,cr2) <- splitSlimeCrit hitp hitv cr
|
||||||
@@ -80,6 +81,7 @@ slimeCritUpdate cid w
|
|||||||
& cWorld . lWorld . creatures . at cid' ?~ (cr2 & crID .~ cid')
|
& cWorld . lWorld . creatures . at cid' ?~ (cr2 & crID .~ cid')
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
& cWorld . lWorld . creatures . ix cid .~ mvslime
|
& cWorld . lWorld . creatures . ix cid .~ mvslime
|
||||||
|
& cWorld . lWorld . creatures . ix cid . crDamage .~ []
|
||||||
where
|
where
|
||||||
txy = w ^?! cWorld . lWorld . creatures . ix 0 . crPos . _xy
|
txy = w ^?! cWorld . lWorld . creatures . ix 0 . crPos . _xy
|
||||||
cr = w ^?! cWorld . lWorld . creatures . ix cid
|
cr = w ^?! cWorld . lWorld . creatures . ix cid
|
||||||
@@ -112,17 +114,16 @@ splitSlimeCrit :: Point2 -> Point2 -> Creature -> Maybe (Creature, Creature)
|
|||||||
splitSlimeCrit p v cr = do
|
splitSlimeCrit p v cr = do
|
||||||
let mp = closestPointOnLine p (p+v) cxy
|
let mp = closestPointOnLine p (p+v) cxy
|
||||||
h = r - distance mp cxy
|
h = r - distance mp cxy
|
||||||
nv = normalize v
|
|
||||||
guard $ h > 0
|
guard $ h > 0
|
||||||
let a1 = segmentArea r h
|
let a1 = segmentArea r h
|
||||||
a2 = pi*r*r - a1
|
a2 = pi*r*r - a1
|
||||||
r1 = sqrt (a1/pi)
|
r1 = sqrt (a1/pi)
|
||||||
r2 = sqrt (a2/pi)
|
r2 = sqrt (a2/pi)
|
||||||
guard $ r1 > 5 && r2 > 5
|
-- guard $ r1 > 5 && r2 > 5
|
||||||
return (cr' & crPos . _xy +~ r2 *^ vNormal nv
|
return (cr' & crPos . _xy .~ mp + r1 *^ normalize (mp - cxy)
|
||||||
& crType . slimeRad .~ r1
|
& crType . slimeRad .~ r1
|
||||||
& crType . slimeCompression .~ V2 r1 0
|
& crType . slimeCompression .~ V2 r1 0
|
||||||
,cr' & crPos . _xy -~ r1 *^ vNormal nv
|
,cr' & crPos . _xy .~ mp - r2 *^ normalize (mp - cxy)
|
||||||
& crType . slimeRad .~ r2
|
& crType . slimeRad .~ r2
|
||||||
& crType . slimeCompression .~ V2 r2 0
|
& crType . slimeCompression .~ V2 r2 0
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2847,8 +2847,8 @@ chasmTestCliffPush src/Dodge/Creature/State/WalkCycle.hs 105;" f
|
|||||||
chasmWallToSurface src/Dodge/Base/Collide.hs 121;" f
|
chasmWallToSurface src/Dodge/Base/Collide.hs 121;" f
|
||||||
checkCombineSelectionExists src/Dodge/DisplayInventory.hs 100;" f
|
checkCombineSelectionExists src/Dodge/DisplayInventory.hs 100;" f
|
||||||
checkConnection src/Dodge/Inventory/Swap.hs 66;" f
|
checkConnection src/Dodge/Inventory/Swap.hs 66;" f
|
||||||
checkDeath src/Dodge/Creature/Update.hs 152;" f
|
checkDeath src/Dodge/Creature/Update.hs 184;" f
|
||||||
checkDeath' src/Dodge/Creature/Update.hs 155;" f
|
checkDeath' src/Dodge/Creature/Update.hs 187;" f
|
||||||
checkEndGame src/Dodge/Update.hs 875;" f
|
checkEndGame src/Dodge/Update.hs 875;" f
|
||||||
checkErrorGL src/Shader/Compile.hs 86;" f
|
checkErrorGL src/Shader/Compile.hs 86;" f
|
||||||
checkFBO src/Framebuffer/Check.hs 6;" f
|
checkFBO src/Framebuffer/Check.hs 6;" f
|
||||||
@@ -2971,7 +2971,7 @@ copierItemUpdate src/Dodge/Creature/State.hs 136;" f
|
|||||||
copyItemToFloor src/Dodge/FloorItem.hs 14;" f
|
copyItemToFloor src/Dodge/FloorItem.hs 14;" f
|
||||||
corDoor src/Dodge/Room/Room.hs 411;" f
|
corDoor src/Dodge/Room/Room.hs 411;" f
|
||||||
cornerList src/Preload/Render.hs 236;" f
|
cornerList src/Preload/Render.hs 236;" f
|
||||||
corpseOrGib src/Dodge/Creature/Update.hs 201;" f
|
corpseOrGib src/Dodge/Creature/Update.hs 233;" f
|
||||||
corridor src/Dodge/Room/Corridor.hs 17;" f
|
corridor src/Dodge/Room/Corridor.hs 17;" f
|
||||||
corridorBoss src/Dodge/LockAndKey.hs 135;" f
|
corridorBoss src/Dodge/LockAndKey.hs 135;" f
|
||||||
corridorN src/Dodge/Room/Corridor.hs 58;" f
|
corridorN src/Dodge/Room/Corridor.hs 58;" f
|
||||||
@@ -3020,7 +3020,7 @@ crShape src/Dodge/Creature/Shape.hs 8;" f
|
|||||||
crSpring src/Dodge/Update.hs 984;" f
|
crSpring src/Dodge/Update.hs 984;" f
|
||||||
crStratConMatches src/Dodge/Creature/Test.hs 78;" f
|
crStratConMatches src/Dodge/Creature/Test.hs 78;" f
|
||||||
crStrength src/Dodge/Creature/Statistics.hs 30;" f
|
crStrength src/Dodge/Creature/Statistics.hs 30;" f
|
||||||
crUpdate src/Dodge/Creature/Update.hs 145;" f
|
crUpdate src/Dodge/Creature/Update.hs 177;" f
|
||||||
crUpdateInvidLocations src/Dodge/Inventory/Location.hs 67;" f
|
crUpdateInvidLocations src/Dodge/Inventory/Location.hs 67;" f
|
||||||
crUpdateItemLocations src/Dodge/Inventory/Location.hs 49;" f
|
crUpdateItemLocations src/Dodge/Inventory/Location.hs 49;" f
|
||||||
crVocalResetTime src/Dodge/Creature/Vocalization.hs 65;" f
|
crVocalResetTime src/Dodge/Creature/Vocalization.hs 65;" f
|
||||||
@@ -3481,7 +3481,7 @@ drawZone src/Dodge/Debug/Picture.hs 152;" f
|
|||||||
drawZoneCirc src/Dodge/Debug/Picture.hs 293;" f
|
drawZoneCirc src/Dodge/Debug/Picture.hs 293;" f
|
||||||
drawZoneCol src/Dodge/Debug/Picture.hs 149;" f
|
drawZoneCol src/Dodge/Debug/Picture.hs 149;" f
|
||||||
drawZoneNearPointCursor src/Dodge/Debug/Picture.hs 286;" f
|
drawZoneNearPointCursor src/Dodge/Debug/Picture.hs 286;" f
|
||||||
dropAll src/Dodge/Creature/Update.hs 239;" f
|
dropAll src/Dodge/Creature/Update.hs 271;" f
|
||||||
dropInventoryPath src/Dodge/HeldUse.hs 1371;" f
|
dropInventoryPath src/Dodge/HeldUse.hs 1371;" f
|
||||||
dropItem src/Dodge/Creature/Action.hs 169;" f
|
dropItem src/Dodge/Creature/Action.hs 169;" f
|
||||||
dropper src/Dodge/Item/Scope.hs 82;" f
|
dropper src/Dodge/Item/Scope.hs 82;" f
|
||||||
@@ -3824,7 +3824,7 @@ hotkeyToChar src/Dodge/Inventory/SelectionList.hs 185;" f
|
|||||||
hotkeyToScancode src/Dodge/Creature/YourControl.hs 62;" f
|
hotkeyToScancode src/Dodge/Creature/YourControl.hs 62;" f
|
||||||
hotkeyToString src/Dodge/Inventory/SelectionList.hs 182;" f
|
hotkeyToString src/Dodge/Inventory/SelectionList.hs 182;" f
|
||||||
hoverCrit src/Dodge/Creature/ChaseCrit.hs 73;" f
|
hoverCrit src/Dodge/Creature/ChaseCrit.hs 73;" f
|
||||||
hoverCritHoverSound src/Dodge/Creature/Update.hs 122;" f
|
hoverCritHoverSound src/Dodge/Creature/Update.hs 154;" f
|
||||||
hoverCritInternal src/Dodge/Humanoid.hs 46;" f
|
hoverCritInternal src/Dodge/Humanoid.hs 46;" f
|
||||||
hoverCritMv src/Dodge/Creature/ReaderUpdate.hs 229;" f
|
hoverCritMv src/Dodge/Creature/ReaderUpdate.hs 229;" f
|
||||||
hoverDeathSounds src/Dodge/Creature/Vocalization.hs 58;" f
|
hoverDeathSounds src/Dodge/Creature/Vocalization.hs 58;" f
|
||||||
@@ -4520,7 +4520,7 @@ pointerToItemID src/Dodge/Item/Location.hs 42;" f
|
|||||||
pointerYourRootItem src/Dodge/Item/Location.hs 33;" f
|
pointerYourRootItem src/Dodge/Item/Location.hs 33;" f
|
||||||
pointerYourSelectedItem src/Dodge/Item/Location.hs 26;" f
|
pointerYourSelectedItem src/Dodge/Item/Location.hs 26;" f
|
||||||
pointsToPoly src/Geometry/ConvexPoly.hs 37;" f
|
pointsToPoly src/Geometry/ConvexPoly.hs 37;" f
|
||||||
poisonSPic src/Dodge/Creature/Update.hs 235;" f
|
poisonSPic src/Dodge/Creature/Update.hs 267;" f
|
||||||
poisonSprayer src/Dodge/Item/Held/SprayGuns.hs 17;" f
|
poisonSprayer src/Dodge/Item/Held/SprayGuns.hs 17;" f
|
||||||
poke34 src/Shader/Poke.hs 518;" f
|
poke34 src/Shader/Poke.hs 518;" f
|
||||||
pokeArrayOff src/Shader/Poke.hs 530;" f
|
pokeArrayOff src/Shader/Poke.hs 530;" f
|
||||||
@@ -4889,7 +4889,7 @@ scaleSH src/Shape.hs 271;" f
|
|||||||
scalp src/Dodge/Creature/Picture.hs 348;" f
|
scalp src/Dodge/Creature/Picture.hs 348;" f
|
||||||
scancodeToHotkey src/Dodge/Creature/YourControl.hs 82;" f
|
scancodeToHotkey src/Dodge/Creature/YourControl.hs 82;" f
|
||||||
scodeToChar src/Dodge/ScodeToChar.hs 6;" f
|
scodeToChar src/Dodge/ScodeToChar.hs 6;" f
|
||||||
scorchSPic src/Dodge/Creature/Update.hs 232;" f
|
scorchSPic src/Dodge/Creature/Update.hs 264;" f
|
||||||
screenBox src/Dodge/Base/Window.hs 54;" f
|
screenBox src/Dodge/Base/Window.hs 54;" f
|
||||||
screenPolygon src/Dodge/Base/Window.hs 18;" f
|
screenPolygon src/Dodge/Base/Window.hs 18;" f
|
||||||
screenPolygonBord src/Dodge/Base/Window.hs 28;" f
|
screenPolygonBord src/Dodge/Base/Window.hs 28;" f
|
||||||
@@ -4917,6 +4917,7 @@ sectionsSizes src/Dodge/DisplayInventory.hs 205;" f
|
|||||||
seedStartMenu src/Dodge/Menu.hs 85;" f
|
seedStartMenu src/Dodge/Menu.hs 85;" f
|
||||||
seedStartOptions src/Dodge/Menu.hs 88;" f
|
seedStartOptions src/Dodge/Menu.hs 88;" f
|
||||||
segOnCirc src/Geometry.hs 113;" f
|
segOnCirc src/Geometry.hs 113;" f
|
||||||
|
segmentArea src/Dodge/Creature/Update.hs 135;" f
|
||||||
selNumPos src/Dodge/Render/HUD.hs 475;" f
|
selNumPos src/Dodge/Render/HUD.hs 475;" f
|
||||||
selNumPosCardinal src/Dodge/Render/HUD.hs 492;" f
|
selNumPosCardinal src/Dodge/Render/HUD.hs 492;" f
|
||||||
selSecDrawCursor src/Dodge/Render/List.hs 101;" f
|
selSecDrawCursor src/Dodge/Render/List.hs 101;" f
|
||||||
@@ -5046,10 +5047,10 @@ showEquipItem src/Dodge/Item/Display.hs 108;" f
|
|||||||
showInt src/Dodge/Item/Info.hs 75;" f
|
showInt src/Dodge/Item/Info.hs 75;" f
|
||||||
showIntsString src/Dodge/Tree/Compose.hs 130;" f
|
showIntsString src/Dodge/Tree/Compose.hs 130;" f
|
||||||
showInventoryPathing src/Dodge/Item/Display.hs 86;" f
|
showInventoryPathing src/Dodge/Item/Display.hs 86;" f
|
||||||
showManObj src/Dodge/TestString.hs 102;" f
|
showManObj src/Dodge/TestString.hs 104;" f
|
||||||
showMuzzlePositions src/Dodge/Debug.hs 292;" f
|
showMuzzlePositions src/Dodge/Debug.hs 292;" f
|
||||||
showTerminalError src/Dodge/Debug/Terminal.hs 80;" f
|
showTerminalError src/Dodge/Debug/Terminal.hs 80;" f
|
||||||
showTimeFlow src/Dodge/TestString.hs 119;" f
|
showTimeFlow src/Dodge/TestString.hs 121;" f
|
||||||
shrinkPolyOnEdges src/Geometry/Polygon.hs 198;" f
|
shrinkPolyOnEdges src/Geometry/Polygon.hs 198;" f
|
||||||
shrinkVert src/Geometry/Polygon.hs 202;" f
|
shrinkVert src/Geometry/Polygon.hs 202;" f
|
||||||
shuffle src/RandomHelp.hs 68;" f
|
shuffle src/RandomHelp.hs 68;" f
|
||||||
@@ -5088,7 +5089,7 @@ slideWindow src/ListHelp.hs 81;" f
|
|||||||
slimeCrit src/Dodge/Creature/ChaseCrit.hs 65;" f
|
slimeCrit src/Dodge/Creature/ChaseCrit.hs 65;" f
|
||||||
slimeCritUpdate src/Dodge/Creature/Update.hs 72;" f
|
slimeCritUpdate src/Dodge/Creature/Update.hs 72;" f
|
||||||
slinkCrit src/Dodge/Creature/ChaseCrit.hs 54;" f
|
slinkCrit src/Dodge/Creature/ChaseCrit.hs 54;" f
|
||||||
slinkCritUpdate src/Dodge/Creature/Update.hs 106;" f
|
slinkCritUpdate src/Dodge/Creature/Update.hs 138;" f
|
||||||
slowCrush90 src/Dodge/Room/LongDoor.hs 263;" f
|
slowCrush90 src/Dodge/Room/LongDoor.hs 263;" f
|
||||||
slowCrushRoom src/Dodge/Room/LongDoor.hs 148;" f
|
slowCrushRoom src/Dodge/Room/LongDoor.hs 148;" f
|
||||||
slowDoorRoom src/Dodge/Room/LongDoor.hs 309;" f
|
slowDoorRoom src/Dodge/Room/LongDoor.hs 309;" f
|
||||||
@@ -5150,7 +5151,7 @@ splashScreen src/Dodge/Initialisation.hs 10;" f
|
|||||||
splitBezierquad src/Geometry/Bezier.hs 15;" f
|
splitBezierquad src/Geometry/Bezier.hs 15;" f
|
||||||
splitExtra src/Justify.hs 21;" f
|
splitExtra src/Justify.hs 21;" f
|
||||||
splitLookupTrie src/SimpleTrie.hs 39;" f
|
splitLookupTrie src/SimpleTrie.hs 39;" f
|
||||||
splitSlimeCrit src/Dodge/Creature/Update.hs 103;" f
|
splitSlimeCrit src/Dodge/Creature/Update.hs 112;" f
|
||||||
splitTrunk src/TreeHelp.hs 181;" f
|
splitTrunk src/TreeHelp.hs 181;" f
|
||||||
splitTrunkAt src/TreeHelp.hs 169;" f
|
splitTrunkAt src/TreeHelp.hs 169;" f
|
||||||
spreadAroundCenter src/Dodge/Base.hs 173;" f
|
spreadAroundCenter src/Dodge/Base.hs 173;" f
|
||||||
@@ -5188,7 +5189,7 @@ stackText src/Picture/Base.hs 180;" f
|
|||||||
stackedInventory src/Dodge/Creature.hs 326;" f
|
stackedInventory src/Dodge/Creature.hs 326;" f
|
||||||
startCr src/Dodge/Creature.hs 90;" f
|
startCr src/Dodge/Creature.hs 90;" f
|
||||||
startCrafts src/Dodge/Room/Start.hs 94;" f
|
startCrafts src/Dodge/Room/Start.hs 94;" f
|
||||||
startDeathTimer src/Dodge/Creature/Update.hs 186;" f
|
startDeathTimer src/Dodge/Creature/Update.hs 218;" f
|
||||||
startDrag src/Dodge/Update/Input/InGame.hs 319;" f
|
startDrag src/Dodge/Update/Input/InGame.hs 319;" f
|
||||||
startInvList src/Dodge/Creature.hs 105;" f
|
startInvList src/Dodge/Creature.hs 105;" f
|
||||||
startInventory src/Dodge/Creature.hs 108;" f
|
startInventory src/Dodge/Creature.hs 108;" f
|
||||||
@@ -5339,7 +5340,7 @@ toBinary src/Dodge/Inventory/SelectionList.hs 138;" f
|
|||||||
toBothLnk src/Dodge/RoomLink.hs 136;" f
|
toBothLnk src/Dodge/RoomLink.hs 136;" f
|
||||||
toClosestMultiple src/HelpNum.hs 3;" f
|
toClosestMultiple src/HelpNum.hs 3;" f
|
||||||
toColor8 src/Color.hs 158;" f
|
toColor8 src/Color.hs 158;" f
|
||||||
toDeathCarriage src/Dodge/Creature/Update.hs 194;" f
|
toDeathCarriage src/Dodge/Creature/Update.hs 226;" f
|
||||||
toFloatVAs src/Shader/Compile.hs 66;" f
|
toFloatVAs src/Shader/Compile.hs 66;" f
|
||||||
toLabel src/Dodge/Cleat.hs 16;" f
|
toLabel src/Dodge/Cleat.hs 16;" f
|
||||||
toMultiset src/Multiset.hs 64;" f
|
toMultiset src/Multiset.hs 64;" f
|
||||||
@@ -5363,7 +5364,7 @@ tone440sawtoothquietS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 677;" f
|
|||||||
topInvW src/Dodge/ListDisplayParams.hs 56;" f
|
topInvW src/Dodge/ListDisplayParams.hs 56;" f
|
||||||
topPrismEdgeIndices src/Shader/Poke.hs 344;" f
|
topPrismEdgeIndices src/Shader/Poke.hs 344;" f
|
||||||
topPrismIndices src/Shader/Poke.hs 419;" f
|
topPrismIndices src/Shader/Poke.hs 419;" f
|
||||||
topTestPart src/Dodge/TestString.hs 97;" f
|
topTestPart src/Dodge/TestString.hs 99;" f
|
||||||
torchShape src/Dodge/Item/Draw/SPic.hs 277;" f
|
torchShape src/Dodge/Item/Draw/SPic.hs 277;" f
|
||||||
torqueAmount src/Dodge/HeldUse.hs 606;" f
|
torqueAmount src/Dodge/HeldUse.hs 606;" f
|
||||||
torqueCr src/Dodge/WorldEffect.hs 85;" f
|
torqueCr src/Dodge/WorldEffect.hs 85;" f
|
||||||
@@ -5558,7 +5559,7 @@ updatePlasmaBall src/Dodge/Update.hs 527;" f
|
|||||||
updatePlasmaBalls src/Dodge/Update.hs 669;" f
|
updatePlasmaBalls src/Dodge/Update.hs 669;" f
|
||||||
updatePreload src/Preload/Update.hs 21;" f
|
updatePreload src/Preload/Update.hs 21;" f
|
||||||
updateProjectile src/Dodge/Projectile/Update.hs 26;" f
|
updateProjectile src/Dodge/Projectile/Update.hs 26;" f
|
||||||
updatePulse src/Dodge/Creature/Update.hs 247;" f
|
updatePulse src/Dodge/Creature/Update.hs 279;" f
|
||||||
updatePulseBall src/Dodge/Update.hs 547;" f
|
updatePulseBall src/Dodge/Update.hs 547;" f
|
||||||
updatePulseLaser src/Dodge/Update.hs 716;" f
|
updatePulseLaser src/Dodge/Update.hs 716;" f
|
||||||
updatePulseLasers src/Dodge/Update.hs 522;" f
|
updatePulseLasers src/Dodge/Update.hs 522;" f
|
||||||
|
|||||||
Reference in New Issue
Block a user