Make rewind gun mostly work; todo sound, dropping item, perhaps more
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ yourControl
|
|||||||
-> World
|
-> World
|
||||||
-> (Endo World, Maybe Creature)
|
-> (Endo World, Maybe Creature)
|
||||||
yourControl cr w =
|
yourControl cr w =
|
||||||
( Endo updateUsingInput
|
( Endo updateUsingInput
|
||||||
, Just . mouseActionsCr (_mouseButtons w) $ wasdWithAiming w speed 0 cr
|
, Just . mouseActionsCr (_mouseButtons w) $ wasdWithAiming w speed 0 cr
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|||||||
+2
-1
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ defaultWorld = World
|
|||||||
, _frameClock = 0
|
, _frameClock = 0
|
||||||
, _worldBounds = defaultBounds
|
, _worldBounds = defaultBounds
|
||||||
, _rewindWorlds = []
|
, _rewindWorlds = []
|
||||||
|
, _rewinding = False
|
||||||
}
|
}
|
||||||
youLight :: TempLightSource
|
youLight :: TempLightSource
|
||||||
youLight =
|
youLight =
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ updateUsingInput w = if _carteDisplay w
|
|||||||
|
|
||||||
updatePressedButtons :: S.Set MouseButton -> World -> World
|
updatePressedButtons :: S.Set MouseButton -> World -> World
|
||||||
updatePressedButtons pkeys w
|
updatePressedButtons pkeys w
|
||||||
| lbPressed && rbPressed
|
| lbPressed && rbPressed
|
||||||
= useItem (_yourID w) w & lClickHammer .~ HammerDown
|
= useItem (_yourID w) w & lClickHammer .~ HammerDown
|
||||||
| lbPressed && canLeftClick = useLeftItem (_yourID w) w
|
| lbPressed && canLeftClick = useLeftItem (_yourID w) w
|
||||||
| lbPressed = w
|
| lbPressed = w
|
||||||
|
|||||||
Reference in New Issue
Block a user