Randomise volleygun muzzle order
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -63,11 +63,6 @@ data CraftType
|
||||
| WIRE
|
||||
| FUELCELL
|
||||
| PORTABLEFUSION
|
||||
-- | FRAGMODULE
|
||||
-- | FLASHMODULE
|
||||
-- | GASINJECTOR
|
||||
-- | FLAKCRAFT
|
||||
-- | FRAGCRAFT
|
||||
deriving (Eq, Ord, Show, Read, Enum, Bounded)
|
||||
|
||||
data AttachType
|
||||
|
||||
@@ -40,6 +40,7 @@ data ItemUse
|
||||
, _heldParams :: HeldParams
|
||||
, _heldTriggerType :: TriggerType
|
||||
, _heldFrame :: Int
|
||||
, _heldUseEffect :: HeldUseEffect
|
||||
}
|
||||
| UseEquip { _uequipEffect :: EquipEffect }
|
||||
| UseAttach {_uaParams :: AttachParams}
|
||||
@@ -48,6 +49,11 @@ data ItemUse
|
||||
| UseBulletMod { _ubMod :: BulletMod }
|
||||
deriving (Eq, Show, Read)
|
||||
|
||||
data HeldUseEffect
|
||||
= NoHeldUseEffect
|
||||
| RandomiseMuzzleFrames Int
|
||||
deriving (Eq, Show, Read)
|
||||
|
||||
data UseFocus
|
||||
= UseFromRoot
|
||||
| UseFromLocation
|
||||
@@ -202,6 +208,8 @@ makeLenses ''MuzzleEffect
|
||||
makeLenses ''AmmoPerShot
|
||||
makeLenses ''UseCondition
|
||||
makeLenses ''UseFocus
|
||||
makeLenses ''HeldUseEffect
|
||||
deriveJSON defaultOptions ''HeldUseEffect
|
||||
deriveJSON defaultOptions ''UseFocus
|
||||
deriveJSON defaultOptions ''UseCondition
|
||||
deriveJSON defaultOptions ''MuzzleEffect
|
||||
|
||||
@@ -43,6 +43,8 @@ data AmmoType
|
||||
| ElectricalAmmo
|
||||
| DroneAmmo
|
||||
| GasAmmo
|
||||
| PrintMaterial
|
||||
| ExplosivePutty
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data ForceFieldType = DefaultForceField
|
||||
|
||||
@@ -41,4 +41,5 @@ defaultHeldUse = UseHeld
|
||||
}
|
||||
, _heldTriggerType = HammerTrigger
|
||||
, _heldFrame = 0
|
||||
, _heldUseEffect = NoHeldUseEffect
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
|
||||
|
||||
heldEffectMuzzles :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
heldEffectMuzzles t cr w =
|
||||
doHeldUseEffect t cr $
|
||||
uncurry (applyCME (_ldtValue t) cr) cmew
|
||||
-- & cWorld . lWorld . lTestString .~ map (show . _mzAmmoSlot) muzzles
|
||||
& doWeaponRepetitions upitm cr
|
||||
@@ -90,6 +91,17 @@ heldEffectMuzzles t cr w =
|
||||
(upitm, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
|
||||
cmew = foldl' (useLoadedAmmo t cr) (CME 0 0 False, w) $ zip [0 ..] loadedmuzzles
|
||||
|
||||
doHeldUseEffect :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
doHeldUseEffect t cr w = case t ^? ldtValue . itUse . heldUseEffect of
|
||||
Just (RandomiseMuzzleFrames x) -> fromMaybe w $ do
|
||||
i <- t ^? ldtValue . itLocation . ilInvID
|
||||
let g = w ^. randGen
|
||||
(is,g') = runState (shuffle [0..x-1]) g
|
||||
return $ w & cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix i . itUse . heldAim . aimMuzzles %~ zipWith (\j mz -> mz & mzFrame .~ j) is
|
||||
& randGen .~ g'
|
||||
Just NoHeldUseEffect -> w
|
||||
Nothing -> w
|
||||
|
||||
-- need to be careful about inventory lock or item ids here
|
||||
doWeaponRepetitions :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
|
||||
doWeaponRepetitions itm cr = case itm ^? ldtValue . itUse . heldParams . weaponRepeat of
|
||||
|
||||
@@ -49,6 +49,7 @@ volleyGun i =
|
||||
& itType .~ HELD (VOLLEYGUN i)
|
||||
& itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
|
||||
& itUse . heldParams . weaponRepeat .~ [1..i-1]
|
||||
& itUse . heldUseEffect .~ (RandomiseMuzzleFrames i)
|
||||
|
||||
rifle :: Item
|
||||
rifle =
|
||||
|
||||
@@ -6,11 +6,10 @@ module Dodge.Item.Held.Stick (
|
||||
smg,
|
||||
) where
|
||||
|
||||
import Dodge.SoundLogic.ExternallyGeneratedSounds
|
||||
import Dodge.Base
|
||||
import Dodge.Data.Item
|
||||
import Dodge.Default.Item
|
||||
--import Dodge.Reloading.Action
|
||||
import Dodge.SoundLogic.ExternallyGeneratedSounds
|
||||
import Geometry
|
||||
import LensHelp
|
||||
|
||||
@@ -21,9 +20,18 @@ bangStick i =
|
||||
& itUse . heldParams . torqueAfter .~ 0.18 + 0.02 * fromIntegral i
|
||||
& itType .~ HELD (BANGSTICK i)
|
||||
& itUse . heldDelay . rateMax .~ 8
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet (UseExactly 1) 0
|
||||
| a <- spreadAroundCenter i baseStickSpread]
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ [ Muzzle
|
||||
(V2 10 0)
|
||||
a
|
||||
0.01
|
||||
0
|
||||
DefaultFlareType
|
||||
MuzzleShootBullet
|
||||
(UseExactly 1)
|
||||
0
|
||||
| a <- spreadAroundCenter i baseStickSpread
|
||||
]
|
||||
|
||||
baseStickSpread :: Float
|
||||
baseStickSpread = 0.2
|
||||
@@ -48,13 +56,13 @@ autoPistol :: Item
|
||||
autoPistol =
|
||||
pistol
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
& itUse . heldParams . bulGunSound ?~ (tap1S,0)
|
||||
& itUse . heldParams . bulGunSound ?~ (tap1S, 0)
|
||||
& itType .~ HELD AUTOPISTOL
|
||||
|
||||
machinePistol :: Item
|
||||
machinePistol =
|
||||
autoPistol
|
||||
& itUse . heldDelay .~ WarmUpNoDelay {_warmTime = 0, _warmMax = 50, _warmSound = crankSlowS}
|
||||
& itUse . heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 50, _warmSound = crankSlowS}
|
||||
& itType .~ HELD MACHINEPISTOL
|
||||
& itUse . heldParams . recoil .~ 20
|
||||
|
||||
|
||||
Reference in New Issue
Block a user