示例#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;
        }
        void SpawnVehicle(VehicleType type, GlobalPoint3D p, Vector3 dir)
        {
            if (spawnCount > 500)
            {
                return;
            }

            var list = GetVehicleTypeArray(type);
            var data = list[Game.Random.Next(list.Length)];

            var vehicle = new Vehicle(this, data);

            vehicle.Position      = Map.GetBlockCenter(p);
            vehicle.Position.Y   += Map.TileSize * 0.51f;
            vehicle.ViewDirection = ClampDirection(new Vector3(dir.X, 0, dir.Z));
            vehicle.Velocity      = Vector3.Zero;//vehicle.ViewDirection * data.Speed;
            vehicle.Scale         = data.Scale;
            vehicle.DrawOffY      = type == VehicleType.TrainCar || type == VehicleType.TrainEngine ? -1.8f : 0;
            vehicle.FrustumCull   = true;

            World.EntityManager.AddEntity("Trub's Trains", data.Name, vehicle);
            ++spawnCount;

            if (spawnCount % 20 == 0)
            {
                Game.AddNotification(string.Format("{0}: {1}", data.Name, spawnCount), NotifyRecipient.Local);
            }
        }
示例#3
0
        bool IsWaterNear(GlobalPoint3D point)
        {
            for (int x = point.X - 1; x <= point.X + 1; x++)
            {
                GlobalPoint3D here = new GlobalPoint3D(x, point.Y, point.Z);
                if (map.GetBlockID(here) == Block.Water)
                {
                    return(true);
                }
            }
            for (int y = point.Y - 1; y <= point.Y + 1; y++)
            {
                GlobalPoint3D here = new GlobalPoint3D(point.X, y, point.Z);
                if (map.GetBlockID(here) == Block.Water)
                {
                    return(true);
                }
            }
            for (int z = point.Z - 1; z <= point.Z + 1; z++)
            {
                GlobalPoint3D here = new GlobalPoint3D(point.X, point.Y, z);
                if (map.GetBlockID(here) == Block.Water)
                {
                    return(true);
                }
            }


            return(false);
        }
示例#4
0
        private void DoHarvest(GlobalPoint3D point, ITMHand hand)
        {
            var gamerID = hand.Player.GamerID;

            FloodSearchList = new List <GlobalPoint3D>();
            FloodSearchCrop(point, gamerID);

            for (int i = 0; i < FloodSearchList.Count; i++)
            {
                if (amountFound <= maxHarvestToFind && !degradeScythe)
                {//degrade is off so run this one
                    FloodSearchCrop(FloodSearchList[i], gamerID);
                    amountFound++;
                }
                else if (amountFound <= maxHarvestToFind && durabilityToRemove <= GetRemainHandDurability(hand))
                {//degrade is on so run this one but stop when tool will break
                    FloodSearchCrop(FloodSearchList[i], gamerID);
                    amountFound++;
                }
            }

            if (degradeScythe)
            {
                DecreaseHandItemDurability(hand, durabilityToRemove);
            }
            durabilityToRemove = 0;

            amountFound = 0;
        }
示例#5
0
        void ContinueDirection(GlobalPoint3D p, int yOffset)
        {
            p.Y += yOffset;
            var b = (Block)map.GetBlockID(p);

            p.Y -= yOffset;

            if (b != data.TrackNE && b != data.TrackSW)
            {
                if (yOffset == -1)
                {
                    Velocity.X = 0;
                    Velocity.Z = 0;
                }
                else
                {
                    ContinueDirection(p, yOffset == 0 ? 1 : -1);
                }
            }
            else
            {
                Position.Y  += yOffset;
                lastDirPoint = p;
            }
        }
示例#6
0
        private void DoLumberJack(GlobalPoint3D point, ITMHand hand)
        {
            var gamerID = hand.Player.GamerID;

            FloodSearchList = new List <GlobalPoint3D>();
            FloodSearchList.Add(point);

            for (int i = 0; i < FloodSearchList.Count; i++)
            {
                if (amountFound <= maxTreeToFind && !degradeAx)
                {//not degrading tools
                    FloodSearchTree(FloodSearchList[i], gamerID);
                    amountFound++;
                }
                else if (amountFound <= maxTreeToFind && durabilityToRemove <= GetRemainHandDurability(hand))
                {//degrade is on so run this one but stop when tool will break
                    FloodSearchTree(FloodSearchList[i], gamerID);
                    amountFound++;
                }
            }
            //game.AddNotification("dur: " + GetRemainHandDurability(hand) + " to remove " + durabilityToRemove);
            if (degradeAx)
            {
                DecreaseHandItemDurability(hand, durabilityToRemove);
            }
            durabilityToRemove = 0;

            amountFound = 0;
        }
示例#7
0
        void ContinueDirection()
        {
            float vdx = Velocity.X < 0 ? -0.5f : Velocity.X > 0 ? 0.5f : 0;
            float vdz = Velocity.Z < 0 ? -0.5f : Velocity.Z > 0 ? 0.5f : 0;

            var p = map.GetPoint(Position + new Vector3(vdx, data.GroundOffsetY, vdz));

            if (p != lastDirPoint)
            {
                lastDirPoint = p;
                bool continueDir = true;

                if ((Velocity.X != 0 || Velocity.Z != 0) && mod.Game.Random.Next(2) == 0)
                {
                    if (ChangeDirection(map.GetPoint(Position + new Vector3(0, data.GroundOffsetY, 0)), 0))
                    {
                        UpdateNewMovementDirection();
                        continueDir = false;
                    }
                }

                if (continueDir)
                {
                    ContinueDirection(p, 0);
                }
            }
        }
示例#8
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++;
                }
            }
        }
示例#9
0
 private bool IsReadyToHarvest(GlobalPoint3D point)
 {
     //game.AddNotification("Aux is " + aux);
     // if (block == Block.Crop && aux == 5)
     if (map.GetBlockID(point) == Block.Crop && map.GetAuxDataNoCache(point) == 5)
     {
         //string key = Block.Crop + "=" + aux;
         //game.AddNotification("Ready to harvest " + key +" " + harvestBlockAuxCfg.ContainsEntry(key));
         //return harvestBlockAuxCfg.ContainsEntry(key);
         return(true);
     }
     return(false);
 }
示例#10
0
        BoundingBox GetBlockBoxCore(ITMMap map, GlobalPoint3D p)
        {
            float tilesize = map.TileSize;
            var   box      = new BoundingBox();

            box.Min.X = p.X * tilesize;
            box.Min.Y = p.Y * tilesize;
            box.Min.Z = p.Z * tilesize;
            box.Max.X = box.Min.X + tilesize;
            box.Max.Y = box.Min.Y + tilesize;
            box.Max.Z = box.Min.Z + tilesize;
            return(box);
        }
示例#11
0
        public void BuildCustomMesh(ITMMeshBuilder meshBuilder, ITMMap map, GlobalPoint3D p, byte blockID)
        {
            switch ((Block)blockID)
            {
            case Blocks.TrainTrackStraight:
                BuildMeshTrainTrackStraight(meshBuilder, map, p, blockID);
                break;

            case Blocks.TrainTrackCorner:
                BuildMeshTrainTrackCorner(meshBuilder, map, p, blockID);
                break;
            }
        }
示例#12
0
        public BoundingBox GetBlockBox(GlobalPoint3D p, Block blockID)
        {
            switch ((Block)blockID)
            {
            case Blocks.TrainTrackStraight:
            case Blocks.TrainTrackCorner:
                var box = GetBlockBoxCore(game.World.Map, p);
                box.Max.Y = box.Min.Y + 0.2f;
                return(box);

            default:
                return(world.GetBlockBox(p, blockID));
            }
        }
示例#13
0
        public byte GetAuxForPlacement(Vector3 viewDirection, GlobalPoint3D swingTarget, BlockFace swingFace, int facePos, Block blockID)
        {
            switch (blockID)
            {
            case Blocks.TrainTrackStraight:
                return((byte)(Math.Abs(viewDirection.X) > Math.Abs(viewDirection.Z) ? 0 : 1));

            case Blocks.TrainTrackCorner:
                return((byte)(facePos & 0x3));

            default:
                return(0);
            }
        }
示例#14
0
        Vector3?GetRandomDirection(GlobalPoint3D p)
        {
            bool found = false;

            dirc[0] = dirc[1] = dirc[2] = dirc[3] = false;

            var blockID = game.World.Map.GetBlockID(p + GlobalPoint3D.Forward);

            if (blockID == Block.MultiTextureBlock2)
            {
                dirc[0] = true;
                found   = true;
            }

            blockID = game.World.Map.GetBlockID(p + GlobalPoint3D.Right);
            if (blockID == Block.MultiTextureBlock2)
            {
                dirc[1] = true;
                found   = true;
            }

            blockID = game.World.Map.GetBlockID(p + GlobalPoint3D.Backward);
            if (blockID == Block.MultiTextureBlock2)
            {
                dirc[2] = true;
                found   = true;
            }

            blockID = game.World.Map.GetBlockID(p + GlobalPoint3D.Left);
            if (blockID == Block.MultiTextureBlock2)
            {
                dirc[3] = true;
                found   = true;
            }

            while (found)
            {
                int i = game.Random.Next(4);
                if (dirc[i])
                {
                    return(dir[i]);
                }
            }

            return(null);
        }
示例#15
0
        void AddSpawnPoint(GlobalPoint3D p)
        {
            Vector3 pos = game.World.Map.GetBlockCenter(p);

            foreach (var s in spawnPoints)
            {
                if (s.Pos == pos)
                {
                    return;
                }
            }

            Vector3 dir = GetRandomDirection(p).Value;

            spawnPoints.Add(new Spawn()
            {
                Pos = pos, Dir = dir, Timer = Services.TotalTime
            });
        }
示例#16
0
 protected virtual Vector3 GetNextDirection(GlobalPoint3D p)
 {
     if (ViewDirection.X != 0)
     {
         --p.Z;
         if ((Block)map.GetBlockID(p) == data.Track)
         {
             return(Vector3.Forward);
         }
         p.Z += 2;
         if ((Block)map.GetBlockID(p) == data.Track)
         {
             return(Vector3.Backward);
         }
         --p.Z;
         --p.X;
         if ((Block)map.GetBlockID(p) == data.Track)
         {
             return(Vector3.Left);
         }
         return(Vector3.Right);
     }
     else
     {
         --p.X;
         if ((Block)map.GetBlockID(p) == data.Track)
         {
             return(Vector3.Left);
         }
         p.X += 2;
         if ((Block)map.GetBlockID(p) == data.Track)
         {
             return(Vector3.Right);
         }
         --p.X;
         --p.Z;
         if ((Block)map.GetBlockID(p) == data.Track)
         {
             return(Vector3.Forward);
         }
         return(Vector3.Backward);
     }
 }
示例#17
0
        bool ChangeDirection(GlobalPoint3D p, int yOffset)
        {
            Block b;

            if (Velocity.Z != 0)                            // north or south
            {
                ++p.X; b = (Block)map.GetBlockID(p); --p.X; // check west
                if (b == data.TrackSW)
                {
                    Velocity.X = 1;
                    Velocity.Z = 0;
                    return(true);
                }
                --p.X; b = (Block)map.GetBlockID(p); ++p.X; // check east
                if (b == data.TrackNE)
                {
                    Velocity.X = -1;
                    Velocity.Z = 0;
                    return(true);
                }
            }
            else if (Velocity.X != 0)                       // east or west
            {
                ++p.Z; b = (Block)map.GetBlockID(p); --p.Z; // check north
                if (b == data.TrackNE)
                {
                    Velocity.X = 0;
                    Velocity.Z = 1;
                    return(true);
                }
                --p.Z; b = (Block)map.GetBlockID(p); ++p.Z; // check south
                if (b == data.TrackSW)
                {
                    Velocity.X = 0;
                    Velocity.Z = -1;
                    return(true);
                }
            }
            return(false);
        }
示例#18
0
        void MyAction(Block block, byte aux, GlobalPoint3D point, ITMHand hand)
        {
            if (!keyDown)
            {
                if (IsBlockWood(block) && IsAxeValid(hand.ItemID) && LumberJack)
                {
                    DoLumberJack(point, hand);
                }

                if (IsBlockMineable(block) && IsPickAxeValid(hand.ItemID) && VeinMining)
                {
                    targetOre = block;
                    DoVeinMine(point, hand);
                }

                if (IsBlockCrop(block) && IsScythValid(hand.ItemID) && Harvesting)
                {
                    DoHarvest(point, hand);
                }

                ProcessErrorMessages();
            }
        }
示例#19
0
        void BuildMeshTrainTrackCorner(ITMMeshBuilder meshBuilder, ITMMap map, GlobalPoint3D p, byte blockID)
        {
            var tilesize = map.TileSize;
            var tc1      = meshBuilder.TexCoords1[blockID];
            var tc2      = meshBuilder.TexCoords2[blockID];
            var tc3      = meshBuilder.TexCoords3[blockID];
            var tc4      = meshBuilder.TexCoords4[blockID];

            meshBuilder.RotateTexCoords(ref p, (byte)BlockFace.Left, ref tc1, ref tc2, ref tc3, ref tc4);

            var data = new AVParams();

            data.Point    = p;
            data.BlockID  = blockID;
            data.IsCorner = true;
            data.Face     = (int)BlockFace.Up;
            data.Pos1     = map.GetPosition(p);
            data.Pos1.Y  -= tilesize;
            data.Pos2.X   = data.Pos1.X + tilesize;
            data.Pos2.Z   = data.Pos1.Z + tilesize;
            data.Pos2.Y   = data.Pos1.Y;

            data.X  = data.Pos1.X;
            data.Y  = data.Pos1.Y + 0.1f;
            data.Z  = data.Pos1.Z;
            data.TC = new NormalizedShort2(tc3.X, tc3.Y);
            meshBuilder.AddVertex(ref data);
            data.X  = data.Pos2.X;
            data.TC = new NormalizedShort2(tc1.X, tc1.Y);
            meshBuilder.AddVertex(ref data);
            data.Z  = data.Pos2.Z;
            data.TC = new NormalizedShort2(tc2.X, tc2.Y);
            meshBuilder.AddVertex(ref data);
            data.X  = data.Pos1.X;
            data.TC = new NormalizedShort2(tc4.X, tc4.Y);
            meshBuilder.AddVertex(ref data);
        }
 public VehicleSetupScreen(ITMGame game, ITMPlayer player, GlobalPoint3D p)
     : base(game, player)
 {
     point = p;
 }
示例#21
0
        string PointToString(GlobalPoint3D point)
        {
            string str = point.X.ToString() + " " + point.Y.ToString() + " " + point.Z.ToString();

            return(str);
        }
示例#22
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++;
                }
            }
        }
示例#23
0
 public DataBlock NewDataBlock(GlobalPoint3D p, Block blockID, GamerID playerID)
 {
     return(null);
 }
示例#24
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++;
                            }
                        }
                    }
                }
            }
        }
示例#25
0
        void BuildMeshTrainTrackStraight(ITMMeshBuilder meshBuilder, ITMMap map, GlobalPoint3D p, byte blockID)
        {
            var tilesize = map.TileSize;
            var tc1      = meshBuilder.TexCoords1[blockID];
            var tc2      = meshBuilder.TexCoords2[blockID];
            var tc3      = meshBuilder.TexCoords3[blockID];
            var tc4      = meshBuilder.TexCoords4[blockID];

            meshBuilder.RotateTexCoords(ref p, (byte)BlockFace.Left, ref tc1, ref tc2, ref tc3, ref tc4);

            var data = new AVParams();

            data.Point    = p;
            data.BlockID  = blockID;
            data.IsCorner = true;
            data.Face     = (int)BlockFace.Up;
            data.Pos1     = map.GetPosition(p);
            data.Pos1.Y  -= tilesize;
            data.Pos2.X   = data.Pos1.X + tilesize;
            data.Pos2.Z   = data.Pos1.Z + tilesize;
            data.Pos2.Y   = data.Pos1.Y;
            var y1 = data.Pos1.Y;
            var y2 = data.Pos2.Y;
            var y3 = data.Pos2.Y;
            var y4 = data.Pos1.Y;

            #region Raise End
            Block b;
            var   aux = map.GetAuxData(p) & 0x01;
            if (aux == 0)
            {
                ++p.X;
                b = (Block)map.GetBlockID(p);
                if (b != Blocks.TrainTrackStraight && b != Blocks.TrainTrackCorner)
                {
                    ++p.Y;
                    b = (Block)map.GetBlockID(p);
                    if (b == Blocks.TrainTrackStraight || b == Blocks.TrainTrackCorner)
                    {
                        y2 += tilesize; y3 += tilesize;
                    }
                }
                else
                {
                    p.X -= 2;
                    b    = (Block)map.GetBlockID(p);
                    if (b != Blocks.TrainTrackStraight && b != Blocks.TrainTrackCorner)
                    {
                        ++p.Y;
                        b = (Block)map.GetBlockID(p);
                        if (b == Blocks.TrainTrackStraight || b == Blocks.TrainTrackCorner)
                        {
                            y1 += tilesize; y4 += tilesize;
                        }
                    }
                }
            }
            else
            {
                ++p.Z;
                b = (Block)map.GetBlockID(p);
                if (b != Blocks.TrainTrackStraight && b != Blocks.TrainTrackCorner)
                {
                    ++p.Y;
                    b = (Block)map.GetBlockID(p);
                    if (b == Blocks.TrainTrackStraight || b == Blocks.TrainTrackCorner)
                    {
                        y3 += tilesize; y4 += tilesize;
                    }
                }
                else
                {
                    p.Z -= 2;
                    b    = (Block)map.GetBlockID(p);
                    if (b != Blocks.TrainTrackStraight && b != Blocks.TrainTrackCorner)
                    {
                        ++p.Y;
                        b = (Block)map.GetBlockID(p);
                        if (b == Blocks.TrainTrackStraight || b == Blocks.TrainTrackCorner)
                        {
                            y1 += tilesize; y2 += tilesize;
                        }
                    }
                }
            }
            #endregion

            data.X  = data.Pos1.X;
            data.Y  = y1 + 0.1f;
            data.Z  = data.Pos1.Z;
            data.TC = new NormalizedShort2(tc3.X, tc3.Y);
            meshBuilder.AddVertex(ref data);
            data.X  = data.Pos2.X;
            data.Y  = y2 + 0.1f;
            data.TC = new NormalizedShort2(tc1.X, tc1.Y);
            meshBuilder.AddVertex(ref data);
            data.Z  = data.Pos2.Z;
            data.Y  = y3 + 0.1f;
            data.TC = new NormalizedShort2(tc2.X, tc2.Y);
            meshBuilder.AddVertex(ref data);
            data.X  = data.Pos1.X;
            data.Y  = y4 + 0.1f;
            data.TC = new NormalizedShort2(tc4.X, tc4.Y);
            meshBuilder.AddVertex(ref data);
        }
示例#26
0
 ArcadeMachine ITMPluginArcade.GetArcadeMachine(int gameID, ITMGame game, ITMMap map, ITMPlayer player, GlobalPoint3D p, BlockFace face)
 {
     return(new BrickbreakerGame(game, map, player, p, face));
 }
示例#27
0
        NewGuiMenu ITMPluginGUI.GetItemCustomSetupScreen(ITMGame game, ITMPlayer player, GlobalPoint3D p, Item itemID)
        {
            switch (itemID)
            {
            case Item.Rasta:
                return(new VehicleSetupScreen(game, player, p));

            default:
                return(null);
            }
        }
示例#28
0
 public void EventBlockMined(Block block, byte b, GlobalPoint3D point, ITMHand hand)
 {
     helper.NotifyAdmins("[" + point.X + ", " + point.Y + ", " + point.Z + "] " + hand.Player.Name + " mined a " + block.ToString() + "! Watch out!");
 }
示例#29
0
 public TotalRoboGame(ITMGame game, ITMMap map, ITMPlayer player, GlobalPoint3D point, BlockFace face)
     : base(game, map, player, point, face)
 {
 }
示例#30
0
 public VehicleSetupScreen(INewGuiMenuScreen screen, ITMGame game, ITMPlayer player, GlobalPoint3D p)
     : base(screen, game, player)
 {
     point = p;
 }