mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add trailmarker
This commit is contained in:
parent
d1a2ac405f
commit
a06b2dadca
@ -23,6 +23,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
private static GameObject _cairnPrefab;
|
private static GameObject _cairnPrefab;
|
||||||
private static GameObject _recorderPrefab;
|
private static GameObject _recorderPrefab;
|
||||||
private static GameObject _preCrashRecorderPrefab;
|
private static GameObject _preCrashRecorderPrefab;
|
||||||
|
private static GameObject _trailmarkerPrefab;
|
||||||
|
|
||||||
private static Dictionary<PropModule.NomaiTextArcInfo, GameObject> arcInfoToCorrespondingSpawnedGameObject = new Dictionary<PropModule.NomaiTextArcInfo, GameObject>();
|
private static Dictionary<PropModule.NomaiTextArcInfo, GameObject> arcInfoToCorrespondingSpawnedGameObject = new Dictionary<PropModule.NomaiTextArcInfo, GameObject>();
|
||||||
public static GameObject GetSpawnedGameObjectByNomaiTextArcInfo(PropModule.NomaiTextArcInfo arc)
|
public static GameObject GetSpawnedGameObjectByNomaiTextArcInfo(PropModule.NomaiTextArcInfo arc)
|
||||||
@ -97,6 +98,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
_preCrashRecorderPrefab = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_EscapePodCrashSite/Sector_CrashFragment/Interactables_CrashFragment/Prefab_NOM_Recorder").InstantiateInactive();
|
_preCrashRecorderPrefab = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_EscapePodCrashSite/Sector_CrashFragment/Interactables_CrashFragment/Prefab_NOM_Recorder").InstantiateInactive();
|
||||||
_preCrashRecorderPrefab.name = "Prefab_NOM_Recorder_Vessel";
|
_preCrashRecorderPrefab.name = "Prefab_NOM_Recorder_Vessel";
|
||||||
_preCrashRecorderPrefab.transform.rotation = Quaternion.identity;
|
_preCrashRecorderPrefab.transform.rotation = Quaternion.identity;
|
||||||
|
|
||||||
|
_trailmarkerPrefab = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_HangingCity/Sector_HangingCity_District2/Interactables_HangingCity_District2/Prefab_NOM_Sign");
|
||||||
|
_trailmarkerPrefab.name = "Prefab_NOM_Trailmarker";
|
||||||
|
_trailmarkerPrefab.transform.rotation = Quaternion.identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject Make(GameObject planetGO, Sector sector, PropModule.NomaiTextInfo info, IModBehaviour mod)
|
public static GameObject Make(GameObject planetGO, Sector sector, PropModule.NomaiTextInfo info, IModBehaviour mod)
|
||||||
@ -159,6 +164,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
customScroll.name = info.rename;
|
customScroll.name = info.rename;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
customScroll.name = _scrollPrefab.name;
|
||||||
|
}
|
||||||
|
|
||||||
var nomaiWallText = MakeWallText(planetGO, sector, info, xmlPath);
|
var nomaiWallText = MakeWallText(planetGO, sector, info, xmlPath);
|
||||||
nomaiWallText.transform.parent = customScroll.transform;
|
nomaiWallText.transform.parent = customScroll.transform;
|
||||||
@ -235,6 +244,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
computerObject.name = info.rename;
|
computerObject.name = info.rename;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
computerObject.name = _computerPrefab.name;
|
||||||
|
}
|
||||||
|
|
||||||
computerObject.transform.parent = sector?.transform ?? planetGO.transform;
|
computerObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
@ -347,6 +360,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
cairnObject.name = info.rename;
|
cairnObject.name = info.rename;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cairnObject.name = _cairnPrefab.name;
|
||||||
|
}
|
||||||
|
|
||||||
cairnObject.transform.parent = sector?.transform ?? planetGO.transform;
|
cairnObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
@ -445,6 +462,65 @@ namespace NewHorizons.Builder.Props
|
|||||||
conversationInfoToCorrespondingSpawnedGameObject[info] = recorderObject;
|
conversationInfoToCorrespondingSpawnedGameObject[info] = recorderObject;
|
||||||
return recorderObject;
|
return recorderObject;
|
||||||
}
|
}
|
||||||
|
case PropModule.NomaiTextInfo.NomaiTextType.Trailmarker:
|
||||||
|
{
|
||||||
|
var trailmarkerObject = _trailmarkerPrefab.InstantiateInactive();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.rename))
|
||||||
|
{
|
||||||
|
trailmarkerObject.name = info.rename;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trailmarkerObject.name = _trailmarkerPrefab.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
trailmarkerObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
trailmarkerObject.transform.parent = newParent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
trailmarkerObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
||||||
|
|
||||||
|
if (info.rotation != null)
|
||||||
|
{
|
||||||
|
trailmarkerObject.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(info.rotation));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// By default align it to normal
|
||||||
|
var up = (trailmarkerObject.transform.position - planetGO.transform.position).normalized;
|
||||||
|
trailmarkerObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * trailmarkerObject.transform.rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Idk do we have to set it active before finding things?
|
||||||
|
trailmarkerObject.SetActive(true);
|
||||||
|
|
||||||
|
var nomaiWallText = trailmarkerObject.transform.Find("Arc_Short").GetComponent<NomaiWallText>();
|
||||||
|
nomaiWallText.SetSector(sector);
|
||||||
|
|
||||||
|
nomaiWallText._location = (NomaiText.Location)Enum.Parse(typeof(NomaiText.Location), Enum.GetName(typeof(PropModule.NomaiTextInfo.NomaiTextLocation), info.location));
|
||||||
|
nomaiWallText._dictNomaiTextData = MakeNomaiTextDict(xmlPath);
|
||||||
|
nomaiWallText._nomaiTextAsset = new TextAsset(xmlPath);
|
||||||
|
nomaiWallText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile);
|
||||||
|
AddTranslation(xmlPath);
|
||||||
|
|
||||||
|
// Make sure the model is loaded
|
||||||
|
StreamingHandler.SetUpStreaming(trailmarkerObject, sector);
|
||||||
|
conversationInfoToCorrespondingSpawnedGameObject[info] = trailmarkerObject;
|
||||||
|
|
||||||
|
return trailmarkerObject;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
Logger.LogError($"Unsupported NomaiText type {info.type}");
|
Logger.LogError($"Unsupported NomaiText type {info.type}");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
4
NewHorizons/External/Modules/PropModule.cs
vendored
4
NewHorizons/External/Modules/PropModule.cs
vendored
@ -514,7 +514,9 @@ namespace NewHorizons.External.Modules
|
|||||||
|
|
||||||
[EnumMember(Value = @"preCrashRecorder")] PreCrashRecorder = 5,
|
[EnumMember(Value = @"preCrashRecorder")] PreCrashRecorder = 5,
|
||||||
|
|
||||||
[EnumMember(Value = @"preCrashComputer")] PreCrashComputer = 6
|
[EnumMember(Value = @"preCrashComputer")] PreCrashComputer = 6,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"trailmarker")] Trailmarker = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user