summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Model
diff options
context:
space:
mode:
Diffstat (limited to 'haskell/src/SpaceTraders/Model')
-rw-r--r--haskell/src/SpaceTraders/Model/Ship.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/haskell/src/SpaceTraders/Model/Ship.hs b/haskell/src/SpaceTraders/Model/Ship.hs
index 522276c..f42d558 100644
--- a/haskell/src/SpaceTraders/Model/Ship.hs
+++ b/haskell/src/SpaceTraders/Model/Ship.hs
@@ -1,8 +1,11 @@
-{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveAnyClass #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE OverloadedStrings #-}
module SpaceTraders.Model.Ship
( Ship(..)
+ , isDocked
+ , isInOrbit
) where
import Data.Aeson
@@ -31,3 +34,9 @@ data Cooldown = Cooldown { shipSymbol :: T.Text
, totalSeconds :: Int
, remainingSeconds :: Int
} deriving (FromJSON, Generic, Show, ToJSON)
+
+isDocked :: Ship -> Bool
+isDocked ship = status (nav ship) == "DOCKED"
+
+isInOrbit :: Ship -> Bool
+isInOrbit = not . isDocked