Add files
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
module Dodge.BlBl (doBlBl) where
|
||||||
|
|
||||||
|
import Dodge.Data.BlBl
|
||||||
|
|
||||||
|
doBlBl :: BlBl -> Bool -> Bool
|
||||||
|
doBlBl bb = case bb of
|
||||||
|
BlNegate -> not
|
||||||
|
BlConst bl -> const bl
|
||||||
|
BlId -> id
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{-# LANGUAGE DeriveAnyClass #-}
|
||||||
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
|
{-# LANGUAGE StrictData #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
|
module Dodge.Data.BlBl where
|
||||||
|
|
||||||
|
import Data.Aeson
|
||||||
|
import Data.Aeson.TH
|
||||||
|
|
||||||
|
data BlBl
|
||||||
|
= BlNegate
|
||||||
|
| BlConst Bool
|
||||||
|
| BlId
|
||||||
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
deriveJSON defaultOptions ''BlBl
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
|
{-# LANGUAGE DeriveAnyClass #-}
|
||||||
|
{-# LANGUAGE StrictData #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
|
module Dodge.Data.Wall.Structure
|
||||||
|
where
|
||||||
|
import Control.Lens
|
||||||
|
import Data.Aeson
|
||||||
|
import Data.Aeson.TH
|
||||||
|
|
||||||
|
data WallStructure
|
||||||
|
= StandaloneWall
|
||||||
|
| DoorPart {_wsDoor :: Int}
|
||||||
|
| MachinePart {_wsMachine :: Int}
|
||||||
|
| BlockPart {_wsBlock :: Int}
|
||||||
|
| CreaturePart { _wlStCreature :: Int }
|
||||||
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
makeLenses ''WallStructure
|
||||||
|
deriveJSON defaultOptions ''WallStructure
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
module Dodge.SelectedClose (getSelectedCloseObj,interactWithCloseObj) where
|
||||||
|
|
||||||
|
import Dodge.Button.Event
|
||||||
|
import Dodge.Inventory.Add
|
||||||
|
import Control.Lens
|
||||||
|
import Dodge.Data.World
|
||||||
|
import NewInt
|
||||||
|
|
||||||
|
interactWithCloseObj :: Either FloorItem Button -> World -> World
|
||||||
|
interactWithCloseObj e w = worldEventFlags . at InventoryChange ?~ () $ case e of
|
||||||
|
(Left flit) -> pickUpItem 0 flit w
|
||||||
|
(Right but) -> doButtonEvent (_btEvent but) but w
|
||||||
|
|
||||||
|
|
||||||
|
getSelectedCloseObj :: World -> Maybe (Either FloorItem Button)
|
||||||
|
getSelectedCloseObj w = do
|
||||||
|
(i, j, _) <- w ^? hud . hudElement . diSelection . _Just
|
||||||
|
case i of
|
||||||
|
3 -> do
|
||||||
|
NInt k <- w ^? hud . closeItems . ix j
|
||||||
|
fmap Left $ w ^? cWorld . lWorld . floorItems . unNIntMap . ix k
|
||||||
|
5 -> do
|
||||||
|
k <- w ^? hud . closeButtons . ix j
|
||||||
|
fmap Right $ w ^? cWorld . lWorld . buttons . ix k
|
||||||
|
_ -> Nothing
|
||||||
Reference in New Issue
Block a user