Commit before perhaps rethinking item structure
This commit is contained in:
@@ -43,7 +43,7 @@ data ItemStructuralFunction
|
||||
| JoystickSF
|
||||
| RemoteDetonatorSF
|
||||
| SmokeReducerSF
|
||||
| UncomposableIsolateSF
|
||||
| NoSF
|
||||
| AmmoModifierSF AmmoType
|
||||
| AmmoTargetingSF AmmoType
|
||||
| AmmoPayloadSF AmmoType
|
||||
|
||||
@@ -8,8 +8,7 @@ import Data.Aeson.TH
|
||||
import Dodge.Data.Bullet
|
||||
|
||||
data BulletMod
|
||||
= -- BulletModTrajectory { _bmTrajectory :: BulletTrajectoryType}
|
||||
BulletModPayload {_bmPayload :: BulletPayload}
|
||||
= BulletModPayload {_bmPayload :: BulletPayload}
|
||||
| BulletModEffect {_bmEffect :: BulletEffect}
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ data ItemType
|
||||
| AMMOMAG {_ibtAmmoMag :: AmmoMagType}
|
||||
| TARGETING {_ibtTargeting :: TargetingType}
|
||||
| BULLETMOD {_ibtBulletMod :: BulletMod}
|
||||
| STICKYMOD
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data CraftType
|
||||
|
||||
@@ -24,6 +24,7 @@ itemFromBase = \case
|
||||
AMMOMAG t -> itemFromAmmoMag t
|
||||
TARGETING tt -> targetingScope tt
|
||||
BULLETMOD bm -> bulletModule bm
|
||||
STICKYMOD -> stickyMod
|
||||
|
||||
itemFromAmmoMag :: AmmoMagType -> Item
|
||||
itemFromAmmoMag at = case at of
|
||||
|
||||
@@ -65,6 +65,7 @@ itemBaseName = \case
|
||||
TARGETING tt -> show tt
|
||||
BULLETMOD (BulletModPayload btt) -> show btt
|
||||
BULLETMOD (BulletModEffect btt) -> show btt
|
||||
STICKYMOD -> "STICKYMOD"
|
||||
|
||||
showAttachItem :: AttachType -> String
|
||||
showAttachItem t = case t of
|
||||
|
||||
@@ -40,6 +40,7 @@ itemSPic it = case it ^. itType of
|
||||
AMMOMAG amt -> ammoMagSPic it amt
|
||||
TARGETING{} -> defSPic
|
||||
BULLETMOD{} -> defSPic
|
||||
STICKYMOD -> defSPic
|
||||
|
||||
craftItemSPic :: CraftType -> Shape
|
||||
craftItemSPic = \case
|
||||
|
||||
@@ -17,6 +17,7 @@ import Dodge.DoubleTree
|
||||
import Dodge.Item.Orientation
|
||||
import LensHelp
|
||||
import ListHelp
|
||||
import qualified Data.Set as S
|
||||
|
||||
tryAttachItems ::
|
||||
LabelDoubleTree ItemLink ComposedItem ->
|
||||
@@ -108,7 +109,7 @@ itemToFunction itm = case itm ^. itType of
|
||||
| Just amtype <- itm ^? itConsumables . magType
|
||||
, Just _ <- itm ^? itLocation . ilEquipSite . _Just ->
|
||||
AmmoMagSF amtype
|
||||
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itConsumables . magType
|
||||
AMMOMAG{} -> maybe NoSF AmmoMagSF $ itm ^? itConsumables . magType
|
||||
ATTACH REMOTESCREEN -> RemoteScreenSF
|
||||
ATTACH JOYSTICK -> JoystickSF
|
||||
ATTACH REMOTEDETONATOR -> RemoteDetonatorSF
|
||||
@@ -124,7 +125,12 @@ itemToFunction itm = case itm ^. itType of
|
||||
EQUIP WRIST_ECG -> TriggerSF
|
||||
EQUIP{} -> EquipmentPlatformSF
|
||||
ATTACH SHELLPAYLOAD{} -> AmmoPayloadSF LauncherAmmo
|
||||
_ -> UncomposableIsolateSF
|
||||
_ -> NoSF
|
||||
|
||||
structureToPotentialFunction
|
||||
:: LabelDoubleTree ComposedItem ItemLink
|
||||
-> S.Set ItemStructuralFunction
|
||||
structureToPotentialFunction _ = mempty
|
||||
|
||||
baseCI :: Item -> ComposedItem
|
||||
baseCI itm = (itm, itemToFunction itm, itemBaseConnections itm)
|
||||
|
||||
@@ -21,7 +21,7 @@ itemInvColor ci = case ci ^. _2 of
|
||||
JoystickSF -> azure
|
||||
RemoteDetonatorSF -> azure
|
||||
SmokeReducerSF -> azure
|
||||
UncomposableIsolateSF -> greyN 0.5
|
||||
NoSF -> greyN 0.5
|
||||
AmmoModifierSF{} -> orange
|
||||
AmmoTargetingSF{} -> green
|
||||
AmmoPayloadSF{} -> violet
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
module Dodge.Item.Scope (
|
||||
stickyMod,
|
||||
shellModule,
|
||||
zoomScope,
|
||||
targetingScope,
|
||||
@@ -36,6 +37,13 @@ targetingScope tt = defaultHeldItem
|
||||
homingModule :: Item
|
||||
homingModule = makeAttach HOMINGMODULE
|
||||
|
||||
stickyMod :: Item
|
||||
stickyMod =
|
||||
defaultHeldItem
|
||||
& itType .~ STICKYMOD
|
||||
& itUse .~ UseNothing
|
||||
|
||||
|
||||
bulletModule :: BulletMod -> Item
|
||||
bulletModule bm =
|
||||
defaultHeldItem
|
||||
|
||||
@@ -94,8 +94,11 @@ shellCollisionCheck pj w
|
||||
time = _pjTimer pj
|
||||
oldPos = _pjPos pj
|
||||
|
||||
-- note this doesn't take into account moving walls, which may break the
|
||||
-- bouncing in some way
|
||||
tryShellBounce :: (Point2, Either Creature Wall) -> Projectile -> World -> World
|
||||
tryShellBounce (p, Right wl) pj w
|
||||
| Just GStick <- pj ^? pjType . gnHitEffect = w
|
||||
| Just x <- pj ^? pjType . gnHitEffect . bounceTolerance =
|
||||
if abs (dotV (pj ^. pjVel) (vNormal hitline)) < x
|
||||
then w & cWorld . lWorld . projectiles . ix (_pjID pj) . pjVel %~ reflectIn
|
||||
|
||||
Reference in New Issue
Block a user