Beamsplitter attachment for lasers

This commit is contained in:
2026-03-26 15:51:16 +00:00
parent c53e60b956
commit 80ef7ec909
12 changed files with 243 additions and 215 deletions
+5 -3
View File
@@ -209,10 +209,12 @@ inventoryX c = case c of
[ makeTypeCraftNum 2 MICROCHIP
]
"J" ->
[ laser
[ capacitor
, makeTypeCraft TRANSFORMER
, laser
, battery
--, dualBeam
] <> makeTypeCraftNum 10 TRANSFORMER
]
<> makeTypeCraftNum 5 BEAMSPLITTER
"K" ->
[ autoRifle
, tinMag
+1 -1
View File
@@ -50,7 +50,7 @@ useItemLoc cr loc pt w
| otherwise = (\loc' -> useItemLoc cr loc' pt w) =<< locUp' loc
where
aimuse
| LaserWeaponSF <- sf = True
| LaserWeaponXSF {} <- sf = True
| HeldPlatformSF <- sf = True
| PulseBallSF <- sf = True
| PlasmaSF <- sf = True
+3 -1
View File
@@ -37,7 +37,8 @@ data ItemSF -- Structural Function
| GrenadeHitEffectSF
| ToggleSF
| MapperSF
| LaserWeaponSF
-- | LaserWeaponSF
| LaserWeaponXSF {_lasWepXSF :: Int}
| PulseLaserSF
| CapacitorSF
| TransformerSF
@@ -45,6 +46,7 @@ data ItemSF -- Structural Function
| PlasmaSF
| TorchSF
| PumpSF
| BeamSplitterSF
deriving (Eq, Ord, Show, Read)
type CItem = (Item, ItemSF)
+1
View File
@@ -62,6 +62,7 @@ data CraftType
| PUMP
| MOTOR
| TRANSFORMER
| BEAMSPLITTER
| PRISM
| LIGHTER
| MAGNET
+15 -6
View File
@@ -175,12 +175,21 @@ itemMuzzles loc = case itm ^. itType of
DETECTOR{} ->
dbwMuzzles & ix 0 . mzEffect .~ MuzzleDetector
& ix 0 . mzAmmoSlot . aps .~ UseExactly 100
LASER ->
dbwMuzzles
& ix 0 . mzPos .~ V2 6 0
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzFlareType .~ LasGunFlare
& ix 0 . mzEffect .~ MuzzleLaser
LASER -> case loc ^? locDT . dtValue . _2 . lasWepXSF of
Nothing ->
dbwMuzzles
& ix 0 . mzPos .~ V2 6 0
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzFlareType .~ LasGunFlare
& ix 0 . mzEffect .~ MuzzleLaser
Just i -> join
[dbwMuzzles
& ix 0 . mzPos .~ V2 6 x
& ix 0 . mzInaccuracy .~ 0
& ix 0 . mzFlareType .~ LasGunFlare
& ix 0 . mzEffect .~ MuzzleLaser
| x <- spreadAroundCenter i 3
]
_ -> []
where
itm = loc ^. locDT . dtValue . _1
+4 -1
View File
@@ -13,7 +13,10 @@ itemAimStance dt
| otherwise = itemBaseStance $ dt ^. dtValue . _1
where
islasweapon = dt ^. dtValue . _1 . itType == CRAFT TRANSFORMER
&& dt ^? dtRight . ix 0 . dtValue . _2 == Just LaserWeaponSF
&& islas (dt ^? dtRight . ix 0 . dtValue . _2) -- == Just LaserWeaponSF
islas = \case
Just (LaserWeaponXSF {}) -> True
_ -> False
itemBaseStance :: Item -> AimStance
itemBaseStance itm = case itm ^. itType of
+1
View File
@@ -42,6 +42,7 @@ craftItemSPic = \case
PIPE -> colorSH green $ xCylinderST 3 10
TUBE -> colorSH cyan $ xCylinderST 5 20
HARDWARE -> colorSH orange $ upperPrismPolyST 3 $ square 4
BEAMSPLITTER -> colorSH orange $ upperPrismPolyST 3 $ square 4
SPRING -> colorSH green $ xCylinderST 1 5
HOSE -> colorSH green $ xCylinderST 1 10
TAPE ->
+8 -4
View File
@@ -53,7 +53,8 @@ itemAboveAttachables (itm,sf) = case (itm ^. itType, sf) of
itemBelowAttachables :: CItem -> [ItemSF]
itemBelowAttachables (itm,sf) = case (itm ^. itType, sf) of
(LASER, WeaponTargetingSF) -> getAmmoLinks itm
(LASER, LaserWeaponSF) -> [PulseBallSF] <> getAmmoLinks itm
(LASER, LaserWeaponXSF 1) -> [PulseBallSF,BeamSplitterSF] <> getAmmoLinks itm
(LASER, LaserWeaponXSF {}) -> replicate 5 BeamSplitterSF <> getAmmoLinks itm
-- (LASER, PulseBallSF) -> [PulseBallSF]
--(HELD LASER, _) -> [PulseBallSF]
(HELD LED, _) -> getAmmoLinks itm
@@ -151,10 +152,12 @@ treeToPotentialFunction ldt = case ldt ^. dtValue . _1 . itType of
ATTACH GYROSCOPE -> S.singleton ProjectileStabiliserSF
HELD GLAUNCHER -> S.singleton UnderBarrelPlatformSF
HELD BURSTRIFLE -> S.singleton UnderBarrelPlatformSF
LASER | sf == WeaponTargetingSF -> S.fromList [WeaponTargetingSF,LaserWeaponSF]
LASER | sf == WeaponTargetingSF -> S.fromList (WeaponTargetingSF: [LaserWeaponXSF i| i <- [1..6]])
LASER -> S.fromList [LaserWeaponXSF i| i <- [1..6]]
-- following limits items to ten ammo slots
_ | AmmoMagSF _ x <- ldt ^. dtValue . _2 -> S.fromList [AmmoMagSF i x | i <- [0..9]]
ATTACH CAPACITOR -> S.fromList [CapacitorSF,PulseBallSF]
CRAFT BEAMSPLITTER -> S.singleton BeamSplitterSF
_ -> S.singleton (ldt ^. dtValue . _2)
where
sf = ldt ^. dtValue . _2
@@ -172,7 +175,7 @@ leftIsParentCombine ltree rtree = do
& dtValue %~ f
updateLeftParentSF :: ItemType -> ItemSF -> ItemSF -> ItemSF
updateLeftParentSF LASER WeaponTargetingSF TransformerSF = LaserWeaponSF
updateLeftParentSF LASER WeaponTargetingSF TransformerSF = LaserWeaponXSF 1
updateLeftParentSF _ psf _ = psf
rightIsParentCombine :: DTComb CItem
@@ -183,7 +186,8 @@ rightIsParentCombine ltree rtree = do
& dtValue %~ f
updateRightParentSF :: ItemType -> ItemSF -> ItemSF -> ItemSF
updateRightParentSF LASER LaserWeaponSF CapacitorSF = PulseLaserSF
updateRightParentSF LASER (LaserWeaponXSF 1) CapacitorSF = PulseLaserSF
updateRightParentSF LASER (LaserWeaponXSF x) BeamSplitterSF = LaserWeaponXSF (x+1)
updateRightParentSF _ psf _ = psf
leftChildList :: DTree CItem -> [ItemSF]
+1
View File
@@ -183,6 +183,7 @@ craftInfo fit = case fit of
MOTOR -> "A device that can create rotational force."
TRANSFORMER -> "A device that can step up or down voltage and current."
PRISM -> "An object that refracts light."
BEAMSPLITTER -> "Divides a single light beam into two paths."
THERMOMETER -> "An object that measures temperature."
LIGHTER -> "A device that can create a small flame."
MAGNET -> "A device that attracts according to its dipoles."
+3 -1
View File
@@ -38,7 +38,7 @@ sfInvColor = \case
ProjectileStabiliserSF -> white
UnderBarrelPlatformSF -> white
UnderBarrelSlotSF -> white
LaserWeaponSF -> white
-- LaserWeaponSF -> white
PulseLaserSF -> white
CapacitorSF -> yellow
PulseBallSF -> white
@@ -46,6 +46,8 @@ sfInvColor = \case
TransformerSF -> yellow
PumpSF -> yellow
TorchSF{} -> green
LaserWeaponXSF {} -> white
BeamSplitterSF {} -> white
--ammoTypeColor :: AmmoType -> Color
--ammoTypeColor = \case
+1 -1
View File
@@ -80,7 +80,7 @@ itemShapeMin g = f . (^. _1) . itemSPic
orientAttachment :: Item -> CItem -> Point3Q
orientAttachment par (ch,chsf) = case (_itType par, chsf) of
(ATTACH UNDERBARRELSLOT, _) -> (V3 (-5) (-8) 0, Q.qID)
(_,LaserWeaponSF) -> (V3 2 8 0, Q.qID)
(_,LaserWeaponXSF {}) -> (V3 2 8 0, Q.qID)
-- (_,TorchSF) -> (V3 2 8 0, Q.qID)
-- (HELD BURSTRIFLE, _, HELD TORCH) -> (V3 20 0 0, Q.axisAngle (V3 0 0 1) (pi/2))
-- (HELD LAUNCHER, _, HELD TORCH) -> (V3 0 20 0, Q.axisAngle (V3 0 0 1) (pi/4))