le funny islands werent showing up for some reason

This commit is contained in:
JohnCorby 2021-12-04 18:34:00 -08:00
parent e69c74ae66
commit b16710d923

View File

@ -1,4 +1,5 @@
using QSB.TornadoSync.TransformSync;
using System.Linq;
using QSB.TornadoSync.TransformSync;
using QSB.TornadoSync.WorldObjects;
using QSB.Utility;
using QSB.WorldSync;
@ -13,32 +14,51 @@ namespace QSB.TornadoSync
{
QSBWorldSync.Init<QSBTornado, TornadoController>();
if (!QSBCore.IsHost)
{
return;
}
foreach (var transformSync in QSBWorldSync.GetWorldObjects<OccasionalTransformSync>())
{
QNetworkServer.Destroy(transformSync.gameObject);
}
// islands
foreach (var islandController in QSBWorldSync.GetWorldObjects<IslandController>())
// cannon parts
var mainCannonPart = GameObject.Find("OrbitalProbeCannon_Body").GetAttachedOWRigidbody();
{
var transformSync = Instantiate(QSBNetworkManager.Instance.OccasionalPrefab).GetComponent<OccasionalTransformSync>();
transformSync.InitBodyIndexes(islandController._islandBody, Locator._giantsDeep.GetOWRigidbody());
transformSync.InitBodyIndexes(mainCannonPart, Locator._giantsDeep.GetOWRigidbody());
transformSync.gameObject.SpawnWithServerAuthority();
}
// cannon parts
foreach (var partName in new[]
foreach (var cannonPartNames in new[]
{
"OrbitalProbeCannon_Body",
"CannonBarrel_Body",
"CannonMuzzle_Body",
"Debris_Body (1)",
"Debris_Body (2)"
})
{
var cannonPart = GameObject.Find(cannonPartNames).GetAttachedOWRigidbody();
var transformSync = Instantiate(QSBNetworkManager.Instance.OccasionalPrefab).GetComponent<OccasionalTransformSync>();
transformSync.InitBodyIndexes(GameObject.Find(partName).GetAttachedOWRigidbody(),
Locator._giantsDeep.GetOWRigidbody());
transformSync.InitBodyIndexes(cannonPart, mainCannonPart);
transformSync.gameObject.SpawnWithServerAuthority();
}
// islands
var islandControllers = QSBWorldSync.GetWorldObjects<IslandController>().ToArray();
DebugLog.DebugWrite($"there are {islandControllers.Length} islandControllers");
foreach (var islandNames in new[]
{
"GabbroIsland_Body",
"StatueIsland_Body",
"ConstructionYardIsland_Body",
"BrambleIsland_Body"
})
{
var island = GameObject.Find(islandNames).GetAttachedOWRigidbody();
var transformSync = Instantiate(QSBNetworkManager.Instance.OccasionalPrefab).GetComponent<OccasionalTransformSync>();
transformSync.InitBodyIndexes(island, Locator._giantsDeep.GetOWRigidbody());
transformSync.gameObject.SpawnWithServerAuthority();
}
}