Remove reduntant left click item use code

This commit is contained in:
2024-11-29 20:40:14 +00:00
parent 1b99b73f44
commit de4a955206
9 changed files with 256 additions and 285 deletions
+2 -11
View File
@@ -5,13 +5,12 @@ module Dodge.WorldEffect (
lineOutputTerminal,
) where
import Dodge.Item.Grammar
import Dodge.HeldUse
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Data.Foldable
import qualified Data.Map.Strict as M
import Data.Maybe
import Dodge.Creature.Impulse.UseItem
import Dodge.Data.World
import Dodge.Default
import Dodge.Inventory.Lock
@@ -35,13 +34,6 @@ doWdWd we = case we of
TorqueCr x cid -> torqueCr x cid
SoundStart so p sid mi -> soundStart so p sid mi
WdWdNegateTrig trid -> cWorld . lWorld . triggers . ix trid %~ not
--WdWdFromItixCrixWdWd itid crid f -> \w -> fromMaybe w $ do
WdWdFromItixCrixWdWd _ crid f -> \w -> fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix crid
--it <- getItem itid w
itRef <- cr ^? crManipulation . manObject . imSelectedItem
it <- invTrees (_crInv cr) ^? ix itRef -- note this probably doesn't always work, invTrees probably only returns rooted trees
return $ doItCrWdWd f it cr w
WdWdFromItCrixWdWd it crid f -> \w -> fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix crid
return $ doItCrWdWd f it cr w
@@ -51,8 +43,7 @@ doWdWd we = case we of
doItCrWdWd :: ItCrWdWd -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
doItCrWdWd icww = case icww of
ItCrWdId -> \_ _ -> id
ItCrWdItemEffect -> flip itemUseEffect
ItCrWdItemHeldEffect -> heldEffect
accessTerminal :: Maybe Int -> World -> World
accessTerminal mtmid w = fromMaybe w $ do