This commit is contained in:
2024-12-20 17:09:17 +00:00
parent d9aaa8cc05
commit 58635466ae
5 changed files with 34 additions and 69 deletions
-2
View File
@@ -33,8 +33,6 @@ import Dodge.Data.Material
import Geometry.Data
import qualified IntMapHelp as IM
--import MaybeHelp
data Creature = Creature
{ _crPos :: Point2
, _crOldPos :: Point2
+12 -38
View File
@@ -1,13 +1,17 @@
module Dodge.Euse
where
module Dodge.Euse (
createShieldWall,
removeShieldWall,
doItmCrWdWd,
useE,
) where
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Color
--import Control.Monad
import Data.Maybe
import Dodge.Creature.HandPos
import Dodge.Creature.Test
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Dodge.Data.World
import Dodge.Default.Wall
import Dodge.Item.HeldOffset
@@ -22,7 +26,7 @@ import LensHelp
doItmCrWdWd :: ItmCrWdWd -> Item -> Creature -> World -> World
doItmCrWdWd x itm cr = case x of
-- (ECamouflage vis) -> overCID (crCamouflage .~ vis) itm cr
-- (ECamouflage vis) -> overCID (crCamouflage .~ vis) itm cr
EonWristShield -> onEquipWristShield itm cr
EoffWristShield -> onRemoveWristShield itm cr
_ -> id
@@ -38,35 +42,6 @@ useE loc cr = case eo of
itm = loc ^. locLDT . ldtValue . _1
eo = itm ^? itUse . uequipEffect . eeUse
tryAttachBulletBelt :: Item -> Creature -> World -> World
tryAttachBulletBelt _ _ w = w
tryChargeBattery :: Item -> Creature -> World -> World
tryChargeBattery _ _ w = w
trySiphonFuel :: Item -> Creature -> World -> World
trySiphonFuel _ _ = id
--trySiphonFuel itm cr w = fromMaybe w $ do
-- eix <- itm ^? itLocation . ipInvID
-- hix <- cr ^? crManipulation . manObject . inInventory . ispItem
-- guard (cr ^? crManipulation . manObject . inInventory . iselAction == Just NoInvSelAction)
-- la <- cr ^? crInv . ix hix . itUse . heldConsumption
-- atype <- la ^? laAmmoType
-- guard (isGas atype)
-- amax <- la ^? laSource . _InternalSource . iaMax
-- acur <- la ^? laSource . _InternalSource . iaLoaded
-- guard (amax > acur)
-- return $
-- w & cWorld . lWorld . creatures . ix (_crID cr) . crInv
-- %~ ( (ix hix . itUse . heldConsumption . laSource . _InternalSource . iaLoaded +~ 1)
-- . (ix eix . itUse . equipEffect . eeUse . euseFuelAmount -~ 1)
-- )
isGas :: AmmoType -> Bool
isGas a = case a of
GasAmmo{} -> True
_ -> False
useMagShield :: Item -> Creature -> World -> World
useMagShield it cr w = w & cWorld . lWorld . magnets . at mgid ?~ themagnet
where
@@ -159,9 +134,10 @@ removeShieldWall it _ w = case it ^? itParams . flatShieldWlMIX . _Just of
createHeadLamp :: Item -> Creature -> World -> World
createHeadLamp _ cr =
cWorld . lWorld . lights .:~ LSParam
cWorld . lWorld . lights
.:~ LSParam
((_crPos cr `v2z` 0) +.+.+ rotate3 (_crDir cr) (translatePointToHead cr (V3 5 0 3)))
200
200
0.7
-- cWorld . lWorld . tempLightSources
@@ -171,5 +147,3 @@ createHeadLamp _ cr =
-- 0.7
-- ((_crPos cr `v2z` 0) +.+.+ rotate3 (_crDir cr) (translatePointToHead cr (V3 5 0 3)))
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
overCID f _ cr = cWorld . lWorld . creatures . ix (_crID cr) %~ f
+10 -10
View File
@@ -72,19 +72,19 @@ showEquipItem eit = case eit of
itemNumberDisplay :: Creature -> ComposedItem -> [String]
itemNumberDisplay cr ci = case (ci ^. _2, itm ^?! itUse, itm ^. itType) of
(_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
(WeaponTargetingSF,_,_)
_ | EQUIP WRIST_ECG <- itm ^. itType
-> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
-- (_,_,EQUIP WRIST_ECG) -> [displayPulse $ cr ^?! crType . avatarPulse . pulseProgress]
-- (WeaponTargetingSF,_,_)
_ | WeaponTargetingSF <- ci ^. _2
-> [maybe "" (const "!TARG!") (itm ^? itTargeting . itTgPos . _Just)]
_ | hasammo -> [maybe "" shortShow
$ itm ^? itConsumables . magLoadStatus . iaLoaded]
(_,UseHeld{},_) -> []
-- (_,UseHotkey{_leftConsumption=lc},_) -> [showAutoRechargeProgress lc]
(_,UseEquip{},_) -> mempty
(_,UseNothing,_) -> []
(_,UseAttach (APInt i),_) -> [show i]
(_,UseAttach {},_) -> []
(_,UseScope OpticScope {_opticZoom = x},_) -> [shortShow x]
(_,UseBulletMod {},_) -> mempty
--(_,UseAttach (APInt i),_) -> [show i]
_ | UseAttach (APInt i) <- itm ^. itUse -> [show i]
_ | UseScope OpticScope {_opticZoom = x} <- itm ^. itUse -> [shortShow x]
-- (_,UseScope OpticScope {_opticZoom = x},_) -> [shortShow x]
(_,_,_) -> mempty
where
itm = ci ^. _1
hasammo = isJust $ itm ^? itConsumables . magLoadStatus . iaLoaded
+1 -3
View File
@@ -29,9 +29,7 @@ torch =
& itUse . heldAim . aimMuzzles . ix 0 . mzPos . _x .~ 10
& itAmmoSlots .~ singleAmmo ElectricalAmmo
{- |
Sends out pulses that display walls.
-}
{- | Sends out pulses that display walls. -}
detector :: Detector -> Item
detector dt =
defaultHeldItem
+11 -16
View File
@@ -3704,14 +3704,14 @@ createBarrelSpark src/Dodge/Spark.hs 44;" f
createFlIt src/Dodge/Placement/PlaceSpot.hs 180;" f
createForceField src/Dodge/ForceField.hs 7;" f
createGas src/Dodge/Gas.hs 8;" f
createHeadLamp src/Dodge/Euse.hs 160;" f
createHeadLamp src/Dodge/Euse.hs 135;" f
createItemYou src/Dodge/Inventory/Add.hs 95;" f
createLightMap src/Render.hs 26;" f
createNewArc src/Dodge/Tesla/Arc.hs 76;" f
createPathGrid src/Dodge/Room/Path.hs 21;" f
createProjectile src/Dodge/HeldUse.hs 560;" f
createShell src/Dodge/Projectile/Create.hs 19;" f
createShieldWall src/Dodge/Euse.hs 135;" f
createShieldWall src/Dodge/Euse.hs 110;" f
createUnusedLinkPos src/Dodge/Tree/Shift.hs 117;" f
createWall src/Dodge/Wall/Create.hs 8;" f
creatureDisplayText src/Dodge/Creature/Picture/Awareness.hs 10;" f
@@ -3974,7 +3974,7 @@ doIntImp src/Dodge/CreatureEffect.hs 24;" f
doInvEffect src/Dodge/ItEffect.hs 10;" f
doItCrWdWd src/Dodge/WorldEffect.hs 44;" f
doItemTimeScroll src/Dodge/Update.hs 201;" f
doItmCrWdWd src/Dodge/Euse.hs 23;" f
doItmCrWdWd src/Dodge/Euse.hs 27;" f
doLoop src/Loop.hs 60;" f
doMCrAc src/Dodge/CreatureEffect.hs 57;" f
doMP2Ac src/Dodge/CreatureEffect.hs 73;" f
@@ -4564,7 +4564,6 @@ isCognizant src/Dodge/Creature/Perception.hs 105;" f
isConnected src/Dodge/Inventory/Swap.hs 95;" f
isElectrical src/Dodge/Data/Damage.hs 42;" f
isFrictionless src/Dodge/Creature/State.hs 448;" f
isGas src/Dodge/Euse.hs 65;" f
isGroupSelectableSection src/Dodge/Update/Input/InGame.hs 169;" f
isInLnk src/Dodge/PlacementSpot.hs 160;" f
isJust' src/MaybeHelp.hs 29;" f
@@ -4997,8 +4996,8 @@ numTraversable src/TreeHelp.hs 183;" f
obstacleColor src/Dodge/Debug/Picture.hs 227;" f
obstructPathsCrossing src/Dodge/Path.hs 138;" f
oldMachineBootS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 516;" f
onEquipWristShield src/Dodge/Euse.hs 84;" f
onRemoveWristShield src/Dodge/Euse.hs 93;" f
onEquipWristShield src/Dodge/Euse.hs 59;" f
onRemoveWristShield src/Dodge/Euse.hs 68;" f
onXY src/Geometry/Vector3D.hs 130;" f
oneH src/Dodge/Creature/Test.hs 95;" f
openCursorAt src/Dodge/Render/HUD/Carte.hs 54;" f
@@ -5025,7 +5024,6 @@ orthogonalPointOnSeg src/Geometry/Intersect.hs 291;" f
outLink src/Dodge/RoomLink.hs 105;" f
outsideScreenPolygon src/Dodge/Debug/Picture.hs 44;" f
outwardIntegers src/Dodge/Base.hs 159;" f
overCID src/Dodge/Euse.hs 174;" f
overCol src/Picture/Base.hs 308;" f
overColObj src/Shape.hs 271;" f
overColSH src/Shape.hs 239;" f
@@ -5353,7 +5351,7 @@ removeAmmoFromMag src/Dodge/HeldUse.hs 373;" f
removeDot src/ShortShow.hs 30;" f
removeHotkey src/Dodge/Hotkey.hs 40;" f
removeInverseWalls src/Dodge/LevelGen/StaticWalls.hs 25;" f
removeShieldWall src/Dodge/Euse.hs 153;" f
removeShieldWall src/Dodge/Euse.hs 128;" f
removeWallsInPolygon src/Dodge/LevelGen/StaticWalls.hs 182;" f
renderDataResizeUpdate src/Preload/Update.hs 26;" f
renderFlatLighting src/Render.hs 104;" f
@@ -5571,7 +5569,7 @@ setViewDistance src/Dodge/Update/Camera.hs 227;" f
setViewPos src/Dodge/Creature/ReaderUpdate.hs 61;" f
setViewport src/Dodge/Render.hs 388;" f
setVol src/Dodge/Config/Update.hs 30;" f
setWristShieldPos src/Dodge/Euse.hs 101;" f
setWristShieldPos src/Dodge/Euse.hs 76;" f
setupConLoop src/Loop.hs 102;" f
setupConLoop' src/Loop.hs 192;" f
setupEBO src/Shader/Compile.hs 188;" f
@@ -5603,7 +5601,7 @@ shellCollisionEffect src/Dodge/Projectile/Update.hs 48;" f
shellMag src/Dodge/Item/Ammo.hs 61;" f
shellShape src/Dodge/Projectile/Draw.hs 27;" f
shellTrailCloud src/Dodge/WorldEvent/Cloud.hs 65;" f
shieldWall src/Dodge/Euse.hs 115;" f
shieldWall src/Dodge/Euse.hs 90;" f
shiftByV2 src/Dodge/PlacementSpot.hs 239;" f
shiftChildren src/Dodge/Tree/Compose.hs 43;" f
shiftDraw src/Dodge/Render/ShapePicture.hs 67;" f
@@ -5900,7 +5898,7 @@ toV3 src/Geometry/Data.hs 38;" f
toV4 src/Geometry/Data.hs 40;" f
toggleCombineInv src/Dodge/DisplayInventory.hs 35;" f
toggleCommand src/Dodge/Terminal.hs 196;" f
toggleEquipmentAt src/Dodge/Creature/Impulse/UseItem.hs 48;" f
toggleEquipmentAt src/Dodge/Creature/Impulse/UseItem.hs 49;" f
toggleJust src/MaybeHelp.hs 41;" f
toggleMap src/Dodge/Update/Input/InGame.hs 547;" f
toggleTweakInv src/Dodge/Update/Input/InGame.hs 560;" f
@@ -5972,9 +5970,7 @@ truncFaces src/Polyhedra/Geodesic.hs 53;" f
truncate src/Polyhedra/Geodesic.hs 38;" f
trunkDepth src/TreeHelp.hs 161;" f
tryAssignHotkey src/Dodge/Creature/YourControl.hs 94;" f
tryAttachBulletBelt src/Dodge/Euse.hs 41;" f
tryAttachItems src/Dodge/Item/Grammar.hs 21;" f
tryChargeBattery src/Dodge/Euse.hs 44;" f
tryCombine src/Dodge/Update/Input/InGame.hs 569;" f
tryDropSelected src/Dodge/Update/Input/InGame.hs 114;" f
tryGetChannel src/Sound.hs 96;" f
@@ -5987,7 +5983,6 @@ tryPutFloorItemIDInInv src/Dodge/Inventory/Add.hs 26;" f
tryPutItemInInv src/Dodge/Inventory/Add.hs 42;" f
tryPutItemInInvAt src/Dodge/Inventory/Add.hs 32;" f
trySeedFromClipboard src/Dodge/Menu.hs 88;" f
trySiphonFuel src/Dodge/Euse.hs 47;" f
trySpinByCID src/Dodge/Projectile/Update.hs 95;" f
trySynthBullet src/Dodge/Creature/State.hs 194;" f
tryUseParent src/Dodge/Creature/State.hs 187;" f
@@ -6158,12 +6153,12 @@ useBreakListsLinkTest src/Dodge/Item/Grammar.hs 35;" f
useBulletPayload src/Dodge/Bullet.hs 96;" f
useC src/Dodge/Cuse.hs 8;" f
useC' src/Dodge/Cuse.hs 13;" f
useE src/Dodge/Euse.hs 30;" f
useE src/Dodge/Euse.hs 34;" f
useGasParams src/Dodge/HeldUse.hs 476;" f
useHotkey src/Dodge/Creature/YourControl.hs 54;" f
useLnkRoomPos src/Dodge/PlacementSpot.hs 244;" f
useLoadedAmmo src/Dodge/HeldUse.hs 266;" f
useMagShield src/Dodge/Euse.hs 70;" f
useMagShield src/Dodge/Euse.hs 45;" f
useNormalCamera src/Dodge/Camera.hs 6;" f
usePayload src/Dodge/Payload.hs 7;" f
useRewindGun src/Dodge/HeldUse.hs 621;" f