Add damage origins

This commit is contained in:
2026-04-24 20:34:20 +01:00
parent 011286ccb5
commit e0e346aade
43 changed files with 535 additions and 449 deletions
+6 -6
View File
@@ -540,7 +540,7 @@ updatePlasmaBall w pb
dodam = \case
Left cr -> creatures . ix (_crID cr) . crDamage .:~ thedam
Right wl -> wallDamages . at (_wlID wl) . non mempty .:~ thedam
thedam = Lasering 100 ep (pb ^. pbVel)
thedam = Lasering 100 ep (pb ^. pbVel) (pb ^. pbOrigin)
sp = pb ^. pbPos
ep = sp + pb ^. pbVel
thit = thingHit sp ep w
@@ -560,7 +560,7 @@ updatePulseBall pb w
dodam = \case
Left cr -> creatures . ix (_crID cr) . crDamage .:~ thedam
Right wl -> wallDamages . at (_wlID wl) . non mempty .:~ thedam
thedam = Lasering 100 ep (pb ^. pzbVel)
thedam = Lasering 100 ep (pb ^. pzbVel) (pb ^. pzbOrigin)
sp = pb ^. pzbPos
ep = sp + pb ^. pzbVel
thit = listToMaybe $ thingsHitZ 20 sp ep w
@@ -718,7 +718,7 @@ updateTeslaArc w pt
, randWallReflect ld' wl
)
| ArcStep lp' ld' _ <- last thearc = (lp', rp ld')
damthings (ArcStep _ _ crwl) = damageCrWlID [Electrical 50] crwl
damthings (ArcStep _ _ crwl) = damageCrWlID [Electrical 50 (pt ^. taOrigin)] crwl
updatePulseLaser :: PulseLaser -> (Endo World, [PulseLaser])
updatePulseLaser pz = case pz ^. pzTimer of
@@ -734,14 +734,14 @@ updatePulseLaser pz = case pz ^. pzTimer of
dodam thit = case thit of
((p, OCreature cr) : _) ->
cWorld . lWorld . creatures . ix (_crID cr) . crDamage
.:~ Lasering (pz ^. pzDamage) p (xp - sp)
.:~ Lasering (pz ^. pzDamage) p (xp - sp) (pz ^. pzOrigin)
((p, OWall wl) : _) ->
cWorld . lWorld . wallDamages . at (_wlID wl) . non mempty
.:~ Lasering (pz ^. pzDamage) p (xp - sp)
.:~ Lasering (pz ^. pzDamage) p (xp - sp) (pz ^. pzOrigin)
((_, OPulseBall pb) : xs) ->
dodam xs
. (cWorld . lWorld . pulseBalls . ix (_pzbID pb) . pzbTimer .~ 0)
. makeExplosionAt (_pzbPos pb `v2z` 20) 0
. makeExplosionAt (pb ^. pzbOrigin) (_pzbPos pb `v2z` 20) 0
_ -> id
phasev = _pzPhaseV pz
sp = _pzPos pz