Defunction-ify item modules, requires more cleanup

This commit is contained in:
2022-06-08 12:28:11 +01:00
parent d91a53f76c
commit bcbfd7d2fa
48 changed files with 762 additions and 740 deletions
+7 -11
View File
@@ -38,9 +38,7 @@ import System.Random
launcher :: Item
launcher = defaultGun
{ _itName = "ROCKO"
, _itType = LAUNCHER
, _itConsumption = defaultAmmo
{ _itConsumption = defaultAmmo
{ _laType = ProjectileAmmo
{ _amPayload = makeExplosionAt
, _amString = "EXPLOSIVE SHELL"
@@ -71,7 +69,6 @@ launcher = defaultGun
, _tweakParams = basicAmPjMoves
}
, _itInvSize = 3
, _itInvDisplay = basicItemDisplay
, _itDimension = ItemDimension
{ _dimRad = 9
, _dimCenter = V3 10 0 0
@@ -82,12 +79,12 @@ launcher = defaultGun
, _dimSPic = launcherPic
}
}
& itModules . at ModLauncherHoming ?~ DefaultModule
& itType . iyBase .~ LAUNCHER
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
launcherX :: Int -> Item
launcherX i = launcher
& itName .~ ("ROCKO-" ++ show i)
& itType .~ LAUNCHERX i
& itType . iyBase .~ LAUNCHERX i
& itConsumption . laMax .~ i
& itConsumption . laLoaded .~ i
& itUse . rUse .~ usePjCreationX i
@@ -287,8 +284,7 @@ remoteLauncherName = "ROCKO-REMOTE"
remoteLauncher :: Item
remoteLauncher = launcher
& itName .~ remoteLauncherName
& itType .~ REMOTELAUNCHER
& itType . iyBase .~ REMOTELAUNCHER
& itUse . rUse .~ fireRemoteShell
& itScope .~ RemoteScope (V2 0 0) 1 True
& itConsumption . laType . amPjDraw .~ drawRemoteShell
@@ -297,7 +293,7 @@ remoteLauncher = launcher
fireRemoteShell :: Item -> Creature -> World -> World
fireRemoteShell it cr w = set (creatures . ix cid . crInv . ix j . itUse . rUse)
(\_ _ -> explodeRemoteRocket itid i)
$ set (creatures . ix cid . crInv . ix j . itName) remoteLauncherName
-- $ set (creatures . ix cid . crInv . ix j . itName) remoteLauncherName
$ addRemRocket w'
where
(w',itid) = getHeldItemLoc cr w
@@ -358,7 +354,7 @@ explodeRemoteRocket itid pjid w = w
& props . ix pjid . pjUpdate .~ (\_ -> retireRemoteProj fireRemoteShell itid 30 pjid)
& props . ix pjid . prDraw .~ const mempty
& itPoint . itUse . rUse .~ (\_ _ -> id)
& itPoint . itName .~ "REMOTELAUNCHER"
-- & itPoint . itName .~ "REMOTELAUNCHER"
& _pjPayload thepj (_pjPos thepj)
where
itPoint = pointToItem $ _itemPositions w IM.! itid