Beispiel #1
0
        public override void FireBullet(Player player, Vector3 origin, Vector3 dir, Vector3 recoil,
                                        int blockDamage, float playerDamage, float maxDist = float.MaxValue)
        {
            Ray ray = new Ray(origin, dir + recoil);
            TerrainRaycastResult result = TerrainPhysics.Raycast(ray, true, maxDist);

            if (result.Intersects)
            {
                result.Chunk.DamageBlock(result.BlockIndex.Value, blockDamage);
                if (DashCMD.GetCVar <bool>("cl_impacts"))
                {
                    debugRenderer.AddBulletImpact(ray.Origin + ray.Direction * result.IntersectionDistance.Value, Color.Red);
                }
            }
        }