generated from Outer-Wilds-New-Horizons/nh-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpsilonAndromedae.cs
85 lines (80 loc) · 3.69 KB
/
UpsilonAndromedae.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using OWML.Common;
using OWML.ModHelper;
using UnityEngine;
namespace UpsilonAndromedae
{
public class UpsilonAndromedae : ModBehaviour
{
private static UpsilonAndromedae instance;
public static UpsilonAndromedae Instance => instance;
public INewHorizons NewHorizonsAPI;
private void Awake()
{
instance = this;
}
private void OnStarSystemLoaded(string starSystem)
{
if (starSystem.Equals("MegaPiggy.UpsilonAndromedae"))
{
Transform player = Locator.GetPlayerTransform();
if (player != null && player.gameObject != null)
{
PlayerResources resources = player.GetComponent<PlayerResources>();
resources._currentFuel *= 4;
resources._currentOxygen *= 4;
resources._currentHealth *= 2;
JetpackThrusterModel thrusterModel = player.GetComponent<JetpackThrusterModel>();
thrusterModel._maxTranslationalThrust *= 2;
thrusterModel._maxRotationalThrust *= 2;
}
Transform ship = Locator.GetShipTransform();
if (ship != null && ship.gameObject != null)
{
ShipResources resources = ship.GetComponent<ShipResources>();
resources._maxFuel *= 4;
resources._maxOxygen *= 4;
resources._currentFuel = resources._maxFuel;
resources._currentOxygen = resources._maxOxygen;
ShipThrusterModel thrusterModel = ship.GetComponent<ShipThrusterModel>();
thrusterModel._maxTranslationalThrust *= 2;
thrusterModel._maxRotationalThrust *= 2;
}
GameObject upsilonAndromedaeFocalPoint = NewHorizonsAPI.GetPlanet("Upsilon Andromedae");
if (upsilonAndromedaeFocalPoint != null)
{
upsilonAndromedaeFocalPoint.transform.DestroyAllChildrenImmediate();
}
GameObject saffar = NewHorizonsAPI.GetPlanet("Saffar");
GameObject tion = NewHorizonsAPI.GetPlanet("Tion");
if (saffar != null && tion != null)
{
saffar.GetComponent<AstroObject>()._moon = tion.GetComponent<AstroObject>();
}
GameObject samh = NewHorizonsAPI.GetPlanet("Samh");
GameObject tuitan = NewHorizonsAPI.GetPlanet("Tuitan");
if (samh != null && tuitan != null)
{
samh.GetComponent<AstroObject>()._moon = tuitan.GetComponent<AstroObject>();
}
GameObject majriti = NewHorizonsAPI.GetPlanet("Majriti");
GameObject britomartis = NewHorizonsAPI.GetPlanet("Britomartis");
if (majriti != null && britomartis != null)
{
majriti.GetComponent<AstroObject>()._moon = britomartis.GetComponent<AstroObject>();
}
GameObject curiel = NewHorizonsAPI.GetPlanet("Curiel");
GameObject aura = NewHorizonsAPI.GetPlanet("Aura");
if (curiel != null && aura != null)
{
curiel.GetComponent<AstroObject>()._moon = aura.GetComponent<AstroObject>();
}
}
}
private void Start()
{
NewHorizonsAPI = ModHelper.Interaction.GetModApi<INewHorizons>("xen.NewHorizons");
NewHorizonsAPI.LoadConfigs(this);
NewHorizonsAPI.GetStarSystemLoadedEvent().AddListener(OnStarSystemLoaded);
}
}
}