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 :: [Item]
startInvList = startInvList =
[ rewindGun [ rewindGun
, pistol
] ]
startInventory :: IM.IntMap Item startInventory :: IM.IntMap Item
startInventory = IM.fromList $ zip [0..defaultInvSize -1] $ startInvList ++ repeat NoItem startInventory = IM.fromList $ zip [0..defaultInvSize -1] $ startInvList ++ repeat NoItem
+2 -1
View File
@@ -55,6 +55,7 @@ type CRUpdate = Creature -> World -> (Endo World, Maybe Creature)
data World = World data World = World
{ _keys :: !(S.Set Scancode) { _keys :: !(S.Set Scancode)
, _mouseButtons :: !(S.Set MouseButton) , _mouseButtons :: !(S.Set MouseButton)
, _mousePos :: !Point2
, _cameraCenter :: !Point2 , _cameraCenter :: !Point2
, _cameraRot :: !Float , _cameraRot :: !Float
, _cameraZoom :: !Float , _cameraZoom :: !Float
@@ -78,7 +79,6 @@ data World = World
, _floorItems :: IM.IntMap FloorItem , _floorItems :: IM.IntMap FloorItem
, _floorTiles :: [(Point3,Point3)] , _floorTiles :: [(Point3,Point3)]
, _randGen :: StdGen , _randGen :: StdGen
, _mousePos :: !Point2
, _testString :: World -> [String] , _testString :: World -> [String]
, _modifications :: IM.IntMap Modification , _modifications :: IM.IntMap Modification
, _yourID :: !Int , _yourID :: !Int
@@ -116,6 +116,7 @@ data World = World
, _preloadData :: PreloadData , _preloadData :: PreloadData
, _savedWorlds :: M.Map SaveSlot World , _savedWorlds :: M.Map SaveSlot World
, _rewindWorlds :: [World] , _rewindWorlds :: [World]
, _rewinding :: Bool
, _frameClock :: Int , _frameClock :: Int
} }
+1
View File
@@ -85,6 +85,7 @@ defaultWorld = World
, _frameClock = 0 , _frameClock = 0
, _worldBounds = defaultBounds , _worldBounds = defaultBounds
, _rewindWorlds = [] , _rewindWorlds = []
, _rewinding = False
} }
youLight :: TempLightSource youLight :: TempLightSource
youLight = 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 :: Item -> Creature -> World -> World
useRewindGun it cr w = case _rewindWorlds w of useRewindGun it cr w = case _rewindWorlds w of
(_:w':ws) -> w' & keys .~ _keys w (w':[]) -> w'
& mouseButtons .~ _mouseButtons w & upbuts
& rewindWorlds .~ []
& rewinding .~ True
& lClickHammer .~ HammerUp
where
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
(_:w':ws) -> w'
& upbuts
& rewindWorlds .~ ws & rewindWorlds .~ ws
& rewinding .~ True
& lClickHammer .~ HammerUp
where
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
_ -> w _ -> w
shrinkGun :: Item shrinkGun :: Item