コード例 #1
0
        private void DoVeinMine(GlobalPoint3D point, ITMHand hand)
        {
            //game.AddNotification("DoVeinMin");
            GamerID gamerID = hand.Player.GamerID;

            //setup the initial search pattern
            FloodSearchList = new List <GlobalPoint3D>();
            FloodSearchOre(point, gamerID, targetOre);

            for (int i = 0; i < FloodSearchList.Count; i++)
            {
                //game.AddNotification("FloodSearchList.Count " + FloodSearchList.Count);
                if (amountFound <= maxOreToFind && !degradePick)
                {//not degrading do this one
                    FloodSearchOre(FloodSearchList[i], gamerID, targetOre);
                }
                else if (amountFound <= maxOreToFind && durabilityToRemove <= GetRemainHandDurability(hand))
                {//degrade is on so run this one but stop when tool will break
                    FloodSearchOre(FloodSearchList[i], gamerID, targetOre);
                    amountFound++;
                }
            }
            if (degradePick)
            {
                DecreaseHandItemDurability(hand, durabilityToRemove);
            }
            durabilityToRemove = 0;
            amountFound        = 0;
            targetOre          = Block.None;
        }
コード例 #2
0
        void FloodSearchCrop(GlobalPoint3D point, GamerID gamerID)
        {
            GlobalPoint3D curPoint;

            //north x+
            curPoint = new GlobalPoint3D(point.X + 1, point.Y, point.Z);
            if (IsReadyToHarvest(curPoint))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }

            //south X-
            curPoint = new GlobalPoint3D(point.X - 1, point.Y, point.Z);
            if (IsReadyToHarvest(curPoint))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }
            //east z+
            curPoint = new GlobalPoint3D(point.X, point.Y, point.Z + 1);
            if (IsReadyToHarvest(curPoint))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }
            //west z-
            curPoint = new GlobalPoint3D(point.X, point.Y, point.Z - 1);
            if (IsReadyToHarvest(curPoint))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }
        }
コード例 #3
0
 public DataBlock NewDataBlock(GlobalPoint3D p, Block blockID, GamerID playerID)
 {
     return(null);
 }
コード例 #4
0
        void FloodSearchOre(GlobalPoint3D point, GamerID gamerID, Block workingOre)
        {
            GlobalPoint3D curPoint;
            Block         curOre;

            for (int y = mineGrid; y >= -mineGrid; y--)
            {
                //north x+
                for (int i = 0; i <= mineGrid; i++)
                {
                    curPoint = new GlobalPoint3D(point.X + i, point.Y + y, point.Z);
                    curOre   = map.GetBlockID(curPoint);

                    if (IsBlockMineable(map.GetBlockID(curPoint)) && !IsLavaNear(curPoint) && !IsWaterNear(curPoint))
                    {
                        if (sameOreOnly && curOre == workingOre || !sameOreOnly)
                        {
                            if (!FloodSearchList.Contains(curPoint))
                            {
                                FloodSearchList.Add(curPoint);
                                map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                                durabilityToRemove++;
                                amountFound++;
                            }
                        }
                    }
                }

                //south X-
                for (int i = 0; i <= mineGrid; i++)
                {
                    curPoint = new GlobalPoint3D(point.X - i, point.Y + y, point.Z);
                    curOre   = map.GetBlockID(curPoint);
                    if (IsBlockMineable(map.GetBlockID(curPoint)) && !IsLavaNear(curPoint) && !IsWaterNear(curPoint))
                    {
                        if (sameOreOnly && curOre == workingOre || !sameOreOnly)
                        {
                            if (!FloodSearchList.Contains(curPoint))
                            {
                                FloodSearchList.Add(curPoint);
                                map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                                durabilityToRemove++;
                                amountFound++;
                            }
                        }
                    }
                }

                //east z+
                for (int i = 0; i <= mineGrid; i++)
                {
                    curPoint = new GlobalPoint3D(point.X, point.Y + y, point.Z + i);
                    curOre   = map.GetBlockID(curPoint);

                    if (IsBlockMineable(map.GetBlockID(curPoint)) && !IsLavaNear(curPoint) && !IsWaterNear(curPoint))
                    {
                        if (sameOreOnly && curOre == workingOre || !sameOreOnly)
                        {
                            if (!FloodSearchList.Contains(curPoint))
                            {
                                FloodSearchList.Add(curPoint);
                                map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                                durabilityToRemove++;
                                amountFound++;
                            }
                        }
                    }
                }

                //west z-
                for (int i = 0; i <= mineGrid; i++)
                {
                    curPoint = new GlobalPoint3D(point.X, point.Y + y, point.Z - i);
                    curOre   = map.GetBlockID(curPoint);
                    if (IsBlockMineable(map.GetBlockID(curPoint)) && !IsLavaNear(curPoint) && !IsWaterNear(curPoint))
                    {
                        if (sameOreOnly && curOre == workingOre || !sameOreOnly)
                        {
                            if (!FloodSearchList.Contains(curPoint))
                            {
                                FloodSearchList.Add(curPoint);
                                map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                                durabilityToRemove++;
                                amountFound++;
                            }
                        }
                    }
                }

                //diagonals +x,-z
                for (int i = 0; i <= mineGrid; i++)
                {
                    curPoint = new GlobalPoint3D(point.X + i, point.Y + y, point.Z - i);
                    curOre   = map.GetBlockID(curPoint);
                    if (IsBlockMineable(map.GetBlockID(curPoint)) && !IsLavaNear(curPoint) && !IsWaterNear(curPoint))
                    {
                        if (sameOreOnly && curOre == workingOre || !sameOreOnly)
                        {
                            if (!FloodSearchList.Contains(curPoint))
                            {
                                FloodSearchList.Add(curPoint);
                                map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                                durabilityToRemove++;
                                amountFound++;
                            }
                        }
                    }
                }

                //diagonals +x,+z
                for (int i = 0; i <= mineGrid; i++)
                {
                    curPoint = new GlobalPoint3D(point.X + i, point.Y + y, point.Z + i);
                    curOre   = map.GetBlockID(curPoint);
                    if (IsBlockMineable(map.GetBlockID(curPoint)) && !IsLavaNear(curPoint) && !IsWaterNear(curPoint))
                    {
                        if (sameOreOnly && curOre == workingOre || !sameOreOnly)
                        {
                            if (!FloodSearchList.Contains(curPoint))
                            {
                                FloodSearchList.Add(curPoint);
                                map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                                durabilityToRemove++;
                                amountFound++;
                            }
                        }
                    }
                }

                //diagonals -x,+z
                for (int i = 0; i <= mineGrid; i++)
                {
                    curPoint = new GlobalPoint3D(point.X - i, point.Y + y, point.Z + i);
                    curOre   = map.GetBlockID(curPoint);
                    if (IsBlockMineable(map.GetBlockID(curPoint)) && !IsLavaNear(curPoint) && !IsWaterNear(curPoint))
                    {
                        if (sameOreOnly && curOre == workingOre || !sameOreOnly)
                        {
                            if (!FloodSearchList.Contains(curPoint))
                            {
                                FloodSearchList.Add(curPoint);
                                map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                                durabilityToRemove++;
                                amountFound++;
                            }
                        }
                    }
                }

                //diagonals -x,-z
                for (int i = 0; i <= mineGrid; i++)
                {
                    curPoint = new GlobalPoint3D(point.X - i, point.Y + y, point.Z - i);
                    curOre   = map.GetBlockID(curPoint);
                    if (IsBlockMineable(map.GetBlockID(curPoint)) && !IsLavaNear(curPoint) && !IsWaterNear(curPoint))
                    {
                        if (sameOreOnly && curOre == workingOre || !sameOreOnly)
                        {
                            if (!FloodSearchList.Contains(curPoint))
                            {
                                FloodSearchList.Add(curPoint);
                                map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                                durabilityToRemove++;
                                amountFound++;
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
        void FloodSearchTree(GlobalPoint3D point, GamerID gamerID)
        {
            //TODO MAYBE diagional search pattern?
            GlobalPoint3D curPoint;

            //north x+
            curPoint = new GlobalPoint3D(point.X + 1, point.Y, point.Z);
            if (IsBlockChopable(map.GetBlockID(curPoint)))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }

            //south X-
            curPoint = new GlobalPoint3D(point.X - 1, point.Y, point.Z);
            if (IsBlockChopable(map.GetBlockID(curPoint)))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }
            //east z+
            curPoint = new GlobalPoint3D(point.X, point.Y, point.Z + 1);
            if (IsBlockChopable(map.GetBlockID(curPoint)))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }
            //west z-
            curPoint = new GlobalPoint3D(point.X, point.Y, point.Z - 1);
            if (IsBlockChopable(map.GetBlockID(curPoint)))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }
            //up y+
            curPoint = new GlobalPoint3D(point.X, point.Y + 1, point.Z);
            if (IsBlockChopable(map.GetBlockID(curPoint)))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }
            //dn y-
            curPoint = new GlobalPoint3D(point.X, point.Y - 1, point.Z);
            if (IsBlockChopable(map.GetBlockID(curPoint)))
            {
                if (!FloodSearchList.Contains(curPoint))
                {
                    FloodSearchList.Add(curPoint);
                    map.ClearBlock(curPoint, UpdateBlockMethod.PlayerRelated, gamerID, true);
                    durabilityToRemove++;
                    amountFound++;
                }
            }
        }
コード例 #6
0
 NetworkGamer INetworkSession.FindGamerById(GamerID gamerId)
 {
     return(null);
 }