static bool Prefix(MissionObjective __instance)
    {
        Debug.Log("A mission got CancelObjective we need to send it");

        int hashCode = ObjectiveNetworker_Reciever.getMissionHash(__instance);

        Message_ObjectiveSync objOutMessage = new Message_ObjectiveSync(PlayerManager.localUID, hashCode, ObjSyncType.EMissionCanceled);

        if (Networker.isHost && objOutMessage.objID != -1)
        {
            Debug.Log("Host sent objective CancelObjective " + __instance.objectiveID);
            ObjectiveNetworker_Reciever.ObjectiveHistory.Add(objOutMessage);
            NetworkSenderThread.Instance.SendPacketAsHostToAllClients(objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            bool shouldComplete = ObjectiveNetworker_Reciever.completeNextCancel;
            Debug.Log($"Should complete is {shouldComplete}.");
            ObjectiveNetworker_Reciever.completeNextCancel = false;
            return(shouldComplete);// clients should not send kill obj packets or have them complete
            //Debug.Log("Client sent objective CancelObjective " + __instance.objectiveID);
            // NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendUnreliable);
        }
        return(true);
    }
    static bool Prefix(MissionObjective __instance)
    {
        //prevents infinite client host pings
        //if (__instance.failed)
        //    return true;
        Debug.Log("A mission got failed we need to send it");


        //Debug.Log("sending __instance.objectiveName + __instance.objectiveID");
        String actionIdentifier = __instance.objectiveName + __instance.objectiveID;

        Debug.Log(actionIdentifier);

        //dont run corrupt objectives
        if (MissionManager.instance.IndexOfObjective(__instance) == -1)
        {
            return(false);
        }
        Message_ObjectiveSync objOutMessage = new Message_ObjectiveSync(PlayerManager.localUID, MissionManager.instance.IndexOfObjective(__instance), ObjSyncType.EMissionFailed);

        if (Networker.isHost && objOutMessage.objID != -1)
        {
            Debug.Log("Host sent objective fail " + __instance.objectiveID);
            NetworkSenderThread.Instance.SendPacketAsHostToAllClients(objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            bool shouldComplete = ObjectiveNetworker_Reciever.completeNextFailed;
            Debug.Log($"Should complete is {shouldComplete}.");
            ObjectiveNetworker_Reciever.completeNextFailed = false;
            return(shouldComplete);// clients should not send kill obj packets or have them complete
            //NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendUnreliable);
        }
        return(true);
    }
    static bool Prefix(MissionObjective __instance)
    {
        Debug.Log("A mission got completed we need to send it");

        int hashCode = ObjectiveNetworker_Reciever.getMissionHash(__instance);

        Message_ObjectiveSync objOutMessage = new Message_ObjectiveSync(PlayerManager.localUID, hashCode, ObjSyncType.EMissionCompleted);

        if (Networker.isHost)
        {
            Debug.Log("Host sent objective complete " + __instance.objectiveID);
            ObjectiveNetworker_Reciever.completeNext = false;
            ObjectiveNetworker_Reciever.ObjectiveHistory.Add(objOutMessage);
            NetworkSenderThread.Instance.SendPacketAsHostToAllClients(objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            bool shouldComplete = ObjectiveNetworker_Reciever.completeNext;
            if (VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Fly_To ||
                VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Refuel ||
                VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Join ||
                VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Land)
            {
                if (shouldComplete == false)
                {
                    //we havent been told to do this by host send it.
                    NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
                }
                return(true);
            }
            else
            {
                //    VTScenario.current.objectives.GetObjective(__instance.objectiveID).objectiveType == VTObjective.ObjectiveTypes.Conditional)


                Debug.Log($"Should complete is {shouldComplete}.");
                ObjectiveNetworker_Reciever.completeNext = false;
                return(shouldComplete);// clients should not send kill obj packets or have them complete
            }
            //NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendUnreliable);
        }
        return(true);
    }
    static void Postfix(VTObjective __instance)
    {
        Debug.Log("A VTObjective got begin we need to send it");

        Message_ObjectiveSync objOutMessage = new Message_ObjectiveSync(PlayerManager.localUID, __instance.objectiveID, ObjSyncType.EVTBegin);

        if (Networker.isHost)
        {
            Debug.Log("Host sent VTObjective begin " + __instance.objectiveID);
            ObjectiveNetworker_Reciever.ObjectiveHistory.Add(objOutMessage);
            NetworkSenderThread.Instance.SendPacketAsHostToAllClients(objOutMessage, Steamworks.EP2PSend.k_EP2PSendReliable);
        }
        else
        {
            bool shouldComplete = ObjectiveNetworker_Reciever.completeNextBegin;
            Debug.Log($"Should complete is {shouldComplete}.");
            ObjectiveNetworker_Reciever.completeNextBegin = false;
            //return shouldComplete;// clients should not send kill obj packets or have them complete
            //NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, objOutMessage, Steamworks.EP2PSend.k_EP2PSendUnreliable);
        }
        // return true;
    }