2018-07-22 20:30:17 +00:00
|
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
2018-08-10 06:58:26 +00:00
|
|
|
{-# LANGUAGE TypeSynonymInstances #-}
|
|
|
|
{-# LANGUAGE FlexibleInstances #-}
|
2018-07-22 20:30:17 +00:00
|
|
|
module Object where
|
|
|
|
|
2018-08-10 20:45:32 +00:00
|
|
|
import Affection as A
|
2018-07-22 20:30:17 +00:00
|
|
|
|
2018-08-10 06:58:26 +00:00
|
|
|
import Control.Monad (when)
|
|
|
|
|
2018-07-22 20:30:17 +00:00
|
|
|
import Data.Ecstasy
|
2018-08-11 09:51:20 +00:00
|
|
|
import Data.Maybe
|
|
|
|
|
|
|
|
import Linear
|
2018-07-22 20:30:17 +00:00
|
|
|
|
2019-02-15 10:22:24 +00:00
|
|
|
-- internal imports
|
|
|
|
|
2018-07-22 20:30:17 +00:00
|
|
|
import Types
|
|
|
|
|
2019-02-15 10:22:24 +00:00
|
|
|
import Object.Computer
|
|
|
|
import Object.Copier
|
2018-08-10 06:58:26 +00:00
|
|
|
|
2019-02-15 10:22:24 +00:00
|
|
|
instance ObjectAction ObjType ObjState where
|
|
|
|
objectAction dt t@ObjCopier s ent = copierObjectAction dt t s ent
|
2018-08-12 04:28:31 +00:00
|
|
|
|
2019-02-15 10:22:24 +00:00
|
|
|
objectAction dt t@ObjComputer s ent = computerObjectAction dt t s ent
|
2018-08-11 09:51:20 +00:00
|
|
|
|
2018-08-10 06:58:26 +00:00
|
|
|
objectAction _ _ _ _ = return ()
|
|
|
|
|
2019-02-15 10:22:24 +00:00
|
|
|
objectTransition t@ObjCopier s pa ent aent =
|
|
|
|
copierObjectTransition t s pa ent aent
|
2018-08-11 09:51:20 +00:00
|
|
|
|
2019-02-15 10:22:24 +00:00
|
|
|
objectTransition t@ObjComputer s pa ent aent =
|
|
|
|
computerObjectTransition t s pa ent aent
|
2018-08-10 06:58:26 +00:00
|
|
|
|
2018-09-12 22:51:22 +00:00
|
|
|
objectTransition _ _ _ _ _ = return unchanged
|
2018-08-10 06:58:26 +00:00
|
|
|
|
|
|
|
instance ActionTime ObjType ObjState where
|
|
|
|
actionTime ObjCopier "copying" = 5
|
2018-08-11 09:51:20 +00:00
|
|
|
actionTime ObjComputer "off" = 0
|
2018-08-12 04:28:31 +00:00
|
|
|
actionTime ObjComputer "on" = 20
|
2018-08-11 09:51:20 +00:00
|
|
|
actionTime ObjComputer "hack" = 20
|
2018-07-30 13:34:45 +00:00
|
|
|
|
2018-08-12 04:28:31 +00:00
|
|
|
actionTime o s = A.log Error (show o ++ ": " ++ s ++ ": has not a time") 0
|