public static bool Prefix(HPEquippable equip) { if (VTOLAPI.currentScene == VTOLScenes.VehicleConfiguration) { if (!Multiplayer._instance.buttonMade) { Multiplayer.CreateVehicleButton(); } } return(true); }
IEnumerator RespawnTimer() { Debug.Log("Starting respawn timer."); GameObject button = Multiplayer.CreateVehicleButton(); yield return(new WaitForSeconds(respawnTimer)); Destroy(button); Debug.Log("Finished respawn timer."); ReArmingPoint[] rearmPoints = GameObject.FindObjectsOfType <ReArmingPoint>(); ReArmingPoint rearmPoint = rearmPoints[Random.Range(0, rearmPoints.Length - 1)]; float lastRadius = 0; if (PlayerManager.carrierStart) { foreach (ReArmingPoint rep in rearmPoints) { if (rep.team == Teams.Allied) { if (rep.radius > 17.8f && rep.radius < 19.0f) { rearmPoint = rep; } } } } else { foreach (ReArmingPoint rep in rearmPoints) { Debug.Log("finding rearm pt"); if (rep.team == Teams.Allied && rep.CheckIsClear(actor)) { if (rep.radius > lastRadius) { rearmPoint = rep; lastRadius = rep.radius; } } } } //UnEject(); //PutPlayerBackInAircraft(); //RepairAircraft(); //foreach (GearAnimator gear in gears) { // gear.ExtendImmediate(); //} //GetComponent<Rigidbody>().velocity = Vector3.zero; //transform.position = rearmPoint.transform.position + Vector3.up * 10; //transform.rotation = rearmPoint.transform.rotation; Destroy(VTOLAPI.GetPlayersVehicleGameObject()); Destroy(detacher.cameraRig); Destroy(detacher.gameObject); Destroy(ejection.gameObject); Destroy(BlackoutEffect.instance); Destroy(GetComponent <PlayerSpawn>()); foreach (EngineEffects effect in effects) { Destroy(effect); } //as much stuff as im destroying, some stuff is most likely getting through, future people, look into this AudioController.instance.ClearAllOpenings(); UnitIconManager.instance.UnregisterAll(); TargetManager.instance.detectedByAllies.Clear(); TargetManager.instance.detectedByEnemies.Clear(); foreach (var actor in TargetManager.instance.allActors) { if (actor != null) { actor.discovered = false; actor.drawIcon = true; //actor.DiscoverActor(); actor.permanentDiscovery = true; Traverse.Create(actor).Field("detectedByAllied").SetValue(false); Traverse.Create(actor).Field("detectedByEnemy").SetValue(false); if (actor.team == Teams.Allied) { actor.DetectActor(Teams.Allied); actor.UpdateKnownPosition(actor.team); } //actor.DiscoverActor(); <----------------breaks and only works on every 2nd spawn // UnitIconManager.instance.RegisterIcon(actor, 0.07f * actor.iconScale, actor.iconOffset); } } if (PlayerManager.selectedVehicle == "FA-26B") { PlayerManager.selectedVehicle = "F/A-26B"; } PilotSaveManager.currentVehicle = VTResources.GetPlayerVehicle(PlayerManager.selectedVehicle); string campID; if (PlayerManager.selectedVehicle == "AV-42C") { campID = "av42cQuickFlight"; } else if (PlayerManager.selectedVehicle == "F/A-26B") { campID = "fa26bFreeFlight"; } else { campID = "f45-quickFlight"; } Campaign campref = VTResources.GetBuiltInCampaign(campID).ToIngameCampaign(); PilotSaveManager.currentCampaign = campref; if (PilotSaveManager.currentVehicle == null) { Debug.LogError("current vehicle is null"); } GameObject newPlayer = Instantiate(PilotSaveManager.currentVehicle.vehiclePrefab); if (newPlayer == null) { Debug.LogError("new vehicle is null"); } newPlayer.GetComponent <Actor>().designation = FlightSceneManager.instance.playerActor.designation;//reassigning designation FlightSceneManager.instance.playerActor = newPlayer.GetComponent <Actor>(); FlightSceneManager.instance.playerActor.flightInfo.PauseGCalculations(); FlightSceneManager.instance.playerActor.flightInfo.OverrideRecordedAcceleration(Vector3.zero); rearmPoint.voiceProfile.PlayMessage(GroundCrewVoiceProfile.GroundCrewMessages.Success); PilotSaveManager.currentScenario.totalBudget = 999999; PilotSaveManager.currentScenario.initialSpending = 0; PilotSaveManager.currentScenario.inFlightSpending = 0; PilotSaveManager.currentScenario.equipConfigurable = true; PlayerVehicleSetup pvSetup = newPlayer.GetComponent <PlayerVehicleSetup>(); pvSetup.SetupForFlight(); Rigidbody rb = newPlayer.GetComponent <Rigidbody>(); GearAnimator gearAnim = newPlayer.GetComponent <GearAnimator>(); if (gearAnim != null) { if (gearAnim.state != GearAnimator.GearStates.Extended) { gearAnim.ExtendImmediate(); } } // PlayerManager.StartRearm(rearmPoint); //rb.velocity = Vector3.zero; //rb.detectCollisions = true; PlayerManager.SpawnLocalVehicleAndInformOtherClients(newPlayer, newPlayer.transform.position, newPlayer.transform.rotation, networkUID); //PlayerManager.SetupLocalAircraft(newPlayer, newPlayer.transform.position, newPlayer.transform.rotation, networkUID); lastMessage.UID = networkUID; lastMessage.isLeftie = PlayerManager.teamLeftie; lastMessage.tagName = Steamworks.SteamFriends.GetPersonaName(); lastMessage.vehicle = VTOLAPI.GetPlayersVehicleEnum(); if (Networker.isHost) { NetworkSenderThread.Instance.SendPacketAsHostToAllClients(lastMessage, Steamworks.EP2PSend.k_EP2PSendReliable); } else { NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, lastMessage, Steamworks.EP2PSend.k_EP2PSendReliable); } }