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
+3 -4
View File
@@ -4,17 +4,16 @@ module Dodge.WorldEvent.Damage
import Dodge.Data
import Geometry
import Dodge.Wall.Damage
import Control.Lens
import LensHelp
damThingHitWith
:: (Point2 -> Point2 -> Point2 -> DamageType)
:: (Point2 -> Point2 -> Point2 -> Damage)
-> Point2
-> Point2
-> Maybe (Point2, Either Creature Wall)
-> World
-> World
damThingHitWith partDT sp ep mayEiCrWl = case mayEiCrWl of
Just (hitp,Left cr ) -> creatures . ix (_crID cr) . crState . crDamage %~ (partDT sp hitp ep :)
Just (hitp,Left cr) -> creatures . ix (_crID cr) . crState . crDamage .:~ partDT sp hitp ep
Just (hitp,Right wl) -> damageWall (partDT sp hitp ep) wl
Nothing -> id