예제 #1
0
        internal static bool RaisePlayerClickingEvent(PlayerClickingEventArgs e)
        {
            var h = PlayerClicking;

            if (h == null)
            {
                return(false);
            }
            h(null, e);
            return(e.Cancel);
        }
예제 #2
0
        public static void ClickedGlass(object sender, PlayerClickingEventArgs e)
        {
            if (e.Player.GunMode && !e.Player.Info.IsHidden && !e.Player.Info.IsFrozen)
            {
                World world = e.Player.World;

                Map map = e.Player.World.Map;

                if (e.Player.GunCache.Values.Contains(e.Coords))
                {
                    if (world.gunPhysics)
                    {
                        e.Player.Send(PacketWriter.MakeSetBlock(e.Coords.X, e.Coords.Y, e.Coords.Z, Block.Glass));

                        if (e.Block == Block.TNT && world.tntPhysics)
                        {
                            if (e.Player.CanFireTNT())
                            {
                                double ksi = 2.0 * Math.PI * (-e.Player.Position.L) / 256.0;
                                double r   = Math.Cos(ksi);
                                double phi = 2.0 * Math.PI * (e.Player.Position.R - 64) / 256.0;

                                Vector3F dir = new Vector3F((float)(r * Math.Cos(phi)), (float)(r * Math.Sin(phi)), (float)(Math.Sin(ksi)));

                                world.AddPhysicsTask(new Particle(world, e.Coords, dir, e.Player, Block.TNT, _TntBulletBehavior), 0);
                            }
                        }
                        else
                        {
                            Block block = e.Block;

                            if (block == Block.Blue)
                            {
                                block = Block.Water;
                            }
                            if (block == Block.Orange)
                            {
                                block = Block.Lava;
                            }

                            double ksi = 2.0 * Math.PI * (-e.Player.Position.L) / 256.0;
                            double r   = Math.Cos(ksi);
                            double phi = 2.0 * Math.PI * (e.Player.Position.R - 64) / 256.0;

                            Vector3F dir = new Vector3F((float)(r * Math.Cos(phi)), (float)(r * Math.Sin(phi)), (float)(Math.Sin(ksi)));

                            world.AddPhysicsTask(new Particle(world, e.Coords, dir, e.Player, block, _BulletBehavior), 0);
                        }
                    }
                }
            }
        }
예제 #3
0
        public static bool RaisePlayerClickingEvent([NotNull] PlayerClickingEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            var h = Clicking;

            if (h == null)
            {
                return(false);
            }
            h(null, e);
            return(e.Cancel);
        }
예제 #4
0
        static bool RaisePlayerClickingEvent([NotNull] PlayerClickingEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            var h = Clicking;

            if (h == null)
            {
                return(false);
            }
            h(null, e);
            e.Player.Info.LastWorld    = e.Player.World.ClassyName;
            e.Player.Info.LastWorldPos = e.Player.Position.ToPlainString();
            return(e.Cancel);
        }