Move towards a simplified creature update
This commit is contained in:
@@ -9,6 +9,7 @@ module Dodge.Creature.Inanimate
|
||||
, explosiveBarrel
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.RemoveCreatureEndo
|
||||
import Dodge.WorldEvent.Explosion
|
||||
import Dodge.Creature.Picture
|
||||
--import Dodge.Creature.Stance.Data
|
||||
@@ -42,7 +43,7 @@ colorLamp
|
||||
-> Float -- height of lamp
|
||||
-> Creature
|
||||
colorLamp col h = defaultInanimate
|
||||
{ _crUpdate = initialiseColorLamp col h
|
||||
{ _crUpdate = toCrUpdate $ initialiseColorLamp col h
|
||||
, _crHP = 100
|
||||
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
||||
, _crRad = 3
|
||||
@@ -51,7 +52,7 @@ colorLamp col h = defaultInanimate
|
||||
|
||||
lamp :: Float -> Creature
|
||||
lamp h = defaultInanimate
|
||||
{ _crUpdate = initialiseLamp h
|
||||
{ _crUpdate = toCrUpdate $ initialiseLamp h
|
||||
, _crHP = 100
|
||||
, _crPict = picAtCrPosNoRot (lampCrPic h)
|
||||
, _crRad = 3
|
||||
@@ -83,12 +84,12 @@ initialiseLamp :: Float -> CRUpdate
|
||||
initialiseLamp = initialiseColorLamp 0.75
|
||||
|
||||
initialiseColorLamp :: Point3 -> Float -> CRUpdate
|
||||
initialiseColorLamp col h cr _ = ( Endo addLS , Just $ cr & crUpdate .~ updateLamp h i)
|
||||
initialiseColorLamp col h cr _ = ( Endo addLS , Just $ cr & crUpdate .~ toCrUpdate (updateLamp h i))
|
||||
where
|
||||
i = _crID cr
|
||||
addLS w = w
|
||||
& lightSources %~ IM.insert lsid (lsColPosID col (V3 x y h) lsid)
|
||||
& creatures . ix i . crUpdate .~ updateLamp h lsid
|
||||
& creatures . ix i . crUpdate .~ toCrUpdate (updateLamp h lsid)
|
||||
where
|
||||
lsid = IM.newKey $ _lightSources w
|
||||
(V2 x y) = _crPos cr
|
||||
@@ -109,7 +110,7 @@ updateLamp h i = unrandUpdate handleLS internalUpdate
|
||||
|
||||
barrel :: Creature
|
||||
barrel = defaultInanimate
|
||||
{ _crUpdate = updateBarrel
|
||||
{ _crUpdate = toCrUpdate updateBarrel
|
||||
, _crHP = 500
|
||||
, _crPict = picAtCrPos $ onLayer CrLayer $ pictures
|
||||
[ color orange $ circleSolid 10
|
||||
@@ -124,7 +125,7 @@ barrel = defaultInanimate
|
||||
|
||||
explosiveBarrel :: Creature
|
||||
explosiveBarrel = defaultInanimate
|
||||
{ _crUpdate = updateExpBarrel
|
||||
{ _crUpdate = toCrUpdate updateExpBarrel
|
||||
, _crHP = 400
|
||||
, _crPict = shapeAtCrPos
|
||||
. colorSH orange
|
||||
|
||||
Reference in New Issue
Block a user