Make examine inventory controlled by item, perhaps still buggy
This commit is contained in:
@@ -3,49 +3,56 @@ module Dodge.Projectile.Create (
|
||||
PJStabiliser (..),
|
||||
) where
|
||||
|
||||
import NewInt
|
||||
--import Dodge.Data.ComposedItem
|
||||
--import Dodge.Data.DoubleTree
|
||||
import Dodge.Item.Location
|
||||
|
||||
import Data.Maybe
|
||||
import Dodge.Data.World
|
||||
import Dodge.Item.Location
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
import NewInt
|
||||
|
||||
data PJStabiliser
|
||||
= StabOrthReduce
|
||||
| StabSpinIncrease
|
||||
|
||||
|
||||
-- assumes the mscreen is in your inventory
|
||||
createShell ::Maybe (NewInt ItmInt)
|
||||
-> Maybe (NewInt ItmInt)
|
||||
-> Maybe PJStabiliser
|
||||
-> ProjectileType
|
||||
-> Payload -> Muzzle -> Creature -> World -> World
|
||||
createShell mdetonator mscreen stab pjtype payload muz cr w = w
|
||||
& updatescreen
|
||||
& updatedetonator
|
||||
& cWorld . lWorld . projectiles . at i
|
||||
?~ Shell
|
||||
{ _pjPos = pos
|
||||
, _pjZ = 20
|
||||
, _pjZVel = 5
|
||||
, _pjVel = rotateV dir (V2 speed 0) + crvelcomponent
|
||||
, _pjID = i
|
||||
, _pjDir = dir
|
||||
, _pjSpin = 0
|
||||
, _pjPayload = payload
|
||||
, _pjTimer = lifespan
|
||||
, _pjUpdates =
|
||||
anyspin <>
|
||||
[ RemoteDirectionPU (lifespan - thrustdelay) 0
|
||||
] <> thrustorgrav
|
||||
, _pjType = pjtype
|
||||
, _pjDetonatorID = mdetonator
|
||||
, _pjScreenID = mscreen
|
||||
}
|
||||
createShell ::
|
||||
Maybe (NewInt ItmInt) ->
|
||||
Maybe (NewInt ItmInt) ->
|
||||
Maybe PJStabiliser ->
|
||||
ProjectileType ->
|
||||
Payload ->
|
||||
Muzzle ->
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
createShell mdetonator mscreen stab pjtype payload muz cr w =
|
||||
w
|
||||
& updatescreen
|
||||
& updatedetonator
|
||||
& cWorld . lWorld . projectiles . at i
|
||||
?~ Shell
|
||||
{ _pjPos = pos
|
||||
, _pjZ = 20
|
||||
, _pjZVel = 5
|
||||
, _pjVel = rotateV dir (V2 speed 0) + crvelcomponent
|
||||
, _pjID = i
|
||||
, _pjDir = dir
|
||||
, _pjSpin = 0
|
||||
, _pjPayload = payload
|
||||
, _pjTimer = lifespan
|
||||
, _pjUpdates =
|
||||
anyspin
|
||||
<> [ RemoteDirectionPU (lifespan - thrustdelay) 0
|
||||
]
|
||||
<> thrustorgrav
|
||||
, _pjType = pjtype
|
||||
, _pjDetonatorID = mdetonator
|
||||
, _pjScreenID = mscreen
|
||||
}
|
||||
where
|
||||
crvelcomponent = case stab of
|
||||
Just StabOrthReduce -> projV (cr ^. crPos - cr ^. crOldPos) (unitVectorAtAngle dir)
|
||||
@@ -55,27 +62,27 @@ createShell mdetonator mscreen stab pjtype payload muz cr w = w
|
||||
Just StabSpinIncrease -> [StartSpinPU (lifespan - 15) (_crID cr) 4]
|
||||
_ -> [StartSpinPU (lifespan - 15) (_crID cr) 2]
|
||||
speed = case pjtype of
|
||||
Grenade {} -> 4
|
||||
Grenade{} -> 4
|
||||
Rocket{} -> 1
|
||||
RetiredProjectile -> 0
|
||||
lifespan = 350
|
||||
thrustorgrav = case pjtype of
|
||||
Grenade {}-> []
|
||||
Grenade{} -> []
|
||||
Rocket{} -> [ThrustPU (lifespan - thrustdelay) 0]
|
||||
RetiredProjectile -> []
|
||||
thrustdelay = 20
|
||||
updatedetonator = fromMaybe id $ do
|
||||
screenid <- mdetonator
|
||||
return $ pointerToItemID screenid . itUse . uaParams
|
||||
return $
|
||||
pointerToItemID screenid . itUse . uaParams
|
||||
. apProjectiles
|
||||
.:~ i
|
||||
updatescreen = fromMaybe id $ do
|
||||
screenid <- mscreen
|
||||
return $ pointerToItemID screenid . itUse . uaParams
|
||||
return $
|
||||
pointerToItemID screenid . itUse . uaParams
|
||||
. apProjectiles
|
||||
.:~ i
|
||||
-- . apLinkedProjectile
|
||||
-- ?~ i
|
||||
i = IM.newKey $ w ^. cWorld . lWorld . projectiles
|
||||
dir = _crDir cr + _mzRot muz
|
||||
pos = _crPos cr +.+ rotateV dir (_mzPos muz)
|
||||
|
||||
Reference in New Issue
Block a user