Add in "linear" lWorld to separate time reversable worlds

This commit is contained in:
2022-10-28 12:24:51 +01:00
parent 5f6bd43599
commit 7e790b7153
130 changed files with 827 additions and 980 deletions
+6 -6
View File
@@ -404,10 +404,10 @@ overNozzles' ::
Creature ->
World ->
World
overNozzles' eff it cr w = neww & cWorld . creatures . ix cid . crInv . ix i . itParams . sprayNozzles .~ newNozzles
overNozzles' eff it cr w = neww & cWorld . lWorld . creatures . ix cid . crInv . ix i . itParams . sprayNozzles .~ newNozzles
where
cid = _crID cr
i = crSel $ _creatures (_cWorld w) IM.! cid
i = crSel $ w ^?! cWorld . lWorld . creatures . ix cid
(neww, newNozzles) = mapAccumR (eff it cr) w $ _sprayNozzles (_itParams it)
overNozzle ::
@@ -443,12 +443,12 @@ useGasParams nz it cr =
fireRemoteShell :: Item -> Creature -> World -> World
fireRemoteShell it cr w =
set
(cWorld . creatures . ix cid . crInv . ix j . itUse . heldUse)
(cWorld . lWorld . creatures . ix cid . crInv . ix j . itUse . heldUse)
(HeldExplodeRemoteShell itid i)
$ addRemRocket w
where
itid = _itID it
i = IM.newKey $ _props (_cWorld w)
i = IM.newKey $ w ^. cWorld . lWorld . props
cid = _crID cr
addRemRocket =
makeShell
@@ -488,7 +488,7 @@ coneRandItemParams = do
}
mcShootLaser :: Item -> Machine -> World -> World
mcShootLaser it mc = cWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
mcShootLaser it mc = cWorld . lWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam phasev pos dir
where
pos = _mcPos mc +.+ 20 *.* unitVectorAtAngle dir
dir = mc ^?! mcType . _McTurret . tuDir
@@ -499,7 +499,7 @@ mcShootLaser it mc = cWorld . lasers .:~ lasRayAt (_lasColor $ _itParams it) dam
shootTeslaArc :: Item -> Creature -> World -> World
shootTeslaArc it cr w =
w'
& cWorld . creatures . ix (_crID cr) . crInv . ix (crSel cr) . itParams .~ ip
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (crSel cr) . itParams .~ ip
where
(w', ip) = shootTeslaArc' (_itParams it) pos dir w
pos = _crPos cr +.+ aimingMuzzlePos cr it *.* unitVectorAtAngle dir