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