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 ("relEnts: " ++ show relEnts)
|
||||||
-- liftIO $ A.logIO A.Debug ("dV2: " ++ show (V2 dr dc))
|
-- liftIO $ A.logIO A.Debug ("dV2: " ++ show (V2 dr dc))
|
||||||
mapM_ (\(t, s, e) ->
|
mapM_ (\(t, s, e) ->
|
||||||
setEntity e =<< objectTransition t s e
|
setEntity e =<< objectTransition t s True e
|
||||||
) relEnts
|
) relEnts
|
||||||
putAffection ud
|
putAffection ud
|
||||||
{ worldState = nws
|
{ worldState = nws
|
||||||
|
@ -315,6 +315,7 @@ drawMap = do
|
||||||
with objType
|
with objType
|
||||||
with objState
|
with objState
|
||||||
with objStateTime
|
with objStateTime
|
||||||
|
with objPlayerActivated
|
||||||
with pos
|
with pos
|
||||||
pos' <- query pos
|
pos' <- query pos
|
||||||
t <- query objType
|
t <- query objType
|
||||||
|
|
|
@ -31,11 +31,11 @@ instance ObjectAction ObjType ObjState where
|
||||||
case mttl of
|
case mttl of
|
||||||
Nothing -> return False
|
Nothing -> return False
|
||||||
Just ttl -> return (ttl < 0)
|
Just ttl -> return (ttl < 0)
|
||||||
when trans (setEntity ent =<< objectTransition t s ent)
|
when trans (setEntity ent =<< objectTransition t s False ent)
|
||||||
|
|
||||||
objectAction _ _ _ _ = return ()
|
objectAction _ _ _ _ = return ()
|
||||||
|
|
||||||
objectTransition ObjCopier "idle" ent = do
|
objectTransition ObjCopier "idle" playerActivated ent = do
|
||||||
[e] <- efor (anEnt ent) $ do
|
[e] <- efor (anEnt ent) $ do
|
||||||
let nstat = AnimState
|
let nstat = AnimState
|
||||||
(AnimId "copier" "copy" N)
|
(AnimId "copier" "copy" N)
|
||||||
|
@ -43,11 +43,12 @@ instance ObjectAction ObjType ObjState where
|
||||||
0
|
0
|
||||||
return unchanged
|
return unchanged
|
||||||
{ objState = Set "copying"
|
{ objState = Set "copying"
|
||||||
|
, objPlayerActivated = Set playerActivated
|
||||||
, anim = Set nstat
|
, anim = Set nstat
|
||||||
}
|
}
|
||||||
return e
|
return e
|
||||||
|
|
||||||
objectTransition ObjCopier "copying" ent = do
|
objectTransition ObjCopier "copying" _ ent = do
|
||||||
[e] <- efor (anEnt ent) $ do
|
[e] <- efor (anEnt ent) $ do
|
||||||
let nstat = AnimState
|
let nstat = AnimState
|
||||||
(AnimId "copier" "open" N)
|
(AnimId "copier" "open" N)
|
||||||
|
@ -57,10 +58,11 @@ instance ObjectAction ObjType ObjState where
|
||||||
{ anim = Set nstat
|
{ anim = Set nstat
|
||||||
, objState = Set "idle"
|
, objState = Set "idle"
|
||||||
, objStateTime = Unset
|
, objStateTime = Unset
|
||||||
|
, objPlayerActivated = Unset
|
||||||
}
|
}
|
||||||
return e
|
return e
|
||||||
|
|
||||||
objectTransition _ _ _ = return unchanged
|
objectTransition _ _ _ _ = return unchanged
|
||||||
|
|
||||||
instance ActionTime ObjType ObjState where
|
instance ActionTime ObjType ObjState where
|
||||||
actionTime ObjCopier "copying" = 5
|
actionTime ObjCopier "copying" = 5
|
||||||
|
|
|
@ -26,5 +26,6 @@ data Entity f = Entity
|
||||||
, objType :: Component f 'Field ObjType
|
, objType :: Component f 'Field ObjType
|
||||||
, objState :: Component f 'Field ObjState
|
, objState :: Component f 'Field ObjState
|
||||||
, objStateTime :: Component f 'Field Double
|
, objStateTime :: Component f 'Field Double
|
||||||
|
, objPlayerActivated :: Component f 'Field Bool
|
||||||
}
|
}
|
||||||
deriving (Generic)
|
deriving (Generic)
|
||||||
|
|
|
@ -19,6 +19,7 @@ class ObjectAction otype ostate where
|
||||||
objectTransition
|
objectTransition
|
||||||
:: otype
|
:: otype
|
||||||
-> ostate
|
-> ostate
|
||||||
|
-> Bool
|
||||||
-> Ent
|
-> Ent
|
||||||
-> SystemT Entity (AffectionState (AffectionData UserData) IO) (Entity 'SetterOf)
|
-> SystemT Entity (AffectionState (AffectionData UserData) IO) (Entity 'SetterOf)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue