Move targeting strings, broke targeting usage
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Creature.State (
|
||||
doDamage,
|
||||
) where
|
||||
|
||||
import Dodge.Item.Display -- this should not really be imported... TODO move canAttachTargetingBelow
|
||||
import Control.Applicative
|
||||
import Data.Foldable
|
||||
import Data.Maybe
|
||||
@@ -275,7 +276,9 @@ crGetTargeting cr = do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
itm <- cr ^? crInv . ix i
|
||||
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)
|
||||
|
||||
@@ -190,7 +190,7 @@ data ItemModuleType
|
||||
| MAGNETMAG
|
||||
| BULPAY BulletSpawn
|
||||
| BULBODY BulletEffect
|
||||
| BULTRAJ BulletTrajectoryType
|
||||
| BULTRAJ {_imtBulletTrajectoryType :: BulletTrajectoryType}
|
||||
| TARGET {_imtTargetType :: TargetType}
|
||||
| INCENDLAS
|
||||
| SPLITLAS
|
||||
|
||||
@@ -20,17 +20,16 @@ invSelectionItem cr i it =
|
||||
, _siIsSelectable = True
|
||||
, _siColor = col
|
||||
, _siOffX = 0
|
||||
, _siOffY = 0
|
||||
, _siOffY = yoff
|
||||
, _siPayload = ()
|
||||
}
|
||||
where
|
||||
anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
|
||||
anyequippos = maybe [] (rightPad 8 ' ' . (' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
|
||||
col = _itInvColor it
|
||||
pics = case _itCurseStatus it of
|
||||
UndroppableIdentified -> itemDisplay cr it
|
||||
-- _ | cr ^? crManipulation . manObject . inInventory . ispItem == Just i -> selectedItemDisplay cr it
|
||||
_ -> itemDisplay cr it
|
||||
(yoff,pics) = case _itCurseStatus it of
|
||||
UndroppableIdentified -> itemDisplayOffset cr it
|
||||
_ -> itemDisplayOffset cr it
|
||||
|
||||
hotkeyToString :: Hotkey -> String
|
||||
hotkeyToString x = case x of
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
module Dodge.Item.Display (
|
||||
itemDisplay,
|
||||
--itemDisplay,
|
||||
itemDisplayOffset,
|
||||
canAttachTargetingBelow,
|
||||
-- selectedItemDisplay,
|
||||
itemString,
|
||||
itemBaseName,
|
||||
@@ -16,6 +18,36 @@ import Dodge.Module
|
||||
import LensHelp
|
||||
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 cr itm = --itemDisplayWithNumber (showConsumption cr it) it
|
||||
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
|
||||
Nothing -> show hit
|
||||
LEFT lit -> show lit
|
||||
EQUIP eit -> show eit
|
||||
EQUIP eit -> showEquipItem eit
|
||||
Consumable cit -> show cit
|
||||
|
||||
showEquipItem :: EquipItemType -> String
|
||||
showEquipItem eit = case eit of
|
||||
TARGETINGHAT _ -> "TARG.HAT"
|
||||
_ -> show eit
|
||||
|
||||
showAutoRechargeProgress :: LeftConsumption -> String
|
||||
showAutoRechargeProgress lc = case lc of
|
||||
AutoRecharging{}
|
||||
|
||||
Reference in New Issue
Block a user