Move targeting strings, broke targeting usage
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Creature.State (
|
|||||||
doDamage,
|
doDamage,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Item.Display -- this should not really be imported... TODO move canAttachTargetingBelow
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
@@ -275,7 +276,9 @@ crGetTargeting cr = do
|
|||||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||||
itm <- cr ^? crInv . ix i
|
itm <- cr ^? crInv . ix i
|
||||||
itm ^? itType . iyModules . ix ModTarget . imtTargetType
|
itm ^? itType . iyModules . ix ModTarget . imtTargetType
|
||||||
<|> cr ^? crInv . ix (i+1) . itUse . equipTargeting . _Just
|
<|> (guard (canAttachTargetingBelow itm)
|
||||||
|
>> cr ^? crInv . ix (i+1) . itUse . equipTargeting . _Just)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- itm <- find hastargeting $ helditem ++ IM.elems (getCrEquipment cr)
|
-- itm <- find hastargeting $ helditem ++ IM.elems (getCrEquipment cr)
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ data ItemModuleType
|
|||||||
| MAGNETMAG
|
| MAGNETMAG
|
||||||
| BULPAY BulletSpawn
|
| BULPAY BulletSpawn
|
||||||
| BULBODY BulletEffect
|
| BULBODY BulletEffect
|
||||||
| BULTRAJ BulletTrajectoryType
|
| BULTRAJ {_imtBulletTrajectoryType :: BulletTrajectoryType}
|
||||||
| TARGET {_imtTargetType :: TargetType}
|
| TARGET {_imtTargetType :: TargetType}
|
||||||
| INCENDLAS
|
| INCENDLAS
|
||||||
| SPLITLAS
|
| SPLITLAS
|
||||||
|
|||||||
@@ -20,17 +20,16 @@ invSelectionItem cr i it =
|
|||||||
, _siIsSelectable = True
|
, _siIsSelectable = True
|
||||||
, _siColor = col
|
, _siColor = col
|
||||||
, _siOffX = 0
|
, _siOffX = 0
|
||||||
, _siOffY = 0
|
, _siOffY = yoff
|
||||||
, _siPayload = ()
|
, _siPayload = ()
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
|
anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
|
||||||
anyequippos = maybe [] (rightPad 8 ' ' . (' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
|
anyequippos = maybe [] (rightPad 8 ' ' . (' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
|
||||||
col = _itInvColor it
|
col = _itInvColor it
|
||||||
pics = case _itCurseStatus it of
|
(yoff,pics) = case _itCurseStatus it of
|
||||||
UndroppableIdentified -> itemDisplay cr it
|
UndroppableIdentified -> itemDisplayOffset cr it
|
||||||
-- _ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it
|
_ -> itemDisplayOffset cr it
|
||||||
_ -> itemDisplay cr it
|
|
||||||
|
|
||||||
hotkeyToString :: Hotkey -> String
|
hotkeyToString :: Hotkey -> String
|
||||||
hotkeyToString x = case x of
|
hotkeyToString x = case x of
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
module Dodge.Item.Display (
|
module Dodge.Item.Display (
|
||||||
itemDisplay,
|
--itemDisplay,
|
||||||
|
itemDisplayOffset,
|
||||||
|
canAttachTargetingBelow,
|
||||||
-- selectedItemDisplay,
|
-- selectedItemDisplay,
|
||||||
itemString,
|
itemString,
|
||||||
itemBaseName,
|
itemBaseName,
|
||||||
@@ -16,6 +18,36 @@ import Dodge.Module
|
|||||||
import LensHelp
|
import LensHelp
|
||||||
import Padding
|
import Padding
|
||||||
|
|
||||||
|
itemDisplayOffset :: Creature -> Item -> (Int,[String])
|
||||||
|
itemDisplayOffset cr itm = case itm ^. itType . iyBase of
|
||||||
|
EQUIP (TARGETINGHAT tt) | targetItemCanAttachAbove cr itm
|
||||||
|
-> ((-1), leftPad 15 ' ' (targetingTypeString tt) :
|
||||||
|
(itemDisplay cr itm & ix 0 %~ (\s -> itemDisplayPad s (replicate (length (targetingTypeString tt)) '^') )))
|
||||||
|
EQUIP (TARGETINGHAT tt)
|
||||||
|
-> (0, itemDisplay cr itm & ix 0 %~ (\s -> itemDisplayPad s (targetingTypeString tt)))
|
||||||
|
_ -> (0, itemDisplay cr itm)
|
||||||
|
|
||||||
|
targetItemCanAttachAbove :: Creature -> Item -> Bool
|
||||||
|
targetItemCanAttachAbove cr itm = fromMaybe False $ do
|
||||||
|
i <- itm ^? itLocation . ipInvID
|
||||||
|
itm' <- cr ^? crInv . ix (i - 1)
|
||||||
|
return $ canAttachTargetingBelow itm'
|
||||||
|
|
||||||
|
canAttachTargetingBelow :: Item -> Bool
|
||||||
|
canAttachTargetingBelow itm =
|
||||||
|
isJust (itm ^? itType . iyModules . ix ModBulletTrajectory . imtBulletTrajectoryType)
|
||||||
|
|| Just LAUNCHHOME == (itm ^? itType . iyModules . ix ModLauncherHoming)
|
||||||
|
|
||||||
|
targetingTypeString :: TargetType -> String
|
||||||
|
targetingTypeString tt = case tt of
|
||||||
|
TargetLaser -> "LASER"
|
||||||
|
TargetRBPress -> "POS"
|
||||||
|
TargetRBLine -> ""
|
||||||
|
TargetRBCreature -> "LIFEFORM"
|
||||||
|
TargetCursor -> "CURSOR"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
itemDisplay :: Creature -> Item -> [String]
|
itemDisplay :: Creature -> Item -> [String]
|
||||||
itemDisplay cr itm = --itemDisplayWithNumber (showConsumption cr it) it
|
itemDisplay cr itm = --itemDisplayWithNumber (showConsumption cr it) it
|
||||||
zipWithDefaults id (leftPad 15 ' ') itemDisplayPad (basicItemDisplay itm) (itemNumberDisplay cr itm)
|
zipWithDefaults id (leftPad 15 ' ') itemDisplayPad (basicItemDisplay itm) (itemNumberDisplay cr itm)
|
||||||
@@ -52,9 +84,14 @@ itemBaseName it = case _iyBase $ _itType it of
|
|||||||
Just i -> takeWhile (/= ' ') (show hit) ++ show i
|
Just i -> takeWhile (/= ' ') (show hit) ++ show i
|
||||||
Nothing -> show hit
|
Nothing -> show hit
|
||||||
LEFT lit -> show lit
|
LEFT lit -> show lit
|
||||||
EQUIP eit -> show eit
|
EQUIP eit -> showEquipItem eit
|
||||||
Consumable cit -> show cit
|
Consumable cit -> show cit
|
||||||
|
|
||||||
|
showEquipItem :: EquipItemType -> String
|
||||||
|
showEquipItem eit = case eit of
|
||||||
|
TARGETINGHAT _ -> "TARG.HAT"
|
||||||
|
_ -> show eit
|
||||||
|
|
||||||
showAutoRechargeProgress :: LeftConsumption -> String
|
showAutoRechargeProgress :: LeftConsumption -> String
|
||||||
showAutoRechargeProgress lc = case lc of
|
showAutoRechargeProgress lc = case lc of
|
||||||
AutoRecharging{}
|
AutoRecharging{}
|
||||||
|
|||||||
Reference in New Issue
Block a user