mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Move backwards compatibility fixes to Migrate methods
This commit is contained in:
parent
1c0466f04f
commit
1c3c085967
@ -14,34 +14,10 @@ namespace NewHorizons.Builder.General
|
|||||||
{
|
{
|
||||||
SpawnPoint playerSpawn = null;
|
SpawnPoint playerSpawn = null;
|
||||||
|
|
||||||
var playerSpawnInfo = module.playerSpawn;
|
if (!Main.Instance.IsWarpingFromVessel && !Main.Instance.IsWarpingFromShip && module.playerSpawn != null)
|
||||||
var shipSpawnInfo = module.shipSpawn;
|
|
||||||
|
|
||||||
// Backwards compatibility
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
if (playerSpawnInfo == null && module.playerSpawnPoint != null)
|
|
||||||
{
|
{
|
||||||
playerSpawnInfo = new SpawnModule.PlayerSpawnPoint()
|
bool alignToBody = module.playerSpawn.rotation == null;
|
||||||
{
|
GameObject spawnGO = GeneralPropBuilder.MakeNew("PlayerSpawnPoint", planetGO.transform, module.playerSpawn, alignToBody);
|
||||||
position = module.playerSpawnPoint,
|
|
||||||
rotation = module.playerSpawnRotation,
|
|
||||||
startWithSuit = module.startWithSuit,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (shipSpawnInfo == null && module.shipSpawnPoint != null)
|
|
||||||
{
|
|
||||||
shipSpawnInfo = new SpawnModule.ShipSpawnPoint()
|
|
||||||
{
|
|
||||||
position = module.shipSpawnPoint,
|
|
||||||
rotation = module.shipSpawnRotation,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
|
|
||||||
if (!Main.Instance.IsWarpingFromVessel && !Main.Instance.IsWarpingFromShip && playerSpawnInfo != null)
|
|
||||||
{
|
|
||||||
bool alignToBody = playerSpawnInfo.rotation == null;
|
|
||||||
GameObject spawnGO = GeneralPropBuilder.MakeNew("PlayerSpawnPoint", planetGO.transform, playerSpawnInfo, alignToBody);
|
|
||||||
spawnGO.layer = 8;
|
spawnGO.layer = 8;
|
||||||
|
|
||||||
playerSpawn = spawnGO.AddComponent<SpawnPoint>();
|
playerSpawn = spawnGO.AddComponent<SpawnPoint>();
|
||||||
@ -49,10 +25,10 @@ namespace NewHorizons.Builder.General
|
|||||||
|
|
||||||
spawnGO.transform.position += spawnGO.transform.up * 4f;
|
spawnGO.transform.position += spawnGO.transform.up * 4f;
|
||||||
}
|
}
|
||||||
if (shipSpawnInfo != null)
|
if (module.shipSpawn != null)
|
||||||
{
|
{
|
||||||
bool alignToBody = shipSpawnInfo.rotation == null;
|
bool alignToBody = module.shipSpawn.rotation == null;
|
||||||
GameObject spawnGO = GeneralPropBuilder.MakeNew("ShipSpawnPoint", planetGO.transform, shipSpawnInfo, alignToBody);
|
GameObject spawnGO = GeneralPropBuilder.MakeNew("ShipSpawnPoint", planetGO.transform, module.shipSpawn, alignToBody);
|
||||||
spawnGO.layer = 8;
|
spawnGO.layer = 8;
|
||||||
|
|
||||||
var spawnPoint = spawnGO.AddComponent<SpawnPoint>();
|
var spawnPoint = spawnGO.AddComponent<SpawnPoint>();
|
||||||
@ -89,7 +65,7 @@ namespace NewHorizons.Builder.General
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Main.Instance.IsWarpingFromVessel || (!Main.Instance.IsWarpingFromShip && (playerSpawnInfo?.startWithSuit ?? false))) && !suitUpQueued)
|
if ((Main.Instance.IsWarpingFromVessel || (!Main.Instance.IsWarpingFromShip && (module.playerSpawn?.startWithSuit ?? false))) && !suitUpQueued)
|
||||||
{
|
{
|
||||||
suitUpQueued = true;
|
suitUpQueued = true;
|
||||||
Delay.RunWhen(() => Main.IsSystemReady, () => SuitUp());
|
Delay.RunWhen(() => Main.IsSystemReady, () => SuitUp());
|
||||||
|
|||||||
@ -24,21 +24,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
RemoteDialogueTrigger remoteTrigger = null;
|
RemoteDialogueTrigger remoteTrigger = null;
|
||||||
if (info.remoteTrigger != null)
|
if (info.remoteTrigger != null)
|
||||||
{
|
{
|
||||||
remoteTrigger = MakeRemoteDialogueTrigger(go, sector, info, info.remoteTrigger, dialogue);
|
remoteTrigger = MakeRemoteDialogueTrigger(go, sector, info, dialogue);
|
||||||
}
|
}
|
||||||
// Backwards compatibility
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
if (remoteTrigger == null && (info.remoteTriggerPosition != null || info.remoteTriggerRadius != 0))
|
|
||||||
{
|
|
||||||
var remoteInfo = new PropModule.DialogueInfo.RemoteTriggerInfo
|
|
||||||
{
|
|
||||||
position = info.remoteTriggerPosition,
|
|
||||||
radius = info.remoteTriggerRadius,
|
|
||||||
prereqCondition = info.remoteTriggerPrereqCondition,
|
|
||||||
};
|
|
||||||
remoteTrigger = MakeRemoteDialogueTrigger(go, sector, info, remoteInfo, dialogue);
|
|
||||||
}
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
|
|
||||||
// Make the character look at the player
|
// Make the character look at the player
|
||||||
// Useful for dialogue replacement
|
// Useful for dialogue replacement
|
||||||
@ -51,9 +38,9 @@ namespace NewHorizons.Builder.Props
|
|||||||
return (dialogue, remoteTrigger);
|
return (dialogue, remoteTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RemoteDialogueTrigger MakeRemoteDialogueTrigger(GameObject planetGO, Sector sector, PropModule.DialogueInfo info, PropModule.DialogueInfo.RemoteTriggerInfo remoteTriggerInfo, CharacterDialogueTree dialogue)
|
private static RemoteDialogueTrigger MakeRemoteDialogueTrigger(GameObject planetGO, Sector sector, PropModule.DialogueInfo info, CharacterDialogueTree dialogue)
|
||||||
{
|
{
|
||||||
var conversationTrigger = GeneralPropBuilder.MakeNew("ConversationTrigger", sector?.transform ?? planetGO.transform, remoteTriggerInfo, defaultPosition: info.position, defaultParentPath: info.pathToAnimController);
|
var conversationTrigger = GeneralPropBuilder.MakeNew("ConversationTrigger", sector?.transform ?? planetGO.transform, info.remoteTrigger, defaultPosition: info.position, defaultParentPath: info.pathToAnimController);
|
||||||
|
|
||||||
var remoteDialogueTrigger = conversationTrigger.AddComponent<RemoteDialogueTrigger>();
|
var remoteDialogueTrigger = conversationTrigger.AddComponent<RemoteDialogueTrigger>();
|
||||||
var sphereCollider = conversationTrigger.AddComponent<SphereCollider>();
|
var sphereCollider = conversationTrigger.AddComponent<SphereCollider>();
|
||||||
@ -67,7 +54,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
dialogue = dialogue,
|
dialogue = dialogue,
|
||||||
prereqConditionType = RemoteDialogueTrigger.MultiConditionType.AND,
|
prereqConditionType = RemoteDialogueTrigger.MultiConditionType.AND,
|
||||||
// Base game never uses more than one condition anyone so we'll keep it simple
|
// Base game never uses more than one condition anyone so we'll keep it simple
|
||||||
prereqConditions = string.IsNullOrEmpty(remoteTriggerInfo.prereqCondition) ? new string[]{ } : new string[] { remoteTriggerInfo.prereqCondition },
|
prereqConditions = string.IsNullOrEmpty(info.remoteTrigger.prereqCondition) ? new string[]{ } : new string[] { info.remoteTrigger.prereqCondition },
|
||||||
// Just set your enter conditions in XML instead of complicating it with this
|
// Just set your enter conditions in XML instead of complicating it with this
|
||||||
onTriggerEnterConditions = new string[]{ }
|
onTriggerEnterConditions = new string[]{ }
|
||||||
}
|
}
|
||||||
@ -75,7 +62,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
remoteDialogueTrigger._activatedDialogues = new bool[1];
|
remoteDialogueTrigger._activatedDialogues = new bool[1];
|
||||||
remoteDialogueTrigger._deactivateTriggerPostConversation = true;
|
remoteDialogueTrigger._deactivateTriggerPostConversation = true;
|
||||||
|
|
||||||
sphereCollider.radius = remoteTriggerInfo.radius == 0 ? info.radius : remoteTriggerInfo.radius;
|
sphereCollider.radius = info.remoteTrigger.radius == 0 ? info.radius : info.remoteTrigger.radius;
|
||||||
|
|
||||||
conversationTrigger.SetActive(true);
|
conversationTrigger.SetActive(true);
|
||||||
|
|
||||||
|
|||||||
37
NewHorizons/External/Configs/PlanetConfig.cs
vendored
37
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -1,3 +1,4 @@
|
|||||||
|
using Epic.OnlineServices.Presence;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.External.Modules.VariableSize;
|
using NewHorizons.External.Modules.VariableSize;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@ -465,6 +466,42 @@ namespace NewHorizons.External.Configs
|
|||||||
{
|
{
|
||||||
ShockEffect = new ShockEffectModule() { hasSupernovaShockEffect = true };
|
ShockEffect = new ShockEffectModule() { hasSupernovaShockEffect = true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spawn points reorganized to use GenericPropInfo
|
||||||
|
if (Spawn.playerSpawn == null && Spawn.playerSpawnPoint != null)
|
||||||
|
{
|
||||||
|
Spawn.playerSpawn = new SpawnModule.PlayerSpawnPoint()
|
||||||
|
{
|
||||||
|
position = Spawn.playerSpawnPoint,
|
||||||
|
rotation = Spawn.playerSpawnRotation,
|
||||||
|
startWithSuit = Spawn.startWithSuit,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (Spawn.shipSpawn == null && Spawn.shipSpawnPoint != null)
|
||||||
|
{
|
||||||
|
Spawn.shipSpawn = new SpawnModule.ShipSpawnPoint()
|
||||||
|
{
|
||||||
|
position = Spawn.shipSpawnPoint,
|
||||||
|
rotation = Spawn.shipSpawnRotation,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remote dialogue trigger reorganized to use GenericPropInfo
|
||||||
|
if (Props.dialogue != null)
|
||||||
|
{
|
||||||
|
foreach (var dialogue in Props.dialogue)
|
||||||
|
{
|
||||||
|
if (dialogue.remoteTrigger == null && (dialogue.remoteTriggerPosition != null || dialogue.remoteTriggerRadius != 0))
|
||||||
|
{
|
||||||
|
dialogue.remoteTrigger = new PropModule.DialogueInfo.RemoteTriggerInfo
|
||||||
|
{
|
||||||
|
position = dialogue.remoteTriggerPosition,
|
||||||
|
radius = dialogue.remoteTriggerRadius,
|
||||||
|
prereqCondition = dialogue.remoteTriggerPrereqCondition,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user