This commit is contained in:
2025-07-12 21:47:08 +01:00
parent 06cf55aa73
commit 026dbf9d15
3 changed files with 78 additions and 50 deletions
-2
View File
@@ -1,10 +1,8 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
module Dodge.Data.ComposedItem where module Dodge.Data.ComposedItem where
import Dodge.Data.AmmoType import Dodge.Data.AmmoType
--import Control.Lens
import Dodge.Data.Item import Dodge.Data.Item
import Linear import Linear
import qualified Linear.Quaternion as Q import qualified Linear.Quaternion as Q
+55 -24
View File
@@ -5,14 +5,14 @@ module Dodge.Item.Draw.SPic (
itemTreeSPic, itemTreeSPic,
) where ) where
import Dodge.Item.Orientation
import Dodge.Item.MaxAmmo
import Color import Color
import Data.Maybe import Data.Maybe
import Data.Strict.Tuple import Data.Strict.Tuple
import Dodge.Data.ComposedItem import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree import Dodge.Data.DoubleTree
import Dodge.Data.Item import Dodge.Data.Item
import Dodge.Item.MaxAmmo
import Dodge.Item.Orientation
import Geometry import Geometry
import LensHelp import LensHelp
import qualified Linear.Quaternion as Q import qualified Linear.Quaternion as Q
@@ -59,17 +59,27 @@ craftItemSPic = \case
HARDWARE -> colorSH orange $ upperPrismPolyST 3 $ square 4 HARDWARE -> colorSH orange $ upperPrismPolyST 3 $ square 4
SPRING -> colorSH green $ xCylinderST 1 5 SPRING -> colorSH green $ xCylinderST 1 5
HOSE -> colorSH green $ xCylinderST 1 10 HOSE -> colorSH green $ xCylinderST 1 10
TAPE -> colorSH (greyN 0.5) TAPE ->
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 3 5 colorSH (greyN 0.5)
CAN -> colorSH green . translateSH (V3 4 0 0)
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 3 4 . upperCylinder Small Typical 1
$ polyCirc 3 5
CAN ->
colorSH green
. translateSH (V3 4 0 0)
. upperCylinder Small Typical 1
$ polyCirc 3 4
TIN -> colorSH green . upperPrismPolyST 3 $ rectXH 2 2 TIN -> colorSH green . upperPrismPolyST 3 $ rectXH 2 2
STEELDRUM -> colorSH green STEELDRUM ->
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 4 8 colorSH green
. translateSH (V3 4 0 0)
. upperCylinder Small Typical 1
$ polyCirc 4 8
PLANK -> colorSH orange $ upperPrismPolyST 3 $ rectXH 8 2 PLANK -> colorSH orange $ upperPrismPolyST 3 $ rectXH 8 2
GLASSSHARD -> colorSH azure $ upperPrismPolyST 1 [V2 0 (-1), V2 4 (-0.5), V2 0 1] GLASSSHARD -> colorSH azure $ upperPrismPolyST 1 [V2 0 (-1), V2 4 (-0.5), V2 0 1]
SCRAPMETAL -> colorSH (greyN 0.3) $ upperPrismPolyST 3 $ square 4 SCRAPMETAL -> colorSH (greyN 0.3) $ upperPrismPolyST 3 $ square 4
PUMP -> colorSH yellow . translateSH (V3 4 0 0) $ PUMP ->
colorSH yellow . translateSH (V3 4 0 0) $
upperCylinder Small Typical 1 (polyCirc 4 4) upperCylinder Small Typical 1 (polyCirc 4 4)
<> upperPrismPolyST 1 (rectNSWE (-2) (-4) 4 0) <> upperPrismPolyST 1 (rectNSWE (-2) (-4) 4 0)
<> upperPrismPolyST 1 (rectNSWE 4 2 0 (-4)) <> upperPrismPolyST 1 (rectNSWE 4 2 0 (-4))
@@ -77,43 +87,60 @@ craftItemSPic = \case
TRANSFORMER -> colorSH blue $ upperPrismPolyST 3 $ square 4 TRANSFORMER -> colorSH blue $ upperPrismPolyST 3 $ square 4
PRISM -> colorSH azure $ upperPrismPolyST 1 [V2 0 (-3), V2 4 0, V2 0 3] PRISM -> colorSH azure $ upperPrismPolyST 1 [V2 0 (-3), V2 4 0, V2 0 3]
LIGHTER -> colorSH yellow . upperPrismPolyST 3 $ rectXH 2 2 LIGHTER -> colorSH yellow . upperPrismPolyST 3 $ rectXH 2 2
MAGNET -> colorSH red (upperPrismPolyST 1 (rectNSWE 2 (-2) 2 0)) MAGNET ->
colorSH red (upperPrismPolyST 1 (rectNSWE 2 (-2) 2 0))
<> colorSH (greyN 0.5) (upperPrismPolyST 1 (rectNSWE 2 (-2) 4 2)) <> colorSH (greyN 0.5) (upperPrismPolyST 1 (rectNSWE 2 (-2) 4 2))
<> colorSH blue (upperPrismPolyST 1 (rectNSWE 2 (-2) 6 4)) <> colorSH blue (upperPrismPolyST 1 (rectNSWE 2 (-2) 6 4))
ANTIMATTER -> colorSH violet $ upperPrismPolyST 3 $ square 4 ANTIMATTER -> colorSH violet $ upperPrismPolyST 3 $ square 4
PLATE -> colorSH green $ upperPrismPolyST 8 $ rectXH 2 5 PLATE -> colorSH green $ upperPrismPolyST 8 $ rectXH 2 5
TRANSMITTER -> colorSH green $ TRANSMITTER ->
colorSH green $
xCylinderST 1 5 <> translateSH (V3 5 0 0) (upperPrismPolyHalfST 3 $ polyCirc 4 3) xCylinderST 1 5 <> translateSH (V3 5 0 0) (upperPrismPolyHalfST 3 $ polyCirc 4 3)
MICROCHIP -> colorSH yellow $ upperPrismPolyST 1 $ square 4 MICROCHIP -> colorSH yellow $ upperPrismPolyST 1 $ square 4
HARDDRIVE -> colorSH green $ upperPrismPolyST 1 $ square 4 HARDDRIVE -> colorSH green $ upperPrismPolyST 1 $ square 4
RAM -> colorSH orange $ upperPrismPolyST 1 $ square 4 RAM -> colorSH orange $ upperPrismPolyST 1 $ square 4
AIUNIT -> colorSH blue $ upperPrismPolyST 1 $ square 4 AIUNIT -> colorSH blue $ upperPrismPolyST 1 $ square 4
CAMERA -> colorSH yellow $ xCylinderST 5 3 <> xCylinderST 3 5 CAMERA -> colorSH yellow $ xCylinderST 5 3 <> xCylinderST 3 5
MINIDISPLAY -> colorSH green $ upperPrismPolyST 1 (square 4) MINIDISPLAY ->
colorSH green $
upperPrismPolyST 1 (square 4)
<> upperPrismPolyST 2 (rectNSWE 4 (-4) 3 4) <> upperPrismPolyST 2 (rectNSWE 4 (-4) 3 4)
LED -> colorSH yellow $ upperPrismPolyST 1 (square 2) LED -> colorSH yellow $ upperPrismPolyST 1 (square 2)
NAILBOX -> colorSH green $ upperPrismPolyST 3 (rectXH 4 3) NAILBOX -> colorSH green $ upperPrismPolyST 3 (rectXH 4 3)
IRONBAR -> colorSH (greyN 0.5) $ upperPrismPolyST 3 $ rectXH 8 2 IRONBAR -> colorSH (greyN 0.5) $ upperPrismPolyST 3 $ rectXH 8 2
LIGHTSENSOR -> colorSH green (upperPrismPolyST 1 $ square 3) LIGHTSENSOR ->
colorSH green (upperPrismPolyST 1 $ square 3)
<> colorSH yellow (upperPrismPolyHalfST 3 $ polyCirc 4 3) <> colorSH yellow (upperPrismPolyHalfST 3 $ polyCirc 4 3)
SOUNDSENSOR -> colorSH yellow (upperPrismPolyST 1 $ rectXH 4 1) SOUNDSENSOR ->
colorSH yellow (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2)) <> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2)) <> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
MICROPHONE -> colorSH yellow (upperPrismPolyST 1 $ rectXH 3 1) MICROPHONE ->
colorSH yellow (upperPrismPolyST 1 $ rectXH 3 1)
<> translateSH (V3 3 0 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2)) <> translateSH (V3 3 0 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
HEATSENSOR -> colorSH red (upperPrismPolyST 1 $ rectXH 4 1) HEATSENSOR ->
colorSH red (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2)) <> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2)) <> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
THERMOMETER -> colorSH green (upperPrismPolyST 1 $ rectXH 3 1) THERMOMETER ->
colorSH green (upperPrismPolyST 1 $ rectXH 3 1)
<> translateSH (V3 3 0 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2)) <> translateSH (V3 3 0 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
CREATURESENSOR -> colorSH azure (upperPrismPolyST 1 $ rectXH 4 1) CREATURESENSOR ->
colorSH azure (upperPrismPolyST 1 $ rectXH 4 1)
<> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2)) <> translateSH (V3 4 1 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
<> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2)) <> translateSH (V3 4 (-1) 0) (colorSH yellow (upperPrismPolyHalfST 2 $ polyCirc 4 2))
WIRE -> colorSH blue $ xCylinderST 1 5 WIRE -> colorSH blue $ xCylinderST 1 5
FUELCELL -> colorSH blue FUELCELL ->
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 3 4 colorSH blue
PORTABLEFUSION -> colorSH azure . translateSH (V3 4 0 0)
. translateSH (V3 4 0 0) . upperCylinder Small Typical 1 $ polyCirc 3 4 . upperCylinder Small Typical 1
$ polyCirc 3 4
PORTABLEFUSION ->
colorSH azure
. translateSH (V3 4 0 0)
. upperCylinder Small Typical 1
$ polyCirc 3 4
-- FRAGMODULE -- FRAGMODULE
-- FLASHMODULE -- FLASHMODULE
-- GASINJECTOR -- GASINJECTOR
@@ -125,7 +152,8 @@ ammoMagSPic it = \case
TINMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- (am * 5)) (-1) 1) TINMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- (am * 5)) (-1) 1)
DRUMMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- (am * 15)) (-1) 1) DRUMMAG -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- (am * 15)) (-1) 1)
CHEMFUELPOUCH -> noPic $ colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5) CHEMFUELPOUCH -> noPic $ colorSH yellow (upperPrismPolyST 3 $ polyCirc 3 5)
BATTERY -> colorSH blue (upperBox Tiny Superfluous 1 (rectNSWE 0 (-2) (-2) 2)) BATTERY ->
colorSH blue (upperBox Tiny Superfluous 1 (rectNSWE 0 (-2) (-2) 2))
:!: setLayer BloomNoZWrite (setDepth 2 . color (mixColorsFrac green red am) $ circleSolid 2) :!: setLayer BloomNoZWrite (setDepth 2 . color (mixColorsFrac green red am) $ circleSolid 2)
_ -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- y) (-1) 1) _ -> noPic $ upperPrismPolyTS 1 (rectNSWE 0 (- y) (-1) 1)
where where
@@ -136,7 +164,8 @@ ammoMagSPic it = \case
fractionLoadedAmmo :: Item -> Float fractionLoadedAmmo :: Item -> Float
fractionLoadedAmmo itm = fromMaybe 0 $ do fractionLoadedAmmo itm = fromMaybe 0 $ do
m <- maxAmmo itm m <- maxAmmo itm
return $ fromIntegral (itm ^?! itConsumables . _Just) return $
fromIntegral (itm ^?! itConsumables . _Just)
/ fromIntegral m / fromIntegral m
-- --
@@ -280,6 +309,7 @@ torchShape =
baseStickShapeX :: Item -> Int -> Shape baseStickShapeX :: Item -> Int -> Shape
baseStickShapeX _ _ = mempty baseStickShapeX _ _ = mempty
--baseStickShapeX it _ = mempty --baseStickShapeX it _ = mempty
-- foldMap f (it ^?! itUse . heldMuzzles) -- foldMap f (it ^?! itUse . heldMuzzles)
-- where -- where
@@ -410,6 +440,7 @@ teslaGunPic = shatterGunSPic
lasGunPic :: Item -> SPic lasGunPic :: Item -> SPic
lasGunPic _ = noPic $ colorSH blue $ upperPrismPolyST 3 $ square 4 lasGunPic _ = noPic $ colorSH blue $ upperPrismPolyST 3 $ square 4
-- colorSH -- colorSH
-- blue -- blue
-- ( upperBoxST 4 (rectNSWE 3 1 0 30) -- ( upperBoxST 4 (rectNSWE 3 1 0 30)
+1 -2
View File
@@ -3,17 +3,16 @@
module Dodge.Item.HeldOffset ( module Dodge.Item.HeldOffset (
turretItemOffset, turretItemOffset,
twoFlatHRot, twoFlatHRot,
-- heldItemOffset,
locOrient, locOrient,
handHandleOrient, handHandleOrient,
) where ) where
import Dodge.DoubleTree
import Dodge.Data.AimStance import Dodge.Data.AimStance
import Dodge.Data.ComposedItem import Dodge.Data.ComposedItem
import Dodge.Data.Creature import Dodge.Data.Creature
import Dodge.Data.DoubleTree import Dodge.Data.DoubleTree
import Dodge.Data.Machine import Dodge.Data.Machine
import Dodge.DoubleTree
import Dodge.Item.AimStance import Dodge.Item.AimStance
import Geometry import Geometry
import LensHelp import LensHelp