Exemplo n.º 1
0
        ActionState ProcessAction(CarryItemAction action)
        {
            if (this.ActionTicksUsed == 1)
            {
                this.ActionTotalTicks = 1;
            }

            if (this.ActionTicksUsed < this.ActionTotalTicks)
            {
                return(ActionState.Ok);
            }

            var item = this.World.FindObject <ItemObject>(action.ItemID);

            var report = new CarryItemActionReport(this, item);

            if (item == null)
            {
                SendFailReport(report, "item not found");
                return(ActionState.Fail);
            }

            if (this.CarriedItem != null)
            {
                SendFailReport(report, "already carrying an item");
                return(ActionState.Fail);
            }

            if (item.Environment != this.Environment || item.Location != this.Location)
            {
                SendFailReport(report, "item not there");
                return(ActionState.Fail);
            }

            if (item.MoveTo(this) == false)
            {
                SendFailReport(report, "failed to move");
                return(ActionState.Fail);
            }

            this.CarriedItem = item;

            SendReport(report);

            return(ActionState.Done);
        }
Exemplo n.º 2
0
        ActionState ProcessAction(CarryItemAction action)
        {
            if (this.ActionTicksUsed == 1)
                this.ActionTotalTicks = 1;

            if (this.ActionTicksUsed < this.ActionTotalTicks)
                return ActionState.Ok;

            var item = this.World.FindObject<ItemObject>(action.ItemID);

            var report = new CarryItemActionReport(this, item);

            if (item == null)
            {
                SendFailReport(report, "item not found");
                return ActionState.Fail;
            }

            if (this.CarriedItem != null)
            {
                SendFailReport(report, "already carrying an item");
                return ActionState.Fail;
            }

            if (item.Environment != this.Environment || item.Location != this.Location)
            {
                SendFailReport(report, "item not there");
                return ActionState.Fail;
            }

            if (item.MoveTo(this) == false)
            {
                SendFailReport(report, "failed to move");
                return ActionState.Fail;
            }

            this.CarriedItem = item;

            SendReport(report);

            return ActionState.Done;
        }
Exemplo n.º 3
0
 void HandleReport(CarryItemActionReport report)
 {
     HandleItemActionReport(report, "starts carrying", "start carrying");
 }
Exemplo n.º 4
0
 void HandleReport(CarryItemActionReport report)
 {
     HandleItemActionReport(report, "starts carrying", "start carrying");
 }