private void EmpDrawExplosion()
        {
            _effect?.Stop();
            var epiCenter = EmpWork.EpiCenter;
            var rangeCap  = EmpWork.RangeCap;
            var radius    = (float)(rangeCap * 0.01);
            var scale     = 7f;

            if (radius < 7)
            {
                scale = radius;
            }

            var matrix = MatrixD.CreateTranslation(epiCenter);

            MyParticlesManager.TryCreateParticleEffect(6666, out _effect, ref matrix, ref epiCenter, uint.MaxValue, true); // 15, 16, 24, 25, 28, (31, 32) 211 215 53
            if (_effect == null)
            {
                EmpWork.EmpDrawComplete();
                return;
            }

            if (Enforced.Debug >= 2)
            {
                Log.Line($"[EmpDraw] scale:{scale} - radius:{radius} - rangeCap:{rangeCap}");
            }

            _effect.UserRadiusMultiplier = radius;
            _effect.UserScale            = scale;

            //TODO fix if keens add support again
            //_effect.UserColorMultiplier = new Vector4(255, 255, 255, 10);
            _effect.Play();
            EmpWork.EmpDrawComplete();
        }
        public IActionResult Details()
        {
            Project p = new Project()
            {
                Pid = "P0001", Pname = "HealthCare"
            };
            Employee e = new Employee()
            {
                Eid = 1, Ename = "Rohan", Pid = "P0001"
            };
            EmpWork ew = new EmpWork()
            {
                Eid = e.Eid, Ename = e.Ename, Pname = p.Pname
            };

            return(View(ew));
        }
Example #3
0
        private void Timings()
        {
            Tick     = (uint)(Session.ElapsedPlayTime.TotalMilliseconds * TickTimeDiv);
            Tick20   = Tick % 20 == 0;
            Tick30   = Tick % 30 == 0;
            Tick60   = Tick % 60 == 0;
            Tick60   = Tick % 60 == 0;
            Tick180  = Tick % 180 == 0;
            Tick300  = Tick % 300 == 0;
            Tick600  = Tick % 600 == 0;
            Tick1800 = Tick % 1800 == 0;

            if (_count++ == 59)
            {
                _count = 0;
                _lCount++;
                if (_lCount == 10)
                {
                    _lCount = 0;
                    _eCount++;
                    if (_eCount == 10)
                    {
                        _eCount        = 0;
                        _previousEntId = -1;
                    }
                }
            }
            if (!GameLoaded)
            {
                if (!MiscLoaded)
                {
                    if (SessionReady && GlobalProtect.Count > 0 && (IsServer || !IsServer && ClientLoadCount++ > 60))
                    {
                        UtilsStatic.GetDefinitons();
                        if (!IsServer)
                        {
                            Players.TryAdd(MyAPIGateway.Session.Player.IdentityId, MyAPIGateway.Session.Player);
                        }
                        Api.Init();
                        MiscLoaded = true;
                        GameLoaded = true;
                    }
                }

                if (MiscLoaded && !WarHeadLoaded && WarTerminalReset != null)
                {
                    WarTerminalReset.ShowInTerminal = true;
                    WarTerminalReset = null;
                    WarHeadLoaded    = true;
                    GameLoaded       = true;
                }
            }

            if (EmpWork.EventRunning && EmpWork.Computed)
            {
                EmpWork.EventComplete();
            }

            if (Tick20)
            {
                Scale();
                EntSlotTick = Tick % (180 / EntSlotScaler) == 0;
                if (EntSlotTick)
                {
                    LoadBalancer();
                }
            }
            else
            {
                EntSlotTick = false;
            }
        }
        private void ComputeEmpBlast()
        {
            var          epiCenter    = EmpWork.EpiCenter;
            var          rangeCap     = EmpWork.RangeCap;
            var          dirYield     = EmpWork.DirYield;
            const double BlockInflate = 1.25;

            GetFilteredItems(epiCenter, rangeCap, dirYield);

            foreach (var cube in _warHeadCubeHits)
            {
                WarHeadHit warHit;
                var        foundSphere = _warHeadGridShapes.TryGetValue(cube.CubeGrid, out warHit);
                if (foundSphere && warHit.Sphere.Contains(cube.PositionComp.WorldAABB.Center) != ContainmentType.Disjoint)
                {
                    var clearance = cube.CubeGrid.GridSize * BlockInflate;
                    var testDir   = Vector3D.Normalize(epiCenter - cube.PositionComp.WorldAABB.Center);
                    var testPos   = cube.PositionComp.WorldAABB.Center + (testDir * clearance);
                    var hit       = cube.CubeGrid.RayCastBlocks(epiCenter, testPos);

                    if (hit == null)
                    {
                        BlockState blockState;
                        uint       endTick;

                        var cubeId   = cube.EntityId;
                        var oldState = _warEffectCubes.TryGetValue(cubeId, out blockState);

                        if (oldState)
                        {
                            endTick = blockState.Endtick + (Tick + (warHit.Duration + 1));
                        }
                        else
                        {
                            endTick = Tick + (warHit.Duration + 1);
                        }
                        var startTick = (((Tick + 1) / 20) * 20) + 20;

                        _warEffectCubes[cube.EntityId] = new BlockState(cube, startTick, endTick);
                    }
                    else if (cube.SlimBlock == cube.CubeGrid.GetCubeBlock(hit.Value))
                    {
                        BlockState blockState;
                        uint       endTick;

                        var cubeId   = cube.EntityId;
                        var oldState = _warEffectCubes.TryGetValue(cubeId, out blockState);

                        if (oldState)
                        {
                            endTick = blockState.Endtick + (Tick + (warHit.Duration + 1));
                        }
                        else
                        {
                            endTick = Tick + (warHit.Duration + 1);
                        }
                        var startTick = (((Tick + 1) / 20) * 20) + 20;

                        _warEffectCubes[cube.EntityId] = new BlockState(cube, startTick, endTick);
                    }
                }
            }
            EmpWork.ComputeComplete();
        }
        private void PrepEmpBlast()
        {
            var stackCount   = 0;
            var warHeadSize  = 0;
            var warHeadYield = 0d;
            var epiCenter    = Vector3D.Zero;

            WarHeadBlast empChild;

            while (EmpStore.TryDequeue(out empChild))
            {
                if (empChild.CustomData.Contains("@EMP"))
                {
                    stackCount++;
                    warHeadSize  = empChild.WarSize;
                    warHeadYield = empChild.Yield;
                    epiCenter   += empChild.Position;
                }
            }

            if (stackCount == 0)
            {
                EmpWork.EventComplete();
                return;
            }
            epiCenter /= stackCount;
            var rangeCap = MathHelper.Clamp(stackCount * warHeadYield, warHeadYield, SyncDist);

            _warHeadGridHits.Clear();
            _pruneWarGrids.Clear();

            var sphere = new BoundingSphereD(epiCenter, rangeCap);

            MyGamePruningStructure.GetAllTopMostEntitiesInSphere(ref sphere, _pruneWarGrids);

            foreach (var ent in _pruneWarGrids)
            {
                var grid = ent as MyCubeGrid;
                if (grid != null)
                {
                    ShieldGridComponent sComp;
                    grid.Components.TryGet(out sComp);
                    if (sComp?.DefenseShields != null && sComp.DefenseShields.NotFailed)
                    {
                        continue;
                    }

                    var gridCenter = grid.PositionComp.WorldVolume.Center;
                    var testDir    = Vector3D.Normalize(gridCenter - epiCenter);
                    var impactPos  = gridCenter + (testDir * -grid.PositionComp.WorldVolume.Radius);

                    IHitInfo hitInfo;
                    MyAPIGateway.Physics.CastRay(epiCenter, impactPos, out hitInfo, CollisionLayers.DefaultCollisionLayer);
                    if (hitInfo?.HitEntity == null)
                    {
                        _warHeadGridHits.Add(grid);
                    }
                }
            }

            EmpWork.StoreEmpBlast(epiCenter, warHeadSize, warHeadYield, stackCount, rangeCap);
        }
Example #6
0
        private void Timings()
        {
            _newFrame = true;
            Tick      = (uint)(Session.ElapsedPlayTime.TotalMilliseconds * TickTimeDiv);
            Tick20    = Tick % 20 == 0;
            Tick60    = Tick % 60 == 0;
            Tick60    = Tick % 60 == 0;
            Tick180   = Tick % 180 == 0;
            Tick600   = Tick % 600 == 0;
            Tick1800  = Tick % 1800 == 0;

            if (_count++ == 59)
            {
                _count = 0;
                _lCount++;
                if (_lCount == 10)
                {
                    _lCount = 0;
                    _eCount++;
                    if (_eCount == 10)
                    {
                        _eCount = 0;
                    }
                }
            }
            if (!GameLoaded && Tick > 100)
            {
                if (!WarHeadLoaded && WarTerminalReset != null)
                {
                    WarTerminalReset.ShowInTerminal = true;
                    WarTerminalReset = null;
                    WarHeadLoaded    = true;
                }

                if (!MiscLoaded)
                {
                    MiscLoaded = true;
                    UtilsStatic.GetDefinitons();
                    if (!IsServer)
                    {
                        Players.TryAdd(MyAPIGateway.Session.Player.IdentityId, MyAPIGateway.Session.Player);
                    }
                }
                GameLoaded = true;
            }

            if (EmpWork.EventRunning && EmpWork.Computed)
            {
                EmpWork.EventComplete();
            }

            if (Tick20)
            {
                Scale();
                EntSlotTick = Tick % (180 / EntSlotScaler) == 0;
                if (EntSlotTick)
                {
                    LoadBalancer();
                }
            }
            else
            {
                EntSlotTick = false;
            }
        }