Rethink damage data type, work on damage sensors

This commit is contained in:
2022-03-13 09:27:35 +00:00
parent d340fd73c3
commit 06a501ff88
30 changed files with 356 additions and 240 deletions
+7 -4
View File
@@ -118,12 +118,15 @@ shieldWall crid = defaultWall
,_wlStructure = CreaturePart crid shieldWallDamage
}
shieldWallDamage :: DamageType -> Wall -> Int -> World -> World
shieldWallDamage dt wl crid w = case dt of
Lasering {_dmFrom=df,_dmAt=da} ->
shieldWallDamage :: Damage -> Wall -> Int -> World -> World
shieldWallDamage dm wl crid w = case _dmType dm of
Lasering ->
w & instantParticles .:~ lasRayAt 5 (da +.+ normalizeV (df -.- da)) (reflDirWall df da wl)
d | isMovementDam d -> w & creatures . ix crid . crState . crDamage .:~ d
d | isMovementDam dm -> w & creatures . ix crid . crState . crDamage .:~ dm
_ -> w
where
df = _dmFrom dm
da = _dmAt dm
createShieldWall :: Creature -> Int -> World -> World
createShieldWall cr invid w = case _itEffectID $ _itEffect it of
+1 -2
View File
@@ -179,7 +179,7 @@ mvLaser :: Float -- ^ Phase velocity, controls deflection through windows
-> Particle
-> (World, Maybe Particle)
mvLaser phasev pos dir w pt
= ( damThingHitWith (Lasering 19) pos xp thHit w
= ( damThingHitWith (\p1 p2 p3 -> Damage Lasering 19 p1 p2 p3 NoDamageEffect) pos xp thHit w
, Just pt {_ptDraw = const pic ,_ptUpdate = ptSimpleTime 0 }
)
where
@@ -190,7 +190,6 @@ mvLaser phasev pos dir w pt
, setDepth 19.5 . color (brightX 10 1 yellow) $ thickLine 3 (pos:ps)
]
aTractorBeam :: Item -> Creature -> World -> World
aTractorBeam _ cr w = w & props . at i ?~ tractorBeamAt i spos outpos dir
where
+3 -1
View File
@@ -171,7 +171,9 @@ overNozzles' eff it cr w = neww & creatures . ix cid . crInv . ix i . itParams .
overNozzle :: (Nozzle -> Item -> Creature -> World -> World)
-> Item -> Creature -> World -> Nozzle -> (World, Nozzle)
overNozzle eff it cr w nz = (eff nz it (cr & crDir +~ wa + na) w & randGen .~ g,nz & nzCurrentWalkAngle .~ wa)
overNozzle eff it cr w nz =
( eff nz it (cr & crDir +~ wa + na) w & randGen .~ g
, nz & nzCurrentWalkAngle .~ wa)
where
na = _nzDir nz
(walkamount, g) = randomR (-aspeed,aspeed) (_randGen w)