refactor: pass creature to weapon use function, as opposed to just id
This commit is contained in:
@@ -18,13 +18,15 @@ import Control.Lens
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
{- |
|
||||
Creates an outwardly increasing circle that draws creatures, even those behind walls. -}
|
||||
aSonarPulse :: Int -> World -> World
|
||||
aSonarPulse cid w = over particles ((:) $ sonarPulseAt (_crPos (_creatures w IM.! cid))) w
|
||||
aSonarPulse :: Creature -> World -> World
|
||||
aSonarPulse cr w = over particles ((:) $ sonarPulseAt (_crPos cr)) w
|
||||
|
||||
{- |
|
||||
Creates an outwardly increasing circle that displays walls, even those behind other walls. -}
|
||||
aRadarPulse :: Int -> World -> World
|
||||
aRadarPulse cid w = over particles ((:) $ radarPulseAt (_crPos (_creatures w IM.! cid))) w
|
||||
aRadarPulse :: Creature -> World -> World
|
||||
aRadarPulse cr w = over particles ((:) $ radarPulseAt (_crPos (_creatures w IM.! cid))) w
|
||||
where
|
||||
cid = _crID cr
|
||||
|
||||
{- |
|
||||
Radar blip at a point.
|
||||
@@ -113,16 +115,16 @@ mvRadar x p w pt =
|
||||
|
||||
aTractorBeam
|
||||
:: Int -- ^ Color id
|
||||
-> Int -- ^ Creature id
|
||||
-> Creature -- ^ Creature id
|
||||
-> World
|
||||
-> World
|
||||
aTractorBeam col cid w
|
||||
= set (creatures . ix cid . crInv . ix itRef . wpFire)
|
||||
aTractorBeam col cr w
|
||||
= set (creatures . ix cid . crInv . ix itRef . itUse)
|
||||
(shoot $ aTractorBeam ((col + 1) `mod` 10))
|
||||
$ over projectiles (IM.insert i (tractorBeamAt col i pos dir)) w
|
||||
where
|
||||
i = newProjectileKey w
|
||||
cr = _creatures w IM.! cid
|
||||
cid = _crID cr
|
||||
pos = _crPos cr +.+ ((_crRad cr + 10) *.* unitVectorAtAngle dir)
|
||||
dir = _crDir cr
|
||||
itRef = _crInvSel cr
|
||||
|
||||
Reference in New Issue
Block a user