Explicitly store list of barrels for weapons

This commit is contained in:
2023-05-20 17:48:51 +01:00
parent 03611c6b95
commit 4cfb7d431a
9 changed files with 73 additions and 98 deletions
+5 -12
View File
@@ -118,14 +118,10 @@ ammoPosition itm hit = case hit of
rhs = Q.axisAngle (V3 1 0 0) 0
bangStickAmmoPos :: Int -> Item -> AmmoPosition
bangStickAmmoPos i itm =
bangStickAmmoPos _ itm =
Bullets
[(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a) | a <- map f [0 .. i - 1]]
where
f n =
barrelspread * fromIntegral n
- 0.5 * barrelspread * fromIntegral (_brlNum (_gunBarrels (_itParams itm)) -1)
barrelspread = itm ^?! itParams . gunBarrels . brlSpread . spreadAngle
[(rotate3z a (V3 5 0 3), Q.axisAngle (V3 0 0 1) a)
| a <- map _barlRot (itm ^?! itParams . gunBarrels)]
volleygunAmmoPos :: Int -> AmmoPosition
volleygunAmmoPos i =
@@ -212,12 +208,9 @@ modulesSPic it _ imt = case imt of
_ -> mempty
baseStickShapeX :: Item -> Int -> Shape
baseStickShapeX it i = foldMap f [0 .. i -1]
baseStickShapeX it _ = foldMap f (it ^?! itParams . gunBarrels)
where
f j = rotateSH ang baseStickShape
where
ang = fromIntegral j * barrelspread - (fromIntegral i - 1) * barrelspread * 0.5
barrelspread = it ^?! itParams . gunBarrels . brlSpread . spreadAngle
f brl = rotateSH (_barlRot brl) baseStickShape
baseStickShape :: Shape
baseStickShape = colorSH green $ xCylinderST 3 10