{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} module Object where import Affection as A import Control.Monad (when) import Data.Ecstasy import Data.Maybe import Linear -- internal imports import Types import Object.Computer import Object.Copier import Object.Door instance ObjectAction ObjType ObjState where objectAction relEnts dt t@ObjCopier s ent = copierObjectAction relEnts dt t s ent objectAction relEnts dt t@ObjComputer s ent = computerObjectAction relEnts dt t s ent objectAction relEnts dt t@ObjDoor s ent = doorObjectAction relEnts dt t s ent objectAction _ _ _ _ _ = return () objectTransition t@ObjCopier s pa ent aent = copierObjectTransition t s pa ent aent objectTransition t@ObjComputer s pa ent aent = computerObjectTransition t s pa ent aent objectTransition t@ObjDoor s pa ent aent = doorObjectTransition t s pa ent aent objectTransition _ _ _ _ _ = return unchanged