Commit before using item structural function more prominently

This commit is contained in:
2024-10-05 16:38:14 +01:00
parent 164beeea6d
commit 7c324a03f6
5 changed files with 38 additions and 63 deletions
+1 -5
View File
@@ -1,5 +1 @@
/home/justin/Haskell/loop/src/Dodge/Render/ShapePicture.hs:78:1-12: warning: [-Wunused-top-binds]
Defined but not used: anyTargeting
|
78 | anyTargeting w = fromMaybe mempty $ do
| ^^^^^^^^^^^^
All good (598 modules, at 16:31:13)
+2 -1
View File
@@ -236,7 +236,8 @@ inventoryX c = case c of
'U' ->
[targetingScope tt | tt <- [minBound .. maxBound]]
<>
[ launcher
[ battery
, launcher
, megaShellMag
, homingModule
, remoteScreen
+7 -12
View File
@@ -161,9 +161,7 @@ equipmentEffects cr = alaf Endo foldMap (useEquipment cr) (IM.keys $ _crInvEquip
invSideEff :: Creature -> World -> World
invSideEff cr = alaf Endo foldMap f (_crInv cr) . updateHeldRootItem cr
where
f it =
itemInvSideEffect cr it
. maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
f it = maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
updateHeldRootItem :: Creature -> World -> World
updateHeldRootItem cr = fromMaybe id $ do
@@ -200,7 +198,8 @@ updateItemWithOrientation ::
World
updateItemWithOrientation cr m loc@(LocLDT _ itmtree) = case _itType itm of
HELD TORCH -> shineTorch cr itmtree m
TARGETING TARGETLASER -> makeTargetLaser cr itmtree m
TARGETING TARGETLASER -> shineTargetLaser cr itmtree m
TARGETING tt -> updateItemTargeting tt cr itm
ATTACH AUGMENTEDHUD -> drawAugmentedHUD loc
_ -> id
where
@@ -211,16 +210,17 @@ drawAugmentedHUD (LocLDT con _) w = fromMaybe w $ do
itm <- con ^? cldtParent
return $ w & cWorld . lWorld . flares <>~ drawTargeting itm w
makeTargetLaser :: Creature -> LabelDoubleTree ItemLink Item -> (Point3, Q.Quaternion Float)
shineTargetLaser :: Creature -> LabelDoubleTree ItemLink Item -> (Point3, Q.Quaternion Float)
-> World -> World
makeTargetLaser cr itmtree (p,q) w = fromMaybe (w & pointItUse . tgPos .~ Nothing) $ do
shineTargetLaser cr itmtree (p,q) w = fromMaybe (w & pointItUse . tgPos .~ Nothing) $ do
guard (crIsAiming cr)
(_, mag) <- find (isammolink . _iatType . fst) (itmtree ^. ldtLeft)
i <- mag ^? ldtValue . itUse . amagLoadStatus . iaLoaded
guard $ i >= x
maginvid <- mag ^? ldtValue . itLocation . ilInvID
return $ w
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix maginvid . itUse . amagLoadStatus . iaLoaded -~ x
& cWorld . lWorld . creatures . ix (_crID cr)
. crInv . ix maginvid . itUse . amagLoadStatus . iaLoaded -~ x
& cWorld . lWorld . lasers .:~ LaserStart
{ _lpPhaseV = 1
, _lpDir = _crDir cr + argV (Q.qToV2 q)
@@ -258,11 +258,6 @@ shineTorch cr itmtree (p, q) = fromMaybe id $ do
cdir = _crDir cr
d = _crDir cr + argV (Q.qToV2 q)
itemInvSideEffect :: Creature -> Item -> World -> World
itemInvSideEffect cr itm = case _itType itm of
TARGETING tt -> updateItemTargeting tt cr itm
_ -> id
-- this probably needs to be set to null when dropped as well?
-- does this need to be updated if it is not attached to the used root item?
updateItemTargeting :: TargetingType -> Creature -> Item -> World -> World
-17
View File
@@ -3,10 +3,6 @@ module Dodge.Render.ShapePicture (
) where
import Data.Strict.Tuple
import Control.Applicative
import Dodge.Data.DoubleTree
import Dodge.Data.ComposedItem
import Dodge.Item.Grammar
import NewInt
import Dodge.Render.List
import Control.Lens
@@ -39,7 +35,6 @@ worldSPic cfig u =
<> foldup btSPic (filtOn _btPos _buttons)
<> foldup mcSPic (filtOn _mcPos _machines)
<> aimDelaySweep w
-- <> anyTargeting w
where
w = _uvWorld u
foldup = foldMap'
@@ -72,18 +67,6 @@ drawSweep cr w = fromMaybe mempty $ do
theinput = w ^. input
mwp = mouseWorldPos theinput campos
-- assume for now that targeting is above the root,
-- and the augmented hud is above that
anyTargeting :: World -> SPic
anyTargeting w = fromMaybe mempty $ do
cr <- w ^? cWorld . lWorld . creatures . ix 0
itinvid <- cr ^? crManipulation . manObject . imRootItem
itmtree <- invTrees (_crInv cr) ^? ix itinvid
ttree <- lookup WeaponTargetingLink (itmtree ^. ldtRight)
_ <- lookup AugmentedHUDLink (ttree ^. ldtLeft)
<|> lookup AugmentedHUDLink (ttree ^. ldtRight)
return . noShape $ drawTargeting (ttree ^. ldtValue) w
drawCreature :: Creature -> SPic
drawCreature cr = case _crType cr of
Humanoid{} -> basicCrPict cr
+28 -28
View File
@@ -3307,7 +3307,7 @@ adjustIMZone src/Dodge/Base.hs 77;" f
advanceScrollAmount src/Dodge/Update.hs 297;" f
advanceSmoothScroll src/Dodge/SmoothScroll.hs 29;" f
advanceStepCounter src/Dodge/Creature/Impulse/Movement.hs 45;" f
aimDelaySweep src/Dodge/Render/ShapePicture.hs 49;" f
aimDelaySweep src/Dodge/Render/ShapePicture.hs 44;" f
aimStanceInfo src/Dodge/Item/Info.hs 214;" f
aimTurn src/Dodge/Creature/YourControl.hs 143;" f
aimingMuzzleLength src/Dodge/Creature/HandPos.hs 46;" f
@@ -3334,7 +3334,6 @@ angleBetween src/Geometry.hs 145;" f
angleVV src/Geometry/Vector.hs 57;" f
angleVV3 src/Geometry/Vector3D.hs 122;" f
annoToRoomTree src/Dodge/Annotation.hs 17;" f
anyTargeting src/Dodge/Render/ShapePicture.hs 77;" f
anyUnusedSpot src/Dodge/PlacementSpot.hs 66;" f
anythingHitCirc src/Dodge/Base/Collide.hs 242;" f
applyCME src/Dodge/HeldUse.hs 63;" f
@@ -3499,7 +3498,7 @@ branchRectWith src/Dodge/Room/Branch.hs 15;" f
branchWith src/Dodge/Room/Room.hs 69;" f
bright src/Color.hs 120;" f
brightX src/Color.hs 116;" f
btSPic src/Dodge/Render/ShapePicture.hs 174;" f
btSPic src/Dodge/Render/ShapePicture.hs 157;" f
bufferEBO src/Shader/Bind.hs 28;" f
bufferPokedVBO src/Shader/Bind.hs 19;" f
bufferShaderLayers src/Shader/Bind.hs 36;" f
@@ -3735,7 +3734,7 @@ crystalDebris src/Dodge/Block/Debris.hs 176;" f
crystalLine src/Dodge/Placement/Instance/Wall.hs 55;" f
crystalWallDamage src/Dodge/Wall/DamageEffect.hs 79;" f
cubeShape src/Dodge/Block/Debris.hs 196;" f
cullPoint src/Dodge/Render/ShapePicture.hs 124;" f
cullPoint src/Dodge/Render/ShapePicture.hs 107;" f
cullPretty src/AesonHelp.hs 13;" f
curveAroundField src/Dodge/Magnet.hs 18;" f
curveLeftField src/Dodge/Magnet.hs 13;" f
@@ -4041,6 +4040,7 @@ doublePairSet src/Geometry.hs 153;" f
doubleTreeToIndentList src/Dodge/DoubleTree.hs 72;" f
doubleV2 src/Geometry.hs 156;" f
drawAllShadows src/Dodge/Shadows.hs 5;" f
drawAugmentedHUD src/Dodge/Creature/State.hs 209;" f
drawBaseMachine src/Dodge/Machine/Draw.hs 52;" f
drawBeam src/Dodge/Beam/Draw.hs 6;" f
drawBlip src/Dodge/RadarBlip.hs 13;" f
@@ -4056,7 +4056,7 @@ drawCombineInventory src/Dodge/Render/HUD.hs 78;" f
drawConcurrentMessage src/Dodge/Render/Picture.hs 58;" f
drawCorpse src/Dodge/Corpse/Draw.hs 6;" f
drawCrInfo src/Dodge/Debug/Picture.hs 341;" f
drawCreature src/Dodge/Render/ShapePicture.hs 87;" f
drawCreature src/Dodge/Render/ShapePicture.hs 70;" f
drawCreatureDisplayTexts src/Dodge/Debug/Picture.hs 163;" f
drawCross src/Dodge/Render/Label.hs 24;" f
drawCrossCol src/Dodge/Render/Label.hs 21;" f
@@ -4121,7 +4121,7 @@ drawShockwave src/Dodge/Shockwave/Draw.hs 7;" f
drawSpark src/Dodge/Spark/Draw.hs 6;" f
drawStaticBall src/Dodge/EnergyBall/Draw.hs 14;" f
drawSubInventory src/Dodge/Render/HUD.hs 70;" f
drawSweep src/Dodge/Render/ShapePicture.hs 56;" f
drawSweep src/Dodge/Render/ShapePicture.hs 51;" f
drawSwitch src/Dodge/Button/Draw.hs 15;" f
drawSwitchWire src/Dodge/LevelGen/Switch.hs 28;" f
drawTargetLaser src/Dodge/Particle/Draw.hs 6;" f
@@ -4205,7 +4205,7 @@ explosiveBarrel src/Dodge/Creature/Inanimate.hs 29;" f
extTrigLitPos src/Dodge/Placement/Instance/Button.hs 84;" f
extendAway src/Dodge/Placement/Instance/LightSource.hs 196;" f
extendConeToScreenEdge src/Dodge/Debug/Picture.hs 82;" f
extraPics src/Dodge/Render/ShapePicture.hs 129;" f
extraPics src/Dodge/Render/ShapePicture.hs 112;" f
extractRoomPos src/Dodge/RoomPos.hs 6;" f
faceEdges src/Polyhedra.hs 64;" f
facesToVF src/Polyhedra/Geodesic.hs 68;" f
@@ -4265,7 +4265,7 @@ flockPointTargetR src/Dodge/Creature/Boid.hs 266;" f
flockToPointUsing src/Dodge/Creature/Boid.hs 214;" f
flockToPointUsing' src/Dodge/Creature/Boid.hs 227;" f
floorItemPickupInfo src/Dodge/Render/HUD.hs 119;" f
floorItemSPic src/Dodge/Render/ShapePicture.hs 168;" f
floorItemSPic src/Dodge/Render/ShapePicture.hs 151;" f
floorWire src/Dodge/Wire.hs 13;" f
foamSprayFadeOutS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 398;" f
foamSprayLoopS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 394;" f
@@ -4556,7 +4556,7 @@ isAmmoIntLink src/Dodge/HeldUse.hs 203;" f
isAnimate src/Dodge/Creature/Test.hs 138;" f
isCognizant src/Dodge/Creature/Perception.hs 105;" f
isElectrical src/Dodge/Data/Damage.hs 42;" f
isFrictionless src/Dodge/Creature/State.hs 336;" f
isFrictionless src/Dodge/Creature/State.hs 342;" f
isGas src/Dodge/Euse.hs 64;" f
isInLnk src/Dodge/PlacementSpot.hs 160;" f
isJust' src/MaybeHelp.hs 29;" f
@@ -4594,7 +4594,7 @@ itemFromHeldType src/Dodge/Item/Held.hs 25;" f
itemFromLeftType src/Dodge/Item.hs 76;" f
itemInfo src/Dodge/Item/Info.hs 12;" f
itemInvColor src/Dodge/Item/InventoryColor.hs 9;" f
itemInvSideEffect src/Dodge/Creature/State.hs 255;" f
itemInvSideEffect src/Dodge/Creature/State.hs 261;" f
itemNumberDisplay src/Dodge/Item/Display.hs 92;" f
itemRooms src/Dodge/LockAndKey.hs 39;" f
itemRotTreeSPic src/Dodge/Item/Draw/SPic.hs 27;" f
@@ -4603,7 +4603,7 @@ itemString src/Dodge/Item/Display.hs 38;" f
itemToBreakLists src/Dodge/Item/Grammar.hs 41;" f
itemToFunction src/Dodge/Item/Grammar.hs 67;" f
itemTreeSPic src/Dodge/Item/Draw/SPic.hs 22;" f
itemUpdate src/Dodge/Creature/State.hs 308;" f
itemUpdate src/Dodge/Creature/State.hs 314;" f
itemUseEffect src/Dodge/Creature/Impulse/UseItem.hs 34;" f
iterateUntil src/MonadHelp.hs 23;" f
iterateWhile src/MonadHelp.hs 30;" f
@@ -4636,7 +4636,7 @@ lShape src/Dodge/Placement/Instance/LightSource.hs 77;" f
lamp src/Dodge/Creature/Lamp.hs 22;" f
lampCover src/Dodge/Placement/Instance/LightSource/Cover.hs 8;" f
lampCoverWhen src/Dodge/Placement/Instance/LightSource/Cover.hs 19;" f
lampCrSPic src/Dodge/Render/ShapePicture.hs 103;" f
lampCrSPic src/Dodge/Render/ShapePicture.hs 86;" f
lasCenSensEdge src/Dodge/Room/LasTurret.hs 112;" f
lasDronesPic src/Dodge/Item/Weapon/Drone.hs 22;" f
lasGun src/Dodge/Item/Held/BatteryGuns.hs 40;" f
@@ -4802,7 +4802,7 @@ makeStaticBall src/Dodge/WorldEvent/SpawnParticle.hs 22;" f
makeSubmenuOption src/Dodge/Menu/OptionType.hs 19;" f
makeSwitch src/Dodge/LevelGen/Switch.hs 52;" f
makeSwitchSPic src/Dodge/LevelGen/Switch.hs 40;" f
makeTargetLaser src/Dodge/Creature/State.hs 208;" f
makeTargetLaser src/Dodge/Creature/State.hs 214;" f
makeTermLine src/Dodge/Terminal.hs 118;" f
makeTermPara src/Dodge/Terminal.hs 121;" f
makeTeslaArc src/Dodge/Tesla/Arc.hs 57;" f
@@ -4838,7 +4838,7 @@ mcKillTerm src/Dodge/Machine/Destroy.hs 26;" f
mcPlaySound src/Dodge/Machine/Update.hs 80;" f
mcProxTest src/Dodge/Machine/Update.hs 126;" f
mcProximitySensorUpdate src/Dodge/Machine/Update.hs 104;" f
mcSPic src/Dodge/Render/ShapePicture.hs 179;" f
mcSPic src/Dodge/Render/ShapePicture.hs 162;" f
mcSensorTriggerUpdate src/Dodge/Machine/Update.hs 69;" f
mcSensorUpdate src/Dodge/Machine/Update.hs 99;" f
mcShootLaser src/Dodge/HeldUse.hs 462;" f
@@ -5076,7 +5076,7 @@ pesNearCirc src/Dodge/Zoning/Pathing.hs 43;" f
pesNearPoint src/Dodge/Zoning/Pathing.hs 33;" f
pesNearRect src/Dodge/Zoning/Pathing.hs 40;" f
pesNearSeg src/Dodge/Zoning/Pathing.hs 37;" f
picAtCrPos1 src/Dodge/Render/ShapePicture.hs 108;" f
picAtCrPos1 src/Dodge/Render/ShapePicture.hs 91;" f
picFormat src/Polyhedra.hs 22;" f
picMap src/Picture/Base.hs 67;" f
pickUpItem src/Dodge/Inventory/Add.hs 89;" f
@@ -5212,7 +5212,7 @@ powlist src/Multiset.hs 55;" f
powlistUpToN src/Multiset.hs 20;" f
powlistUpToN' src/Multiset.hs 9;" f
powlistUpToN'' src/Multiset.hs 27;" f
ppDraw src/Dodge/Render/ShapePicture.hs 165;" f
ppDraw src/Dodge/Render/ShapePicture.hs 148;" f
ppEvents src/Dodge/Update.hs 558;" f
ppLevelReset src/Dodge/PressPlate.hs 13;" f
preCritStart src/Dodge/Room/Start.hs 92;" f
@@ -5556,7 +5556,7 @@ setOldPos src/Dodge/Update.hs 349;" f
setOutLinks src/Dodge/RoomLink.hs 48;" f
setOutLinksByType src/Dodge/RoomLink.hs 57;" f
setOutLinksPD src/Dodge/RoomLink.hs 77;" f
setRBCreatureTargeting src/Dodge/Creature/State.hs 287;" f
setRBCreatureTargeting src/Dodge/Creature/State.hs 293;" f
setSelectionListRestriction src/Dodge/Update/Input/ScreenLayer.hs 121;" f
setShaderSource src/Shader/Compile.hs 290;" f
setShadowLimits src/Dodge/Shadows.hs 11;" f
@@ -5605,8 +5605,8 @@ shieldWall src/Dodge/Euse.hs 114;" f
shiftByV2 src/Dodge/PlacementSpot.hs 239;" f
shiftChildren src/Dodge/Tree/Compose.hs 43;" f
shiftDec src/Dodge/Placement/PlaceSpot.hs 136;" f
shiftDraw src/Dodge/Render/ShapePicture.hs 112;" f
shiftDraw' src/Dodge/Render/ShapePicture.hs 118;" f
shiftDraw src/Dodge/Render/ShapePicture.hs 95;" f
shiftDraw' src/Dodge/Render/ShapePicture.hs 101;" f
shiftInBy src/Dodge/PlacementSpot.hs 236;" f
shiftLinkBy src/Dodge/Room/Link.hs 87;" f
shiftPSBy src/Dodge/Placement/Shift.hs 12;" f
@@ -5620,7 +5620,7 @@ shiftRoomBy src/Dodge/Room/Link.hs 37;" f
shiftRoomShiftBy src/Dodge/Room/Link.hs 81;" f
shiftRoomShiftToLink src/Dodge/Room/Link.hs 70;" f
shiftedGrid src/Grid.hs 25;" f
shineTorch src/Dodge/Creature/State.hs 237;" f
shineTorch src/Dodge/Creature/State.hs 243;" f
shootBullet src/Dodge/HeldUse.hs 363;" f
shootFirstMiss src/Dodge/Creature/Volition.hs 33;" f
shootL src/Dodge/Item/Weapon/TriggerType.hs 165;" f
@@ -5757,7 +5757,7 @@ ssfold src/FoldableHelp.hs 105;" f
stackPicturesAt src/Dodge/Render/List.hs 81;" f
stackPicturesAtOff src/Dodge/Render/List.hs 84;" f
stackText src/Picture/Base.hs 188;" f
stackedInventory src/Dodge/Creature.hs 280;" f
stackedInventory src/Dodge/Creature.hs 281;" f
startCr src/Dodge/Creature.hs 91;" f
startCrafts src/Dodge/Room/Start.hs 102;" f
startInvList src/Dodge/Creature.hs 109;" f
@@ -5839,8 +5839,8 @@ teslaGunPic src/Dodge/Item/Draw/SPic.hs 348;" f
teslaParams src/Dodge/Tesla/ItemParams.hs 6;" f
testCrossWalls src/Dodge/Room/Path.hs 47;" f
testEvent src/Dodge/Event/Test.hs 10;" f
testInventory src/Dodge/Creature.hs 256;" f
testPic src/Dodge/Render/ShapePicture.hs 162;" f
testInventory src/Dodge/Creature.hs 257;" f
testPic src/Dodge/Render/ShapePicture.hs 145;" f
testStringInit src/Dodge/TestString.hs 22;" f
text src/Picture/Base.hs 193;" f
textGrad src/Picture/Text.hs 5;" f
@@ -6011,7 +6011,7 @@ upProjectile src/Dodge/Projectile/Update.hs 25;" f
updateAllNodes src/TreeHelp.hs 85;" f
updateArc src/Dodge/Tesla/Arc.hs 86;" f
updateAttachedItems src/Dodge/Creature/State.hs 174;" f
updateAutoRecharge src/Dodge/Creature/State.hs 319;" f
updateAutoRecharge src/Dodge/Creature/State.hs 325;" f
updateBackspaceRegex src/Dodge/Update/Input/InGame.hs 159;" f
updateBarrel src/Dodge/Barreloid.hs 45;" f
updateBarreloid src/Dodge/Barreloid.hs 13;" f
@@ -6054,7 +6054,7 @@ updateInstantBullets src/Dodge/Update.hs 530;" f
updateInv src/Dodge/Creature/State.hs 151;" f
updateInventoryPositioning src/Dodge/DisplayInventory.hs 87;" f
updateInventorySectionItems src/Dodge/DisplayInventory.hs 143;" f
updateItemTargeting src/Dodge/Creature/State.hs 262;" f
updateItemTargeting src/Dodge/Creature/State.hs 268;" f
updateItemWithOrientation src/Dodge/Creature/State.hs 195;" f
updateKeyInGame src/Dodge/Update/Input/InGame.hs 102;" f
updateKeysInTerminal src/Dodge/Update/Input/InGame.hs 91;" f
@@ -6066,7 +6066,7 @@ updateLinearShockwave src/Dodge/LinearShockwave/Update.hs 8;" f
updateLongPressInGame src/Dodge/Update/Input/InGame.hs 128;" f
updateMIM src/Dodge/Update.hs 543;" f
updateMachine src/Dodge/Machine/Update.hs 16;" f
updateMovement src/Dodge/Creature/State.hs 326;" f
updateMovement src/Dodge/Creature/State.hs 332;" f
updateObjCatMaybes src/Dodge/Update.hs 405;" f
updateObjMapMaybe src/Dodge/Update.hs 398;" f
updatePastWorlds src/Dodge/Update.hs 303;" f
@@ -6161,7 +6161,7 @@ useStopWatch src/Dodge/Luse.hs 24;" f
useTimeCheck src/Dodge/Item/Weapon/TriggerType.hs 127;" f
useTimeScrollGun src/Dodge/Luse.hs 32;" f
useUnusedLnk src/Dodge/PlacementSpot.hs 169;" f
useUpdate src/Dodge/Creature/State.hs 311;" f
useUpdate src/Dodge/Creature/State.hs 317;" f
usedRoomInLinkPoss src/Dodge/PlacementSpot.hs 196;" f
usedRoomLinkPoss src/Dodge/PlacementSpot.hs 203;" f
v2z src/Geometry/Vector3D.hs 93;" f
@@ -6249,7 +6249,7 @@ wlsNearRect src/Dodge/Zoning/Wall.hs 46;" f
wlsNearSeg src/Dodge/Zoning/Wall.hs 42;" f
wordsBy src/ListHelp.hs 116;" f
worldPosToScreen src/Dodge/Base/Coordinate.hs 28;" f
worldSPic src/Dodge/Render/ShapePicture.hs 29;" f
worldSPic src/Dodge/Render/ShapePicture.hs 25;" f
worldToGenWorld src/Dodge/LevelGen/LevelStructure.hs 14;" f
wpAdd src/Dodge/Room/RezBox.hs 134;" f
wristArmour src/Dodge/Item/Equipment.hs 47;" f