Move towards allowing equipable targeting items

This commit is contained in:
2023-01-06 11:01:32 +00:00
parent bf479ca080
commit 612ee85579
23 changed files with 152 additions and 145 deletions
+10
View File
@@ -72,10 +72,18 @@ data Creature = Creature
, _crName :: String
, _crStatistics :: CreatureStatistics
, _crCamouflage :: CamouflageStatus
, _crTargeting :: CreatureTargeting
}
--deriving (Eq, Show, Read) --Generic, Flat)
data CreatureTargeting = CreatureTargeting
{ _ctPos :: Maybe Point2
, _ctType :: Maybe TargetType
, _ctID :: Maybe Int
, _ctActive :: Bool
}
data CreatureCorpse = MakeDefaultCorpse
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
@@ -92,6 +100,7 @@ crSel :: Creature -> Int
crSel = _iselPos . _crInvSel
makeLenses ''Creature
makeLenses ''CreatureTargeting
makeLenses ''Intention
concat
@@ -100,4 +109,5 @@ concat
[ ''CreatureCorpse
, ''Creature
, ''Intention
, ''CreatureTargeting
]
+2
View File
@@ -79,6 +79,8 @@ data CraftType
| TIMEMODULE
| SIZEMODULE
| GRAVITYMODULE
| TARGETMODULE TargetType
deriving (Eq,Ord,Show,Read)
--deriving (Eq, Ord, Show, Enum, Read) --Generic, Flat)
+1 -14
View File
@@ -10,25 +10,12 @@ import Data.Aeson
import Data.Aeson.TH
import Geometry.Data
data Targeting
= NoTargeting
| Targeting
{ _tgPos :: Maybe Point2
, _tgType :: TargetType --Item -> Creature -> World -> Targeting -> (World, Targeting)
-- , _tgDraw :: TargetDraw --Item -> Creature -> Configuration -> World -> Picture
, _tgID :: Maybe Int
, _tgActive :: Bool
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data TargetType
= TargetLaser
| TargetRBPress
| TargetRBLine
| TargetRBCreature
| TargetCursor
deriving (Eq, Ord, Show, Read) --Generic, Flat)
deriving (Eq, Ord, Show, Read, Enum, Bounded) --Generic, Flat)
makeLenses ''Targeting
deriveJSON defaultOptions ''TargetType
deriveJSON defaultOptions ''Targeting
+2 -2
View File
@@ -34,7 +34,7 @@ data ItemUse
, _heldAim :: AimParams
, _heldScroll :: HeldScroll
, _heldConsumption :: HeldConsumption
, _heldTargeting :: Targeting
, _useTargeting :: Maybe TargetType
}
| LeftUse
{ _leftUse :: Luse
@@ -49,7 +49,7 @@ data ItemUse
}
| EquipUse
{ _equipEffect :: EquipEffect
, _equipTargeting :: Targeting
, _useTargeting :: Maybe TargetType
}
| CraftUse
{_useAmount :: ItAmount}
+1 -1
View File
@@ -24,7 +24,7 @@ data ProjectileCreate = CreateShell | CreateTrackingShell
data ProjectileUpdate
= PJThrust {_pjuStart :: Int, _pjuEnd :: Int}
| PJSpin {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
| PJTrack {_pjuStart :: Int, _pjuEnd :: Int, _pjuITID :: Int}
| PJTrack {_pjuStart :: Int, _pjuEnd :: Int, _pjuCRID :: Int}
| PJReduceSpin {_pjuReduceSpin :: Float}
| PJRemoteDirection {_pjuStart :: Int, _pjuEnd :: Int, _pjuCID :: Int, _pjuITID :: Int}
| PJSetScope {_pjuITID :: Int}