Move towards tweak parameters editing items
This commit is contained in:
@@ -53,7 +53,7 @@ autoGun = defaultAutoGun
|
||||
, withSoundForI autoBS 5
|
||||
--, withSoundForI seagullChatterS 5
|
||||
, useAmmo 1
|
||||
, withRandomDirI (autogunSpread/2)
|
||||
, applyInaccuracy
|
||||
, withMuzFlareI
|
||||
, withSmoke 1 black 20 200 5
|
||||
]
|
||||
@@ -406,7 +406,5 @@ startZoomInLongGun = itAttachment . scopeZoomChange %~ \x -> max 5 (x + 5)
|
||||
startZoomOutLongGun :: Item -> Item
|
||||
startZoomOutLongGun = itAttachment . scopeZoomChange %~ \x -> min (-5) (x-5)
|
||||
|
||||
spreadGunSpread :: Float
|
||||
spreadGunSpread = 0.5
|
||||
autogunSpread :: Float
|
||||
autogunSpread = 0.07
|
||||
|
||||
@@ -40,8 +40,7 @@ launcher = defaultGun
|
||||
, _itConsumption = defaultAmmo
|
||||
{ _aoType = defaultShellAmmo
|
||||
{ _amPayload = makeExplosionAt
|
||||
, _amString = ""
|
||||
, _amPjParams = basicAmPjMoves
|
||||
, _amString = "EXPLOSIVE SHELL"
|
||||
, _amPjDraw = shellPic
|
||||
}
|
||||
, _wpMaxAmmo = 30
|
||||
@@ -59,6 +58,20 @@ launcher = defaultGun
|
||||
& useAim . aimStance .~ TwoHandTwist
|
||||
, _itFloorPict = launcherPic
|
||||
, _itEffect = NoItEffect
|
||||
, _itParams = ShellLauncher
|
||||
{ _tweakSel = 0
|
||||
, _tweakParams = basicAmPjMoves
|
||||
, _shellSpinDrag = 1
|
||||
, _shellSpinAmount = 2
|
||||
, _shellThrustDelay = 1
|
||||
}
|
||||
}
|
||||
|
||||
defaultShellAmmo :: AmmoType
|
||||
defaultShellAmmo = ProjectileAmmo
|
||||
{ _amPayload = const id
|
||||
, _amString = "Shell"
|
||||
, _amPjDraw = const mempty
|
||||
}
|
||||
|
||||
launcherPic :: Item -> SPic
|
||||
@@ -69,32 +82,32 @@ launcherPic _ =
|
||||
, mempty
|
||||
)
|
||||
|
||||
basicAmPjMoves :: [PjParam]
|
||||
basicAmPjMoves :: [TweakParam]
|
||||
basicAmPjMoves =
|
||||
[spinDrag
|
||||
,spinStart
|
||||
,thrustParam
|
||||
]
|
||||
spinDrag :: PjParam
|
||||
spinDrag = PjParam
|
||||
spinDrag :: TweakParam
|
||||
spinDrag = PjExtraUpdate
|
||||
{ _pjMoveParam = \i _ _ -> reduceSpinBy (1 - fromIntegral i*2 / 200)
|
||||
, _pjIntParam = 1
|
||||
, _curTweak = 1
|
||||
, _pjDisplayParam = pjPadText "SPIN SLOWDOWN" . show
|
||||
, _pjMaxParam = 5
|
||||
}
|
||||
pjPadText :: String -> String -> String
|
||||
pjPadText s = (rightPad 12 ' ' s ++ ) . (' ':)
|
||||
spinStart :: PjParam
|
||||
spinStart = PjParam
|
||||
spinStart :: TweakParam
|
||||
spinStart = PjExtraUpdate
|
||||
{ _pjMoveParam = \i _ cr -> pjEffAtTime 35 $ trySpinByCID (_crID cr) i
|
||||
, _pjIntParam = 2
|
||||
, _curTweak = 2
|
||||
, _pjDisplayParam = pjPadText "SPIN AMOUNT" . show
|
||||
, _pjMaxParam = 5
|
||||
}
|
||||
thrustParam :: PjParam
|
||||
thrustParam = PjParam
|
||||
thrustParam :: TweakParam
|
||||
thrustParam = PjExtraUpdate
|
||||
{ _pjMoveParam = \i _ _ -> pjThrust i
|
||||
, _pjIntParam = 1
|
||||
, _curTweak = 1
|
||||
, _pjDisplayParam = pjPadText "THRUST DELAY" . show
|
||||
, _pjMaxParam = 5
|
||||
}
|
||||
@@ -124,25 +137,26 @@ doThrust pj w = w
|
||||
r1 = randInCirc 10 & evalState $ _randGen w
|
||||
smokeGen = shellTrailCloud $ addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos))
|
||||
|
||||
--flameLauncher :: Item
|
||||
--flameLauncher = launcher & wpAmmo . amPayload .~ makeFlameExplosionAt
|
||||
--poisonLauncher :: Item
|
||||
--poisonLauncher = launcher & wpAmmo . amPayload .~ makePoisonExplosionAt
|
||||
--teslaLauncher :: Item
|
||||
--teslaLauncher = launcher & wpAmmo . amPayload .~ makeTeslaExplosionAt
|
||||
--aPJtweakParams :: Prop -> Item -> Creature -> World -> World
|
||||
--aPJtweakParams pr it cr w =
|
||||
|
||||
aRocketWithItemParams
|
||||
:: Item -- ^ Firing item
|
||||
-> Creature
|
||||
-> World
|
||||
-> World
|
||||
aRocketWithItemParams :: Item -> Creature -> World -> World
|
||||
aRocketWithItemParams it cr w = over props (IM.insert i theShell) w
|
||||
where
|
||||
am = _itConsumption it
|
||||
i = IM.newKey $ _props w
|
||||
pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
|
||||
dir = _crDir cr
|
||||
ammoMvs pj w' = foldr (\pjP -> _pjMoveParam pjP (_pjIntParam pjP) it cr pj) w' (_amPjParams $ _aoType am)
|
||||
params = _itParams it
|
||||
spindrag = _shellSpinDrag params
|
||||
spinamount = _shellSpinAmount params
|
||||
thrustdelay = _shellThrustDelay params
|
||||
ammoMvs pj w' =
|
||||
foldr (\pjP -> _pjMoveParam pjP (_curTweak pjP) it cr pj) w'
|
||||
(filter ispjupdate $ _tweakParams $ _itParams it)
|
||||
ispjupdate PjExtraUpdate {} = True
|
||||
ispjupdate _ = False
|
||||
-- I feel like this might leak...
|
||||
theShell = defaultShell
|
||||
{ _pjPos = pos
|
||||
, _pjStartPos = pos
|
||||
@@ -150,7 +164,12 @@ aRocketWithItemParams it cr w = over props (IM.insert i theShell) w
|
||||
, _pjAcc = rotateV dir (V2 3 0)
|
||||
, _prDraw = _amPjDraw $ _aoType am
|
||||
, _pjID = i
|
||||
, _pjUpdate = \pj -> ammoMvs pj . decTimMvVel pj . moveShell pj
|
||||
--, _pjUpdate = \pj -> ammoMvs pj . decTimMvVel pj . moveShell pj
|
||||
, _pjUpdate = \pj -> pjEffAtTime 35 (trySpinByCID (_crID cr) spinamount) pj
|
||||
. pjThrust thrustdelay pj
|
||||
. reduceSpinBy (1-fromIntegral spindrag*2 / 200) pj
|
||||
. decTimMvVel pj
|
||||
. moveShell pj
|
||||
, _pjPayload = _amPayload $ _aoType am
|
||||
, _pjTimer = 50
|
||||
}
|
||||
@@ -242,7 +261,6 @@ remoteLauncher = defaultGun
|
||||
{ _aoType = defaultShellAmmo
|
||||
{ _amPayload = makeExplosionAt
|
||||
, _amString = ""
|
||||
, _amPjParams = basicAmPjMoves
|
||||
, _amPjDraw = shellPic
|
||||
}
|
||||
, _wpMaxAmmo = 30
|
||||
@@ -258,6 +276,10 @@ remoteLauncher = defaultGun
|
||||
& useAim . aimStance .~ TwoHandTwist
|
||||
, _itFloorPict = launcherPic
|
||||
, _itAttachment = ItScope (V2 0 0) 0 1 True
|
||||
-- , _itParams = ShellLauncher
|
||||
-- { _tweakSel = 0
|
||||
-- , _tweakParams = basicAmPjMoves -- TODO change to allow tweaking rocket speed
|
||||
-- }
|
||||
}
|
||||
|
||||
fireRemoteLauncher :: Creature -> World -> World
|
||||
|
||||
Reference in New Issue
Block a user