Beispiel #1
0
    public static bool IsSpeeding(BasePlayer ply, TickInterpolator ticks, float deltaTime)
    {
        ply.speedhackPauseTime = Mathf.Max(0.0f, ply.speedhackPauseTime - deltaTime);
        if ((double)ply.speedhackPauseTime > 0.0 || ConVar.AntiHack.speedhack_protection <= 0)
        {
            return(false);
        }
        int       num1      = Object.op_Equality((Object)((Component)ply).get_transform().get_parent(), (Object)null) ? 1 : 0;
        Matrix4x4 matrix4x4 = num1 != 0 ? Matrix4x4.get_identity() : ((Component)ply).get_transform().get_parent().get_localToWorldMatrix();
        Vector3   worldPos  = num1 != 0 ? ticks.StartPoint : ((Matrix4x4) ref matrix4x4).MultiplyPoint3x4(ticks.StartPoint);
        Vector3   vector3   = Vector3.op_Subtraction(num1 != 0 ? ticks.EndPoint : ((Matrix4x4) ref matrix4x4).MultiplyPoint3x4(ticks.EndPoint), worldPos);
        float     num2      = Vector3Ex.Magnitude2D(vector3);

        if ((double)num2 > 0.0)
        {
            float num3 = Mathf.Max(0.0f, Vector3.Dot(Vector3Ex.XZ3D(Object.op_Implicit((Object)TerrainMeta.HeightMap) ? TerrainMeta.HeightMap.GetNormal(worldPos) : Vector3.get_up()), Vector3Ex.XZ3D(vector3))) * ConVar.AntiHack.speedhack_slopespeed * deltaTime;
            num2 = Mathf.Max(0.0f, num2 - num3);
        }
        float running = 1f;
        float ducking = 0.0f;

        if (ConVar.AntiHack.speedhack_protection >= 2)
        {
            running = ply.IsRunning() ? 1f : 0.0f;
            ducking = ply.IsDucked() || ply.IsSwimming() ? 1f : 0.0f;
        }
        float num4 = Mathf.Max(ConVar.AntiHack.speedhack_forgiveness, 0.1f);
        float num5 = 2f * num4;

        ply.speedhackDistance = Mathf.Clamp((float)((double)ply.speedhackDistance + (double)num2 - (double)deltaTime * (double)ply.GetSpeed(running, ducking)), -num5, num5);
        return((double)ply.speedhackDistance > (double)num4);
    }
    public override void Process(uint seed)
    {
        TerrainHeightMap heightMap = TerrainMeta.HeightMap;
        Vector3          position1 = TerrainMeta.Position;
        Vector3          size      = TerrainMeta.Size;
        float            x1        = (float)position1.x;
        float            z1        = (float)position1.z;
        float            num1      = (float)(position1.x + size.x);
        float            num2      = (float)(position1.z + size.z);

        PlaceMonument.SpawnInfo spawnInfo1 = new PlaceMonument.SpawnInfo();
        int num3 = int.MinValue;
        Prefab <MonumentInfo> prefab1 = Prefab.Load <MonumentInfo>(this.Monument.resourceID, (GameManager)null, (PrefabAttribute.Library)null);

        for (int index = 0; index < 10000; ++index)
        {
            float  x2     = SeedRandom.Range(ref seed, x1, num1);
            float  z2     = SeedRandom.Range(ref seed, z1, num2);
            float  normX  = TerrainMeta.NormalizeX(x2);
            float  normZ  = TerrainMeta.NormalizeZ(z2);
            float  num4   = SeedRandom.Value(ref seed);
            double factor = (double)this.Filter.GetFactor(normX, normZ);
            if (factor * factor >= (double)num4)
            {
                float   height = heightMap.GetHeight(normX, normZ);
                Vector3 pos;
                ((Vector3) ref pos).\u002Ector(x2, height, z2);
                Quaternion localRotation = prefab1.Object.get_transform().get_localRotation();
                Vector3    localScale    = prefab1.Object.get_transform().get_localScale();
                prefab1.ApplyDecorComponents(ref pos, ref localRotation, ref localScale);
                if ((!Object.op_Implicit((Object)prefab1.Component) || prefab1.Component.CheckPlacement(pos, localRotation, localScale)) && (prefab1.ApplyTerrainAnchors(ref pos, localRotation, localScale, this.Filter) && prefab1.ApplyTerrainChecks(pos, localRotation, localScale, this.Filter)) && (prefab1.ApplyTerrainFilters(pos, localRotation, localScale, (SpawnFilter)null) && prefab1.ApplyWaterChecks(pos, localRotation, localScale) && !prefab1.CheckEnvironmentVolumes(pos, localRotation, localScale, EnvironmentType.Underground)))
                {
                    PlaceMonument.SpawnInfo spawnInfo2 = new PlaceMonument.SpawnInfo();
                    spawnInfo2.prefab   = (Prefab)prefab1;
                    spawnInfo2.position = pos;
                    spawnInfo2.rotation = localRotation;
                    spawnInfo2.scale    = localScale;
                    int num5 = -Mathf.RoundToInt(Vector3Ex.Magnitude2D(pos));
                    if (num5 > num3)
                    {
                        num3       = num5;
                        spawnInfo1 = spawnInfo2;
                    }
                }
            }
        }
        if (num3 == int.MinValue)
        {
            return;
        }
        Prefab     prefab2   = spawnInfo1.prefab;
        Vector3    position2 = spawnInfo1.position;
        Quaternion rotation  = spawnInfo1.rotation;
        Vector3    scale     = spawnInfo1.scale;

        prefab2.ApplyTerrainPlacements(position2, rotation, scale);
        prefab2.ApplyTerrainModifiers(position2, rotation, scale);
        World.AddPrefab("Monument", prefab2.ID, position2, rotation, scale);
    }
    public override void VehicleFixedUpdate()
    {
        base.VehicleFixedUpdate();
        float num1 = this.TimeSinceDriver();
        bool  b    = this.EngineOn() && !this.IsFlipped() && ((double)this.healthFraction > 0.0 && this.HasFuel(false)) && (double)num1 < 75.0;

        if ((double)num1 > 15.0)
        {
            this.steering += Mathf.InverseLerp(15f, 30f, num1);
            this.steering  = Mathf.Clamp(-1f, 1f, this.steering);
            if ((double)num1 > 75.0)
            {
                this.gasPedal = 0.0f;
            }
        }
        this.SetFlag(BaseEntity.Flags.Reserved3, (double)this.steering > 0.0, false, false);
        this.SetFlag(BaseEntity.Flags.Reserved4, (double)this.steering < 0.0, false, false);
        this.SetFlag(BaseEntity.Flags.Reserved1, b, false, false);
        this.SetFlag(BaseEntity.Flags.Reserved2, this.EngineOn() && (double)this.gasPedal != 0.0, false, false);
        this.SetFlag(BaseEntity.Flags.Reserved5, (double)this.buoyancy.submergedFraction > 0.850000023841858, false, false);
        this.SetFlag(BaseEntity.Flags.Reserved6, this.HasFuel(false), false, false);
        Vector3 velocity = this.myRigidBody.get_velocity();

        this.SetFlag(BaseEntity.Flags.Reserved7, ((double)((Vector3) ref velocity).get_magnitude() < 1.0 ? 1 : 0) != 0, false, false);
        this.SetFlag(BaseEntity.Flags.Reserved8, this.RecentlyPushed(), false, false);
        this.SendNetworkUpdate_Flags();
        this.UpdateDrag();
        if (this.dying)
        {
            this.buoyancy.buoyancyScale = Mathf.Lerp(this.buoyancy.buoyancyScale, 0.0f, Time.get_fixedDeltaTime() * 0.1f);
        }
        else
        {
            float num2 = 1f;
            float num3 = Mathf.InverseLerp(1f, 10f, Vector3Ex.Magnitude2D(this.myRigidBody.get_velocity())) * 0.5f * this.healthFraction;
            if (!this.EngineOn())
            {
                num3 = 0.0f;
            }
            float num4 = (float)(1.0 - 0.300000011920929 * (1.0 - (double)this.healthFraction));
            this.buoyancy.buoyancyScale = (num2 + num3) * num4;
        }
        if (!this.EngineOn())
        {
            return;
        }
        this.UseFuel(Time.get_fixedDeltaTime() * (this.HasFlag(BaseEntity.Flags.Reserved2) ? 1f : 0.0333f));
        this.lastUsedFuelTime = Time.get_time();
    }
Beispiel #4
0
    protected override void ApplySplat(Matrix4x4 localToWorld, Matrix4x4 worldToLocal)
    {
        if ((double)this.Radius == 0.0)
        {
            this.Radius = (float)this.extents.x;
        }
        bool should0 = this.ShouldSplat(1);
        bool should1 = this.ShouldSplat(2);
        bool should2 = this.ShouldSplat(4);
        bool should3 = this.ShouldSplat(8);
        bool should4 = this.ShouldSplat(16);
        bool should5 = this.ShouldSplat(32);
        bool should6 = this.ShouldSplat(64);
        bool should7 = this.ShouldSplat(128);

        if (!should0 && !should1 && (!should2 && !should3) && (!should4 && !should5 && (!should6 && !should7)))
        {
            return;
        }
        TextureData splat0data = new TextureData(this.splatmap0);
        TextureData splat1data = new TextureData(this.splatmap1);

        TerrainMeta.SplatMap.ForEachParallel(((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(-this.Radius, 0.0f, -this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(this.Radius, 0.0f, -this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(-this.Radius, 0.0f, this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(this.Radius, 0.0f, this.Radius))), (Action <int, int>)((x, z) =>
        {
            GenerateCliffSplat.Process(x, z);
            float normZ = TerrainMeta.SplatMap.Coordinate(z);
            float normX = TerrainMeta.SplatMap.Coordinate(x);
            Vector3 vector3_1;
            ((Vector3) ref vector3_1).\u002Ector(TerrainMeta.DenormalizeX(normX), 0.0f, TerrainMeta.DenormalizeZ(normZ));
            Vector3 vector3_2 = Vector3.op_Subtraction(((Matrix4x4) ref worldToLocal).MultiplyPoint3x4(vector3_1), this.offset);
            float opacity     = Mathf.InverseLerp(this.Radius, this.Radius - this.Fade + Noise.Billow((float)vector3_1.x, (float)vector3_1.z, 4, 0.005f, 0.25f * this.Fade, 2f, 0.5f), Vector3Ex.Magnitude2D(vector3_2));
            if ((double)opacity == 0.0)
            {
                return;
            }
            Vector4 interpolatedVector1 = splat0data.GetInterpolatedVector((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z));
            Vector4 interpolatedVector2 = splat1data.GetInterpolatedVector((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z));
            if (!should0)
            {
                interpolatedVector1.x = (__Null)0.0;
            }
            if (!should1)
            {
                interpolatedVector1.y = (__Null)0.0;
            }
            if (!should2)
            {
                interpolatedVector1.z = (__Null)0.0;
            }
            if (!should3)
            {
                interpolatedVector1.w = (__Null)0.0;
            }
            if (!should4)
            {
                interpolatedVector2.x = (__Null)0.0;
            }
            if (!should5)
            {
                interpolatedVector2.y = (__Null)0.0;
            }
            if (!should6)
            {
                interpolatedVector2.z = (__Null)0.0;
            }
            if (!should7)
            {
                interpolatedVector2.w = (__Null)0.0;
            }
            TerrainMeta.SplatMap.SetSplatRaw(x, z, interpolatedVector1, interpolatedVector2, opacity);
        }));
    }
Beispiel #5
0
    protected override void ApplyHeight(Matrix4x4 localToWorld, Matrix4x4 worldToLocal)
    {
        if ((double)this.Radius == 0.0)
        {
            this.Radius = (float)this.extents.x;
        }
        bool        useBlendMap = Object.op_Inequality((Object)this.blendmap, (Object)null);
        Vector3     position    = ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.get_zero());
        TextureData heightdata  = new TextureData(this.heightmap);
        TextureData blenddata   = useBlendMap ? new TextureData(this.blendmap) : new TextureData();

        TerrainMeta.HeightMap.ForEachParallel(((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(-this.Radius, 0.0f, -this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(this.Radius, 0.0f, -this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(-this.Radius, 0.0f, this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(this.Radius, 0.0f, this.Radius))), (Action <int, int>)((x, z) =>
        {
            float normZ = TerrainMeta.HeightMap.Coordinate(z);
            float normX = TerrainMeta.HeightMap.Coordinate(x);
            Vector3 vector3_1;
            ((Vector3) ref vector3_1).\u002Ector(TerrainMeta.DenormalizeX(normX), 0.0f, TerrainMeta.DenormalizeZ(normZ));
            Vector3 vector3_2 = Vector3.op_Subtraction(((Matrix4x4) ref worldToLocal).MultiplyPoint3x4(vector3_1), this.offset);
            float num1        = !useBlendMap ? Mathf.InverseLerp(this.Radius, this.Radius - this.Fade + Noise.Billow((float)vector3_1.x, (float)vector3_1.z, 4, 0.005f, 0.25f * this.Fade, 2f, 0.5f), Vector3Ex.Magnitude2D(vector3_2)) : (float)blenddata.GetInterpolatedVector((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z)).w;
            if ((double)num1 == 0.0)
            {
                return;
            }
            float num2   = TerrainMeta.NormalizeY((float)(position.y + this.offset.y + (double)heightdata.GetInterpolatedHalf((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z)) * this.size.y));
            float height = Mathf.SmoothStep(TerrainMeta.HeightMap.GetHeight01(x, z), num2, num1);
            TerrainMeta.HeightMap.SetHeight(x, z, height);
        }));
    }
Beispiel #6
0
    protected override void ApplyBiome(Matrix4x4 localToWorld, Matrix4x4 worldToLocal)
    {
        if ((double)this.Radius == 0.0)
        {
            this.Radius = (float)this.extents.x;
        }
        bool should0 = this.ShouldBiome(1);
        bool should1 = this.ShouldBiome(2);
        bool should2 = this.ShouldBiome(4);
        bool should3 = this.ShouldBiome(8);

        if (!should0 && !should1 && (!should2 && !should3))
        {
            return;
        }
        TextureData biomedata = new TextureData(this.biomemap);

        TerrainMeta.BiomeMap.ForEachParallel(((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(-this.Radius, 0.0f, -this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(this.Radius, 0.0f, -this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(-this.Radius, 0.0f, this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(this.Radius, 0.0f, this.Radius))), (Action <int, int>)((x, z) =>
        {
            float normZ = TerrainMeta.BiomeMap.Coordinate(z);
            float normX = TerrainMeta.BiomeMap.Coordinate(x);
            Vector3 vector3_1;
            ((Vector3) ref vector3_1).\u002Ector(TerrainMeta.DenormalizeX(normX), 0.0f, TerrainMeta.DenormalizeZ(normZ));
            Vector3 vector3_2 = Vector3.op_Subtraction(((Matrix4x4) ref worldToLocal).MultiplyPoint3x4(vector3_1), this.offset);
            float opacity     = Mathf.InverseLerp(this.Radius, this.Radius - this.Fade + Noise.Billow((float)vector3_1.x, (float)vector3_1.z, 4, 0.005f, 0.25f * this.Fade, 2f, 0.5f), Vector3Ex.Magnitude2D(vector3_2));
            if ((double)opacity == 0.0)
            {
                return;
            }
            Vector4 interpolatedVector = biomedata.GetInterpolatedVector((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z));
            if (!should0)
            {
                interpolatedVector.x = (__Null)0.0;
            }
            if (!should1)
            {
                interpolatedVector.y = (__Null)0.0;
            }
            if (!should2)
            {
                interpolatedVector.z = (__Null)0.0;
            }
            if (!should3)
            {
                interpolatedVector.w = (__Null)0.0;
            }
            TerrainMeta.BiomeMap.SetBiomeRaw(x, z, interpolatedVector, opacity);
        }));
    }
Beispiel #7
0
    protected override void ApplyAlpha(Matrix4x4 localToWorld, Matrix4x4 worldToLocal)
    {
        if ((double)this.Radius == 0.0)
        {
            this.Radius = (float)this.extents.x;
        }
        TextureData alphadata = new TextureData(this.alphamap);

        TerrainMeta.AlphaMap.ForEachParallel(((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(-this.Radius, 0.0f, -this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(this.Radius, 0.0f, -this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(-this.Radius, 0.0f, this.Radius))), ((Matrix4x4) ref localToWorld).MultiplyPoint3x4(Vector3.op_Addition(this.offset, new Vector3(this.Radius, 0.0f, this.Radius))), (Action <int, int>)((x, z) =>
        {
            float normZ = TerrainMeta.AlphaMap.Coordinate(z);
            float normX = TerrainMeta.AlphaMap.Coordinate(x);
            Vector3 vector3_1;
            ((Vector3) ref vector3_1).\u002Ector(TerrainMeta.DenormalizeX(normX), 0.0f, TerrainMeta.DenormalizeZ(normZ));
            Vector3 vector3_2 = Vector3.op_Subtraction(((Matrix4x4) ref worldToLocal).MultiplyPoint3x4(vector3_1), this.offset);
            float opacity     = Mathf.InverseLerp(this.Radius, this.Radius - this.Fade + Noise.Billow((float)vector3_1.x, (float)vector3_1.z, 4, 0.005f, 0.25f * this.Fade, 2f, 0.5f), Vector3Ex.Magnitude2D(vector3_2));
            if ((double)opacity == 0.0)
            {
                return;
            }
            float w = (float)alphadata.GetInterpolatedVector((float)((vector3_2.x + this.extents.x) / this.size.x), (float)((vector3_2.z + this.extents.z) / this.size.z)).w;
            TerrainMeta.AlphaMap.SetAlpha(x, z, w, opacity);
        }));
    }
Beispiel #8
0
 public static bool TestFlying(
     BasePlayer ply,
     Vector3 oldPos,
     Vector3 newPos,
     bool verifyGrounded)
 {
     ply.isInAir    = false;
     ply.isOnPlayer = false;
     if (verifyGrounded)
     {
         float   flyhackExtrusion = ConVar.AntiHack.flyhack_extrusion;
         Vector3 pos = Vector3.op_Multiply(Vector3.op_Addition(oldPos, newPos), 0.5f);
         if (!ply.OnLadder() && !WaterLevel.Test(Vector3.op_Subtraction(pos, new Vector3(0.0f, flyhackExtrusion, 0.0f))) && (EnvironmentManager.Get(pos) & EnvironmentType.Elevator) == (EnvironmentType)0)
         {
             float   flyhackMargin = ConVar.AntiHack.flyhack_margin;
             float   radius        = ply.GetRadius();
             float   height        = ply.GetHeight(false);
             Vector3 vector3_1     = Vector3.op_Addition(pos, new Vector3(0.0f, radius - flyhackExtrusion, 0.0f));
             Vector3 vector3_2     = Vector3.op_Addition(pos, new Vector3(0.0f, height - radius, 0.0f));
             float   num1          = radius - flyhackMargin;
             ply.isInAir = !Physics.CheckCapsule(vector3_1, vector3_2, num1, 1503731969, (QueryTriggerInteraction)1);
             if (ply.isInAir)
             {
                 int num2 = Physics.OverlapCapsuleNonAlloc(vector3_1, vector3_2, num1, AntiHack.buffer, 131072, (QueryTriggerInteraction)1);
                 for (int index = 0; index < num2; ++index)
                 {
                     BasePlayer baseEntity = ((Component)AntiHack.buffer[index]).get_gameObject().ToBaseEntity() as BasePlayer;
                     if (!Object.op_Equality((Object)baseEntity, (Object)null) && !Object.op_Equality((Object)baseEntity, (Object)ply) && (!baseEntity.isInAir && !baseEntity.isOnPlayer) && (!baseEntity.TriggeredAntiHack(1f, float.PositiveInfinity) && !baseEntity.IsSleeping()))
                     {
                         ply.isOnPlayer = true;
                         ply.isInAir    = false;
                         break;
                     }
                 }
                 for (int index = 0; index < AntiHack.buffer.Length; ++index)
                 {
                     AntiHack.buffer[index] = (Collider)null;
                 }
             }
         }
     }
     else
     {
         ply.isInAir = !ply.OnLadder() && !ply.IsSwimming() && !ply.IsOnGround();
     }
     if (ply.isInAir)
     {
         bool    flag    = false;
         Vector3 vector3 = Vector3.op_Subtraction(newPos, oldPos);
         double  num1    = (double)Mathf.Abs((float)vector3.y);
         float   num2    = Vector3Ex.Magnitude2D(vector3);
         if (vector3.y >= 0.0)
         {
             ply.flyhackDistanceVertical += (float)vector3.y;
             flag = true;
         }
         double num3 = (double)num2;
         if (num1 < num3)
         {
             ply.flyhackDistanceHorizontal += num2;
             flag = true;
         }
         if (flag)
         {
             float num4 = ply.GetJumpHeight() + ConVar.AntiHack.flyhack_forgiveness_vertical;
             if ((double)ply.flyhackDistanceVertical > (double)num4)
             {
                 return(true);
             }
             float num5 = 5f + ConVar.AntiHack.flyhack_forgiveness_horizontal;
             if ((double)ply.flyhackDistanceHorizontal > (double)num5)
             {
                 return(true);
             }
         }
     }
     else
     {
         ply.flyhackDistanceVertical   = 0.0f;
         ply.flyhackDistanceHorizontal = 0.0f;
     }
     return(false);
 }
Beispiel #9
0
    public static bool Check(
        BasePlayer player,
        Construction construction,
        Vector3 position,
        Quaternion rotation)
    {
        OBB obb;

        ((OBB) ref obb).\u002Ector(position, rotation, construction.bounds);
        float radius = ((Vector3) ref obb.extents).get_magnitude() + 2f;
        List <BuildingBlock> list = (List <BuildingBlock>)Pool.GetList <BuildingBlock>();

        Vis.Entities <BuildingBlock>((Vector3)obb.position, radius, list, 2097152, (QueryTriggerInteraction)2);
        uint num = 0;

        for (int index = 0; index < list.Count; ++index)
        {
            BuildingBlock buildingBlock   = list[index];
            Construction  construction1   = construction;
            Construction  blockDefinition = buildingBlock.blockDefinition;
            Vector3       vector3_1       = position;
            Vector3       position1       = ((Component)buildingBlock).get_transform().get_position();
            Quaternion    quaternion      = rotation;
            Quaternion    rotation1       = ((Component)buildingBlock).get_transform().get_rotation();
            BuildingProximity.ProximityInfo proximity1    = BuildingProximity.GetProximity(construction1, vector3_1, quaternion, blockDefinition, position1, rotation1);
            BuildingProximity.ProximityInfo proximity2    = BuildingProximity.GetProximity(blockDefinition, position1, rotation1, construction1, vector3_1, quaternion);
            BuildingProximity.ProximityInfo proximityInfo = new BuildingProximity.ProximityInfo();
            proximityInfo.hit        = proximity1.hit || proximity2.hit;
            proximityInfo.connection = proximity1.connection || proximity2.connection;
            if ((double)proximity1.sqrDist <= (double)proximity2.sqrDist)
            {
                proximityInfo.line    = proximity1.line;
                proximityInfo.sqrDist = proximity1.sqrDist;
            }
            else
            {
                proximityInfo.line    = proximity2.line;
                proximityInfo.sqrDist = proximity2.sqrDist;
            }
            if (proximityInfo.connection)
            {
                BuildingManager.Building building = buildingBlock.GetBuilding();
                if (building != null)
                {
                    BuildingPrivlidge buildingPrivilege = building.GetDominatingBuildingPrivilege();
                    if (Object.op_Inequality((Object)buildingPrivilege, (Object)null))
                    {
                        if (!construction.canBypassBuildingPermission && !buildingPrivilege.IsAuthed(player))
                        {
                            Construction.lastPlacementError = "Cannot attach to unauthorized building";
                            // ISSUE: cast to a reference type
                            Pool.FreeList <BuildingBlock>((List <M0>&) ref list);
                            return(true);
                        }
                        if (num == 0U)
                        {
                            num = building.ID;
                        }
                        else if ((int)num != (int)building.ID)
                        {
                            Construction.lastPlacementError = "Cannot connect two buildings with cupboards";
                            // ISSUE: cast to a reference type
                            Pool.FreeList <BuildingBlock>((List <M0>&) ref list);
                            return(true);
                        }
                    }
                }
            }
            if (proximityInfo.hit)
            {
                Vector3 vector3_2 = Vector3.op_Subtraction((Vector3)proximityInfo.line.point1, (Vector3)proximityInfo.line.point0);
                if ((double)Mathf.Abs((float)vector3_2.y) <= 1.49000000953674 && (double)Vector3Ex.Magnitude2D(vector3_2) <= 1.49000000953674)
                {
                    Construction.lastPlacementError = "Not enough space";
                    // ISSUE: cast to a reference type
                    Pool.FreeList <BuildingBlock>((List <M0>&) ref list);
                    return(true);
                }
            }
        }
        // ISSUE: cast to a reference type
        Pool.FreeList <BuildingBlock>((List <M0>&) ref list);
        return(false);
    }