Tweaks concerning item types

This commit is contained in:
2024-12-18 11:39:12 +00:00
parent d0ef2628ce
commit d405747bd5
21 changed files with 98 additions and 69 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ startCr =
& crMvType .~ MvWalking yourDefaultSpeed
& crType . skinUpper .~ lightx4 black
& crType .~ Avatar
(greyN 0.9) (lightx4 green) (greyN 0.3)
(greyN 0.9) (lightx4 green) (greyN 0.3) (PulseStatus 55 0)
-- | Items you start with.
startInvList :: [Item]
+1 -1
View File
@@ -28,7 +28,7 @@ useRootItem crid w = (worldEventFlags . at InventoryChange ?~ ()) . fromMaybe w
itmtree <- invRootTrees (_crInv cr) ^? ix itRef
let itm = itmtree ^. ldtValue . _1
case itmtree ^. ldtValue . _2 of
WeaponPlatformSF ->
HeldPlatformSF ->
return $
heldEffect (bimap _iatType fst3 itmtree) cr w
& pointerToItem itm . itUse . heldHammer .~ HammerDown
+8 -1
View File
@@ -2,6 +2,7 @@ module Dodge.Creature.Update (
updateCreature,
) where
import Control.Lens
import Dodge.Creature.YourControl
import Dodge.Creature.State
import Dodge.Barreloid
@@ -11,8 +12,14 @@ import Dodge.Lampoid
updateCreature :: Creature -> World -> World
updateCreature cr = case _crType cr of
Avatar{} -> crUpdate yourControl cr
Avatar{} -> (cWorld . lWorld . creatures . ix 0 . crType . avatarPulse %~ updatePulse)
. crUpdate yourControl cr
Lampoid{} -> updateLampoid cr
Humanoid{} -> updateHumanoid cr
Barreloid{} -> updateBarreloid cr
NonDrawnCreature -> id
updatePulse :: Pulse -> Pulse
updatePulse PulseStatus {_pulseRate = pr, _pulseProgress = pp}
| pp >= pr = PulseStatus pr 0
| otherwise = PulseStatus pr (pp + 1)
+2 -1
View File
@@ -26,8 +26,9 @@ data ComposeLinkType
deriving (Eq, Ord, Show, Read)
data ItemStructuralFunction
= WeaponPlatformSF
= HeldPlatformSF
| EquipmentPlatformSF
| GadgetPlatformSF
| WeaponScopeSF
| WeaponTargetingSF
| AugmentedHUDSF
+9
View File
@@ -60,11 +60,18 @@ data HumanoidAI
| MultGunAI
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Pulse = PulseStatus
{ _pulseRate :: Int
, _pulseProgress :: Int
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data CreatureType
= Avatar
{ _skinHead :: Color
, _skinUpper :: Color
, _skinLower :: Color
, _avatarPulse :: Pulse
}
| Humanoid
{ _skinHead :: Color
@@ -80,10 +87,12 @@ data CreatureType
data BarrelType = PlainBarrel | ExplosiveBarrel
deriving (Eq, Ord, Show, Read) --Generic, Flat)
makeLenses ''Pulse
makeLenses ''CreatureStatistics
makeLenses ''Vocalization
makeLenses ''CrMvType
makeLenses ''CreatureType
deriveJSON defaultOptions ''Pulse
deriveJSON defaultOptions ''CreatureStatistics
deriveJSON defaultOptions ''Vocalization
deriveJSON defaultOptions ''CrMvType
+2 -2
View File
@@ -114,7 +114,7 @@ data EquipItemType
| BULLETBELTBRACER
| BATTERYPACK
| AUTODETECTOR Detector
| PULSECHECKER
| WRIST_ECG
deriving (Eq, Ord, Show, Read)
data LeftItemType
@@ -160,10 +160,10 @@ data HeldItemType
| POISONSPRAYER
| DRONELAUNCHER
| SHATTERGUN
| HELDDETECTOR Detector
| TORCH
| FLATSHIELD
| KEYCARD Int
| DETECTOR Detector
deriving (Eq, Ord, Show, Read) --Generic, Flat)
data Detector
+1 -1
View File
@@ -237,7 +237,7 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
itemDetectorEffect :: Item -> Creature -> World -> World
itemDetectorEffect itm cr w = fromMaybe w $ do
HELDDETECTOR dt <- itm ^? itType . ibtHeld
DETECTOR dt <- itm ^? itType . ibtHeld
return $ detectorEffect dt itm cr w
walkNozzle :: Int -> Muzzle -> Item -> Creature -> World -> World
+1 -1
View File
@@ -72,7 +72,7 @@ itemFromEquipType et = case et of
BULLETBELTPACK -> bulletBeltPack
BULLETBELTBRACER -> bulletBeltBracer
AUTODETECTOR d -> autoDetector d
PULSECHECKER -> pulseChecker
WRIST_ECG -> pulseChecker
itemFromLeftType :: LeftItemType -> Item
itemFromLeftType lt = case lt of
+18 -12
View File
@@ -94,22 +94,28 @@ showAutoRechargeProgress lc = case lc of
-- ic = (itm ^?! itUse . heldConsumption . laSource)
itemNumberDisplay :: Creature -> ComposedItem -> [String]
itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse) of
(WeaponTargetingSF,_)
itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
(_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
(WeaponTargetingSF,_,_)
-> [maybe "" (const "!TARG!") (itm ^? itTargeting . itTgPos . _Just)]
(_,UseHeld{}) -> []
(_,UseHotkey{_leftConsumption=lc}) -> [showAutoRechargeProgress lc]
(_,UseEquip{}) -> showEquipmentNumber cr itm
(_,UseCraft) -> []
(_,UseConsume {}) -> []
(_,UseAttach (APInt i)) -> [show i]
(_,UseAttach {}) -> []
(_,UseAmmoMag {}) -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
(_,UseScope OpticScope {_opticZoom = x}) -> [shortShow x]
(_,UseBulletMod {}) -> mempty
(_,UseHeld{},_) -> []
(_,UseHotkey{_leftConsumption=lc},_) -> [showAutoRechargeProgress lc]
(_,UseEquip{},_) -> showEquipmentNumber cr itm
(_,UseCraft,_) -> []
(_,UseConsume {},_) -> []
(_,UseAttach (APInt i),_) -> [show i]
(_,UseAttach {},_) -> []
(_,UseAmmoMag {},_) -> [maybe "" shortShow $ itm ^? itUse . amagLoadStatus . iaLoaded]
(_,UseScope OpticScope {_opticZoom = x},_) -> [shortShow x]
(_,UseBulletMod {},_) -> mempty
where
itm = ci ^. _1
displayPulse :: Int -> String
displayPulse x = take 5 $ drop y "----^-----"
where
y = min 5 $ x `div` 3
showEquipmentNumber :: Creature -> Item -> [String]
showEquipmentNumber _ itm = case _eeUse ee of
EFuelSource x _ -> [show x]
+2 -2
View File
@@ -65,7 +65,7 @@ fractionLoadedAmmo rs = fromIntegral (_iaLoaded rs) / fromIntegral (_iaMax rs)
equipItemSPic :: EquipItemType -> Item -> SPic
equipItemSPic et _ = case et of
PULSECHECKER -> defSPic
WRIST_ECG -> defSPic
MAGSHIELD -> defSPic
FLAMESHIELD -> defSPic
FRONTARMOUR -> defSPic
@@ -209,7 +209,7 @@ heldItemSPic ht it = case ht of
POISONSPRAYER -> flamerPic it
DRONELAUNCHER -> defSPic
SHATTERGUN -> shatterGunSPic
HELDDETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
KEYCARD _ -> noShape (setDepth 0 $ translate (-5) (-5) $ rotate (pi / 2.5) keyPic)
torchShape :: Shape
+1 -1
View File
@@ -129,4 +129,4 @@ pulseChecker :: Item
pulseChecker =
defaultEquipment
& itUse . uequipEffect . eeSite .~ GoesOnWrist
& itType .~ EQUIP PULSECHECKER
& itType .~ EQUIP WRIST_ECG
+3 -3
View File
@@ -53,7 +53,7 @@ itemToBreakLists ::
([(ItemStructuralFunction, ComposeLinkType)], [(ItemStructuralFunction, ComposeLinkType)])
itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
(HELD TORCH, _) -> (getAmmoLinks itm, [])
(_, WeaponPlatformSF) ->
(_, HeldPlatformSF) ->
( getAmmoLinks itm
, [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
)
@@ -83,7 +83,7 @@ getAmmoLinks itm =
itemToFunction :: Item -> ItemStructuralFunction
itemToFunction itm = case itm ^. itType of
HELD LASER -> WeaponTargetingSF
HELD{} -> WeaponPlatformSF
HELD{} -> HeldPlatformSF
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itUse . amagType
ATTACH REMOTESCREEN -> RemoteScreenSF
ATTACH BULLETSYNTH -> AmmoModifierSF BulletAmmo
@@ -125,7 +125,7 @@ toLasgunUpdate :: Item -> LinkUpdate
toLasgunUpdate itm =
LUpdate
(ILink FunctionChangeLink orientAttachment)
(\(par, _, _) -> (par, WeaponPlatformSF, uncurry useBreakL $ itemToBreakLists itm WeaponPlatformSF))
(\(par, _, _) -> (par, HeldPlatformSF, uncurry useBreakL $ itemToBreakLists itm HeldPlatformSF))
(\(chi, _, up) -> (chi, FunctionChangeSF, up))
--itemLinkTestLeft :: Item -> PartiallyComposedItem -> Maybe LinkUpdate
+1 -1
View File
@@ -64,5 +64,5 @@ itemFromHeldType ht = case ht of
-- REMOTELAUNCHER -> remoteLauncher
POISONSPRAYER -> poisonSprayer
DRONELAUNCHER -> undefined
HELDDETECTOR d -> clickDetector d
DETECTOR d -> clickDetector d
FLATSHIELD -> flatShield
+1 -1
View File
@@ -38,5 +38,5 @@ clickDetector dt =
& itUse . heldDelay . rateMax .~ 20
& itUse . heldAim . aimRange .~ 1
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1}
& itType .~ HELD (HELDDETECTOR dt)
& itType .~ HELD (DETECTOR dt)
& itUse . heldAim . aimMuzzles . ix 0 . mzEffect .~ MuzzleDetector
+2 -2
View File
@@ -86,7 +86,7 @@ heldInfo hit = case hit of
DRONELAUNCHER -> "A device for launching drones."
SHATTERGUN -> "A seismic device that shatters hard items in its line of fire."
-- FORCEFIELDGUN -> "A device that produces a durable forcefield."
HELDDETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius."
DETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius."
TORCH -> "A stick with a light on the end."
FLATSHIELD -> "A panel of metal that blocks unwanted objects from the front of the user."
KEYCARD i -> "A keycard. It is labelled " ++ show i ++ "."
@@ -119,7 +119,7 @@ equipInfo eit = case eit of
BULLETBELTBRACER -> "A container holding a long belt of bullets."
BATTERYPACK -> "A collection of batteries with a universal adapter."
AUTODETECTOR d -> "A device that detects " ++ detectorInfo d ++ " in an expanding radius. Pulses automatically. "
PULSECHECKER -> "A device that detects heartbeats."
WRIST_ECG -> "A wristworn device that detects the hearts electrical activity."
--targetingInfo :: TargetingType -> String
--targetingInfo tt = case tt of
+2 -1
View File
@@ -10,8 +10,9 @@ import Dodge.Data.ComposedItem
itemInvColor :: ComposedItem -> Color
itemInvColor ci = case ci ^. _2 of
WeaponPlatformSF -> white
HeldPlatformSF -> white
EquipmentPlatformSF -> yellow
GadgetPlatformSF -> blue
WeaponScopeSF -> chartreuse
WeaponTargetingSF -> green
AugmentedHUDSF -> rose
+8 -8
View File
@@ -4,13 +4,13 @@
Extra weapon effects, supplementing explicit use effects.
-}
module Dodge.Item.Weapon.ExtraEffect (
autoSonarEffect,
-- autoSonarEffect,
autoEffect,
autoRadarEffect,
-- autoRadarEffect,
) where
import Dodge.Data.World
import Dodge.RadarSweep
--import Dodge.RadarSweep
import Dodge.SoundLogic
import LensHelp
import Sound.Data
@@ -35,11 +35,11 @@ autoEffect eff t sid itm cr w
. eparamInt
-~ 1
-- | Automatically send out radar pulses that detect walls.
autoRadarEffect :: Item -> Creature -> World -> World
autoRadarEffect = autoEffect (const (aRadarPulse ObWall)) 100 click1S
---- | Automatically send out radar pulses that detect walls.
--autoRadarEffect :: Item -> Creature -> World -> World
--autoRadarEffect = autoEffect (const (aRadarPulse ObWall)) 100 click1S
-- | Automatically send out sonar pulses that detect creatures.
autoSonarEffect :: Item -> Creature -> World -> World
autoSonarEffect = autoEffect (const (aRadarPulse ObCreature)) 50 click1S
--autoSonarEffect :: Item -> Creature -> World -> World
--autoSonarEffect = autoEffect (const (aRadarPulse ObCreature)) 50 click1S
+1 -1
View File
@@ -18,7 +18,7 @@ lockRoomMultiItems =
( blinkAcrossChallenge
, takeOne
[ [LEFT BLINKERUNSAFE, EQUIP $ AUTODETECTOR WALLDETECTOR]
, [LEFT BLINKERUNSAFE, HELD $ HELDDETECTOR WALLDETECTOR]
, [LEFT BLINKERUNSAFE, HELD $ DETECTOR WALLDETECTOR]
]
)
]
+5 -5
View File
@@ -1,9 +1,8 @@
module Dodge.RadarSweep
( aRadarPulse
, updateRadarSweep
) where
module Dodge.RadarSweep (
aRadarPulse,
updateRadarSweep,
) where
import NewInt
import Color
import Data.Maybe
import Dodge.Data.World
@@ -11,6 +10,7 @@ import Dodge.Zoning.Wall
import Geometry
import qualified IntMapHelp as IM
import LensHelp
import NewInt
aRadarPulse :: ObjectType -> Creature -> World -> World
aRadarPulse ob cr =