Move item inv size and item dimensions from records to external function
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
module Dodge.Item.InvSize (
|
||||
itInvHeight,
|
||||
itDim,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Dodge.Data.Item
|
||||
import Linear.V3
|
||||
|
||||
itInvHeight :: Item -> Int
|
||||
itInvHeight x = case x ^. itType of
|
||||
HELD (MINIGUNX i) -> (i + 3) `div` 2
|
||||
HELD LAUNCHER -> 3
|
||||
HELD FLATSHIELD -> 3
|
||||
HELD (BANGSTICK i) -> max 1 (i `div` 2)
|
||||
_ -> 1
|
||||
|
||||
itDim :: Item -> ItemDimension
|
||||
itDim x = case x ^. itType of
|
||||
HELD TESLAGUN -> ItemDimension 9 (V3 4 0 0) (V3 10 (-5) 3)
|
||||
HELD LASER -> did & dimRad .~ 10
|
||||
& dimCenter .~ V3 15 0 0
|
||||
HELD TRACTORGUN -> did & dimRad .~ 10
|
||||
& dimCenter .~ V3 15 0 0
|
||||
HELD FLAMETHROWER -> did & dimRad .~ 7
|
||||
& dimCenter .~ V3 9 0 0
|
||||
HELD y | hasCaneGunDim y -> did & dimRad .~ 8
|
||||
& dimCenter .~ V3 5 0 0
|
||||
HELD (MINIGUNX {}) -> did & dimRad .~ 20
|
||||
& dimCenter .~ V3 5 0 0
|
||||
& dimAttachPos .~ V3 5 (-5) 0
|
||||
HELD LAUNCHER -> did & dimRad .~ 9
|
||||
& dimCenter .~ V3 10 0 0
|
||||
HELD BANGSTICK{} -> did
|
||||
& dimRad .~ 5
|
||||
& dimCenter .~ V3 5 0 0
|
||||
HELD BANGROD -> did
|
||||
& dimRad .~ 12
|
||||
& dimCenter .~ V3 5 0 0
|
||||
HELD BANGCONE -> did
|
||||
& dimRad .~ 8
|
||||
& dimCenter .~ V3 5 0 0
|
||||
_ -> did
|
||||
|
||||
hasCaneGunDim :: HeldItemType -> Bool
|
||||
hasCaneGunDim = \case
|
||||
VOLLEYGUN {} -> True -- this shouldn't really be the case
|
||||
RIFLE -> True
|
||||
_ -> False
|
||||
|
||||
did :: ItemDimension
|
||||
did = ItemDimension 2 0 (V3 10 (-5) 3)
|
||||
Reference in New Issue
Block a user