Ejemplo n.º 1
0
        private void SmallGridIntersect(MyEntity ent)
        {
            var grid = (MyCubeGrid)ent;

            if (ent == null || grid == null || grid.MarkedForClose || grid.Closed)
            {
                return;
            }
            if (GridInside(grid, MyOrientedBoundingBoxD.CreateFromBoundingBox(grid.PositionComp.WorldAABB)))
            {
                return;
            }
            EntIntersectInfo entInfo;

            WebEnts.TryGetValue(ent, out entInfo);
            if (entInfo == null)
            {
                return;
            }

            if (_isServer)
            {
                CustomCollision.SmallIntersect(entInfo, FewDmgBlocks, DestroyedBlocks, ForceData, ImpulseData, grid, DetectMatrixOutside, DetectMatrixOutsideInv, Session.Enforced.DisableBlockDamage == 0);
            }
            else
            {
                CustomCollision.ClientSmallIntersect(entInfo, grid, DetectMatrixOutside, DetectMatrixOutsideInv, Eject);
            }
            var contactpoint = entInfo.ContactPoint;

            entInfo.ContactPoint = Vector3D.NegativeInfinity;
            if (contactpoint != Vector3D.NegativeInfinity)
            {
                entInfo.Touched = true;
                WebDamage       = true;
                if (!_isServer)
                {
                    return;
                }

                var damage = entInfo.Damage * DsState.State.ModulateEnergy;
                if (_mpActive)
                {
                    if (_isServer)
                    {
                        AddShieldHit(grid.EntityId, damage, Session.Instance.MPKinetic, null, false, contactpoint);
                    }
                }
                else
                {
                    Absorb             += damage;
                    ImpactSize          = entInfo.Damage;
                    WorldImpactPosition = contactpoint;
                }
                entInfo.Damage = 0;
            }
        }