186 lines
4.7 KiB
Haskell
186 lines
4.7 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.Map.Strict as M
|
|
import Control.Lens
|
|
|
|
defaultAmmo :: ItemConsumption
|
|
defaultAmmo = LoadableAmmo
|
|
{ _laType = GenericAmmo
|
|
, _laMax = 15
|
|
, _laLoaded = 0
|
|
, _laReloadTime = 40
|
|
, _laReloadState = Nothing'
|
|
, _laReloadType = 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
|
|
, _heldScroll = \_ _ -> id
|
|
}
|
|
|
|
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
|
|
, _heldScroll = \_ _ -> id
|
|
}
|
|
|
|
defaultrUse :: ItemUse
|
|
defaultrUse = RightUse
|
|
{ _rUse = \_ _ -> id
|
|
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
|
, _useMods = []
|
|
, _useHammer = HasHammer HammerUp
|
|
, _useAim = defaultAimParams
|
|
, _heldScroll = \_ _ -> id
|
|
}
|
|
defaultlUse :: ItemUse
|
|
defaultlUse = LeftUse
|
|
{ _lUse = \_ _ -> id
|
|
, _useDelay = FixedRate {_rateMax = 8, _rateTime = 0}
|
|
, _useHammer = NoHammer
|
|
, _eqEq = defaultEquip
|
|
}
|
|
defaultEquip :: Equipment
|
|
defaultEquip = Equipment
|
|
{ _eqSite = GoesOnSpecial
|
|
, _eqUse = \_ _ -> id
|
|
, _eqOnEquip = \_ _ -> id
|
|
, _eqOnRemove = \_ _ -> id
|
|
, _eqParams = NoEquipParams
|
|
, _eqViewDist = Nothing
|
|
}
|
|
|
|
luseInstantNoH :: (Item -> Creature -> World -> World) -> ItemUse
|
|
luseInstantNoH f = defaultlUse
|
|
{ _lUse = f
|
|
, _useDelay = NoDelay
|
|
, _useHammer = NoHammer
|
|
}
|
|
defaultAimParams :: AimParams
|
|
defaultAimParams = AimParams
|
|
{ _aimWeight = 0
|
|
, _aimRange = 0
|
|
, _aimZoom = ItZoom 20 0.2 1
|
|
, _aimStance = OneHand
|
|
}
|
|
|
|
defaultGun :: Item
|
|
defaultGun = Item
|
|
{ _itName = "default"
|
|
, _itType = NoCombineType
|
|
, _itCurseStatus = Uncursed
|
|
, _itConsumption = defaultAmmo
|
|
, _itUse = defaultrUse
|
|
, _itDimension = defItDimCol white
|
|
, _itEquipPict = pictureWeaponOnAim
|
|
, _itAttachment = NoItAttachment
|
|
, _itID = Nothing
|
|
, _itInvPos = Nothing
|
|
, _itIsHeld = False
|
|
, _itEffect = NoItEffect
|
|
, _itInvDisplay = basicItemDisplay
|
|
, _itInvColor = white
|
|
, _itInvSize = 1
|
|
, _itParams = NoParams
|
|
, _itTweaks = NoTweaks
|
|
, _itModules = M.fromList
|
|
[(ModBullet, DefaultModule)
|
|
,(ModTarget, DefaultModule)
|
|
,(ModBulletTrajectory, DefaultModule)
|
|
,(ModTeleport, DefaultModule)
|
|
]
|
|
, _itScope = NoScope
|
|
, _itTargeting = NoTargeting
|
|
, _itValue = defaultItemValue
|
|
}
|
|
defaultItemValue :: ItemValue
|
|
defaultItemValue = ItemValue 10 MundaneItem
|
|
defaultCraftable :: Item
|
|
defaultCraftable = Item
|
|
{ _itName = "default"
|
|
, _itType = NoCombineType
|
|
, _itCurseStatus = Uncursed
|
|
, _itConsumption = NoConsumption
|
|
, _itUse = NoUse
|
|
, _itEquipPict = pictureWeaponOnAim
|
|
, _itAttachment = NoItAttachment
|
|
, _itID = Nothing
|
|
, _itInvPos = Nothing
|
|
, _itIsHeld = False
|
|
, _itEffect = NoItEffect
|
|
, _itInvDisplay = basicItemDisplay
|
|
, _itInvColor = green
|
|
, _itInvSize = 1
|
|
, _itParams = NoParams
|
|
, _itDimension = defItDimCol green
|
|
, _itTweaks = NoTweaks
|
|
, _itModules = M.empty
|
|
, _itScope = NoScope
|
|
, _itTargeting = NoTargeting
|
|
, _itValue = defaultItemValue
|
|
}
|
|
defItDim :: ItemDimension
|
|
defItDim = ItemDimension
|
|
{ _dimRad = 2
|
|
, _dimCenter = V3 0 0 0
|
|
, _dimPortage = HeldItem
|
|
{ _handlePos = 0
|
|
, _muzPos = 0
|
|
}
|
|
, _dimSPic = const $ noPic $ colorSH green $ upperPrismPoly 3 $ square 4
|
|
}
|
|
defItDimCol :: Color -> ItemDimension
|
|
defItDimCol col = ItemDimension
|
|
{ _dimRad = 2
|
|
, _dimCenter = V3 0 0 0
|
|
, _dimPortage = HeldItem
|
|
{ _handlePos = 0
|
|
, _muzPos = 0
|
|
}
|
|
, _dimSPic = const $ noPic $ colorSH col $ upperPrismPoly 3 $ square 4
|
|
}
|
|
defBulletShooter :: ItemParams
|
|
defBulletShooter = BulletShooter
|
|
{ _muzVel = 1
|
|
, _rifling = 0.8
|
|
, _bore = 2
|
|
, _gunBarrels = SingleBarrel 0
|
|
, _recoil = 0
|
|
, _torqueAfter = 0
|
|
, _randomOffset = 0
|
|
}
|
|
|
|
defaultAutoGun :: Item
|
|
defaultAutoGun = defaultGun
|
|
& itUse . useAim . aimStance .~ TwoHandTwist
|