Add ItEffect data as parameter to the effect itself
This commit is contained in:
+20
-19
@@ -588,12 +588,13 @@ boosterGun = defaultGun
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 0
|
||||
, _itUseTime = 0
|
||||
, _itUse = shoot $ boostSelf Nothing 20
|
||||
, _itUse = boostSelf 20
|
||||
, _wpSpread = 0.05
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ polygon [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||
, _itAimingSpeed = 1
|
||||
, _itAimingRange = 0
|
||||
, _itEffect = resetAttachmentID
|
||||
}
|
||||
|
||||
aTeslaArc :: Creature -> World -> World
|
||||
@@ -640,7 +641,7 @@ makeShellAt pl i cid pos dir = Shell
|
||||
, _pjVel = rotateV dir (1,0)
|
||||
, _pjDraw = \_ -> blank
|
||||
, _pjID = i
|
||||
, _pjUpdate = moveShell 50 i cid 0 (rotateV dir (3,0))
|
||||
, _pjUpdate = \_ -> moveShell 50 i cid 0 (rotateV dir (3,0))
|
||||
, _pjPayload = pl
|
||||
}
|
||||
|
||||
@@ -657,21 +658,21 @@ moveShell time i cid rot accel w
|
||||
else w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> piclow)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid rot (rotateV rot accel)
|
||||
& projectiles . ix i . pjUpdate .~ (\_ -> moveShell (time-1) i cid rot (rotateV rot accel))
|
||||
| isJust thingHit = doExplode
|
||||
| time == 35 = w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> pic)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid spin accel
|
||||
& projectiles . ix i . pjUpdate .~ \_ -> moveShell (time-1) i cid spin accel
|
||||
| time >= 20 = w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> pic)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid rot' (rotateV rot accel)
|
||||
& projectiles . ix i . pjUpdate .~ (\_ -> moveShell (time-1) i cid rot' (rotateV rot accel))
|
||||
| time > -99 = w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& randGen .~ g
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> pic)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid rot' (rotateV rot accel)
|
||||
& projectiles . ix i . pjUpdate .~ (\_ -> moveShell (time-1) i cid rot' (rotateV rot accel))
|
||||
& projectiles . ix i . pjVel %~ (\v -> accel +.+ frict *.* v)
|
||||
& soundFromPos (ShellSound i) newPos (fromIntegral smokeTrailSound) 1 250
|
||||
& makeFlameletTimed (oldPos -.- vel) (vel +.+ rotateV (pi+sparkD) accel) Nothing 3 10
|
||||
@@ -679,7 +680,7 @@ moveShell time i cid rot accel w
|
||||
| time > -200 = w
|
||||
& projectiles . ix i . pjPos %~ (+.+ vel)
|
||||
& projectiles . ix i . pjDraw .~ (\_ -> pic)
|
||||
& projectiles . ix i . pjUpdate .~ moveShell (time-1) i cid rot' (rotateV rot accel)
|
||||
& projectiles . ix i . pjUpdate .~ (\_ -> moveShell (time-1) i cid rot' (rotateV rot accel))
|
||||
| otherwise = doExplode
|
||||
where
|
||||
doExplode = w
|
||||
@@ -761,7 +762,7 @@ retireRemoteRocket itid 0 pjid w =
|
||||
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (hammerCheck fireRemoteLauncher)
|
||||
(w & projectiles %~ IM.delete pjid)
|
||||
retireRemoteRocket itid t pjid w = setScope w
|
||||
& projectiles . ix pjid . pjUpdate .~ retireRemoteRocket itid (t-1) pjid
|
||||
& projectiles . ix pjid . pjUpdate .~ (\_ -> retireRemoteRocket itid (t-1) pjid)
|
||||
where
|
||||
setScope w' = case _itemPositions w' IM.! itid of
|
||||
InInv cid invid -> w'
|
||||
@@ -777,7 +778,7 @@ retireRemoteBomb itid 0 pjid w =
|
||||
$ set (pointToItem (_itemPositions w IM.! itid) . itUse) (hammerCheck throwRemoteBomb)
|
||||
(w & projectiles %~ IM.delete pjid)
|
||||
retireRemoteBomb itid t pjid w = setScope w
|
||||
& projectiles . ix pjid . pjUpdate .~ retireRemoteBomb itid (t-1) pjid
|
||||
& projectiles . ix pjid . pjUpdate .~ (\_ -> retireRemoteBomb itid (t-1) pjid)
|
||||
where
|
||||
setScope w' = case _itemPositions w' IM.! itid of
|
||||
InInv cid invid -> w'
|
||||
@@ -790,7 +791,7 @@ moveRemoteBomb :: Int -> Int -> Int -> World -> World
|
||||
moveRemoteBomb itid time pID w
|
||||
| time < -4 = setScope
|
||||
$ updatePicture
|
||||
$ set (projectiles .ix pID.pjUpdate) (moveRemoteBomb itid (f time) pID)
|
||||
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (f time) pID)
|
||||
w
|
||||
| time < 2
|
||||
= case hitWl of
|
||||
@@ -804,7 +805,7 @@ moveRemoteBomb itid time pID w
|
||||
updatedWorld
|
||||
= updateV $ set (projectiles . ix pID . pjPos) finalPos
|
||||
$ updatePicture
|
||||
$ set (projectiles .ix pID.pjUpdate) (moveRemoteBomb itid (time-1) pID)
|
||||
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (time-1) pID)
|
||||
$ setScope
|
||||
w
|
||||
setScope w' = case _itemPositions w' IM.! itid of
|
||||
@@ -916,7 +917,7 @@ fireRemoteLauncher cr w = setLocation
|
||||
, _pjVel = rotateV dir (1,0)
|
||||
, _pjDraw = \_ -> blank
|
||||
, _pjID = i
|
||||
, _pjUpdate = moveRemoteShell 50 i cid itid dir
|
||||
, _pjUpdate = \_ -> moveRemoteShell 50 i cid itid dir
|
||||
}
|
||||
j = _crInvSel cr
|
||||
newitid = IM.newKey $ _itemPositions w
|
||||
@@ -938,7 +939,7 @@ moveRemoteShell time i cid itid _ w
|
||||
else over (projectiles . ix i . pjPos) (+.+ vel)
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> piclow)
|
||||
$ set (projectiles . ix i . pjUpdate)
|
||||
(moveRemoteShell (time-1) i cid itid newdir)
|
||||
(\_ -> moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ setScope
|
||||
w
|
||||
| time >= 20 = case thingHit of
|
||||
@@ -946,7 +947,7 @@ moveRemoteShell time i cid itid _ w
|
||||
Nothing -> over (projectiles . ix i . pjPos) (+.+ vel)
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> pic)
|
||||
$ set (projectiles . ix i . pjUpdate)
|
||||
(moveRemoteShell (time-1) i cid itid newdir)
|
||||
(\_ -> moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ setScope
|
||||
w
|
||||
| time > -99 = case thingHit of
|
||||
@@ -956,7 +957,7 @@ moveRemoteShell time i cid itid _ w
|
||||
Nothing -> over (projectiles . ix i . pjPos) (+.+ vel)
|
||||
$ set randGen g
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> pic)
|
||||
$ set (projectiles . ix i . pjUpdate) (moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ set (projectiles . ix i . pjUpdate) (\_ -> moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ over (projectiles . ix i . pjVel) (\v -> accel +.+ frict *.* v)
|
||||
$ soundFromPos (ShellSound i) newPos (fromIntegral smokeTrailSound) 1 250
|
||||
$ smokeGen
|
||||
@@ -969,7 +970,7 @@ moveRemoteShell time i cid itid _ w
|
||||
w
|
||||
Nothing -> over (projectiles . ix i . pjPos) (+.+ vel)
|
||||
$ set (projectiles . ix i . pjDraw) (\_ -> pic)
|
||||
$ set (projectiles . ix i . pjUpdate) (moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ set (projectiles . ix i . pjUpdate) (\_ -> moveRemoteShell (time-1) i cid itid newdir)
|
||||
$ setScope
|
||||
w
|
||||
| otherwise = doExplosion
|
||||
@@ -1013,7 +1014,7 @@ explodeRemoteRocket
|
||||
-> World
|
||||
-> World
|
||||
explodeRemoteRocket itid pjid w
|
||||
= set (projectiles . ix pjid . pjUpdate) (retireRemoteRocket itid 30 pjid)
|
||||
= set (projectiles . ix pjid . pjUpdate) (\_ -> retireRemoteRocket itid 30 pjid)
|
||||
$ set (projectiles . ix pjid . pjDraw) (\_ -> blank)
|
||||
$ set (itPoint . itUse) (const id)
|
||||
$ resetName
|
||||
@@ -1036,7 +1037,7 @@ throwRemoteBomb cr w = setLocation
|
||||
, _pjVel = v
|
||||
, _pjDraw = \_ -> blank
|
||||
, _pjID = i
|
||||
, _pjUpdate = moveRemoteBomb itid 50 i
|
||||
, _pjUpdate = \_ -> moveRemoteBomb itid 50 i
|
||||
}
|
||||
i = newProjectileKey w
|
||||
v' = 0.02 / _cameraZoom w *.* rotateV (_cameraRot w) ( _mousePos w)
|
||||
@@ -1061,7 +1062,7 @@ throwRemoteBomb cr w = setLocation
|
||||
|
||||
explodeRemoteBomb :: Int -> Int -> Creature -> World -> World
|
||||
explodeRemoteBomb itid pjid cr w
|
||||
= set (projectiles . ix pjid . pjUpdate) (retireRemoteBomb itid 30 pjid)
|
||||
= set (projectiles . ix pjid . pjUpdate) (\_ -> retireRemoteBomb itid 30 pjid)
|
||||
$ set (projectiles . ix pjid . pjDraw) (\_ -> blank)
|
||||
$ set (creatures . ix cid . crInv . ix j . itUse) (const id)
|
||||
$ resetName
|
||||
|
||||
Reference in New Issue
Block a user