Tweak equipment draw

This commit is contained in:
2021-11-19 14:24:31 +00:00
parent 4ef1811dd6
commit 6f518d720c
13 changed files with 33 additions and 41 deletions
+1 -1
View File
@@ -167,7 +167,7 @@ startCr = defaultCreature
{- | Items you start with. -}
startInvList :: [Item]
startInvList =
[shrinkGun
[
]
startInventory :: IM.IntMap Item
startInventory = IM.fromList $ zip [0..defaultInvSize -1] $ startInvList ++ repeat NoItem
+2 -10
View File
@@ -225,20 +225,12 @@ youDropItem w = case yourItem w ^? itCurseStatus of
where
cr = you w
{- | Copy an inventory item to the floor. -}
copyInvItemToFloor
:: Creature
-> Int -- ^ Inventory position
-> World
-> World
copyInvItemToFloor :: Creature -> Int -> World -> World
copyInvItemToFloor cr i w = case _crInv cr IM.! i of
NoItem -> w
it -> copyItemToFloor (_crPos cr) it w
{- | Copy an item to the floor. -}
copyItemToFloor
:: Point2
-> Item
-> World
-> World
copyItemToFloor :: Point2 -> Item -> World -> World
copyItemToFloor pos it w = w'
& floorItems %~ IM.insert flid theflit
& updateLocation
+9 -2
View File
@@ -3,8 +3,12 @@ module Dodge.Default.Weapon
import Dodge.Data
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Draw
import Picture
import ShapePicture
import Shape
import Geometry.Vector3D
import Geometry
import Linear.V3
defaultGun :: Item
@@ -30,12 +34,15 @@ defaultGun = Weapon
, _wpSpread = 0.02
, _wpRange = 20
, _itHammer = HammerUp
, _itFloorPict = const emptyBlank
, _itFloorPict = const $ noPic $ colorSH green (prismPoly
(map (addZ 3) $ rectNESW 3 3 (-3) (-3))
(map (addZ 0) $ rectNESW 5 3 (-5) (-7))
)
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = ItZoom 20 0.2 1
, _itAimZoom = ItZoom 20 0.2 1
, _itEquipPict = \_ _ -> emptyBlank
, _itEquipPict = pictureWeaponOnAim
, _itScroll = \_ _ -> id
, _itAttachment = NoItAttachment
, _itID = Nothing
+10 -1
View File
@@ -8,11 +8,20 @@ import ShapePicture
import qualified Data.IntMap.Strict as IM
import Control.Lens
pictureWeaponOnAim
:: Creature
-> Int -- ^ Position of item in inventory
-> SPic
pictureWeaponOnAim cr i = pictureWeaponOnAimItem pic cr i
where
it = _crInv cr IM.! i
pic = _itFloorPict it it
pictureWeaponOnAim'
:: (Item -> SPic)
-> Creature
-> Int -- ^ Position of item in inventory
-> SPic
pictureWeaponOnAim f cr i = pictureWeaponOnAimItem pic cr i
pictureWeaponOnAim' f cr i = pictureWeaponOnAimItem pic cr i
where
pic = f (_crInv cr IM.! i)
+1 -1
View File
@@ -50,7 +50,7 @@ frontArmour = defaultEquipment
}
flatShield :: Item
flatShield = defaultEquipment
{ _itEquipPict = pictureWeaponOnAim flatShieldEquipSPic
{ _itEquipPict = pictureWeaponOnAim' flatShieldEquipSPic
, _itAimStance = TwoHandFlat
, _itEffect = effectOnOffEquip createShieldWall removeShieldWall
, _itName = "SHIELD"
+4 -4
View File
@@ -164,7 +164,7 @@ remoteBomb = defaultThrowable
[ hammerCheckI
]
, _itAttachment = ItScope (V2 0 0) 0 1 True
, _itEquipPict = pictureWeaponOnAim $ \_ -> (,) emptySH remoteBombUnarmedPic
, _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH remoteBombUnarmedPic
}
@@ -219,7 +219,7 @@ explodeRemoteBomb itid pjid cr w
cid = _crID cr
resetName = set (creatures . ix cid . crInv . ix j . itName) "REMOTEBOMB"
resetPict = set (creatures . ix cid . crInv . ix j . itEquipPict )
(pictureWeaponOnAim $ \_ -> (,) emptySH remoteBombUnarmedPic)
(pictureWeaponOnAim' $ \_ -> (,) emptySH remoteBombUnarmedPic)
-- resetScope = creatures . ix cid . crInv . ix j . itScope . _Just . scopePos .~ (0,0)
j = _crInvSel $ _creatures w IM.! cid
remoteBombPic
@@ -269,7 +269,7 @@ radar = defaultGun
, _itAimingRange = 1
, _itZoom = defaultItZoom { _itZoomMax = 1}
, _itAimZoom = defaultItZoom { _itZoomMax = 1}
, _itEquipPict = pictureWeaponOnAim $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
, _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
}
{- |
Sends out pulses that display creatures. -}
@@ -293,7 +293,7 @@ sonar = defaultGun
, _itAimingRange = 1
, _itZoom = defaultItZoom {_itZoomMax = 1}
, _itAimZoom = defaultItZoom {_itZoomMax = 1}
, _itEquipPict = pictureWeaponOnAim $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
, _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5)
}
{- |
Automatically sends out pulses that display creatures. -}
-3
View File
@@ -59,7 +59,6 @@ teslaGun = defaultGun
, _itAimingSpeed = 0.4
, _itZoom = defaultItZoom
, _itAimingRange = 0
, _itEquipPict = pictureWeaponOnAim teslaGunPic
}
teslaGunPic :: Item -> SPic
teslaGunPic _ =
@@ -95,7 +94,6 @@ lasGun = defaultAutoGun
, _itFloorPict = lasGunPic
, _itAimingSpeed = 0.4
, _itAimingRange = 1
, _itEquipPict = pictureWeaponOnAim lasGunPic
, _itAttachment = ItCharMode $ Seq.fromList "/VZ"
, _itScroll = scrollCharMode
, _itInvDisplay = basicWeaponDisplay
@@ -132,7 +130,6 @@ tractorGun = defaultAutoGun
, _itFloorPict = tractorGunSPic
, _itAimingSpeed = 0.4
, _itAimingRange = 0.5
, _itEquipPict = pictureWeaponOnAim tractorGunSPic
}
-- TODO own picture for tractor gun
tractorGunSPic :: Item -> SPic
-1
View File
@@ -35,7 +35,6 @@ bezierGun = defaultGun
. torqueBefore 0.05
]
, _itFloorPict = bezierGunSPic
, _itEquipPict = pictureWeaponOnAim bezierGunSPic
, _itAttachment = NoItAttachment
, _itScroll = \_ _ -> removeItTarget
, _itHammer = HammerUp
+2 -10
View File
@@ -66,7 +66,7 @@ autoGun = defaultAutoGun
, _itAimingRange = 1
, _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
, _itEquipPict = pictureWeaponOnAim autoGunPic
, _itEquipPict = pictureWeaponOnAim
, _itAttachment = ItCharMode $ Seq.fromList "MS"
, _itScroll = scrollCharMode
, _itInvDisplay = basicWeaponDisplay
@@ -118,14 +118,11 @@ pistol = defaultGun
, _wpAmmo = basicBullet
}
pistolPic :: Item -> SPic
pistolPic it =
( colorSH green (prismPoly
pistolPic it = noPic $ colorSH green (prismPoly
(map (addZ 3) $ rectNESW 3 3 (-3) (-3))
(map (addZ 0) $ rectNESW 5 3 (-5) (-7))
)
<> translateSH (V3 (-4) 5.5 4) (rotateSH pi $ bulletClip am)
, mempty
)
where
am = loadedAmmo it
@@ -156,7 +153,6 @@ hvAutoGun = defaultAutoGun
, _itFloorPict = hvAutoGunPic
, _itAimingSpeed = 0.2
, _itAimingRange = 1
, _itEquipPict = pictureWeaponOnAim hvAutoGunPic
, _wpAmmo = hvBullet
}
hvAutoGunPic :: Item -> SPic
@@ -197,7 +193,6 @@ ltAutoGun = defaultAutoGun
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itZoom = defaultItZoom
, _itEquipPict = pictureWeaponOnAim ltAutoGunPic
, _itAimStance = OneHand
, _wpAmmo = ltBullet
}
@@ -330,7 +325,6 @@ spreadGun = defaultGun
, _itFloorPict = spreadGunPic
, _itAimingSpeed = 1
, _itAimingRange = 0
, _itEquipPict = pictureWeaponOnAim spreadGunPic
, _wpAmmo = basicBullet
, _wpNumBarrels = 50
}
@@ -370,7 +364,6 @@ multGun = defaultGun
, _itAimingRange = 1
, _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
, _itEquipPict = pictureWeaponOnAim multGunSPic
, _itAimStance = TwoHandTwist
, _wpAmmo = basicBullet
, _wpNumBarrels = 5
@@ -418,7 +411,6 @@ longGun = defaultGun
, _itAimingRange = 1
, _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
, _itEquipPict = pictureWeaponOnAim longGunSPic
, _itScroll = zoomLongGun
, _itAttachment = ItScope (V2 0 0) 0 1 False
, _itEffect = itemLaserScopeEffect
+2 -2
View File
@@ -39,7 +39,7 @@ grenade = Throwable
, _itAimingRange = 0
, _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomMax = f fuseTime, _itZoomMin = f fuseTime}
, _itEquipPict = pictureWeaponOnAim $ \_ -> grenadePic fuseTime
, _itEquipPict = pictureWeaponOnAim' $ \_ -> grenadePic fuseTime
, _itID = Nothing
, _itUseRate = 25
, _itUseTime = 0
@@ -131,7 +131,7 @@ throwArmReset x = ItInvEffect {_itInvEffect = f ,_itEffectCounter = x }
counterDown it
| _itEffectCounter (_itEffect it) == 0 = it
& itHammer .~ HammerUp
& itEquipPict .~ pictureWeaponOnAim (\_ -> grenadePic 50)
& itEquipPict .~ pictureWeaponOnAim' (\_ -> grenadePic 50)
| otherwise = it & itEffect . itEffectCounter -~ 1
--flameGrenade :: Item
-2
View File
@@ -56,7 +56,6 @@ launcher = defaultGun
, _itFloorPict = launcherPic
, _itAimingSpeed = 0.2
, _itAimingRange = 0.5
, _itEquipPict = pictureWeaponOnAim launcherPic
, _itHammer = NoHammer
, _itEffect = NoItEffect
, _wpAmmo = defaultShellAmmo
@@ -256,7 +255,6 @@ remoteLauncher = defaultGun
, _itFloorPict = launcherPic
, _itAimingSpeed = 0.2
, _itAimingRange = 0.5
, _itEquipPict = pictureWeaponOnAim launcherPic
, _itAttachment = ItScope (V2 0 0) 0 1 True
, _itAimStance = TwoHandTwist
}
-2
View File
@@ -54,7 +54,6 @@ poisonSprayer = defaultAutoGun
, _itAimingSpeed = 0.2
, _itAimingRange = 0
, _itZoom = defaultItZoom
, _itEquipPict = pictureWeaponOnAim flamerPic
, _wpSpread = 0.1
, _wpNumBarrels = 3
}
@@ -82,7 +81,6 @@ flamer = defaultAutoGun
, _itAimingRange = 0
, _itZoom = defaultItZoom
, _itAimZoom = defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5}
, _itEquipPict = pictureWeaponOnAim flamerPic
, _itAttachment = NoItAttachment
}
flamerPic :: Item -> SPic
+2 -2
View File
@@ -37,8 +37,8 @@ keyholeCorridor = corridor
, midWall $ rectNSEW top bot 25 40]
}
where
top = 55
bot = 25
top = 65
bot = 15
corridorN :: Room
corridorN = defaultRoom