Commit before tweaking item id/locations
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
All good (618 modules, at 10:46:18)
|
||||
All good (619 modules, at 13:53:46)
|
||||
|
||||
@@ -5,6 +5,7 @@ module Dodge.Creature.Impulse.UseItem (
|
||||
useItemHotkey,
|
||||
) where
|
||||
|
||||
import Dodge.SelectUse
|
||||
import Dodge.Item.Grammar
|
||||
import Dodge.Data.ComposedItem
|
||||
import Dodge.Data.DoubleTree
|
||||
@@ -40,17 +41,14 @@ itemEffect cr it w = case it ^. ldtValue . itUse of
|
||||
EquipUse{} -> doequipmentchange
|
||||
(ConsumeUse eff) -> useC eff (_ldtValue it) cr w
|
||||
CraftUse{} -> w
|
||||
AttachUse{} -> w
|
||||
AttachUse{} -> selectUse it cr w
|
||||
AmmoMagUse{} -> w
|
||||
where
|
||||
itm = it ^. ldtValue
|
||||
hammerTest f = case _crHammerPosition cr of
|
||||
HammerUp -> f w -- & setuhamdown
|
||||
_ -> w -- & setuhamdown
|
||||
-- setuhamdown = cWorld . lWorld . creatures . ix (_crID cr) . crHammerPosition .~ HammerDown
|
||||
doequipmentchange = fromMaybe w $ do
|
||||
guard (_crHammerPosition cr == HammerUp)
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
return $ hammerTest $ toggleEquipmentAt invid cr
|
||||
return $ toggleEquipmentAt invid cr w
|
||||
|
||||
toggleEquipmentAt :: Int -> Creature -> World -> World
|
||||
toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
|
||||
|
||||
@@ -215,9 +215,8 @@ pressedMBEffectsTopInventory pkeys w
|
||||
DisplayInventory{_subInventory = NoSubInventory} -> True
|
||||
_ -> False
|
||||
isDown but = but `M.member` pkeys
|
||||
theinput = w ^. input
|
||||
rotation =
|
||||
maybe
|
||||
0
|
||||
(angleBetween (theinput ^. mousePos))
|
||||
(theinput ^. heldPos . at SDL.ButtonMiddle)
|
||||
(angleBetween $ w ^. input . mousePos)
|
||||
(w ^. input . heldPos . at SDL.ButtonMiddle)
|
||||
|
||||
@@ -60,6 +60,7 @@ data ItemUse
|
||||
| CraftUse
|
||||
| -- {_useAmount :: ItAmount}
|
||||
AttachUse
|
||||
{_atLinkedProjectile :: Maybe Int}
|
||||
| -- {_attachParams :: AttachParams}
|
||||
AmmoMagUse
|
||||
{ _amagLoadStatus :: ReloadStatus
|
||||
|
||||
@@ -62,6 +62,7 @@ rmInvItem cid invid w = w
|
||||
& updateselection
|
||||
& pointcid %~ updateRootItemID
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& updateCreatureItemLocations cid
|
||||
where
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
|
||||
@@ -94,6 +95,15 @@ rmInvItem cid invid w = w
|
||||
| x > invid || Just x == maxk = max 0 $ x - 1
|
||||
| otherwise = x
|
||||
|
||||
updateCreatureItemLocations :: Int -> World -> World
|
||||
updateCreatureItemLocations crid w = fromMaybe w $ do
|
||||
inv <- w ^? cWorld . lWorld . creatures . ix crid . crInv
|
||||
return $ foldl' updateItemLocation w inv
|
||||
|
||||
updateItemLocation :: World -> Item -> World
|
||||
updateItemLocation w itm = w
|
||||
& cWorld . lWorld . itemLocations . ix (itm ^. itID) .~ itm ^. itLocation
|
||||
|
||||
---- | after this the item at the inventory position will no longer exist
|
||||
--rmInvItem ::
|
||||
-- -- | Creature id
|
||||
|
||||
@@ -104,9 +104,9 @@ chemFuelPouch =
|
||||
bulletSynthesizer :: Item
|
||||
bulletSynthesizer = defaultHeldItem
|
||||
& itType . iyBase .~ ATTACH BULLETSYNTHESIZER
|
||||
& itUse .~ AttachUse
|
||||
& itUse .~ AttachUse Nothing
|
||||
|
||||
rocketHomer :: Item
|
||||
rocketHomer = defaultHeldItem
|
||||
& itType . iyBase .~ ATTACH ROCKETHOMER
|
||||
& itUse .~ AttachUse
|
||||
& itUse .~ AttachUse Nothing
|
||||
|
||||
@@ -19,10 +19,10 @@ targetingScope :: TargetType -> Item
|
||||
targetingScope tt =
|
||||
defaultHeldItem
|
||||
& itType . iyBase .~ ATTACH (TARGETATTACH tt)
|
||||
& itUse .~ AttachUse
|
||||
& itUse .~ AttachUse Nothing
|
||||
|
||||
rocketRemoteScreen :: Item
|
||||
rocketRemoteScreen =
|
||||
defaultHeldItem
|
||||
& itType . iyBase .~ ATTACH ROCKETREMOTESCREEN
|
||||
& itUse .~ AttachUse
|
||||
& itUse .~ AttachUse Nothing
|
||||
|
||||
@@ -20,7 +20,8 @@ import Dodge.Data.Universe
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
testStringInit :: Universe -> [String]
|
||||
testStringInit _ = mempty
|
||||
testStringInit u = map show $
|
||||
(IM.toList . IM.filter (\itloc -> itloc ^? ipCrID == Just 0) $ (u ^. uvWorld . cWorld . lWorld . itemLocations)) <> IM.toList ( fmap _itLocation (u ^?! uvWorld . cWorld . lWorld . creatures . ix 0 . crInv))
|
||||
--testStringInit u = fromMaybe mempty $ do
|
||||
-- inv <- fmap invLDT $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crInv
|
||||
-- invitm <- inv ^? ix 1
|
||||
|
||||
@@ -5885,7 +5885,7 @@ itemDetectorEffect src/Dodge/HeldUse.hs 200;" f
|
||||
itemDisplay src/Dodge/Item/Display.hs 33;" f
|
||||
itemDisplayPad src/Dodge/Item/Display.hs 45;" f
|
||||
itemEffect src/Dodge/Creature/Action/UseItem.hs 28;" f
|
||||
itemEffect src/Dodge/Creature/Impulse/UseItem.hs 35;" f
|
||||
itemEffect src/Dodge/Creature/Impulse/UseItem.hs 34;" f
|
||||
itemEquipPict src/Dodge/Item/Draw.hs 17;" f
|
||||
itemFromAmmoMag src/Dodge/Item.hs 29;" f
|
||||
itemFromAttachType src/Dodge/Item.hs 39;" f
|
||||
@@ -7496,7 +7496,7 @@ toV3 src/Geometry/Data.hs 38;" f
|
||||
toV4 src/Geometry/Data.hs 40;" f
|
||||
toggleCombineInv src/Dodge/DisplayInventory.hs 32;" f
|
||||
toggleCommand src/Dodge/Terminal.hs 194;" f
|
||||
toggleEquipmentAt src/Dodge/Creature/Impulse/UseItem.hs 56;" f
|
||||
toggleEquipmentAt src/Dodge/Creature/Impulse/UseItem.hs 55;" f
|
||||
toggleJust src/MaybeHelp.hs 41;" f
|
||||
toggleMap src/Dodge/Update/Input/InGame.hs 237;" f
|
||||
toggleMapKey src/Dodge/Config/KeyConfig.hs 25;" f
|
||||
@@ -7795,8 +7795,8 @@ useHeld src/Dodge/HeldUse.hs 306;" f
|
||||
useHotKey src/Dodge/Creature/YourControl.hs 49;" f
|
||||
useItem src/Dodge/Creature/Action/UseItem.hs 14;" f
|
||||
useItemHotkey src/Dodge/Creature/Impulse/UseItem.hs 128;" f
|
||||
useItemLeftClick src/Dodge/Creature/Impulse/UseItem.hs 101;" f
|
||||
useItemLeftClick' src/Dodge/Creature/Impulse/UseItem.hs 116;" f
|
||||
useItemLeftClick src/Dodge/Creature/Impulse/UseItem.hs 100;" f
|
||||
useItemLeftClick' src/Dodge/Creature/Impulse/UseItem.hs 115;" f
|
||||
useL src/Dodge/Luse.hs 13;" f
|
||||
useLeftItem src/Dodge/Creature/Action/UseItem.hs 38;" f
|
||||
useLnkRoomPos src/Dodge/PlacementSpot.hs 244;" f
|
||||
|
||||
Reference in New Issue
Block a user