Remove equipment records

This commit is contained in:
2025-06-05 15:54:33 +01:00
parent 5f3b932338
commit 4b326433ab
15 changed files with 78 additions and 69 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ module Dodge.Combine.Combinations
, bulletWeapons
) where
--import Data.Bifunctor
import Dodge.Data.Magnet
import Dodge.Item.Ammo
import Dodge.Data.Item
import Dodge.Item
@@ -95,7 +95,7 @@ itemCombinations =
, p [o (HELD SPARKGUN), p 2 $ cr PIPE] teslaGun
-- , p [o $ cr TELEPORTMODULE, p 2 $ cr MICROCHIP] blinker
, p [o $ HELD BLINKER, p 2 $ cr MICROCHIP] unsafeBlinker
, po [cr MAGNET, cr TIN] magShield
, po [cr MAGNET, cr TIN] (magShield MagnetRepulse)
, p [p 2 $ cr PIPE, o $ cr PLATE, o $ cr MOTOR] powerLegs
, p [p 4 $ cr CAN] metalPlate
, p [p 3 $ cr TIN] metalPlate
+3 -2
View File
@@ -22,6 +22,7 @@ module Dodge.Creature (
module Dodge.Creature.YourControl,
) where
import Dodge.Data.Magnet
import Dodge.Item.Ammo
import Dodge.Item.Scope
import Control.Lens
@@ -292,7 +293,7 @@ testInventory =
[ autoAmr
, brainHat
, headLamp
, magShield
, magShield MagnetRepulse
, frontArmour
, wristArmour
, flatShield
@@ -309,7 +310,7 @@ testInventory =
stackedInventory :: [Item]
stackedInventory =
[ torch
, magShield
, magShield MagnetRepulse
, bangCone
, megaTinMag 100
, arHUD
+1 -1
View File
@@ -12,7 +12,7 @@ equipType itm = case itm ^. itType of
eitType :: EquipItemType -> EquipType
eitType = \case
MAGSHIELD -> GoesOnWrist
MAGSHIELD _ -> GoesOnWrist
FLAMESHIELD -> GoesOnWrist
FRONTARMOUR -> GoesOnChest
WRISTARMOUR -> GoesOnWrist
+2 -1
View File
@@ -4,6 +4,7 @@
module Dodge.Data.Item.Combine where
import Dodge.Data.Magnet
import Dodge.Data.Payload
import Control.Lens
import Data.Aeson
@@ -116,7 +117,7 @@ data ConsumableItemType
deriving (Eq, Ord, Show, Read)
data EquipItemType
= MAGSHIELD
= MAGSHIELD MagnetBuBu
| FLAMESHIELD
| FRONTARMOUR
| WRISTARMOUR
+7 -8
View File
@@ -11,16 +11,15 @@ import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Dodge.Data.Equipment.Misc
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
-- , _eeParams :: EquipParams
-- , _eeViewDist :: Maybe Float
-- , _eeAttachPos :: Point3
}
-- { _eeUse :: Euse --Item -> Creature -> World -> World
---- , _eeOnEquip :: ItmCrWdWd --Item -> Creature -> World -> World
---- , _eeOnRemove :: ItmCrWdWd --Item -> Creature -> World -> World
---- , _eeParams :: EquipParams
---- , _eeViewDist :: Maybe Float
---- , _eeAttachPos :: Point3
-- }
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data ItmCrWdWd
+1 -2
View File
@@ -1,13 +1,12 @@
module Dodge.Default.Item.Use.Equipment where
import Dodge.Data.Item.HeldUse
import Dodge.Data.Item.Use.Equipment
defaultEquip :: EquipEffect
defaultEquip =
EquipEffect
{ --_eeType = GoesOnHead
_eeUse = EDoNothing
-- _eeUse = EDoNothing
-- , _eeOnEquip = ItmCrWdWdDoNothing
-- , _eeOnRemove = ItmCrWdWdDoNothing
-- , _eeParams = NoEquipParams
+17 -15
View File
@@ -3,17 +3,17 @@ module Dodge.Equipment (
effectOnEquip,
) where
import Dodge.Creature.Test
import Dodge.Creature.HandPos
import Geometry
import Dodge.Wall.Move
import Dodge.Wall.ForceField
import qualified IntMapHelp as IM
import Dodge.Wall.Delete
import Dodge.Item.Location
import Control.Lens
import Dodge.Data.World
import Data.Maybe
import Dodge.Creature.HandPos
import Dodge.Creature.Test
import Dodge.Data.World
import Dodge.Item.Location
import Dodge.Wall.Delete
import Dodge.Wall.ForceField
import Dodge.Wall.Move
import Geometry
import qualified IntMapHelp as IM
effectOnRemove :: Item -> Creature -> World -> World
effectOnRemove itm = case itm ^. itType of
@@ -38,13 +38,15 @@ effectOnEquip itm = case itm ^. itType of
onEquipWristShield' :: Item -> Creature -> World -> World
onEquipWristShield' itm cr w =
w
-- & pointerToItem itm . itUse . uequipEffect . eeParams .~ EquipID i
& pointerToItem itm . itParams .~ ItemParamID {_itParamID = i}
-- & pointerToItem itm . itUse . uequipEffect . eeParams .~ EquipID i
& pointerToItem itm . itParams .~ ItemParamID{_itParamID = i}
& cWorld . lWorld . walls . at i ?~ forceField{_wlID = i}
& setWristShieldPos (itm
-- & itUse . uequipEffect . eeParams .~ EquipID i
& itParams .~ ItemParamID {_itParamID = i}
) cr
& setWristShieldPos
( itm
-- & itUse . uequipEffect . eeParams .~ EquipID i
& itParams .~ ItemParamID{_itParamID = i}
)
cr
where
i = IM.newKey (w ^. cWorld . lWorld . walls)
+11 -6
View File
@@ -33,14 +33,19 @@ doItmCrWdWd x itm cr = case x of
useE :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
useE loc cr = case eo of
Nothing -> id
Just EDoNothing -> id
Just (EMagShield mt) -> useMagShield mt itm cr
Just EWristShield -> setWristShieldPos itm cr
Just EHeadLamp -> createHeadLamp itm cr
-- Nothing -> id
-- Just EDoNothing -> id
--Just (EMagShield mt)
EQUIP (MAGSHIELD mt) -> useMagShield mt itm cr
--Just EWristShield
EQUIP WRISTARMOUR -> setWristShieldPos itm cr
--Just EHeadLamp
EQUIP HEADLAMP -> createHeadLamp itm cr
_ -> id
where
itm = loc ^. locLDT . ldtValue . _1
eo = itm ^? itUse . uequipEffect . eeUse
eo = itm ^. itType
--eo = itm ^? itUse . uequipEffect . eeUse
-- this should probably drain energy
useMagShield :: MagnetBuBu -> Item -> Creature -> World -> World
+2 -3
View File
@@ -47,7 +47,7 @@ itemFromAmmoMag at = case at of
CHEMFUELPOUCH -> chemFuelPouch
itemFromAttachType :: AttachType -> Item
itemFromAttachType at = case at of
itemFromAttachType = \case
UNDERBARRELSLOT -> underBarrelSlot
ZOOMSCOPE -> zoomScope
BULLETSYNTH -> bulletSynthesizer
@@ -57,13 +57,12 @@ itemFromAttachType at = case at of
GYROSCOPE -> gyroscope
REMOTEDETONATOR -> remoteDetonator
SMOKEREDUCER -> smokeReducer
-- ROCKETHOMER -> rocketHomer
HOMINGMODULE -> homingModule
SHELLPAYLOAD p -> shellModule p
itemFromEquipType :: EquipItemType -> Item
itemFromEquipType et = case et of
MAGSHIELD -> magShield
MAGSHIELD mt -> magShield mt
FLAMESHIELD -> flameShield
FRONTARMOUR -> frontArmour
WRISTARMOUR -> wristArmour
+1 -1
View File
@@ -144,7 +144,7 @@ fractionLoadedAmmo rs = fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs)
equipItemSPic :: EquipItemType -> Item -> SPic
equipItemSPic et _ = case et of
WRIST_ECG -> defSPic
MAGSHIELD -> defSPic
MAGSHIELD _ -> defSPic
FLAMESHIELD -> defSPic
FRONTARMOUR -> defSPic
-- ( mempty
+9 -9
View File
@@ -23,11 +23,11 @@ import Dodge.Data.Item
import Dodge.Default
import LensHelp
magShield :: Item
magShield =
magShield :: MagnetBuBu -> Item
magShield mt =
defaultEquipment
& itUse . uequipEffect . eeUse .~ EMagShield MagnetRepulse
& itType .~ EQUIP MAGSHIELD
-- & itUse . uequipEffect . eeUse .~ EMagShield MagnetRepulse
& itType .~ EQUIP (MAGSHIELD mt)
flameShield :: Item
flameShield =
@@ -43,14 +43,14 @@ wristArmour :: Item
wristArmour =
defaultEquipment
-- & itUse . uequipEffect . eeOnEquip .~ EonWristShield
& itUse . uequipEffect . eeUse .~ EWristShield
-- & itUse . uequipEffect . eeUse .~ EWristShield
-- & itUse . uequipEffect . eeOnRemove .~ EoffWristShield
& itType .~ EQUIP WRISTARMOUR
batteryPack :: Item
batteryPack =
defaultEquipment
& itUse . uequipEffect . eeUse .~ EDoNothing
-- & itUse . uequipEffect . eeUse .~ EDoNothing
& itConsumables
.~ AmmoMag
{ _magParams = NoAmmoParams
@@ -80,7 +80,7 @@ fuelPack =
bulletBeltPack :: Item
bulletBeltPack =
defaultEquipment
& itUse . uequipEffect . eeUse .~ EDoNothing
-- & itUse . uequipEffect . eeUse .~ EDoNothing
& itConsumables
.~ AmmoMag
{ _magParams = BulletParams defaultBullet
@@ -95,7 +95,7 @@ bulletBeltPack =
bulletBeltBracer :: Item
bulletBeltBracer =
defaultEquipment
& itUse . uequipEffect . eeUse .~ EDoNothing
-- & itUse . uequipEffect . eeUse .~ EDoNothing
& itConsumables
.~ AmmoMag
{ _magParams = BulletParams defaultBullet
@@ -116,7 +116,7 @@ hat = defaultEquipment & itType .~ EQUIP HAT
headLamp :: Item
headLamp =
defaultEquipment
& itUse . uequipEffect . eeUse .~ EHeadLamp
-- & itUse . uequipEffect . eeUse .~ EHeadLamp
& itType .~ EQUIP HEADLAMP
powerLegs :: Item
+2 -1
View File
@@ -138,7 +138,8 @@ heldInfo hit = case hit of
equipInfo :: EquipItemType -> String
equipInfo eit = case eit of
MAGSHIELD -> "A device designed to repulse nearby metallic objects."
MAGSHIELD mt -> "A device designed to repulse nearby metallic objects. Of type: "
<> show mt <> "."
FLAMESHIELD -> "A device designed to repulse nearby flames."
FRONTARMOUR -> "A device designed to shield from the front."
WRISTARMOUR -> "A device that projects a forcefield."