Implementation of creature update using endofunctor monoid

This commit is contained in:
2021-08-18 00:59:35 +02:00
parent 5971fae5ec
commit cfb27d4a76
4 changed files with 18 additions and 7 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ polyToTriFold _ = []
initialiseLamp :: Float -> CRUpdate
initialiseLamp h w (f,g) cr = ( (addLS . f , g), Just $ cr & crUpdate .~ updateLamp h i)
where
i = IM.newKey $ _lightSources $ f w -- to give different lights different keys
i = _crID cr
addLS = over lightSources (IM.insert i (lightAt (V3 x y h) i))
(V2 x y) = _crPos cr