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