Move equip effect on remove out of record
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -4,6 +4,7 @@ module Dodge.Creature.Impulse.UseItem (
|
|||||||
useItem,
|
useItem,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Equipment
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Data.ComposedItem
|
import Dodge.Data.ComposedItem
|
||||||
@@ -127,7 +128,8 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation invid w of
|
|||||||
itmat i = _crInv cr IM.! i
|
itmat i = _crInv cr IM.! i
|
||||||
itm = itmat invid
|
itm = itmat invid
|
||||||
onequip itm' = doItmCrWdWd ((_eeOnEquip . _uequipEffect . _itUse) itm') itm'
|
onequip itm' = doItmCrWdWd ((_eeOnEquip . _uequipEffect . _itUse) itm') itm'
|
||||||
onremove itm' = doItmCrWdWd ((_eeOnRemove . _uequipEffect . _itUse) itm') itm'
|
--onremove itm' = doItmCrWdWd ((_eeOnRemove . _uequipEffect . _itUse) itm') itm'
|
||||||
|
onremove itm' = effectOnRemove itm'
|
||||||
|
|
||||||
toggleExamineInv :: World -> World
|
toggleExamineInv :: World -> World
|
||||||
toggleExamineInv w = case w ^? hud . hudElement . subInventory of
|
toggleExamineInv w = case w ^? hud . hudElement . subInventory of
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import Dodge.Data.Item.HeldUse
|
|||||||
data EquipEffect = EquipEffect
|
data EquipEffect = EquipEffect
|
||||||
{ _eeUse :: Euse --Item -> Creature -> World -> World
|
{ _eeUse :: Euse --Item -> Creature -> World -> World
|
||||||
, _eeOnEquip :: ItmCrWdWd --Item -> Creature -> World -> World
|
, _eeOnEquip :: ItmCrWdWd --Item -> Creature -> World -> World
|
||||||
, _eeOnRemove :: ItmCrWdWd --Item -> Creature -> World -> World
|
-- , _eeOnRemove :: ItmCrWdWd --Item -> Creature -> World -> World
|
||||||
-- , _eeParams :: EquipParams
|
-- , _eeParams :: EquipParams
|
||||||
-- , _eeViewDist :: Maybe Float
|
-- , _eeViewDist :: Maybe Float
|
||||||
-- , _eeAttachPos :: Point3
|
-- , _eeAttachPos :: Point3
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ defaultEquip =
|
|||||||
{ --_eeType = GoesOnHead
|
{ --_eeType = GoesOnHead
|
||||||
_eeUse = EDoNothing
|
_eeUse = EDoNothing
|
||||||
, _eeOnEquip = ItmCrWdWdDoNothing
|
, _eeOnEquip = ItmCrWdWdDoNothing
|
||||||
, _eeOnRemove = ItmCrWdWdDoNothing
|
-- , _eeOnRemove = ItmCrWdWdDoNothing
|
||||||
-- , _eeParams = NoEquipParams
|
-- , _eeParams = NoEquipParams
|
||||||
-- , _eeViewDist = Nothing
|
-- , _eeViewDist = Nothing
|
||||||
-- , _eeAttachPos = 0
|
-- , _eeAttachPos = 0
|
||||||
|
|||||||
@@ -15,13 +15,16 @@ module Dodge.Inventory (
|
|||||||
swapItemWith,
|
swapItemWith,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Equipment
|
||||||
|
--import Dodge.Wall.Delete
|
||||||
|
--import Dodge.Item.Location
|
||||||
import Data.Function
|
import Data.Function
|
||||||
import qualified Data.IntSet as IS
|
import qualified Data.IntSet as IS
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.Data.SelectionList
|
import Dodge.Data.SelectionList
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
import Dodge.Euse
|
--import Dodge.Euse
|
||||||
import Dodge.Inventory.CheckSlots
|
import Dodge.Inventory.CheckSlots
|
||||||
import Dodge.Inventory.Location
|
import Dodge.Inventory.Location
|
||||||
import Dodge.Inventory.RBList
|
import Dodge.Inventory.RBList
|
||||||
@@ -87,9 +90,10 @@ rmInvItem cid invid w =
|
|||||||
pointcid . crManipulation . manObject . imSelectedItem %~ g
|
pointcid . crManipulation . manObject . imSelectedItem %~ g
|
||||||
cr = w ^?! cWorld . lWorld . creatures . ix cid
|
cr = w ^?! cWorld . lWorld . creatures . ix cid
|
||||||
itm = _crInv cr IM.! invid
|
itm = _crInv cr IM.! invid
|
||||||
dounequipfunction = fromMaybe id $ do
|
dounequipfunction = effectOnRemove itm cr
|
||||||
rmf <- itm ^? itUse . uequipEffect . eeOnRemove
|
-- fromMaybe id $ do
|
||||||
return $ doItmCrWdWd rmf itm cr
|
-- rmf <- itm ^? itUse . uequipEffect . eeOnRemove
|
||||||
|
-- return $ doItmCrWdWd rmf itm cr
|
||||||
removeAnySlotEquipment = fromMaybe id $ do
|
removeAnySlotEquipment = fromMaybe id $ do
|
||||||
epos <-
|
epos <-
|
||||||
w
|
w
|
||||||
@@ -107,6 +111,7 @@ rmInvItem cid invid w =
|
|||||||
| x > invid || Just x == maxk = max 0 $ x - 1
|
| x > invid || Just x == maxk = max 0 $ x - 1
|
||||||
| otherwise = x
|
| otherwise = x
|
||||||
|
|
||||||
|
|
||||||
-- this looks ugly...
|
-- this looks ugly...
|
||||||
updateCloseObjects :: World -> World
|
updateCloseObjects :: World -> World
|
||||||
updateCloseObjects w =
|
updateCloseObjects w =
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ wristArmour =
|
|||||||
defaultEquipment
|
defaultEquipment
|
||||||
& itUse . uequipEffect . eeOnEquip .~ EonWristShield
|
& itUse . uequipEffect . eeOnEquip .~ EonWristShield
|
||||||
& itUse . uequipEffect . eeUse .~ EWristShield
|
& itUse . uequipEffect . eeUse .~ EWristShield
|
||||||
& itUse . uequipEffect . eeOnRemove .~ EoffWristShield
|
-- & itUse . uequipEffect . eeOnRemove .~ EoffWristShield
|
||||||
& itType .~ EQUIP WRISTARMOUR
|
& itType .~ EQUIP WRISTARMOUR
|
||||||
|
|
||||||
batteryPack :: Item
|
batteryPack :: Item
|
||||||
|
|||||||
Reference in New Issue
Block a user