Beispiel #1
0
        bool TickGun(AmmunitionData args)
        {
            while (true)
            {
                Vec3U16 pos = args.PosAt(args.iterations);
                args.iterations++;

                BlockID cur = p.level.GetBlock(pos.X, pos.Y, pos.Z);
                if (cur == Block.Invalid)
                {
                    return(false);
                }
                if (cur != Block.Air && !args.all.Contains(pos) && OnHitBlock(args, pos, cur))
                {
                    return(false);
                }

                p.level.BroadcastChange(pos.X, pos.Y, pos.Z, args.block);
                args.visible.Add(pos);
                args.all.Add(pos);

                Player pl = PlayerAt(p, pos, true);
                if (pl != null)
                {
                    OnHitPlayer(args, pl); return(false);
                }
                if (TickMove(args))
                {
                    return(true);
                }
            }
        }