Esempio n. 1
0
        public void RequestUpdateMotion(uint holdKey, MovementData md, MotionItem[] commands)
        {
            new ActionChain(this, () =>
            {
                // Update our current style
                if ((md.MovementStateFlag & MovementStateFlag.CurrentStyle) != 0)
                {
                    MotionStance newStance = (MotionStance)md.CurrentStyle;

                    if (newStance != stance)
                    {
                        stance = (MotionStance)md.CurrentStyle;
                    }
                }

                md = md.ConvertToClientAccepted(holdKey, GetCreatureSkill(Skill.Run));
                UniversalMotion newMotion = new UniversalMotion(stance, md);

                // This is a hack to make walking work correctly.   Og II
                if (holdKey != 0 || (md.ForwardCommand == (uint)MotionCommand.WalkForward))
                {
                    newMotion.IsAutonomous = true;
                }

                // FIXME(ddevec): May need to de-dupe animation/commands from client -- getting multiple (e.g. wave)
                // FIXME(ddevec): This is the operation that should update our velocity (for physics later)
                newMotion.Commands.AddRange(commands);
                CurrentLandblock?.EnqueueBroadcastMotion(this, newMotion);

                // TODO: use real motion / animation system from physics
                CurrentMotionCommand = md.ForwardCommand;
            }).EnqueueChain();
        }