Make rewind gun mostly work; todo sound, dropping item, perhaps more

This commit is contained in:
2021-11-26 18:56:37 +00:00
parent c1d4f32903
commit f29c200a27
6 changed files with 19 additions and 5 deletions
+1
View File
@@ -164,6 +164,7 @@ startCr = defaultCreature
startInvList :: [Item]
startInvList =
[ rewindGun
, pistol
]
startInventory :: IM.IntMap Item
startInventory = IM.fromList $ zip [0..defaultInvSize -1] $ startInvList ++ repeat NoItem
+1 -1
View File
@@ -18,7 +18,7 @@ yourControl
-> World
-> (Endo World, Maybe Creature)
yourControl cr w =
( Endo updateUsingInput
( Endo updateUsingInput
, Just . mouseActionsCr (_mouseButtons w) $ wasdWithAiming w speed 0 cr
)
where
+2 -1
View File
@@ -55,6 +55,7 @@ type CRUpdate = Creature -> World -> (Endo World, Maybe Creature)
data World = World
{ _keys :: !(S.Set Scancode)
, _mouseButtons :: !(S.Set MouseButton)
, _mousePos :: !Point2
, _cameraCenter :: !Point2
, _cameraRot :: !Float
, _cameraZoom :: !Float
@@ -78,7 +79,6 @@ data World = World
, _floorItems :: IM.IntMap FloorItem
, _floorTiles :: [(Point3,Point3)]
, _randGen :: StdGen
, _mousePos :: !Point2
, _testString :: World -> [String]
, _modifications :: IM.IntMap Modification
, _yourID :: !Int
@@ -116,6 +116,7 @@ data World = World
, _preloadData :: PreloadData
, _savedWorlds :: M.Map SaveSlot World
, _rewindWorlds :: [World]
, _rewinding :: Bool
, _frameClock :: Int
}
+1
View File
@@ -85,6 +85,7 @@ defaultWorld = World
, _frameClock = 0
, _worldBounds = defaultBounds
, _rewindWorlds = []
, _rewinding = False
}
youLight :: TempLightSource
youLight =
+13 -2
View File
@@ -32,9 +32,20 @@ rewindEffect iteff cr invid w = w & rewindWorlds %~ (take 100 . (w' : ))
useRewindGun :: Item -> Creature -> World -> World
useRewindGun it cr w = case _rewindWorlds w of
(_:w':ws) -> w' & keys .~ _keys w
& mouseButtons .~ _mouseButtons w
(w':[]) -> w'
& upbuts
& rewindWorlds .~ []
& rewinding .~ True
& lClickHammer .~ HammerUp
where
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
(_:w':ws) -> w'
& upbuts
& rewindWorlds .~ ws
& rewinding .~ True
& lClickHammer .~ HammerUp
where
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
_ -> w
shrinkGun :: Item
+1 -1
View File
@@ -18,7 +18,7 @@ updateUsingInput w = if _carteDisplay w
updatePressedButtons :: S.Set MouseButton -> World -> World
updatePressedButtons pkeys w
| lbPressed && rbPressed
| lbPressed && rbPressed
= useItem (_yourID w) w & lClickHammer .~ HammerDown
| lbPressed && canLeftClick = useLeftItem (_yourID w) w
| lbPressed = w