Globally assign attachment orientations

This commit is contained in:
2025-06-26 20:59:38 +01:00
parent 494c7a4f89
commit 758c0aeec8
4 changed files with 10 additions and 10 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ module Dodge.Creature.State (
doDamage,
) where
import Dodge.Item.Orientation
import Dodge.Item.UseDelay
import Control.Applicative
import Control.Monad
@@ -294,9 +295,9 @@ chainLinkOrientation ::
ItemLink ->
CItem ->
(Point3, Q.Quaternion Float)
chainLinkOrientation (p, q) par (ILink lt f) child = (p + Q.rotate q p1, q * q1)
chainLinkOrientation (p, q) par (ILink lt) child = (p + Q.rotate q p1, q * q1)
where
(p1, q1) = f (par ^. _1) lt (child ^. _1)
(p1, q1) = orientAttachment (par ^. _1) lt (child ^. _1)
updateItemWithOrientation ::
Creature ->
+2 -3
View File
@@ -9,8 +9,6 @@ import Dodge.Data.AmmoType
import Dodge.Data.DoubleTree
import Control.Lens
import Dodge.Data.Item
import Geometry.Data
import Linear.Quaternion (Quaternion (..))
data CLinkType
= AmmoInLink Int AmmoType
@@ -69,7 +67,8 @@ type CItem = (Item, ItemStructuralFunction, LinkTest)
data ItemLink = ILink
{ _iatType :: CLinkType
, _iatOrient :: Item -> CLinkType -> Item -> (Point3, Quaternion Float)
-- , _iatOrient :: Item -> CLinkType -> Item -> (Point3, Quaternion Float)
-- , _iatOrient :: Item -> CLinkType -> (Point3, Quaternion Float)
}
-- this should possibly use a full item structure tree rather than a
+2 -1
View File
@@ -5,6 +5,7 @@ module Dodge.Item.Draw.SPic (
itemTreeSPic,
) where
import Dodge.Item.Orientation
import Dodge.Item.MaxAmmo
import Color
import Data.Maybe
@@ -28,7 +29,7 @@ itemTreeSPic (LDT (itm,_,_) l r) =
itemRotTreeSPic :: Item -> (ItemLink, LabelDoubleTree ItemLink CItem) -> SPic
itemRotTreeSPic par (il, t) = translateSP p . overPosSP (Q.rotate q) $ itemTreeSPic t
where
(p, q) = _iatOrient il par (_iatType il) itm
(p, q) = orientAttachment par (_iatType il) itm
itm = t ^. ldtValue . _1
itemSPic :: Item -> SPic
+3 -4
View File
@@ -24,7 +24,6 @@ import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Dodge.Data.Item
import Dodge.DoubleTree
import Dodge.Item.Orientation
import LensHelp
import ListHelp
@@ -40,7 +39,7 @@ useBreakL ::
LinkTest
useBreakL x y = useBreakListsLinkTest (map (uncurry noa) x) (map (uncurry noa) y)
where
noa a b = (a, ILink b orientAttachment)
noa a b = (a, ILink b)
useBreakListsLinkTest ::
[(ItemStructuralFunction, ItemLink)] ->
@@ -216,7 +215,7 @@ llright itm pci = case pci ^. ldtValue . _1 . itType of
toLasgunUpdate :: Item -> LinkUpdate
toLasgunUpdate itm =
LUpdate
(ILink FunctionChangeLink orientAttachment)
(ILink FunctionChangeLink)
(\(par, _, _) -> (par, HeldPlatformSF, uncurry useBreakL $ itemToBreakLists itm HeldPlatformSF))
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
@@ -226,7 +225,7 @@ springLinkTest = LTest (const Nothing) $
CRAFT HARDWARE ->
Just
( LUpdate
(ILink FunctionChangeLink orientAttachment)
(ILink FunctionChangeLink)
(\(par, _, up) -> (par, MakeAutoSF, up))
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
)