Move TriggerType out of item record
This commit is contained in:
@@ -20,8 +20,10 @@ module Dodge.Data (
|
||||
module Dodge.Data.CreatureEffect,
|
||||
module Dodge.Data.MountedObject,
|
||||
module Dodge.Data.AimStance,
|
||||
module Dodge.Data.TriggerType,
|
||||
) where
|
||||
|
||||
import Dodge.Data.TriggerType
|
||||
import Dodge.Data.AimStance
|
||||
import Dodge.Data.Config
|
||||
import Dodge.Data.Scenario
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Item.Use (
|
||||
module Dodge.Data.Item.Use,
|
||||
module Dodge.Data.Item.Use.Equipment,
|
||||
@@ -35,7 +34,7 @@ data ItemUse
|
||||
{ _heldDelay :: UseDelay
|
||||
, _heldAim :: AimParams
|
||||
, _heldParams :: HeldParams
|
||||
, _heldTriggerType :: TriggerType
|
||||
-- , _heldTriggerType :: TriggerType
|
||||
, _heldFrame :: Int
|
||||
, _heldUseEffect :: HeldUseEffect
|
||||
}
|
||||
@@ -69,9 +68,6 @@ data UseCondition
|
||||
| UseableAnytime
|
||||
deriving (Eq, Show, Read)
|
||||
|
||||
data TriggerType = AutoTrigger | HammerTrigger
|
||||
deriving (Eq, Show, Read)
|
||||
|
||||
data AttachParams
|
||||
= APProjectiles {_apProjectiles :: [Int]}
|
||||
| APInt {_apInt :: Int}
|
||||
@@ -192,7 +188,6 @@ deriveJSON defaultOptions ''UseFocus
|
||||
deriveJSON defaultOptions ''UseCondition
|
||||
deriveJSON defaultOptions ''MuzzleEffect
|
||||
deriveJSON defaultOptions ''FlareType
|
||||
deriveJSON defaultOptions ''TriggerType
|
||||
deriveJSON defaultOptions ''AmmoParams
|
||||
deriveJSON defaultOptions ''HeldParams
|
||||
deriveJSON defaultOptions ''AmmoPerShot
|
||||
|
||||
@@ -39,7 +39,6 @@ defaultHeldUse = UseHeld
|
||||
, _weaponInvLock = 0
|
||||
, _weaponRepeat = []
|
||||
}
|
||||
, _heldTriggerType = HammerTrigger
|
||||
, _heldFrame = 0
|
||||
, _heldUseEffect = NoHeldUseEffect
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ module Dodge.HeldUse (
|
||||
mcUseHeld,
|
||||
) where
|
||||
|
||||
import Dodge.BaseTriggerType
|
||||
import Sound.Data
|
||||
import Color
|
||||
import Control.Applicative
|
||||
@@ -85,7 +86,8 @@ hammerCheck ::
|
||||
t2 ->
|
||||
t2
|
||||
hammerCheck f pt it cr
|
||||
| Just HammerTrigger <- it ^? ldtValue . itUse . heldTriggerType
|
||||
| t <- baseTriggerType (it ^. ldtValue)
|
||||
, t == HammerTrigger || t == AlwaysSingleTrigger
|
||||
, isNothing $ lookup MakeAutoLink (it ^. ldtRight)
|
||||
, pt /= InitialPress =
|
||||
id
|
||||
@@ -158,7 +160,7 @@ doWeaponRepetitions itm cr = case itm ^? ldtValue . itUse . heldParams . weaponR
|
||||
f x = (x, WdWdFromItCrixWdWd (upitm x) (_crID cr) ItCrWdItemHeldEffect)
|
||||
upitm x =
|
||||
itm & ldtValue . itUse . heldParams . weaponRepeat .~ []
|
||||
& ldtValue . itUse . heldTriggerType .~ AutoTrigger
|
||||
-- & ldtValue . itUse . heldTriggerType .~ AutoTrigger
|
||||
& ldtValue . itUse . heldFrame .~ x
|
||||
|
||||
applyCME :: Item -> Creature -> CumulativeMuzzleEffect -> World -> World
|
||||
|
||||
@@ -7,6 +7,8 @@ module Dodge.Item.Grammar (
|
||||
allInvLocs,
|
||||
) where
|
||||
|
||||
import Dodge.Data.TriggerType
|
||||
import Dodge.BaseTriggerType
|
||||
import Dodge.Data.AimStance
|
||||
import Dodge.Item.AimStance
|
||||
import Control.Applicative
|
||||
@@ -112,8 +114,8 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
_ -> ([], [])
|
||||
|
||||
getAutoSpringLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||
getAutoSpringLinks itm = case itm ^? itUse . heldTriggerType of
|
||||
Just HammerTrigger -> [(MakeAutoSF, MakeAutoLink)]
|
||||
getAutoSpringLinks itm = case baseTriggerType itm of
|
||||
HammerTrigger -> [(MakeAutoSF, MakeAutoLink)]
|
||||
_ -> []
|
||||
|
||||
extraWeaponLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||
|
||||
@@ -29,7 +29,6 @@ teslaGun =
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleTesla
|
||||
& itType .~ HELD TESLAGUN
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
|
||||
teslaParams :: ItemParams
|
||||
teslaParams =
|
||||
@@ -47,7 +46,6 @@ laser =
|
||||
& itUse . heldParams .~ BeamShooterParams-- Nothing
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
& itUse . heldDelay .~ NoDelay
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 6 0
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzFlareType .~ LasGunFlare
|
||||
@@ -67,7 +65,6 @@ tractorGun =
|
||||
defaultHeldItem
|
||||
& itUse . heldParams .~ BeamShooterParams
|
||||
& itAmmoSlots .~ singleAmmo ElectricalAmmo
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 30 0
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
|
||||
@@ -72,7 +72,6 @@ autoRifle :: Item
|
||||
autoRifle =
|
||||
rifle
|
||||
& itType .~ HELD AUTORIFLE
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
|
||||
burstRifle :: Item
|
||||
burstRifle =
|
||||
|
||||
@@ -34,7 +34,6 @@ flameSpitter =
|
||||
& itUse . heldParams . weaponInvLock .~ 10
|
||||
& itUse . heldParams . weaponRepeat .~ [1..9]
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect . nzPressure .~ UniRandFloat 3 4
|
||||
& itUse . heldTriggerType .~ HammerTrigger
|
||||
|
||||
flameTorrent :: Item
|
||||
flameTorrent =
|
||||
@@ -97,4 +96,3 @@ flameThrower =
|
||||
, _weaponInvLock = 0
|
||||
, _weaponRepeat = mempty
|
||||
}
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
|
||||
@@ -56,11 +56,7 @@ pistol =
|
||||
& itType .~ HELD PISTOL
|
||||
|
||||
autoPistol :: Item
|
||||
autoPistol =
|
||||
pistol
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
-- & itUse . heldParams . bulGunSound ?~ (tap1S, 0)
|
||||
& itType .~ HELD AUTOPISTOL
|
||||
autoPistol = pistol & itType .~ HELD AUTOPISTOL
|
||||
|
||||
machinePistol :: Item
|
||||
machinePistol =
|
||||
|
||||
Reference in New Issue
Block a user