Refactor bullet particles
This commit is contained in:
@@ -199,11 +199,11 @@ moveBy
|
||||
-> World
|
||||
moveBy n v = over (creatures . ix n . crPos) (+.+ v)
|
||||
|
||||
reloadWeapon
|
||||
startReloadingWeapon
|
||||
:: Int -- ^ Creature id
|
||||
-> World
|
||||
-> Maybe World
|
||||
reloadWeapon cid w =
|
||||
startReloadingWeapon cid w =
|
||||
let cr = _creatures w IM.! cid
|
||||
it = _crInv cr IM.! _crInvSel cr
|
||||
itRef = creatures . ix cid . crInv . ix (_crInvSel cr)
|
||||
@@ -216,7 +216,8 @@ reloadWeapon cid w =
|
||||
{- | Start reloading if clip is empty. -}
|
||||
crAutoReload :: Creature -> Creature
|
||||
crAutoReload cr = case cr ^? crInv . ix (_crInvSel cr) . wpLoadedAmmo of
|
||||
Just 0 -> cr & crInv . ix (_crInvSel cr) . wpReloadState %~ (`fromMaybe` reloadT)
|
||||
Just 0 | _posture (_crStance cr) /= Aiming
|
||||
-> cr & crInv . ix (_crInvSel cr) . wpReloadState %~ (`fromMaybe` reloadT)
|
||||
& crInv . ix (_crInvSel cr) . wpLoadedAmmo %~ (`fromMaybe` maxA)
|
||||
_ -> cr
|
||||
where
|
||||
@@ -368,3 +369,4 @@ creatureTurnToward p turnSpeed cr
|
||||
where
|
||||
vToTarg = p -.- _crPos cr
|
||||
dirToTarget = argV vToTarg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user