Remove internal ammo
This commit is contained in:
@@ -54,8 +54,6 @@ itemCombinations =
|
||||
, po [HELD PISTOL, CRAFT SPRING] autoPistol
|
||||
, po [HELD AUTOPISTOL, cr PLANK] smg
|
||||
, po [HELD AUTOPISTOL, cr SPRING] machinePistol
|
||||
, po [HELD (BANGSTICK 1), cr CAN] revolver
|
||||
, po [HELD REVOLVER, cr SPRING] $ revolverX 1
|
||||
, po [cr CAN, cr HARDWARE] bangCone
|
||||
, po [HELD BANGCONE, cr PLANK] blunderbuss
|
||||
, po [HELD BLUNDERBUSS, cr STEELDRUM] (grapeCannon 1)
|
||||
@@ -107,7 +105,6 @@ itemCombinations =
|
||||
]
|
||||
++ map (\i -> po [HELD (LASWIDE i), cr TRANSFORMER] $ lasWide (i + 1)) [2 .. 9]
|
||||
++ map (\i -> po [cr PIPE, HELD (BANGSTICK i)] $ bangStick (i + 1)) [1 .. 8]
|
||||
++ map (\i -> po [hd (REVOLVERX i), cr CAN] $ revolverX (i + 1)) [1 .. 5]
|
||||
++ map (\i -> po [hd (VOLLEYGUN i), HELD (BANGSTICK 1)] $ volleyGun (i + 1)) [3 .. 5]
|
||||
++ map (\i -> po [hd (MINIGUNX i), HELD (BANGSTICK 1)] $ miniGunX (i + 1)) [3 .. 15]
|
||||
++ map (\i -> po [hd (GRAPECANNON i), cr STEELDRUM] $ grapeCannon (i + 1)) [1, 2, 3]
|
||||
@@ -210,13 +207,7 @@ moduleCombinations =
|
||||
[ amod [cr MICROCHIP, cr TRANSMITTER] LAUNCHHOME
|
||||
]
|
||||
)
|
||||
,
|
||||
( ModBattery
|
||||
, batteryGuns
|
||||
,
|
||||
[ amod [cr BATTERY] EXTRABATTERY
|
||||
]
|
||||
)
|
||||
|
||||
]
|
||||
where
|
||||
amod = (,)
|
||||
@@ -241,14 +232,12 @@ bulletWeapons :: [Item]
|
||||
bulletWeapons =
|
||||
[bangStick i | i <- [1 .. 9]]
|
||||
++ [volleyGun i | i <- [3 .. 6]]
|
||||
++ [revolverX i | i <- [1 .. 5]]
|
||||
++ [miniGunX i | i <- [3 .. 16]]
|
||||
++ [grapeCannon i | i <- [1, 2, 3, 4]]
|
||||
++ [ pistol
|
||||
, autoPistol
|
||||
, smg
|
||||
, machinePistol
|
||||
, revolver
|
||||
, rifle
|
||||
, repeater
|
||||
, autoRifle
|
||||
|
||||
@@ -44,7 +44,6 @@ bulletCombinations = filter
|
||||
maxShowX :: ItemBaseType -> Maybe Int
|
||||
maxShowX bt = case bt of
|
||||
HELD (BANGSTICK _) -> Just 2
|
||||
HELD (REVOLVERX _) -> Just 1
|
||||
HELD (VOLLEYGUN _) -> Just 3
|
||||
HELD (MINIGUNX _) -> Just 3
|
||||
HELD (GRAPECANNON _) -> Just 1
|
||||
|
||||
@@ -32,7 +32,6 @@ moduleModification imt = case imt of
|
||||
. (itParams . subParams ?~ teslaParams)
|
||||
WEPTELE -> makeDirectedTele
|
||||
LAUNCHHOME -> itUse . heldConsumption . laAmmoType . amPjCreation .~ CreateTrackingShell
|
||||
EXTRABATTERY -> itUse . heldConsumption . laSource . _InternalSource . iaMax +~ 1000
|
||||
ATTACHTORCH -> id
|
||||
where
|
||||
makeDirectedTele it =
|
||||
|
||||
@@ -100,7 +100,7 @@ useItemLeftClick cr w = fromMaybe w $ do
|
||||
invid <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
ituse <- cr ^? crInv . ix invid . itUse
|
||||
case ituse of
|
||||
HeldUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crUpdateLoadSource)
|
||||
HeldUse{} -> return $ hammerTest (cWorld . lWorld . creatures . ix (_crID cr) %~ crReload)
|
||||
ConsumeUse{} -> return $ useItemRightClick cr w
|
||||
EquipUse{} -> return $ useItemRightClick cr w
|
||||
LeftUse{} -> return $ useItemRightClick cr w
|
||||
|
||||
@@ -174,7 +174,7 @@ reloadOverride :: Creature -> Creature
|
||||
reloadOverride cr = fromMaybe cr $ do
|
||||
guard $ cr ^. crStance . posture == Aiming
|
||||
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
guard $ cr ^? crInv . ix itRef . itUse . heldConsumption . laSource . _InternalSource . iaLoaded == Just 0
|
||||
guard $ cr ^? crInv . ix (itRef + 1) . itUse . attachParams . ammoAttachParams . iaLoaded == Just 0
|
||||
return $ cr & crActionPlan . apStrategy .~ StrategyActions Reload reloadActions
|
||||
where
|
||||
reloadActions =
|
||||
|
||||
@@ -38,24 +38,12 @@ crIsReloading cr = case cr ^? crManipulation . manObject . inInventory . iselAct
|
||||
Just ReloadAction{} -> True
|
||||
_ -> False
|
||||
|
||||
-- Assumes the ammotype below the selected item is correct
|
||||
crWeaponReady :: Creature -> Bool
|
||||
crWeaponReady cr = fromMaybe False $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
asource <- cr ^? crInv . ix i . itUse . heldConsumption . laSource
|
||||
case asource of
|
||||
InternalSource ia -> return (_iaLoaded ia > 0 && _iaPrimed ia)
|
||||
AboveSource -> do
|
||||
x <- cr ^? crInv . ix (i - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return (x > 0)
|
||||
BelowSource -> do
|
||||
x <- cr ^? crInv . ix (i + 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return (x > 0)
|
||||
EitherSource -> return $
|
||||
justIsPositive (cr ^? crInv . ix (i - 1) . itUse . equipEffect . eeUse . euseAmmoAmount)
|
||||
|| justIsPositive (cr ^? crInv . ix (i + 1) . itUse . equipEffect . eeUse . euseAmmoAmount)
|
||||
where
|
||||
justIsPositive Nothing = False
|
||||
justIsPositive (Just x) = x > 0
|
||||
x <- cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
return (x > 0)
|
||||
|
||||
crCanSeeCr :: Creature -> (World, Creature) -> Bool
|
||||
crCanSeeCr tcr (w, cr) = hasLOS (_crPos cr) (_crPos tcr) w
|
||||
|
||||
@@ -157,8 +157,6 @@ data LeftItemType
|
||||
data HeldItemType
|
||||
= BANGSTICK {_xNum :: Int}
|
||||
| PISTOL
|
||||
| REVOLVER
|
||||
| REVOLVERX {_xNum :: Int}
|
||||
| MACHINEPISTOL
|
||||
| AUTOPISTOL
|
||||
| SMG
|
||||
@@ -215,7 +213,6 @@ data ItemModuleType
|
||||
| STATICLAS
|
||||
| WEPTELE
|
||||
| LAUNCHHOME
|
||||
| EXTRABATTERY
|
||||
| ATTACHTORCH
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import Dodge.Data.Item.Use.Consumption.LoadAction
|
||||
data HeldConsumption
|
||||
= LoadableAmmo
|
||||
{ _laAmmoType :: AmmoType
|
||||
, _laSource :: AmmoSource
|
||||
, _laSourceType :: AmmoSourceType
|
||||
}
|
||||
| NoConsumption
|
||||
|
||||
@@ -9,14 +9,6 @@ defaultLoadable :: HeldConsumption
|
||||
defaultLoadable =
|
||||
LoadableAmmo
|
||||
{ _laAmmoType = GenericAmmo
|
||||
, _laSource =
|
||||
InternalSource InternalAmmo
|
||||
{ _iaMax = 15
|
||||
, _iaLoaded = 0
|
||||
, _iaPrimed = True
|
||||
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
|
||||
, _iaProgress = Nothing
|
||||
}
|
||||
, _laSourceType = BulletSource
|
||||
}
|
||||
|
||||
|
||||
+18
-16
@@ -32,7 +32,8 @@ useE eo = case eo of
|
||||
EonWristShield -> onEquipWristShield
|
||||
EoffWristShield -> onRemoveWristShield
|
||||
EFuelSource 0 _ -> const . const id
|
||||
EFuelSource{} -> trySiphonFuel
|
||||
--EFuelSource{} -> trySiphonFuel
|
||||
EFuelSource{} -> const . const id
|
||||
EBatterySource{} -> tryChargeBattery
|
||||
EAmmoSource{} -> tryAttachBulletBelt
|
||||
|
||||
@@ -43,21 +44,22 @@ tryChargeBattery :: Item -> Creature -> World -> World
|
||||
tryChargeBattery _ _ w = w
|
||||
|
||||
trySiphonFuel :: Item -> Creature -> World -> World
|
||||
trySiphonFuel itm cr w = fromMaybe w $ do
|
||||
eix <- itm ^? itLocation . ipInvID
|
||||
hix <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
guard (cr ^? crManipulation . manObject . inInventory . iselAction == Just NoInvSelAction)
|
||||
la <- cr ^? crInv . ix hix . itUse . heldConsumption
|
||||
atype <- la ^? laAmmoType
|
||||
guard (isGas atype)
|
||||
amax <- la ^? laSource . _InternalSource . iaMax
|
||||
acur <- la ^? laSource . _InternalSource . iaLoaded
|
||||
guard (amax > acur)
|
||||
return $
|
||||
w & cWorld . lWorld . creatures . ix (_crID cr) . crInv
|
||||
%~ ( (ix hix . itUse . heldConsumption . laSource . _InternalSource . iaLoaded +~ 1)
|
||||
. (ix eix . itUse . equipEffect . eeUse . euseFuelAmount -~ 1)
|
||||
)
|
||||
trySiphonFuel itm cr = id
|
||||
--trySiphonFuel itm cr w = fromMaybe w $ do
|
||||
-- eix <- itm ^? itLocation . ipInvID
|
||||
-- hix <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
-- guard (cr ^? crManipulation . manObject . inInventory . iselAction == Just NoInvSelAction)
|
||||
-- la <- cr ^? crInv . ix hix . itUse . heldConsumption
|
||||
-- atype <- la ^? laAmmoType
|
||||
-- guard (isGas atype)
|
||||
-- amax <- la ^? laSource . _InternalSource . iaMax
|
||||
-- acur <- la ^? laSource . _InternalSource . iaLoaded
|
||||
-- guard (amax > acur)
|
||||
-- return $
|
||||
-- w & cWorld . lWorld . creatures . ix (_crID cr) . crInv
|
||||
-- %~ ( (ix hix . itUse . heldConsumption . laSource . _InternalSource . iaLoaded +~ 1)
|
||||
-- . (ix eix . itUse . equipEffect . eeUse . euseFuelAmount -~ 1)
|
||||
-- )
|
||||
|
||||
isGas :: AmmoType -> Bool
|
||||
isGas a = case a of
|
||||
|
||||
@@ -83,10 +83,10 @@ useMod hm = case hm of
|
||||
[ useAmmoAmount 1
|
||||
, withItem $ \it ->
|
||||
duplicateNumBarrels
|
||||
( min
|
||||
(it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
|
||||
-- ( min
|
||||
-- (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
|
||||
(it ^?! itParams . lasCycle `div` lasWideRate)
|
||||
)
|
||||
-- )
|
||||
, withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
@@ -485,9 +485,9 @@ fireRemoteShell it cr w =
|
||||
j = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
|
||||
caneStickSoundChoice :: Item -> SoundID
|
||||
caneStickSoundChoice it
|
||||
| (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded) < 2 = tap3S
|
||||
| otherwise = shotgunS
|
||||
caneStickSoundChoice it = tap3S
|
||||
-- -- | (it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded) < 2 = tap3S
|
||||
-- -- | otherwise = shotgunS
|
||||
|
||||
bangStickSoundChoice :: Item -> SoundID
|
||||
bangStickSoundChoice = caneStickSoundChoice
|
||||
|
||||
+44
-31
@@ -81,7 +81,13 @@ itemBaseName it = case _iyBase $ _itType it of
|
||||
LEFT lit -> show lit
|
||||
EQUIP eit -> showEquipItem eit
|
||||
CONSUMABLE cit -> show cit
|
||||
ATTACH ait -> show ait
|
||||
ATTACH ait -> showAttachItem ait
|
||||
|
||||
showAttachItem :: AttachType -> String
|
||||
showAttachItem at = case at of
|
||||
SCROLLATTACH x -> show x
|
||||
AMMOATTACH x -> show x
|
||||
TARGETATTACH x -> show x
|
||||
|
||||
showEquipItem :: EquipItemType -> String
|
||||
showEquipItem eit = case eit of
|
||||
@@ -111,60 +117,67 @@ showAutoRechargeProgress lc = case lc of
|
||||
|
||||
itemNumberDisplay :: Creature -> Item -> [String]
|
||||
itemNumberDisplay cr itm = case iu of
|
||||
HeldUse{} -> [showReloadProgress cr itm]
|
||||
--HeldUse{} -> [showReloadProgress cr itm]
|
||||
HeldUse{} -> []
|
||||
LeftUse{} -> [showAutoRechargeProgress (_leftConsumption iu)]
|
||||
EquipUse{} -> showEquipmentNumber cr itm
|
||||
CraftUse x -> [show $ x ^. getItAmount]
|
||||
ConsumeUse {_useAmount = x} -> [show $ x ^. getItAmount]
|
||||
AttachUse {} -> []
|
||||
|
||||
AttachUse {} -> [showReloadProgress cr itm]
|
||||
-- this could be cleaner here...
|
||||
where
|
||||
iu = itm ^?! itUse
|
||||
|
||||
showEquipmentNumber :: Creature -> Item -> [String]
|
||||
showEquipmentNumber cr itm = case _eeUse ee of
|
||||
EFuelSource x _ -> [show x]
|
||||
EAmmoSource{} -> showAmmoSource cr itm
|
||||
EAmmoSource{_euseAmmoAmount = x} -> [show x]--showAmmoSource cr itm
|
||||
EBatterySource{_euseBatteryAmount = x} -> [show x]
|
||||
_ -> [""]
|
||||
where
|
||||
ee = itm ^?! itUse . equipEffect
|
||||
|
||||
showAmmoSource :: Creature -> Item -> [String]
|
||||
showAmmoSource cr itm = fromMaybe ["FAIL"] $ do
|
||||
eu <- itm ^? itUse . equipEffect . eeUse
|
||||
atype <- eu ^? euseAmmoSourceType
|
||||
x <- fmap showIntKMG' $ eu ^? euseAmmoAmount
|
||||
i <- itm ^? itLocation . ipInvID
|
||||
( do
|
||||
at' <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSourceType
|
||||
as <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSource
|
||||
guard (at' == atype && as == AboveSource)
|
||||
return ["vvvv", x]
|
||||
)
|
||||
<|> Just [x]
|
||||
--showAmmoSource :: Creature -> Item -> [String]
|
||||
--showAmmoSource cr itm = fromMaybe ["FAIL"] $ do
|
||||
-- eu <- itm ^? itUse . equipEffect . eeUse
|
||||
-- atype <- eu ^? euseAmmoSourceType
|
||||
-- x <- fmap showIntKMG' $ eu ^? euseAmmoAmount
|
||||
-- i <- itm ^? itLocation . ipInvID
|
||||
-- ( do
|
||||
-- at' <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSourceType
|
||||
-- as <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSource
|
||||
-- guard (at' == atype && as == AboveSource)
|
||||
-- return ["vvvv", x]
|
||||
-- )
|
||||
-- <|> Just [x]
|
||||
|
||||
showReloadProgress :: Creature -> Item -> String
|
||||
showReloadProgress cr itm = case ic ^? laSource of
|
||||
Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
|
||||
Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
|
||||
Just la -> showLoadActionType la (_laSource ic)
|
||||
Just AboveSource -> fromMaybe "^^^^" $ do
|
||||
i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||
_ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return ""
|
||||
_ -> ""
|
||||
where
|
||||
ic = itm ^?! itUse . heldConsumption
|
||||
showReloadProgress cr itm = fromMaybe [] $ do
|
||||
ia <- itm ^? itUse . attachParams . ammoAttachParams
|
||||
return $ case ia ^? iaProgress . _Just . ix 0 of
|
||||
Nothing -> maybe "" show $ ia ^? iaLoaded
|
||||
Just la -> showLoadActionType la ia
|
||||
--showReloadProgress :: Creature -> Item -> String
|
||||
--showReloadProgress cr itm = case ic ^? laSource of
|
||||
-- Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
|
||||
-- Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
|
||||
-- Just la -> showLoadActionType la (_laSource ic)
|
||||
-- Just AboveSource -> fromMaybe "^^^^" $ do
|
||||
-- i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||
-- _ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
-- return ""
|
||||
-- _ -> ""
|
||||
-- where
|
||||
-- ic = itm ^?! itUse . heldConsumption
|
||||
|
||||
showLoadActionType :: LoadAction -> AmmoSource -> String
|
||||
showLoadActionType :: LoadAction -> InternalAmmo -> String
|
||||
showLoadActionType la as = case la of
|
||||
LoadEject{} -> "E"
|
||||
LoadInsert{} -> "L"
|
||||
LoadAdd{} -> "A" ++ x
|
||||
LoadPrime{} -> "P"
|
||||
where
|
||||
x = maybe "" show $ as ^? _InternalSource . iaLoaded
|
||||
x = maybe "" show $ as ^? iaLoaded
|
||||
|
||||
maybeWarmupStatus :: Item -> Maybe String
|
||||
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
|
||||
|
||||
+70
-69
@@ -71,8 +71,6 @@ ammoPosition itm hit = case hit of
|
||||
TORCH -> NoAmmoPosition
|
||||
BANGSTICK i -> bangStickAmmoPos i itm
|
||||
PISTOL -> Magazine (V3 5 2 0) lhs
|
||||
REVOLVER -> revolverAmmoPos
|
||||
REVOLVERX _ -> revolverAmmoPos
|
||||
MACHINEPISTOL -> Magazine (V3 5 2 0) lhs
|
||||
AUTOPISTOL -> Magazine (V3 5 2 0) lhs
|
||||
SMG -> Magazine (V3 7 (-2) 0) rhs
|
||||
@@ -137,23 +135,21 @@ multigunAmmoPos i =
|
||||
where
|
||||
f n = fromIntegral n * 5 - ((fromIntegral i - 1) * 2.5)
|
||||
|
||||
revolverAmmoPos :: AmmoPosition
|
||||
revolverAmmoPos =
|
||||
Bullets
|
||||
[(V3 5 0 1 + Q.rotate q (V3 0 0 2), q) | q <- qs]
|
||||
where
|
||||
qs = [Q.axisAngle (V3 1 0 0) (f i) | i <- [1 .. 6 :: Int]]
|
||||
f i = fromIntegral i * pi / 3 + pi / 6
|
||||
--revolverAmmoPos :: AmmoPosition
|
||||
--revolverAmmoPos =
|
||||
-- Bullets
|
||||
-- [(V3 5 0 1 + Q.rotate q (V3 0 0 2), q) | q <- qs]
|
||||
-- where
|
||||
-- qs = [Q.axisAngle (V3 1 0 0) (f i) | i <- [1 .. 6 :: Int]]
|
||||
-- f i = fromIntegral i * pi / 3 + pi / 6
|
||||
|
||||
heldItemSPic :: HeldItemType -> Item -> SPic
|
||||
heldItemSPic ht it = case ht of
|
||||
FLATSHIELD -> flatShieldEquipSPic
|
||||
FORCEFIELDGUN -> defSPic
|
||||
TORCH -> noPic torchShape
|
||||
BANGSTICK i -> noPic $ baseStickShapeX it i <> addBullets it
|
||||
BANGSTICK i -> noPic $ baseStickShapeX it i -- <> addBullets it
|
||||
PISTOL -> noPic $ baseStickShape <> addTinClip it
|
||||
REVOLVER -> noPic $ baseStickShape <> addBullets it
|
||||
REVOLVERX _ -> noPic $ baseStickShape <> addBullets it
|
||||
MACHINEPISTOL -> noPic $ baseStickShape <> addTinClip it
|
||||
AUTOPISTOL -> noPic $ baseStickShape <> addTinClip it
|
||||
SMG -> noPic $ baseSMGShape <> addTinClip it
|
||||
@@ -161,17 +157,17 @@ heldItemSPic ht it = case ht of
|
||||
BLUNDERBUSS -> noPic $ bangConeShape 20
|
||||
GRAPECANNON _ -> noPic $ bangConeShape 20
|
||||
MINIGUNX i -> miniGunXPictItem i it
|
||||
VOLLEYGUN i -> noPic $ volleyGunShape i <> addBullets it
|
||||
MULTIGUN i -> noPic $ volleyGunShape i <> addBullets it
|
||||
RIFLE -> noPic $ baseRifleShape <> addBullets it
|
||||
VOLLEYGUN i -> noPic $ volleyGunShape i -- <> addBullets it
|
||||
MULTIGUN i -> noPic $ volleyGunShape i -- <> addBullets it
|
||||
RIFLE -> noPic $ baseRifleShape -- <> addBullets it
|
||||
REPEATER -> noPic $ baseRifleShape <> addTinClip it
|
||||
AUTORIFLE -> noPic $ baseRifleShape <> addTinClip it
|
||||
BURSTRIFLE -> noPic $ baseRifleShape <> addTinClip it
|
||||
BANGROD -> noPic $ baseRodShape <> addBullets it
|
||||
ELEPHANTGUN -> noPic $ baseAMRShape <> addBullets it
|
||||
BANGROD -> noPic $ baseRodShape -- <> addBullets it
|
||||
ELEPHANTGUN -> noPic $ baseAMRShape -- <> addBullets it
|
||||
AMR -> noPic $ baseAMRShape <> addTinClip it
|
||||
AUTOAMR -> noPic $ baseAMRShape <> addTinClip it
|
||||
SNIPERRIFLE -> noPic $ baseAMRShape <> addBullets it
|
||||
SNIPERRIFLE -> noPic $ baseAMRShape -- <> addBullets it
|
||||
MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
|
||||
FLAMESPITTER -> flamerPic it
|
||||
FLAMETHROWER -> flamerPic it
|
||||
@@ -251,12 +247,12 @@ baseRifleShape :: Shape
|
||||
--baseRifleShape = colorSH red $ xCylinder 4 2 25
|
||||
baseRifleShape = colorSH red $ xCylinderST 3 25
|
||||
|
||||
addBullets :: Item -> Shape
|
||||
addBullets itm = fromMaybe mempty $ do
|
||||
x <- itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
hit <- itm ^? itType . iyBase . ibtHeld
|
||||
ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs
|
||||
return $ foldMap (uncurry (drawBullet itm)) ps
|
||||
--addBullets :: Item -> Shape
|
||||
--addBullets itm = fromMaybe mempty $ do
|
||||
-- x <- itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
-- hit <- itm ^? itType . iyBase . ibtHeld
|
||||
-- ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs
|
||||
-- return $ foldMap (uncurry (drawBullet itm)) ps
|
||||
|
||||
-- why is this duplicated?
|
||||
drawBullet :: Item -> Point3 -> Q.Quaternion Float -> Shape
|
||||
@@ -293,47 +289,49 @@ drawBullet itm p q =
|
||||
rectNSWE 0.2 (- 0.2) (-2) (-1)
|
||||
|
||||
addTinClip :: Item -> Shape
|
||||
addTinClip itm = fromMaybe mempty $ do
|
||||
hit <- itm ^? itType . iyBase . ibtHeld
|
||||
let ap = ammoPosition itm hit
|
||||
p <- ap ^? amposPos
|
||||
d <- ap ^? amposDir
|
||||
return $ translateSH p $ overPosSH (Q.rotate d) $ makeTinClip itm
|
||||
|
||||
makeTinClip :: Item -> Shape
|
||||
makeTinClip it =
|
||||
colorSH
|
||||
midcol
|
||||
( upperPrismPolyTS
|
||||
1
|
||||
( reverse $
|
||||
rectNSWE 0 (- y) (-1) 1
|
||||
)
|
||||
)
|
||||
<> tips
|
||||
<> tails
|
||||
where
|
||||
midcol =
|
||||
maybe
|
||||
black
|
||||
bulletEffectColor
|
||||
(it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
|
||||
y = fromIntegral y' * 0.3
|
||||
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
tips = fromMaybe mempty $ do
|
||||
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
|
||||
return $
|
||||
colorSH (bulletPayloadColor ebt) $
|
||||
upperPrismPolyTS 1.1 $
|
||||
reverse $
|
||||
rectNSWE 0 (- y) 1 2
|
||||
tails = fromMaybe mempty $ do
|
||||
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory
|
||||
return $
|
||||
colorSH (bulletTrajColor ebt) $
|
||||
upperPrismPolyTS 1.1 $
|
||||
reverse $
|
||||
rectNSWE 0 (- y) (-2) (-1)
|
||||
addTinClip _ = mempty
|
||||
--addTinClip :: Item -> Shape
|
||||
--addTinClip itm = fromMaybe mempty $ do
|
||||
-- hit <- itm ^? itType . iyBase . ibtHeld
|
||||
-- let ap = ammoPosition itm hit
|
||||
-- p <- ap ^? amposPos
|
||||
-- d <- ap ^? amposDir
|
||||
-- return $ translateSH p $ overPosSH (Q.rotate d) $ makeTinClip itm
|
||||
--
|
||||
--makeTinClip :: Item -> Shape
|
||||
--makeTinClip it =
|
||||
-- colorSH
|
||||
-- midcol
|
||||
-- ( upperPrismPolyTS
|
||||
-- 1
|
||||
-- ( reverse $
|
||||
-- rectNSWE 0 (- y) (-1) 1
|
||||
-- )
|
||||
-- )
|
||||
-- <> tips
|
||||
-- <> tails
|
||||
-- where
|
||||
-- midcol =
|
||||
-- maybe
|
||||
-- black
|
||||
-- bulletEffectColor
|
||||
-- (it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
|
||||
-- y = fromIntegral y' * 0.3
|
||||
-- y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
-- tips = fromMaybe mempty $ do
|
||||
-- ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
|
||||
-- return $
|
||||
-- colorSH (bulletPayloadColor ebt) $
|
||||
-- upperPrismPolyTS 1.1 $
|
||||
-- reverse $
|
||||
-- rectNSWE 0 (- y) 1 2
|
||||
-- tails = fromMaybe mempty $ do
|
||||
-- ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory
|
||||
-- return $
|
||||
-- colorSH (bulletTrajColor ebt) $
|
||||
-- upperPrismPolyTS 1.1 $
|
||||
-- reverse $
|
||||
-- rectNSWE 0 (- y) (-2) (-1)
|
||||
|
||||
bulletEffectColor :: BulletEffect -> Color
|
||||
bulletEffectColor x = case x of
|
||||
@@ -410,14 +408,15 @@ flamerPic it =
|
||||
( colorSH yellow $
|
||||
translateSHxy tx ty (upperPrismPolyST tz $ polyCirc 3 r)
|
||||
<> xCylinderST 5 18
|
||||
, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * am)
|
||||
--, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * am)
|
||||
, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * 0.5)
|
||||
)
|
||||
where
|
||||
tx = 4
|
||||
ty = - 6
|
||||
tz = 3
|
||||
r = 5
|
||||
am = fractionLoadedAmmo2 it
|
||||
-- am = fractionLoadedAmmo2 it
|
||||
|
||||
launcherPic :: Item -> SPic
|
||||
launcherPic _ = noPic . colorSH cyan $ xCylinderST 5 20
|
||||
@@ -454,7 +453,8 @@ lasGunPic it =
|
||||
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0
|
||||
)
|
||||
where
|
||||
amFrac = fractionLoadedAmmo it
|
||||
--amFrac = fractionLoadedAmmo it
|
||||
amFrac = 0.5
|
||||
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
|
||||
|
||||
dualBeamPic :: Item -> SPic
|
||||
@@ -466,7 +466,8 @@ dualBeamPic it =
|
||||
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (- gap) (-1)
|
||||
)
|
||||
where
|
||||
amFrac = fractionLoadedAmmo it
|
||||
--amFrac = fractionLoadedAmmo it
|
||||
amFrac = 0.5
|
||||
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
|
||||
gap = _dbGap (_itParams it) - 3
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@ itemFromHeldType ht = case ht of
|
||||
SHATTERGUN -> shatterGun
|
||||
BANGSTICK i -> bangStick i
|
||||
PISTOL -> pistol
|
||||
REVOLVER -> revolver
|
||||
REVOLVERX i -> revolverX i
|
||||
MACHINEPISTOL -> machinePistol
|
||||
AUTOPISTOL -> autoPistol
|
||||
SMG -> smg
|
||||
|
||||
@@ -21,8 +21,6 @@ sparkGun =
|
||||
teslaGun :: Item
|
||||
teslaGun =
|
||||
defaultBatteryGun
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 200
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||
& itDimension . dimRad .~ 9
|
||||
& itDimension . dimCenter .~ V3 4 0 0
|
||||
& itParams .~ teslaParams
|
||||
@@ -40,8 +38,6 @@ lasGun =
|
||||
defaultAutoBatteryGun
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultLoadable
|
||||
& laSource . _InternalSource . iaMax .~ 200000
|
||||
& laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||
)
|
||||
& itParams
|
||||
.~ Refracting
|
||||
@@ -81,8 +77,6 @@ tractorGun =
|
||||
lasGun
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultLoadable
|
||||
& laSource . _InternalSource . iaMax .~ 10000
|
||||
& laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||
)
|
||||
& itParams .~ Attracting{_attractionPower = 1}
|
||||
& itTweaks
|
||||
@@ -137,7 +131,6 @@ lasCircle =
|
||||
& itType . iyBase .~ HELD LASCIRCLE
|
||||
& itParams . lasColor .~ orange
|
||||
& itParams . lasDamage .~ 2
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 10000
|
||||
& itUse . heldUse .~ HeldLaser --shootLaser
|
||||
& itUse . heldDelay .~ NoDelay
|
||||
& itUse . heldUse .~ HeldCircleLaser --circleLaser
|
||||
|
||||
@@ -34,8 +34,6 @@ defaultBangCane =
|
||||
& itUse . heldAim . aimStance .~ OneHand
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||
|
||||
volleyGun :: Int -> Item
|
||||
volleyGun i =
|
||||
@@ -46,7 +44,6 @@ volleyGun i =
|
||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
|
||||
& itType . iyBase .~ HELD (VOLLEYGUN i)
|
||||
|
||||
@@ -59,7 +56,6 @@ multiGun i =
|
||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
|
||||
& itType . iyBase .~ HELD (MULTIGUN i)
|
||||
|
||||
@@ -68,9 +64,6 @@ rifle =
|
||||
defaultBangCane
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
& itType . iyBase .~ HELD RIFLE
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle
|
||||
.~ [loadEject 5, loadInsert 5, loadPrime 5]
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
@@ -82,8 +75,6 @@ repeater =
|
||||
rifle
|
||||
& itType . iyModules . at ModRifleMag ?~ EMPTYMODULE
|
||||
& itType . iyBase .~ HELD REPEATER
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 20, loadInsert 20, loadPrime 20]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 15
|
||||
|
||||
autoRifle :: Item
|
||||
autoRifle =
|
||||
@@ -111,10 +102,6 @@ miniGunUse i =
|
||||
& heldAim . aimRange .~ 1
|
||||
& heldAim . aimStance .~ TwoHandUnder
|
||||
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& heldConsumption
|
||||
.~ (defaultBulletLoadable & laSource .~ AboveSource)
|
||||
-- & heldConsumption . laSource . _InternalSource . iaCycle
|
||||
-- .~ [loadEject 40, loadInsert 40, loadPrime 40]
|
||||
|
||||
miniGunX :: Int -> Item
|
||||
miniGunX i =
|
||||
|
||||
@@ -27,14 +27,10 @@ bangCone =
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.5]
|
||||
& itType . iyBase .~ HELD BANGCONE
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 5
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 20, loadPrime 5]
|
||||
|
||||
blunderbuss :: Item
|
||||
blunderbuss =
|
||||
bangCone
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 25
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 30, loadPrime 5]
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
@@ -45,8 +41,6 @@ grapeCannon :: Int -> Item
|
||||
grapeCannon i =
|
||||
blunderbuss
|
||||
& itType . iyBase .~ HELD (GRAPECANNON i)
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 25 + 25 * i
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert (30 + i * 10), loadPrime 5]
|
||||
& itParams . recoil .~ (150 + fromIntegral i * 50)
|
||||
& itParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
|
||||
& itParams . randomOffset .~ (12 + 4 * fromIntegral i)
|
||||
|
||||
@@ -39,9 +39,6 @@ launcher =
|
||||
, _amPjDraw = DrawShell
|
||||
, _amPjCreation = CreateShell
|
||||
}
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
|
||||
& itType . iyBase .~ HELD LAUNCHER
|
||||
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
|
||||
|
||||
@@ -49,8 +46,6 @@ launcherX :: Int -> Item
|
||||
launcherX i =
|
||||
launcher
|
||||
& itType . iyBase .~ HELD (LAUNCHERX i)
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ i
|
||||
& itUse . heldUse .~ HeldPJCreationX i
|
||||
& itUse . heldMods .~ LauncherXMod i
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ bangRod =
|
||||
& itUse . heldMods .~ BangRodMod
|
||||
& itDimension . dimRad .~ 12
|
||||
& itDimension . dimCenter .~ V3 5 0 0
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 5]
|
||||
& itType . iyBase .~ HELD BANGROD
|
||||
& itUse . heldAim . aimWeight .~ 8
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
@@ -54,7 +52,6 @@ amr :: Item
|
||||
amr =
|
||||
elephantGun
|
||||
& itType . iyBase .~ HELD AMR
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 15
|
||||
|
||||
autoAmr :: Item
|
||||
autoAmr =
|
||||
@@ -80,7 +77,5 @@ machineGun =
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 100
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 40, loadPrime 10]
|
||||
& itInvSize .~ 3
|
||||
& itParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
|
||||
|
||||
@@ -28,8 +28,6 @@ flameSpitter :: Item
|
||||
flameSpitter =
|
||||
flameThrower
|
||||
& itType . iyBase .~ HELD FLAMESPITTER
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 10
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
|
||||
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
|
||||
& itUse . heldAim . aimStance .~ OneHand
|
||||
& itUse . heldDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
|
||||
@@ -96,12 +94,10 @@ flameThrower =
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0]
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultLoadable
|
||||
& laSource . _InternalSource . iaMax .~ 250
|
||||
& laAmmoType
|
||||
.~ GasAmmo
|
||||
{ _amString = "FLAME"
|
||||
, _amCreateGas = CreateFlame --aFlame
|
||||
}
|
||||
& laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
|
||||
)
|
||||
& itType . iyBase .~ HELD FLAMETHROWER
|
||||
|
||||
@@ -4,8 +4,6 @@ module Dodge.Item.Held.Stick (
|
||||
autoPistol,
|
||||
machinePistol,
|
||||
smg,
|
||||
revolver,
|
||||
revolverX,
|
||||
) where
|
||||
|
||||
import Dodge.Base
|
||||
@@ -34,28 +32,15 @@ bangStick i =
|
||||
& itUse . heldDelay . rateMax .~ 8
|
||||
& itUse . heldMods .~ BangStickMod
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) a 0.01 | a <- spreadAroundCenter i baseStickSpread]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||
|
||||
baseStickSpread :: Float
|
||||
baseStickSpread = 0.2
|
||||
|
||||
revolver :: Item
|
||||
revolver =
|
||||
pistol
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultBulletLoadable
|
||||
& laSource . _InternalSource . iaMax .~ 6
|
||||
& laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||
)
|
||||
& itType . iyBase .~ HELD REVOLVER
|
||||
|
||||
pistol :: Item
|
||||
pistol =
|
||||
bangStick 1
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultBulletLoadable
|
||||
& laSource .~ BelowSource
|
||||
)
|
||||
& itUse . heldDelay . rateMax .~ 6
|
||||
& itUse . heldMods .~ PistolMod
|
||||
@@ -94,11 +79,3 @@ smg =
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
|
||||
-- & itUse . heldAim . aimHandlePos .~ 2
|
||||
& itParams . torqueAfter .~ 0.05
|
||||
|
||||
revolverX :: Int -> Item
|
||||
revolverX i =
|
||||
revolver
|
||||
& itUse . heldDelay . rateMax .~ 8
|
||||
& itUse . heldMods .~ RevolverXMod
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i * 6
|
||||
& itType . iyBase .~ HELD (REVOLVERX i)
|
||||
|
||||
@@ -63,8 +63,6 @@ heldInfo hit = case hit of
|
||||
BANGSTICK 1 -> "A firearm with a short barrel that requires reloading after each shot."
|
||||
BANGSTICK i -> over _head toUpper (showInt i) ++ " small gun barrels strapped together. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously, with significant spread."
|
||||
PISTOL -> "A small firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||
REVOLVER -> "A small firearm fed by a revolving cylinder. Single shot and load."
|
||||
REVOLVERX i -> "A small firearm fed by " ++ showInt i ++ "revolving cylinders."
|
||||
MACHINEPISTOL -> "A small firearm automatically, and extremely rapidly, fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||
AUTOPISTOL -> "A small firearm automatically fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||
SMG -> "A small firearm with an attached stock for stability."
|
||||
|
||||
@@ -28,8 +28,6 @@ heldBounds :: HeldItemType -> Point3
|
||||
heldBounds hit = case hit of
|
||||
BANGSTICK _ -> V3 0 0 0
|
||||
PISTOL -> bss
|
||||
REVOLVER -> bss
|
||||
REVOLVERX _ -> bss
|
||||
MACHINEPISTOL -> bss
|
||||
AUTOPISTOL -> bss
|
||||
SMG -> smgs
|
||||
|
||||
@@ -17,7 +17,6 @@ droneLauncher =
|
||||
& itUse . heldAim . aimRange .~ 0.5
|
||||
& itUse . heldAim . aimStance .~ TwoHandOver
|
||||
& itUse . heldConsumption . laAmmoType .~ DroneAmmo{_amString = "LASDRONE"}
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 2
|
||||
& itType . iyBase .~ HELD DRONELAUNCHER
|
||||
|
||||
lasDronesPic :: Item -> SPic
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
module Dodge.Item.Weapon.FractionLoaded (
|
||||
fractionLoadedAmmo,
|
||||
fractionLoadedAmmo2,
|
||||
-- fractionLoadedAmmo,
|
||||
-- fractionLoadedAmmo2,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Data.Item
|
||||
|
||||
---- this shouldn't really be used
|
||||
loadedAmmo :: Item -> Int
|
||||
loadedAmmo itm = fromMaybe 0 $ itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
|
||||
-- | _laTransfer (_itConsumption it) == NoTransfer = _laLoaded (_itConsumption it)
|
||||
-- | otherwise = 0
|
||||
|
||||
fractionLoadedAmmo :: Item -> Float
|
||||
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral itmaxammo
|
||||
where
|
||||
itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||
|
||||
fractionLoadedAmmo2 :: Item -> Float
|
||||
fractionLoadedAmmo2 it =
|
||||
1 - (1 - fromIntegral (loadedAmmo it) / fromIntegral itmaxammo) ** 2
|
||||
where
|
||||
itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||
-- ---- this shouldn't really be used
|
||||
-- loadedAmmo :: Item -> Int
|
||||
-- loadedAmmo itm = fromMaybe 0 $ itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
--
|
||||
-- -- | _laTransfer (_itConsumption it) == NoTransfer = _laLoaded (_itConsumption it)
|
||||
-- -- | otherwise = 0
|
||||
--
|
||||
-- fractionLoadedAmmo :: Item -> Float
|
||||
-- fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral itmaxammo
|
||||
-- where
|
||||
-- itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||
--
|
||||
-- fractionLoadedAmmo2 :: Item -> Float
|
||||
-- fractionLoadedAmmo2 it =
|
||||
-- 1 - (1 - fromIntegral (loadedAmmo it) / fromIntegral itmaxammo) ** 2
|
||||
-- where
|
||||
-- itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||
|
||||
@@ -140,23 +140,11 @@ withThickSmokeI eff item cr w =
|
||||
-- TODO create a trigger that does different things on first and continued
|
||||
-- fire.
|
||||
ammoCheckI :: ChainEffect
|
||||
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
||||
Just (InternalSource ia)
|
||||
| _iaLoaded ia <= 0 || not (_iaPrimed ia) ->
|
||||
failsound w
|
||||
Just AboveSource
|
||||
| fromMaybe True $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return $ x <= 0 ->
|
||||
failsound w
|
||||
Just BelowSource
|
||||
| fromMaybe True $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
x <- cr ^? crInv . ix (invid + 1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
return $ x <= 0 ->
|
||||
failsound w
|
||||
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||
ammoCheckI eff itm cr w = fromMaybe (failsound w) $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
x <- cr ^? crInv . ix (invid + 1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
guard $ x > 0
|
||||
return $ eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||
where
|
||||
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||
Just 0 -> soundStart (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
|
||||
@@ -165,8 +153,8 @@ ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
||||
itUseCharge :: Int -> Item -> Item
|
||||
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
||||
|
||||
itUseAmmo :: Int -> Item -> Item
|
||||
itUseAmmo x = itUse . heldConsumption . laSource . _InternalSource . iaLoaded %~ (max 0 . subtract x)
|
||||
--itUseAmmo :: Int -> Item -> Item
|
||||
--itUseAmmo x = itUse . heldConsumption . laSource . _InternalSource . iaLoaded %~ (max 0 . subtract x)
|
||||
|
||||
{- | Fires at an increasing rate.
|
||||
Has different effect after first fire.
|
||||
@@ -183,7 +171,7 @@ rateIncAB exeffFirst exeffCont eff item cr w
|
||||
w
|
||||
& pointItem
|
||||
%~ ( (itUse . heldDelay . rateMax .~ max fastRate (currentRate - 1))
|
||||
. itUseAmmo 1
|
||||
-- . itUseAmmo 1
|
||||
. (itUse . heldDelay . rateTime .~ currentRate)
|
||||
)
|
||||
& exeffCont eff item cr
|
||||
@@ -191,7 +179,7 @@ rateIncAB exeffFirst exeffCont eff item cr w
|
||||
w
|
||||
& pointItem
|
||||
%~ ( (itUse . heldDelay . rateMax .~ startRate - 1)
|
||||
. itUseAmmo 1
|
||||
-- . itUseAmmo 1
|
||||
. (itUse . heldDelay . rateTime .~ startRate)
|
||||
)
|
||||
& exeffFirst eff item cr
|
||||
@@ -352,7 +340,7 @@ useAllAmmo eff item cr = fromMaybe id $ do
|
||||
invid <- item ^? itLocation . ipInvID
|
||||
return $ eff item cr
|
||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (invid + 1)
|
||||
. itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ 0)
|
||||
. itUse . attachParams . ammoAttachParams . iaLoaded .~ 0)
|
||||
|
||||
useAmmoUpTo :: Int -> ChainEffect
|
||||
useAmmoUpTo amAmount eff itm cr = fromMaybe id $ do
|
||||
@@ -370,18 +358,7 @@ useAmmoAmount amAmount eff item cr =
|
||||
itref = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
|
||||
useAmmoAmount' :: Int -> Int -> IM.IntMap Item -> IM.IntMap Item
|
||||
useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . laSource of
|
||||
Just InternalSource{} ->
|
||||
inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x
|
||||
Just AboveSource ->
|
||||
inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
Just BelowSource ->
|
||||
inv & ix (itref + 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
Just EitherSource -> case inv ^? ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount of
|
||||
Just amamount | amamount > 0 ->
|
||||
inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
_ -> inv & ix (itref + 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
_ -> inv
|
||||
useAmmoAmount' itref x inv = inv & ix (itref + 1) . itUse . attachParams . ammoAttachParams . iaLoaded -~ x
|
||||
|
||||
-- . crInv . ix itRef . itUse . heldConsumption . laSource
|
||||
|
||||
@@ -677,10 +654,12 @@ repeatOnFrames is hm f it cr w =
|
||||
-- return $ f it cr' w'
|
||||
|
||||
duplicateLoaded :: ChainEffect
|
||||
duplicateLoaded eff it cr w = foldr f w [1 .. numBul]
|
||||
duplicateLoaded eff it cr w = foldr f w (take numbul [1 .. ])
|
||||
where
|
||||
f _ = eff it cr
|
||||
numBul = it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
numbul = fromMaybe 0 $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
cr ^? crInv . ix (i+1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
|
||||
duplicateNumBarrels :: Int -> ChainEffect
|
||||
duplicateNumBarrels n eff itm cr w = foldr f w (take n $ itm ^?! itUse . heldAim . aimMuzzles)
|
||||
@@ -697,9 +676,12 @@ duplicateNumBarrels n eff itm cr w = foldr f w (take n $ itm ^?! itUse . heldAim
|
||||
(a,g) = randomR (-inacc,inacc) $ _randGen w'
|
||||
|
||||
duplicateLoadedBarrels :: ChainEffect
|
||||
duplicateLoadedBarrels eff itm = duplicateNumBarrels numbul eff itm
|
||||
duplicateLoadedBarrels eff itm cr = duplicateNumBarrels numbul eff itm cr
|
||||
where
|
||||
numbul = itm ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
numbul :: Int
|
||||
numbul = fromMaybe 0 $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
cr ^? crInv . ix (i+1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
|
||||
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
||||
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
||||
|
||||
@@ -37,7 +37,6 @@ moduleName imt = case imt of
|
||||
STATICLAS -> Just "+STATIC"
|
||||
WEPTELE -> Just "+DIRECTEDTELE"
|
||||
LAUNCHHOME -> Just "+TARGET HOMING"
|
||||
EXTRABATTERY -> Just "+BATTERY"
|
||||
ATTACHTORCH -> Just "+TORCH"
|
||||
|
||||
|
||||
|
||||
+9
-10
@@ -1,8 +1,7 @@
|
||||
module Dodge.Reloading (
|
||||
crCancelReloading,
|
||||
crUpdateLoadSource,
|
||||
crReload,
|
||||
stepReloading,
|
||||
tryStartLoading,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
@@ -18,7 +17,7 @@ crCancelReloading cr =
|
||||
updateProgress = fromMaybe id $ do
|
||||
InInventory (SelItem i _) <- cr ^? crManipulation . manObject
|
||||
return $
|
||||
crInv . ix i . itUse . heldConsumption . laSource . _InternalSource . iaProgress
|
||||
crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams . iaProgress
|
||||
%~ const Nothing
|
||||
|
||||
stepReloading :: Creature -> Creature
|
||||
@@ -28,29 +27,29 @@ stepReloading cr = case cr ^? crManipulation . manObject . inInventory of
|
||||
cr & crManipulation . manObject . inInventory . iselAction . actionProgress -~ 1
|
||||
| otherwise ->
|
||||
cr
|
||||
& crInv . ix i . itUse . heldConsumption . laSource . _InternalSource %~ doLoadAction la
|
||||
& crInv . ix i . itUse . heldConsumption . laSource . _InternalSource %~ rotateActionProgress
|
||||
& crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams %~ doLoadAction la
|
||||
& crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams %~ rotateActionProgress
|
||||
& tryNextLoadAction
|
||||
_ -> cr
|
||||
|
||||
tryNextLoadAction :: Creature -> Creature
|
||||
tryNextLoadAction cr = case cr ^? crManipulation . manObject . inInventory of
|
||||
Just (SelItem i _) -> case cr ^? crInv . ix i . itUse . heldConsumption . laSource . _InternalSource . iaProgress . _Just . ix 0 of
|
||||
Just (SelItem i _) -> case cr ^? crInv . ix i . itUse . attachParams . ammoAttachParams . iaProgress . _Just . ix 0 of
|
||||
Nothing -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
||||
Just la ->
|
||||
cr & crManipulation . manObject . inInventory . iselAction . actionProgress .~ _actionTime la
|
||||
& crManipulation . manObject . inInventory . iselAction . reloadAction .~ la
|
||||
_ -> cr
|
||||
|
||||
crUpdateLoadSource :: Creature -> Creature
|
||||
crUpdateLoadSource cr = case cr ^? crManipulation . manObject . inInventory . iselAction of
|
||||
crReload :: Creature -> Creature
|
||||
crReload cr = case cr ^? crManipulation . manObject . inInventory . iselAction of
|
||||
Just NoInvSelAction -> cr & tryStartLoading
|
||||
_ -> cr & crManipulation . manObject . inInventory . iselAction .~ NoInvSelAction
|
||||
|
||||
tryStartLoading :: Creature -> Creature
|
||||
tryStartLoading cr = fromMaybe cr $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
ia <- cr ^? crInv . ix i . itUse . heldConsumption . laSource . _InternalSource
|
||||
ia <- cr ^? crInv . ix (i + 1) . itUse . attachParams . ammoAttachParams
|
||||
return $ startLoading ia cr
|
||||
|
||||
-- case as of
|
||||
@@ -67,7 +66,7 @@ startLoading ic cr = case ic ^? iaProgress . _Just . ix 0 of
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
return $
|
||||
cr & startLoadingStep la
|
||||
& crInv . ix i . itUse . heldConsumption . laSource . _InternalSource . iaProgress ?~ (la : las)
|
||||
& crInv . ix i . itUse . attachParams . ammoAttachParams . iaProgress ?~ (la : las)
|
||||
|
||||
startLoadingStep :: LoadAction -> Creature -> Creature
|
||||
startLoadingStep la cr = cr & crManipulation . manObject . inInventory . iselAction .~ ReloadAction (_actionTime la) la
|
||||
|
||||
@@ -116,7 +116,7 @@ updateInitialPressInGame uv sc = case sc of
|
||||
ScancodeP -> pauseGame uv
|
||||
ScancodeF -> over uvWorld youDropItem uv
|
||||
ScancodeM -> toggleMap uv
|
||||
ScancodeR -> over (uvWorld . cWorld . lWorld . creatures . ix 0) crUpdateLoadSource uv
|
||||
ScancodeR -> over (uvWorld . cWorld . lWorld . creatures . ix 0) crReload uv
|
||||
ScancodeT -> over uvWorld testEvent uv
|
||||
ScancodeX -> uv & uvWorld %~ toggleTweakInv
|
||||
ScancodeC -> toggleCombineInv uv
|
||||
|
||||
Reference in New Issue
Block a user