From 35337651a0c20c17307338649344d9d5ddd55dc8 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 11 Aug 2018 09:11:54 +0200 Subject: [PATCH] make copying not abortable --- src/Object.hs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Object.hs b/src/Object.hs index 6469c26..606f4ba 100644 --- a/src/Object.hs +++ b/src/Object.hs @@ -50,16 +50,20 @@ instance ObjectAction ObjType ObjState where objectTransition ObjCopier "copying" _ ent = do [e] <- efor (anEnt ent) $ do - let nstat = AnimState - (AnimId "copier" "open" N) - 0 - 0 - return unchanged - { anim = Set nstat - , objState = Set "idle" - , objStateTime = Unset - , objPlayerActivated = Unset - } + ttl <- query objStateTime + if ttl < 0 + then do + let nstat = AnimState + (AnimId "copier" "open" N) + 0 + 0 + return unchanged + { anim = Set nstat + , objState = Set "idle" + , objStateTime = Unset + , objPlayerActivated = Unset + } + else return unchanged return e objectTransition _ _ _ _ = return unchanged