148 lines
3.9 KiB
Haskell
148 lines
3.9 KiB
Haskell
module Dodge.Default.Weapon
|
|
where
|
|
import Dodge.Data
|
|
import Dodge.Item.Weapon.InventoryDisplay
|
|
import Dodge.Item.Draw
|
|
import Picture
|
|
import ShapePicture
|
|
import Shape
|
|
import Geometry.Vector3D
|
|
import Geometry
|
|
--import Dodge.TweakBullet
|
|
|
|
--import qualified Data.IntMap.Strict as IM
|
|
import Control.Lens
|
|
|
|
defaultAmmo :: ItemConsumption
|
|
defaultAmmo = LoadableAmmo
|
|
{ _aoType = GenericAmmo
|
|
, _ammoMax = 15
|
|
, _ammoLoaded = 15
|
|
, _reloadTime = 40
|
|
, _reloadState = Nothing'
|
|
, _reloadType = ActiveClear
|
|
}
|
|
|
|
ruseRate :: Int
|
|
-> (Item -> Creature -> World -> World)
|
|
-> HammerType
|
|
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
|
|
-> ItemUse
|
|
ruseRate i f ht usemods = RightUse
|
|
{ _rUse = f
|
|
, _useDelay = FixedRate
|
|
{ _rateMax = i
|
|
, _rateTime = 0
|
|
}
|
|
, _useMods = usemods
|
|
, _useHammer = ht
|
|
, _useAim = defaultAimParams
|
|
}
|
|
|
|
ruseInstant
|
|
:: (Item -> Creature -> World -> World)
|
|
-> HammerType
|
|
-> [(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
|
|
-> ItemUse
|
|
ruseInstant f ht usemods = RightUse
|
|
{ _rUse = f
|
|
, _useDelay = NoDelay
|
|
, _useMods = usemods
|
|
, _useHammer = ht
|
|
, _useAim = defaultAimParams
|
|
}
|
|
|
|
defaultrUse :: ItemUse
|
|
defaultrUse = RightUse
|
|
{ _rUse = \_ _ -> id
|
|
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
|
, _useMods = []
|
|
, _useHammer = HasHammer HammerUp
|
|
, _useAim = defaultAimParams
|
|
}
|
|
defaultlUse :: ItemUse
|
|
defaultlUse = LeftUse
|
|
{ _lUse = \_ _ -> id
|
|
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
|
, _useHammer = NoHammer
|
|
}
|
|
|
|
luseInstantNoH :: (Creature -> Int -> World -> World) -> ItemUse
|
|
luseInstantNoH f = LeftUse
|
|
{ _lUse = f
|
|
, _useDelay = NoDelay
|
|
, _useHammer = NoHammer
|
|
}
|
|
defaultAimParams :: AimParams
|
|
defaultAimParams = AimParams
|
|
{ _aimSpeed = 1
|
|
, _aimRange = 0
|
|
, _aimZoom = ItZoom 20 0.2 1
|
|
, _aimStance = OneHand
|
|
}
|
|
|
|
defaultGun :: Item
|
|
defaultGun = Item
|
|
{ _itName = "default"
|
|
, _itCombineType = NoCombineType
|
|
, _itCurseStatus = Uncursed
|
|
-- , _itIdentity = Pistol
|
|
, _itConsumption = defaultAmmo
|
|
, _itUse = defaultrUse
|
|
, _itFloorPict = const $ noPic $ colorSH green (prismPoly
|
|
(map (addZ 3) $ rectNESW 3 3 (-3) (-3))
|
|
(map (addZ 0) $ rectNESW 5 3 (-5) (-7))
|
|
)
|
|
-- , _itZoom = ItZoom 20 0.2 1
|
|
, _itEquipPict = pictureWeaponOnAim
|
|
, _itScroll = \_ _ -> id
|
|
, _itAttachment = NoItAttachment
|
|
, _itID = Nothing
|
|
, _itEffect = NoItEffect
|
|
, _itInvDisplay = basicWeaponDisplay
|
|
, _itInvColor = white
|
|
, _itInvSize = 1
|
|
, _itTargeting = Nothing
|
|
, _itParams = NoParams
|
|
, _itDimension = defaultItemDimension
|
|
, _itTweaks = NoTweaks
|
|
}
|
|
defaultCraftable :: Item
|
|
defaultCraftable = Item
|
|
{ _itName = "default"
|
|
, _itCombineType = NoCombineType
|
|
, _itCurseStatus = Uncursed
|
|
-- , _itIdentity = Generic
|
|
, _itConsumption = NoConsumption
|
|
, _itUse = NoUse
|
|
, _itFloorPict = const $ noPic $ colorSH green (prismPoly
|
|
(map (addZ 3) $ rectNESW 3 3 (-3) (-3))
|
|
(map (addZ 0) $ rectNESW 5 3 (-5) (-7))
|
|
)
|
|
-- , _itZoom = ItZoom 20 0.2 1
|
|
, _itEquipPict = pictureWeaponOnAim
|
|
, _itScroll = \_ _ -> id
|
|
, _itAttachment = NoItAttachment
|
|
, _itID = Nothing
|
|
, _itEffect = NoItEffect
|
|
, _itInvDisplay = \it -> take (_itInvSize it) (_itName it : repeat "*")
|
|
, _itInvColor = green
|
|
, _itInvSize = 1
|
|
, _itTargeting = Nothing
|
|
, _itParams = NoParams
|
|
, _itDimension = defaultItemDimension
|
|
, _itTweaks = NoTweaks
|
|
}
|
|
defaultItemDimension :: ItemDimension
|
|
defaultItemDimension = ItemDimension
|
|
{ _itDim = V3 4 4 4
|
|
, _itRad = 10
|
|
, _itHandle = V3 2 2 2
|
|
, _itCenter = V3 2 2 2
|
|
, _muzzleLength = 5 -- how much the item projects out from the cr radius when aiming
|
|
}
|
|
|
|
defaultAutoGun :: Item
|
|
defaultAutoGun = defaultGun
|
|
& itUse . useAim . aimStance .~ TwoHandTwist
|