Implement remote screen for launcher projectiles

This commit is contained in:
2024-09-27 10:39:21 +01:00
parent fb6fcff61c
commit 5f9fb183a9
35 changed files with 238 additions and 170 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ module Dodge.Item.Weapon.Launcher (
import Control.Lens
import Dodge.Data.World
import Dodge.Item.Location
--import Dodge.Item.Location
import Dodge.Payload
explodeRemoteRocket ::
@@ -19,8 +19,8 @@ explodeRemoteRocket itid pjid w =
& cWorld . lWorld . projectiles . ix pjid . prjUpdates .~ [PJRetireRemote itid 30 pjid]
& cWorld . lWorld . projectiles . ix pjid . prjDraw .~ DrawBlankProjectile
-- & itPoint . itUse . heldUse .~ HeldDoNothing
& itPoint . itUse . heldMods .~ DoNothingMod
-- & itPoint . itUse . heldMods .~ DoNothingMod
& usePayload (_prjPayload thepj) (_prjPos thepj)
where
itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid-- _itemLocations (_cWorld w) IM.! itid
-- itPoint = pointerToItemLocation $ w ^?! cWorld . lWorld . itemLocations . ix itid-- _itemLocations (_cWorld w) IM.! itid
thepj = w ^?! cWorld . lWorld . projectiles . ix pjid
+12 -12
View File
@@ -1,16 +1,16 @@
module Dodge.Item.Weapon.Remote (
setRemoteScope,
-- setRemoteScope,
) where
import Control.Lens
import Dodge.Data.World
import Geometry
--import Control.Lens
--import Dodge.Data.World
--import Geometry
setRemoteScope :: Int -> Point2 -> World -> World
setRemoteScope itid pos w = case w ^? cWorld . lWorld . itemLocations . ix itid of
Just (InInv cid' invid _ _ _) ->
w
& cWorld . lWorld . creatures . ix cid' . crInv . ix invid . itScope
. remotePos
.~ (pos -.- (w ^?! cWorld . lWorld . creatures . ix cid' . crPos))
_ -> w
--setRemoteScope :: Int -> Point2 -> World -> World
--setRemoteScope itid pos w = case w ^? cWorld . lWorld . itemLocations . ix itid of
-- Just (InInv cid' invid _ _ _) ->
-- w
-- & cWorld . lWorld . creatures . ix cid' . crInv . ix invid . itScope
-- . remotePos
-- .~ (pos -.- (w ^?! cWorld . lWorld . creatures . ix cid' . crPos))
-- _ -> w
+14 -14
View File
@@ -1,4 +1,4 @@
{-# LANGUAGE TupleSections #-}
--{-# LANGUAGE TupleSections #-}
{- |
Weapon effects when pulling the trigger.
@@ -29,7 +29,7 @@ module Dodge.Item.Weapon.TriggerType (
hammerCheck,
shootL,
useTimeCheck,
ammoCheckI,
-- ammoCheckI,
modClock,
blCheck,
repeatTransformed,
@@ -115,18 +115,18 @@ withThickSmokeI eff item cr w =
-- TODO create a trigger that does different things on first and continued
-- fire.
ammoCheckI :: ChainEffect
ammoCheckI eff itm cr w = fromMaybe (failsound w) $ do
atype <- itm ^? ldtValue . itUse . heldAmmoTypes . ix 0
leftitms <- itm ^? ldtLeft
mag <- lookup (AmmoInLink 0 atype) leftitms
x <- mag ^? ldtValue . itUse . amagLoadStatus . iaLoaded
guard $ x > 0
return $ eff itm cr $ w -- & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
where
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
_ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
--ammoCheckI :: ChainEffect
--ammoCheckI eff itm cr w = fromMaybe (failsound w) $ do
-- atype <- itm ^? ldtValue . itUse . heldAmmoTypes . ix 0
-- leftitms <- itm ^? ldtLeft
-- mag <- lookup (AmmoInLink 0 atype) leftitms
-- x <- mag ^? ldtValue . itUse . amagLoadStatus . iaLoaded
-- guard $ x > 0
-- return $ eff itm cr w -- & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
-- where
-- failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
-- Just 0 -> soundStart (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
-- _ -> soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) click1S Nothing
itUseCharge :: Int -> Item -> Item
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)