Start more sensibly separating avatar from ai creatures

This commit is contained in:
2024-12-17 19:55:07 +00:00
parent 234b10df40
commit d0ef2628ce
23 changed files with 392 additions and 368 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ module Dodge.Tree.Compose (
attachOnward,
attachOnward',
showIntsString,
module Dodge.Tree.Compose.Data,
module Dodge.Data.MetaTree
) where
import Control.Monad.State
@@ -24,7 +24,7 @@ import Data.List (intersperse)
import Data.Maybe
import Data.Tuple
import Dodge.Data.GenWorld
import Dodge.Tree.Compose.Data
import Dodge.Data.MetaTree
import LensHelp
import TreeHelp
-19
View File
@@ -1,19 +0,0 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Tree.Compose.Data where
import Data.Tree
import Control.Lens
data MetaTree a b = MTree {_mtLabel :: b , _mtTree :: MetaNode a b, _mtBranches :: [MetaBranch a b] }
data MetaNode a b = NodeTree {_nodeTree :: Tree a} | NodeMTree {_nodeMetaTree :: MetaTree a b}
data MetaBranch a b = MBranch {_mbAttach :: a -> Maybe a, _mbTree :: MetaTree a b}
newtype SelfTree a = ST {_unST :: Tree (a,Either (Tree a) (SelfTree a))}
makeLenses ''MetaTree
makeLenses ''MetaBranch
makeLenses ''MetaNode
instance Functor (MetaTree a) where
fmap f (MTree b mn bs) = MTree (f b) (mn & nodeMetaTree %~ fmap f) (map (mbTree %~ fmap f) bs)