Allow for laser to be attached to transformer to create weapon
This commit is contained in:
@@ -20,13 +20,15 @@ useItem invid pt w = fmap (worldEventFlags . at InventoryChange ?~ ()) $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
itmloc <- allInvLocs (_crInv cr) ^? ix invid . _2
|
||||
useItemLoc cr itmloc pt w
|
||||
-- let usedloc = chooseUseLocation itmloc
|
||||
-- useItemLoc cr usedloc pt w
|
||||
|
||||
useItemLoc :: Creature -> LocationLDT ItemLink OItem -> PressType -> World -> Maybe World
|
||||
useItemLoc cr loc pt w
|
||||
| HeldPlatformSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsRoot
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming{} <- cr ^. crStance . posture =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
| LaserWeaponSF <- sf
|
||||
, fromMaybe False $ loc ^? locLDT . ldtValue . _1 . itLocation . ilIsAttached
|
||||
, Aiming{} <- cr ^. crStance . posture =
|
||||
return $ gadgetEffect pt loc cr w
|
||||
| GadgetPlatformSF <- sf =
|
||||
|
||||
@@ -62,6 +62,7 @@ data ItemStructuralFunction
|
||||
| GrenadeHitEffectSF
|
||||
| ToggleSF
|
||||
| MapperSF
|
||||
| LaserWeaponSF
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
type CItem = (Item, ItemStructuralFunction)
|
||||
|
||||
@@ -56,6 +56,7 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
( getAmmoLinks itm
|
||||
, [(ARHUDSF,SFLink ARHUDSF),(TriggerSF, TriggerLink),(MapperSF,SFLink MapperSF)]
|
||||
)
|
||||
(CRAFT TRANSFORMER, _) -> ([],[(LaserWeaponSF,SFLink LaserWeaponSF)])
|
||||
(MAPPER, _) ->
|
||||
( []
|
||||
, [(ARHUDSF,SFLink ARHUDSF)]
|
||||
@@ -127,7 +128,6 @@ itemToFunction itm = case itm ^. itType of
|
||||
HELD LASER -> WeaponTargetingSF
|
||||
HELD{} -> case itUseCondition itm of
|
||||
UseableWhenAimed -> HeldPlatformSF
|
||||
--Just MustBeHeld -> UnloadedWeaponSF
|
||||
_ -> GadgetPlatformSF
|
||||
_
|
||||
| Just amtype <- magAmmoType itm-- ^? itConsumables . magType
|
||||
@@ -160,6 +160,7 @@ treeToPotentialFunction ldt = case ldt ^. ldtValue . _1 . itType of
|
||||
ATTACH GYROSCOPE -> S.singleton ProjectileStabiliserSF
|
||||
HELD GLAUNCHER -> S.singleton UnderBarrelPlatformSF
|
||||
HELD BURSTRIFLE -> S.singleton UnderBarrelPlatformSF
|
||||
HELD LASER -> S.fromList [WeaponTargetingSF,LaserWeaponSF]
|
||||
_ -> S.singleton (ldt ^. ldtValue . _2)
|
||||
|
||||
baseCI :: Item -> CItem
|
||||
@@ -215,13 +216,6 @@ joinItemsInList f = fst . h . ([],)
|
||||
h ( z : zs, y : ys) = case f y z of
|
||||
Nothing -> h ( y : z : zs,ys)
|
||||
Just w -> h ( zs,w : ys)
|
||||
--joinItemsInList f xs = snd $ h (xs, [])
|
||||
-- where
|
||||
-- h ([], zs) = ([], zs)
|
||||
-- h (y : ys, []) = h (ys, [y])
|
||||
-- h (y : ys, z : zs) = case f y z of
|
||||
-- Nothing -> h (ys, y : z : zs)
|
||||
-- Just w -> h (w : ys, zs)
|
||||
|
||||
-- this puts the first elements in the intmap at the end of the list
|
||||
invLDT :: IM.IntMap Item -> [LDTree ItemLink CItem]
|
||||
|
||||
@@ -35,6 +35,7 @@ itemInvColor ci = case ci ^. _2 of
|
||||
ProjectileStabiliserSF -> white
|
||||
UnderBarrelPlatformSF -> white
|
||||
UnderBarrelSlotSF -> white
|
||||
LaserWeaponSF -> white
|
||||
|
||||
--ammoTypeColor :: AmmoType -> Color
|
||||
--ammoTypeColor = \case
|
||||
|
||||
Reference in New Issue
Block a user