Пример #1
0
        public override void Shoot(MyShootActionEnum action, Vector3 direction)
        {
            base.Shoot(action, direction);

            if (action == MyShootActionEnum.PrimaryAction /* && IsPreheated*/ && Sync.IsServer)
            {
                var block = GetTargetBlock();
                if (block != null && CanWeld(block) && m_activated)
                {
                    Weld();
                }
                else
                {
                    var info = FindProjectedBlock();
                    if (info.raycastResult == MyProjector.BuildCheckResult.OK)
                    {
                        if (MySession.Static.CreativeMode || MyBlockBuilderBase.SpectatorIsBuilding || Owner.CanStartConstruction(info.hitCube.BlockDefinition))
                        {
                            info.cubeProjector.Build(info.hitCube, Owner.ControllerInfo.Controller.Player.Identity.IdentityId, Owner.EntityId);
                        }
                        else
                        {
                            MyBlockPlacerBase.OnMissingComponents(info.hitCube.BlockDefinition);
                        }
                    }
                }
            }
            return;
        }
Пример #2
0
        public override void Shoot(MyShootActionEnum action, Vector3 direction, string gunAction)
        {
            MyAnalyticsHelper.ReportActivityStartIf(!m_activated, this.Owner, "Welding", "Character", "HandTools", "Welder", false);

            base.Shoot(action, direction, gunAction);

            if (action == MyShootActionEnum.PrimaryAction /* && IsPreheated*/ && Sync.IsServer)
            {
                var block = GetTargetBlock();
                if (block != null && CanWeld(block) && m_activated)
                {
                    Weld();
                }
                else
                {
                    var info = FindProjectedBlock();
                    if (info.raycastResult == MyProjector.BuildCheckResult.OK)
                    {
                        if (MySession.Static.CreativeMode || MyBlockBuilderBase.SpectatorIsBuilding || Owner.CanStartConstruction(info.hitCube.BlockDefinition))
                        {
                            info.cubeProjector.Build(info.hitCube, Owner.ControllerInfo.Controller.Player.Identity.IdentityId, Owner.EntityId);
                        }
                        else
                        {
                            MyBlockPlacerBase.OnMissingComponents(info.hitCube.BlockDefinition);
                        }
                    }
                }
            }
            else if (action == MyShootActionEnum.SecondaryAction && Sync.IsServer)
            {
                FillStockpile();
            }
            return;
        }
Пример #3
0
        public override void Shoot(MyShootActionEnum action, Vector3 direction, Vector3D?overrideWeaponPos, string gunAction)
        {
            MyAnalyticsHelper.ReportActivityStartIf(!m_activated, this.Owner, "Welding", "Character", "HandTools", "Welder", true);

            base.Shoot(action, direction, overrideWeaponPos, gunAction);

            if (action == MyShootActionEnum.PrimaryAction /* && IsPreheated*/)
            {
                var block = GetTargetBlock();
                if (block != null && m_activated)
                {
                    if (Sync.IsServer && CanWeld(block))
                    {
                        Weld();
                    }
                }
                else if (Owner == MySession.Static.LocalCharacter)
                {
                    var info = FindProjectedBlock();
                    if (info.raycastResult == BuildCheckResult.OK)
                    {
                        if (IsWithinWorldLimits(info.cubeProjector.CubeGrid, Owner.ControllerInfo.Controller.Player.Identity.IdentityId, info.hitCube.BlockDefinition.BlockPairName))
                        {
                            if (MySession.Static.CreativeMode || MyBlockBuilderBase.SpectatorIsBuilding || Owner.CanStartConstruction(info.hitCube.BlockDefinition) || MySession.Static.IsAdminModeEnabled(Sync.MyId))
                            {
                                info.cubeProjector.Build(info.hitCube, Owner.ControllerInfo.Controller.Player.Identity.IdentityId, Owner.EntityId, builtBy: Owner.ControllerInfo.Controller.Player.Identity.IdentityId);
                            }
                            else
                            {
                                MyBlockPlacerBase.OnMissingComponents(info.hitCube.BlockDefinition);
                            }
                        }
                        else
                        {
                            MyGuiAudio.PlaySound(MyGuiSounds.HudUnable);
                            MyHud.Notifications.Add(MyNotificationSingletons.ShipOverLimits);
                        }
                    }
                }
            }
            else if (action == MyShootActionEnum.SecondaryAction && Sync.IsServer)
            {
                FillStockpile();
            }
            return;
        }