draw only progress for player activated actions
This commit is contained in:
parent
84cd30d8e5
commit
289579470f
4 changed files with 30 additions and 25 deletions
|
@ -282,7 +282,7 @@ playerInteract (MsgMouseButton _ _ SDL.Pressed _ SDL.ButtonRight _ m) = do
|
|||
liftIO $ A.logIO A.Debug ("relEnts: " ++ show relEnts)
|
||||
-- liftIO $ A.logIO A.Debug ("dV2: " ++ show (V2 dr dc))
|
||||
mapM_ (\(t, s, e) ->
|
||||
setEntity e =<< objectTransition t s e
|
||||
setEntity e =<< objectTransition t s True e
|
||||
) relEnts
|
||||
putAffection ud
|
||||
{ worldState = nws
|
||||
|
@ -315,6 +315,7 @@ drawMap = do
|
|||
with objType
|
||||
with objState
|
||||
with objStateTime
|
||||
with objPlayerActivated
|
||||
with pos
|
||||
pos' <- query pos
|
||||
t <- query objType
|
||||
|
|
|
@ -31,11 +31,11 @@ instance ObjectAction ObjType ObjState where
|
|||
case mttl of
|
||||
Nothing -> return False
|
||||
Just ttl -> return (ttl < 0)
|
||||
when trans (setEntity ent =<< objectTransition t s ent)
|
||||
when trans (setEntity ent =<< objectTransition t s False ent)
|
||||
|
||||
objectAction _ _ _ _ = return ()
|
||||
|
||||
objectTransition ObjCopier "idle" ent = do
|
||||
objectTransition ObjCopier "idle" playerActivated ent = do
|
||||
[e] <- efor (anEnt ent) $ do
|
||||
let nstat = AnimState
|
||||
(AnimId "copier" "copy" N)
|
||||
|
@ -43,11 +43,12 @@ instance ObjectAction ObjType ObjState where
|
|||
0
|
||||
return unchanged
|
||||
{ objState = Set "copying"
|
||||
, objPlayerActivated = Set playerActivated
|
||||
, anim = Set nstat
|
||||
}
|
||||
return e
|
||||
|
||||
objectTransition ObjCopier "copying" ent = do
|
||||
objectTransition ObjCopier "copying" _ ent = do
|
||||
[e] <- efor (anEnt ent) $ do
|
||||
let nstat = AnimState
|
||||
(AnimId "copier" "open" N)
|
||||
|
@ -57,10 +58,11 @@ instance ObjectAction ObjType ObjState where
|
|||
{ anim = Set nstat
|
||||
, objState = Set "idle"
|
||||
, objStateTime = Unset
|
||||
, objPlayerActivated = Unset
|
||||
}
|
||||
return e
|
||||
|
||||
objectTransition _ _ _ = return unchanged
|
||||
objectTransition _ _ _ _ = return unchanged
|
||||
|
||||
instance ActionTime ObjType ObjState where
|
||||
actionTime ObjCopier "copying" = 5
|
||||
|
|
|
@ -26,5 +26,6 @@ data Entity f = Entity
|
|||
, objType :: Component f 'Field ObjType
|
||||
, objState :: Component f 'Field ObjState
|
||||
, objStateTime :: Component f 'Field Double
|
||||
, objPlayerActivated :: Component f 'Field Bool
|
||||
}
|
||||
deriving (Generic)
|
||||
|
|
|
@ -19,6 +19,7 @@ class ObjectAction otype ostate where
|
|||
objectTransition
|
||||
:: otype
|
||||
-> ostate
|
||||
-> Bool
|
||||
-> Ent
|
||||
-> SystemT Entity (AffectionState (AffectionData UserData) IO) (Entity 'SetterOf)
|
||||
|
||||
|
|
Loading…
Reference in a new issue