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,36 +31,38 @@ 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)
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
return unchanged
|
return unchanged
|
||||||
{ objState = Set "copying"
|
{ objState = Set "copying"
|
||||||
, anim = Set nstat
|
, objPlayerActivated = Set playerActivated
|
||||||
|
, 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)
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
return unchanged
|
return unchanged
|
||||||
{ 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
|
||||||
|
|
|
@ -11,20 +11,21 @@ import Types.Animation
|
||||||
import Types.ObjType
|
import Types.ObjType
|
||||||
|
|
||||||
data Entity f = Entity
|
data Entity f = Entity
|
||||||
{ pos :: Component f 'Field (V2 Double)
|
{ pos :: Component f 'Field (V2 Double)
|
||||||
, mmpos :: Component f 'Field (V2 Double)
|
, mmpos :: Component f 'Field (V2 Double)
|
||||||
, gridPos :: Component f 'Field (V2 Int)
|
, gridPos :: Component f 'Field (V2 Int)
|
||||||
, vel :: Component f 'Field (V2 Double)
|
, vel :: Component f 'Field (V2 Double)
|
||||||
, mmvel :: Component f 'Field (V2 Double)
|
, mmvel :: Component f 'Field (V2 Double)
|
||||||
, velFact :: Component f 'Field Double
|
, velFact :: Component f 'Field Double
|
||||||
, rot :: Component f 'Field Direction
|
, rot :: Component f 'Field Direction
|
||||||
, obstacle :: Component f 'Field (Boundaries Double)
|
, obstacle :: Component f 'Field (Boundaries Double)
|
||||||
, player :: Component f 'Unique ()
|
, player :: Component f 'Unique ()
|
||||||
, npcMoveState :: Component f 'Field NPCMoveState
|
, npcMoveState :: Component f 'Field NPCMoveState
|
||||||
, anim :: Component f 'Field AnimState
|
, anim :: Component f 'Field AnimState
|
||||||
, objAccess :: Component f 'Field ((V2 Int), Direction)
|
, objAccess :: Component f 'Field ((V2 Int), Direction)
|
||||||
, 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