public static void Postfix()
            {
                if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay())
                {
                    if (!dontAutoselectAfterFiring && !Controls.IsPressed(CCInput.FIRE_WEAPON) && !waitingSwapWeaponType.Equals(""))
                    {
                        // Thunderbolt needs atleast a 4ms delay after releasing the fire button to actually release the shot.
                        // so swapping on release would swallow an already charged shot if the client picked up a weapon
                        if (GameManager.m_local_player.m_weapon_type.Equals(WeaponType.THUNDERBOLT))
                        {
                            if (ThunderboltSwapDelay > 0f)
                            {
                                ThunderboltSwapDelay -= Time.deltaTime;
                                return;
                            }
                            ThunderboltSwapDelay = 0.025f; // 25ms to ensure that it is 100% reliable
                        }

                        swapToWeapon(waitingSwapWeaponType);
                        GameManager.m_local_player.UpdateCurrentWeaponName();
                        waitingSwapWeaponType = "";
                    }
                }
                if (sp_next_missileType != MissileType.NUM && delay == 0) // do this properly once you wake up again
                {
                    swapToMissile((int)sp_next_missileType);
                    sp_next_missileType = MissileType.NUM;
                }
                else if (delay > 0)
                {
                    delay--;
                }
            }
Ejemplo n.º 2
0
 public static void UnlockWeaponEvent(WeaponType wt, Player __instance)
 {
     if (MenuManager.opt_primary_autoswitch == 0 && MPAutoSelection.primarySwapFlag)
     {
         if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay() && __instance == GameManager.m_local_player)
         {
             int new_weapon     = getWeaponPriority(wt);
             int current_weapon = getWeaponPriority(GameManager.m_local_player.m_weapon_type);
             if (!PrimaryNeverSelect[new_weapon] && (new_weapon < current_weapon ||
                                                     (MPClassic.matchEnabled && GameManager.m_local_player.m_weapon_type.Equals(WeaponType.IMPULSE) && GameManager.m_local_player.m_weapon_level[0].Equals(WeaponUnlock.LEVEL_1)) // Specific impulse upgrade case for classic mod
                                                     ))
             {
                 if (!Controls.IsPressed(CCInput.FIRE_WEAPON))
                 {
                     swapToWeapon(wt.ToString());
                     GameManager.m_local_player.UpdateCurrentWeaponName();
                 }
                 else
                 {
                     waitingSwapWeaponType = wt.ToString();
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 static void Postfix(PlayerShip __instance)
 {
     if (NetworkMatch.InGameplay())
     {
         __instance.gameObject.SetActive(false);
         RUtility.DestroyGameObjectDelayed(__instance.gameObject, true, 0);
     }
 }
Ejemplo n.º 4
0
        // when using the new protocol, this object replaces
        // Client.m_PendingPlayerSnapshotMessages
        //public static Queue<NewPlayerSnapshotToClientMessage> m_PendingPlayerSnapshotMessages = new Queue<NewPlayerSnapshotToClientMessage>();

        public static void OnNewPlayerSnapshotToClient(NetworkMessage msg)
        {
            if (NetworkMatch.GetMatchState() == MatchState.PREGAME || NetworkMatch.InGameplay())
            {
                NewPlayerSnapshotToClientMessage item = msg.ReadMessage <NewPlayerSnapshotToClientMessage>();
                MPClientShipReckoning.AddNewPlayerSnapshot(item);
            }
        }
Ejemplo n.º 5
0
 public static void OnNewPlayerSnapshotToClient(NetworkMessage msg)
 {
     if (NetworkMatch.GetMatchState() == MatchState.PREGAME || NetworkMatch.InGameplay())
     {
         PlayerSnapshotToClientMessage item = msg.ReadMessage <NewPlayerSnapshotToClientMessage>().ToPlayerSnapshotToClientMessage();
         Client.m_PendingPlayerSnapshotMessages.Enqueue(item);
     }
 }
Ejemplo n.º 6
0
 public static void Postfix()
 {
     if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay())
     {
         if (!Controls.IsPressed(CCInput.FIRE_WEAPON) && !waitingSwapWeaponType.Equals(""))
         {
             swapToWeapon(waitingSwapWeaponType);
             GameManager.m_local_player.UpdateCurrentWeaponName();
             waitingSwapWeaponType = "";
         }
     }
 }
Ejemplo n.º 7
0
 public static bool Prefix(NetworkMessage msg)
 {
     if (NetworkMatch.GetMatchState() == MatchState.PREGAME || NetworkMatch.InGameplay())
     {
         PlayerSnapshotToClientMessage    item    = msg.ReadMessage <PlayerSnapshotToClientMessage>();
         NewPlayerSnapshotToClientMessage newItem = new NewPlayerSnapshotToClientMessage {
             m_num_snapshots    = item.m_num_snapshots,
             m_server_timestamp = 0, // Unused.
             m_snapshots        = item.m_snapshots.Select(m => NewPlayerSnapshot.FromOldSnapshot(m)).ToArray()
         };
         MPClientShipReckoning.AddNewPlayerSnapshot(newItem, true);
     }
     return(false);
 }
Ejemplo n.º 8
0
 public static bool Prefix(Player __instance)
 {
     if (MPAutoSelection.secondarySwapFlag)
     {
         if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay() && __instance == GameManager.m_local_player)
         {
             if (!__instance.CanFireMissileAmmo(MissileType.NUM))
             {
                 new DelayedSwitchTimer().Awake();
                 return(false);
             }
         }
     }
     return(true);
 }
Ejemplo n.º 9
0
 private static bool Prefix(Player __instance)
 {
     if (MenuManager.opt_primary_autoswitch == 0 && MPAutoSelection.primarySwapFlag)
     {
         if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay() && __instance == GameManager.m_local_player)
         {
             maybeSwapPrimary();
             if (swap_failed)
             {
                 uConsole.Log("-AUTOORDER- [EB] swap failed on trying to switch to an ammo weapon");
                 swap_failed = false;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     return(true);
 }
Ejemplo n.º 10
0
 static void Postfix()
 {
     // only on the Client, in Multiplayer, in an active game, not during death or death roll or pregame:
     if (!Server.IsActive() && GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay() && !GameManager.m_local_player.c_player_ship.m_dying && !GameManager.m_local_player.c_player_ship.m_dead && !GameManager.m_local_player.m_pregame && !MPObserver.Enabled)
     {
         if (!doManualInterpolation)
         {
             enableManualInterpolation();
         }
         lastPosition = currPosition;
         lastRotation = currRotation;
         if (targetTransformNode != null)
         {
             currPosition = targetTransformNode.position;
             currRotation = targetTransformNode.rotation;
         }
     }
     else if (doManualInterpolation)
     {
         disableManualInterpolation();
     }
 }
Ejemplo n.º 11
0
        public static void Postfix(NetworkMessage msg)
        {
            msg.reader.SeekZero();
            RespawnMessage respawnMessage = msg.ReadMessage <RespawnMessage>();

            GameObject gameObject = ClientScene.FindLocalObject(respawnMessage.m_net_id);

            if (gameObject == null)
            {
                return;
            }
            Player playerFromNetId = gameObject.GetComponent <Player>();

            if (playerFromNetId == null)
            {
                return;
            }

            if (playerFromNetId.isLocalPlayer)
            {
                if (MenuManager.opt_primary_autoswitch == 0 && MPAutoSelection.primarySwapFlag)
                {
                    if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay())
                    {
                        MPAutoSelection.maybeSwapPrimary(true);
                    }
                }

                if (MPAutoSelection.secondarySwapFlag)
                {
                    if (GameplayManager.IsMultiplayerActive && NetworkMatch.InGameplay())
                    {
                        MPAutoSelection.maybeSwapMissiles(true);
                    }
                }
            }
        }