-
Notifications
You must be signed in to change notification settings - Fork 4
/
SeaToSeaMod.cs
840 lines (726 loc) · 43.1 KB
/
SeaToSeaMod.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
using UnityEngine; //Needed for most Unity Enginer manipulations: Vectors, GameObjects, Audio, etc.
using System.IO; //For data read/write methods
using System; //For data read/write methods
using System.Collections.Generic; //Working with Lists and Collections
using System.Reflection;
using System.Xml;
using System.Linq; //More advanced manipulation of lists/collections
using HarmonyLib;
using QModManager.API.ModLoading;
using ReikaKalseki.DIAlterra;
using ReikaKalseki.Exscansion;
using ReikaKalseki.SeaToSea;
using SMLHelper.V2.Handlers;
using SMLHelper.V2.Utility;
using SMLHelper.V2.Crafting;
using SMLHelper.V2.Assets;
namespace ReikaKalseki.SeaToSea
{
[QModCore]
public static class SeaToSeaMod {
public const string MOD_KEY = "ReikaKalseki.SeaToSea";
//public static readonly ModLogger logger = new ModLogger();
public static readonly Assembly modDLL = Assembly.GetExecutingAssembly();
internal static readonly Config<C2CConfig.ConfigEntries> config = new Config<C2CConfig.ConfigEntries>(modDLL);
internal static readonly XMLLocale itemLocale = new XMLLocale(modDLL, "XML/items.xml");
internal static readonly XMLLocale pdaLocale = new XMLLocale(modDLL, "XML/pda.xml");
internal static readonly XMLLocale signalLocale = new XMLLocale(modDLL, "XML/signals.xml");
internal static readonly XMLLocale trackerLocale = new XMLLocale(modDLL, "XML/tracker.xml");
internal static readonly XMLLocale miscLocale = new XMLLocale(modDLL, "XML/misc.xml");
public static readonly WorldgenDatabase worldgen = new WorldgenDatabase();
private static Dictionary<string, Dictionary<string, Texture2D>> degasiBaseTextures = new Dictionary<string, Dictionary<string, Texture2D>>();
private static readonly Dictionary<Vector3, Tuple<float, int, float>> mercurySpawners = new Dictionary<Vector3, Tuple<float, int, float>>(){
{new Vector3(908.7F, -235.1F, 615.7F), Tuple.Create(2F, 4, 32F)},
{new Vector3(904.3F, -247F, 668.8F), Tuple.Create(1F, 3, 32F)},
{new Vector3(915.1F, -246.8F, 651.2F), Tuple.Create(2F, 6, 32F)},
{new Vector3(1273, -290, 604.3F), Tuple.Create(2F, 3, 32F)},
{new Vector3(1254, -293.3F, 606.3F), Tuple.Create(2F, 3, 32F)},
{new Vector3(1239, -286.4F, 617), Tuple.Create(2F, 3, 32F)},
{new Vector3(1245, -308.2F, 555.8F), Tuple.Create(2F, 3, 32F)},
{new Vector3(-1216, -299.1F, 510.3F), Tuple.Create(2F, 3, 32F)},
{new Vector3(1278, -276.4F, 497.5F), Tuple.Create(2F, 3, 32F)},
{new Vector3(1228, -275.6F, 483.9F), Tuple.Create(2F, 3, 32F)}
};
public static readonly TechnologyFragment[] rebreatherChargerFragments = new TechnologyFragment[]{
new TechnologyFragment("f350b8ae-9ee4-4349-a6de-d031b11c82b1", go => go.transform.localScale = new Vector3(1, 3, 1)),
new TechnologyFragment("f744e6d9-f719-4653-906b-34ed5dbdb230", go => go.transform.localScale = new Vector3(1, 2, 1)),
//new TechnologyFragment("589bf5a6-6866-4828-90b2-7266661bb6ed"),
new TechnologyFragment("3c076458-505e-4683-90c1-34c1f7939a0f", go => go.transform.localScale = new Vector3(1, 1, 0.2F)),
};
public static readonly TechnologyFragment[] bioprocFragments = new TechnologyFragment[]{
new TechnologyFragment("85259b00-2672-497e-bec9-b200a1ab012f"),
//new TechnologyFragment("ba258aad-07e9-4c9b-b517-2ce7400db7b2"),
//new TechnologyFragment("cf4ca320-bb13-45b6-b4c9-2a079023e787"),
new TechnologyFragment("f4b3942e-02d8-4526-b384-677a2ad9ce58", go => go.transform.localScale = new Vector3(0.25F, 0.25F, 0.5F)),
new TechnologyFragment("f744e6d9-f719-4653-906b-34ed5dbdb230"),
};
public static TechnologyFragment lathingDroneFragment;
public static MushroomTreeBacterialColony mushroomBioFragment;
public static GeyserCoral geyserCoral;
public static PowerSealModuleFragment powersealModuleFragment;
public static EjectedHeatSink ejectedHeatSink;
public static UnmovingHeatBlade thermoblade;
public static MountainBaseCuredPeeper peeper;
//public static SeaTreaderTunnelLocker locker;
public static SeaTreaderTunnelLight tunnelLight;
public static FallingGlassForestWreck gfWreckProp;
public static DeadMelon deadMelon;
public static Campfire campfire;
public static Mattress mattress;
public static MarshmallowCan marshCan;
private static BloodKelpBaseNuclearReactorMelter reactorMelter;
private static TrailerBaseConverter bioBreaker;
private static MercuryLootSpawner mercuryLootSpawner;
internal static CrashZoneSanctuarySpawner crashSanctuarySpawner;
internal static SanctuaryGrassSpawner sanctuaryGrassSpawner;
internal static CrashZoneSanctuaryFern crashSanctuaryFern;
//internal static CrashZoneSanctuaryGrassBump sanctuaryGrassBump;
//internal static CrashZoneSanctuaryCoralSheet sanctuaryCoral;
internal static LRNestGrass lrNestGrass;
public static DataChit laserCutterBulkhead;
public static DataChit bioProcessorBoost;
// public static DataChit vehicleSpeedBoost;
//internal static VoidLeviElecSphere leviPulse;
internal static DeepStalker deepStalker;
internal static SanctuaryJellyray sanctuaryray;
internal static PurpleHolefish purpleHolefish;
internal static PurpleBoomerang purpleBoomerang;
internal static PurpleHoopfish purpleHoopfish;
internal static VoidSpikeLeviathan voidSpikeLevi;
internal static Bioprocessor processor;
internal static RebreatherRecharger rebreatherCharger;
internal static GeyserFilter geyserFilter;
public static SignalManager.ModSignal treaderSignal;
public static SignalManager.ModSignal voidSpikeDirectionHint;
//public static SignalManager.ModSignal duneArchWreckSignal;
public static SignalManager.ModSignal sanctuaryDirectionHint;
internal static Story.StoryGoal crashMesaRadio;
//public static Story.StoryGoal duneArchRadio;
//public static Story.StoryGoal mountainPodRadio;
internal static Story.StoryGoal auroraTerminal;
internal static Story.StoryGoal sunbeamCountdownTrigger;
internal static Harmony harmony;
/*
public static SoundManager.SoundData voidspikeLeviRoar;
public static SoundManager.SoundData voidspikeLeviBite;
public static SoundManager.SoundData voidspikeLeviFX;
public static SoundManager.SoundData voidspikeLeviAmbient;
*/
internal static bool anywhereSeamothModuleCheatActive = false;
internal static bool trackerShowAllCheatActive = false;
internal static bool fastSeaglideCheatActive = false;
[QModPrePatch]
public static void PreLoad() {
config.load();
C2CIntegration.injectConfigValues();
}
[QModPatch]
public static void Load() {
harmony = new Harmony(MOD_KEY);
Harmony.DEBUG = true;
FileLog.logPath = Path.Combine(Path.GetDirectoryName(modDLL.Location), "harmony-log.txt");
FileLog.Log("Ran mod register, started harmony (harmony log)");
SNUtil.log("Ran mod register, started harmony");
try {
InstructionHandlers.runPatchesIn(harmony, typeof(C2CPatches));
}
catch (Exception ex) {
FileLog.Log("Caught exception when running patcher!");
FileLog.Log(ex.Message);
FileLog.Log(ex.StackTrace);
FileLog.Log(ex.ToString());
}
ModVersionCheck.getFromGitVsInstall("Sea To Sea", modDLL, "SeaToSea").register();
SNUtil.checkModHash(modDLL);
CustomPrefab.addPrefabNamespace("ReikaKalseki.SeaToSea");
C2CIntegration.injectLoad();
itemLocale.load();
pdaLocale.load();
signalLocale.load();
trackerLocale.load();
miscLocale.load();
C2CItems.preAdd();
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(VoidSpike).TypeHandle);
// voidspikeLeviRoar = SoundManager.registerSound(SeaToSeaMod.modDLL, "voidspikelevi_roar", "Sounds/voidlevi-roar.ogg", SoundManager.soundMode3D, s => {SoundManager.setup3D(s, 200);}, SoundSystem.masterBus);
//voidspikeLeviFX = SoundManager.registerSound(SeaToSeaMod.modDLL, "voidspikelevi_fx", "Sounds/voidlevi-fx1.ogg", SoundManager.soundMode3D, s => {SoundManager.setup3D(s, 200);}, SoundSystem.masterBus);
// voidspikeLeviAmbient = SoundManager.registerSound(SeaToSeaMod.modDLL, "voidspikelevi_amb", "Sounds/voidlevi-longamb2.ogg", SoundManager.soundMode3D, s => {SoundManager.setup3D(s, 200);}, SoundSystem.masterBus);
//voidspikeLeviBite = SoundManager.registerSound(SeaToSeaMod.modDLL, "voidspikelevi_bite", "Sounds/voidlevi-bite.ogg", SoundManager.soundMode3D, s => {SoundManager.setup3D(s, 200);}, SoundSystem.masterBus);
deepStalker = new DeepStalker(itemLocale.getEntry("DeepStalker"));
deepStalker.Patch();
sanctuaryray = new SanctuaryJellyray(itemLocale.getEntry("SanctuaryJellyray"));
sanctuaryray.Patch();
purpleBoomerang = new PurpleBoomerang(itemLocale.getEntry("PurpleBoomerang"));
purpleBoomerang.cookableIntoBase = 1;
purpleBoomerang.Patch();
purpleHolefish = new PurpleHolefish(itemLocale.getEntry("PurpleHolefish"));
purpleHolefish.Patch();
purpleHoopfish = new PurpleHoopfish(itemLocale.getEntry("PurpleHoopfish"));
purpleHoopfish.cookableIntoBase = 1;
purpleHoopfish.Patch();
WaterParkCreature.waterParkCreatureParameters[deepStalker.TechType] = SNUtil.getModifiedACUParams(TechType.Stalker, 1, 1, 1, 1.5F);
WaterParkCreature.waterParkCreatureParameters[sanctuaryray.TechType] = SNUtil.getModifiedACUParams(TechType.Jellyray, 1, 1, 1, 1.25F);
WaterParkCreature.waterParkCreatureParameters[purpleBoomerang.TechType] = SNUtil.getModifiedACUParams(TechType.Boomerang, 1, 1, 1, 0.67F);
WaterParkCreature.waterParkCreatureParameters[purpleHoopfish.TechType] = SNUtil.getModifiedACUParams(TechType.Hoopfish, 1.2F, 1.2F, 1.2F, 1.25F);
WaterParkCreature.waterParkCreatureParameters[purpleHolefish.TechType] = SNUtil.getModifiedACUParams(TechType.HoleFish, 4F, 4F, 4F, 3.0F);
voidSpikeLevi = new VoidSpikeLeviathan(itemLocale.getEntry("VoidSpikeLevi"));
voidSpikeLevi.register();
XMLLocale.LocaleEntry e = miscLocale.getEntry("bulkheadLaserCutterUpgrade");
laserCutterBulkhead = new DataChit(e.key, e.name, e.desc, d => {d.controlText = e.pda; d.graphic = () => SNUtil.getTechPopupSprite(TechType.LaserCutter);});
laserCutterBulkhead.Patch();
e = miscLocale.getEntry("bioprocessorBoost");
bioProcessorBoost = new DataChit(e.key, e.name, e.desc, d => {d.controlText = e.pda;});
bioProcessorBoost.Patch();
C2CItems.addFlora();
C2CRecipes.addItemsAndRecipes();
C2CItems.addTablets();
powersealModuleFragment = new PowerSealModuleFragment();
powersealModuleFragment.register();
ejectedHeatSink = new EjectedHeatSink();
ejectedHeatSink.Patch();
thermoblade = new UnmovingHeatBlade();
thermoblade.Patch();
peeper = new MountainBaseCuredPeeper();
peeper.Patch();
//locker = new SeaTreaderTunnelLocker();
//locker.Patch();
tunnelLight = new SeaTreaderTunnelLight();
tunnelLight.Patch();
gfWreckProp = new FallingGlassForestWreck();
gfWreckProp.Patch();
deadMelon = new DeadMelon();
deadMelon.Patch();
campfire = new Campfire();
campfire.Patch();
mattress = new Mattress();
mattress.Patch();
marshCan = new MarshmallowCan();
marshCan.Patch();
reactorMelter = new BloodKelpBaseNuclearReactorMelter();
reactorMelter.Patch();
bioBreaker = new TrailerBaseConverter();
bioBreaker.Patch();
mushroomBioFragment = new MushroomTreeBacterialColony(itemLocale.getEntry("TREE_BACTERIA"));
mushroomBioFragment.register();
mercuryLootSpawner = new MercuryLootSpawner();
mercuryLootSpawner.Patch();
crashSanctuarySpawner = new CrashZoneSanctuarySpawner();
crashSanctuarySpawner.Patch();
sanctuaryGrassSpawner = new SanctuaryGrassSpawner();
sanctuaryGrassSpawner.Patch();
crashSanctuaryFern = new CrashZoneSanctuaryFern();
crashSanctuaryFern.Patch();
//sanctuaryGrassBump = new CrashZoneSanctuaryGrassBump();
//sanctuaryGrassBump.Patch();
//sanctuaryCoral = new CrashZoneSanctuaryCoralSheet();
//sanctuaryCoral.Patch();
lrNestGrass = new LRNestGrass();
lrNestGrass.Patch();
//leviPulse = new VoidLeviElecSphere();
//leviPulse.Patch();
BasicCraftingItem drone = CraftingItems.getItem(CraftingItems.Items.LathingDrone);
lathingDroneFragment = TechnologyFragment.createFragment("6e0f4652-c439-4540-95be-e61384e27692", drone.TechType, drone.FriendlyName, 3, 2, true, go => {
ObjectUtil.removeComponent<Pickupable>(go);
ObjectUtil.removeComponent<Rigidbody>(go);
go.EnsureComponent<LathingDroneSparker>();
}); //it has its own model
e = itemLocale.getEntry("bioprocessor");
processor = new Bioprocessor(e);
processor.Patch();
SNUtil.log("Registered custom machine "+processor);
processor.addPDAPage(e.pda, "Bioprocessor");
processor.addFragments(4, 5, bioprocFragments);
Bioprocessor.addRecipes();
e = itemLocale.getEntry("rebreathercharger");
rebreatherCharger = new RebreatherRecharger(e);
rebreatherCharger.Patch();
SNUtil.log("Registered custom machine "+rebreatherCharger);
rebreatherCharger.addPDAPage(e.pda, "RebreatherCharger");
rebreatherCharger.addFragments(4, 7.5F, rebreatherChargerFragments);
e = itemLocale.getEntry("geyserfilter");
geyserFilter = new GeyserFilter(e);
geyserFilter.Patch();
SNUtil.log("Registered custom machine "+geyserFilter);
geyserFilter.addPDAPage(e.pda, "GeyserFilter");
geyserCoral = new GeyserCoral(itemLocale.getEntry("GEYSER_CORAL"));
geyserCoral.register();
addPDAEntries();
addCommands();
addOreGen();
GenUtil.registerWorldgen(new PositionedPrefab(CustomMaterials.getItem(CustomMaterials.Materials.VENT_CRYSTAL).ClassID, Azurite.mountainBaseAzurite, Quaternion.Euler(0, 202.4F, 33.2F)));
//GenUtil.registerWorldgen(new PositionedPrefab("e85adb0d-665e-48f5-9fa2-2dd316776864", C2CHooks.bkelpBaseGeoCenter), go => go.transform.localScale = Vector3.one*60);
addSignalsAndRadio();
PDAMessages.addAll();
auroraTerminal = SNUtil.addVOLine("auroraringterminal_c2c", Story.GoalType.PDA, miscLocale.getEntry("auroraringterminal").desc, SoundManager.getSound("event:/player/story/Aurora_RingRoom_Terminal2"));
sunbeamCountdownTrigger = new Story.StoryGoal("c2cTriggerSunbeamCountdown", Story.GoalType.Story, 0);
KnownTech.onAdd += onTechUnlocked;
//DamageSystem.acidImmune = DamageSystem.acidImmune.AddToArray<TechType>(TechType.Seamoth);
C2CItems.postAdd();
VoidSpikesBiome.instance.register();
UnderwaterIslandsFloorBiome.instance.register();
CrashZoneSanctuaryBiome.instance.register();
VoidSpike.register();
AvoliteSpawner.instance.register();
LifeformScanningSystem.instance.register();
C2CItems.alkali.addNativeBiome(VanillaBiomes.MOUNTAINS, true).addNativeBiome(VanillaBiomes.TREADER, true).addNativeBiome(VanillaBiomes.KOOSH, true);
C2CItems.kelp.addNativeBiome(UnderwaterIslandsFloorBiome.instance);
C2CItems.healFlower.addNativeBiome(VanillaBiomes.REDGRASS, true);
C2CItems.sanctuaryPlant.addNativeBiome(CrashZoneSanctuaryBiome.instance);
C2CItems.mountainGlow.addNativeBiome(VanillaBiomes.MOUNTAINS);
initHandlers();
Vector3 ang = new Vector3(0, 317, 0);
Vector3 pos1 = new Vector3(-1226, -350, -1258);
Vector3 pos2 = new Vector3(-1327, -350, -1105);
Vector3 tgt = pos2+(pos2-pos1).setLength(40);
for (int i = 0; i <= 4; i++) {
Vector3 pos = Vector3.Lerp(pos1, pos2, i/4F);
GenUtil.registerWorldgen(new PositionedPrefab(VanillaCreatures.SEA_TREADER.prefab, pos, Quaternion.Euler(ang)), go => {
go.GetComponent<TreaderMoveOnSurface>().timeNextTarget = Time.time+120;
go.GetComponent<SeaTreader>().MoveTo(tgt);
});
}
SaveSystem.addPlayerSaveCallback(typeof(LiquidBreathingSystem).GetField("kharaaTreatmentRemainingTime", BindingFlags.Instance | BindingFlags.NonPublic), () => LiquidBreathingSystem.instance);
SNUtil.addMultiScanUnlock(TechType.PowerTransmitter, 2, TechType.PowerTransmitter, 1, false);
SNUtil.addMultiScanUnlock(TechType.LEDLight, 2, TechType.LEDLight, 1, false);
SNUtil.addMultiScanUnlock(TechType.ThermalPlant, 4, TechType.ThermalPlant, 1, false);
SNUtil.addMultiScanUnlock(TechType.NuclearReactor, 7, TechType.NuclearReactor, 1, false);
}
private static void initHandlers() {
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(C2CUnlocks).TypeHandle);
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(C2CProgression).TypeHandle);
}
class LavaCastleVentCrystalPlacer : Spawnable {
internal LavaCastleVentCrystalPlacer() : base("LavaCastleVentCrystalPlacer", "", "") {
}
public override GameObject GetGameObject() {
GameObject go = new GameObject("LavaCastleVentCrystalPlacer");
go.EnsureComponent<LavaCastleVentCrystalConverter>();
return go;
}
}
class LavaCastleVentCrystalConverter : MonoBehaviour {
void Update() {
if ((transform.position-Player.main.transform.position).sqrMagnitude <= 40000) {
float ch = SeaToSeaMod.config.getBoolean(C2CConfig.ConfigEntries.HARDMODE) ? 0.15F : 0.25F;
if (UnityEngine.Random.Range(0F, 1F) < ch) {
GameObject azur = ObjectUtil.createWorldObject(CustomMaterials.getItem(CustomMaterials.Materials.VENT_CRYSTAL).ClassID);
azur.transform.rotation = transform.rotation;
azur.transform.position = transform.position;
azur.SetActive(true);
}
UnityEngine.Object.Destroy(gameObject);
}
}
}
[QModPostPatch]
public static void PostLoad() {
new LavaCastleVentCrystalPlacer().Patch();
worldgen.load(s => s != "fcswreck.xml" || FCSIntegrationSystem.instance.isLoaded()); //load in post because some cross-mod TTs may not exist yet
mushroomBioFragment.postRegister();
geyserCoral.postRegister();
AvoliteSpawner.instance.postRegister();
DataboxTypingMap.instance.load();
DataboxTypingMap.instance.addValue(-789.81, -216.10, -711.02, C2CItems.bandage.TechType);
DataboxTypingMap.instance.addValue(-483.55, -504.69, 1326.64, C2CItems.tetherModule.TechType);
ESHooks.addLeviathan(voidSpikeLevi.TechType);
ESHooks.scannabilityEvent += C2CHooks.isItemMapRoomDetectable;
foreach (BiomeType bb in Enum.GetValues(typeof(BiomeType))) {
LootDistributionHandler.EditLootDistributionData(VanillaResources.SULFUR.prefab, bb, 0, 1);
LootDistributionHandler.EditLootDistributionData(CustomEgg.getEgg(TechType.SpineEel).ClassID, bb, 0, 1);
}
POITeleportSystem.instance.populate();
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(ExplorationTrackerPages).TypeHandle);
C2CIntegration.addPostCompat();
dumpAbandonedBaseTextures();
Dictionary<string, bool> modsWithIssues = new Dictionary<string, bool>(){
{"CyclopsNuclearUpgrades", false},
{"CyclopsBioReactor", false},
//{"AquariumBreeding", false},
{"RedBaron", true},
//{"SeamothArms", true},
{"HabitatControlPanel", true},
{"MoreSeamothDepth", true},
{"CustomCraft2", true},
//{"FCSAlterraHub", false},
{"SlotExtender", false},
{"WarpChip", false},
//{"Socknautica", false},
{"Socksfor1Monsters", false},
{"DADTankSubPack", true},
{"DWEquipmentBonanza", false},
{"SeaVoyager", false},
{"SubnauticaRandomiser", true},
{"EquivalentExchange", true},
{"Deathrun", false},
{"DecorationsMod", false},
{"AnthCreatures", true},
{"SpyWatch", true},
{"SeamothEnergyShield", true},
{"SeamothThermal", false},
{"ArmorSuit", false},
{"ShieldSuit", false},
{"TimeControlSuit", true},
{"CameraDroneStasisUpgrade", true},
//{"CameraDroneFlightUpgrade", false},
{"CustomizeYourSpawns", true},
{"StasisModule", true},
{"StasisTorpedo", true},
{"CyclopsLaserCannonModule", false},
{"DebrisRecycling", true},
{"AD3D_DeepEngineMod", false},
{"AD3D_TechFabricatorMod", false},
{"PassiveReapers", true},
{"PlasmaCannonArm", false}, //add scanner module?
{"Radiant Depths", true}, //TODO id might be wrong
};
foreach (KeyValuePair<string, bool> kvp in modsWithIssues) {
if (QModManager.API.QModServices.Main.ModPresent(kvp.Key)) {
if (kvp.Value) {
string msg = "Mod '"+kvp.Key+"' detected. This mod is not compatible with SeaToSea, and cannot be used alongside it.";
SNUtil.createPopupWarning(msg, false/*, null, SNUtil.createPopupButton("OK")*/);
throw new Exception(msg);
}
else {
string msg = "SeaToSea: Mod '"+kvp.Key+"' detected. This mod will significantly alter the balance of your pack and risks completely breaking C2C progression.";
SNUtil.createPopupWarning(msg, false/*, null, SNUtil.createPopupButton("OK")*/);
SNUtil.log(msg+" You should remove this mod if possible when using SeaToSea.");
}
}
}
if (!QModManager.API.QModServices.Main.ModPresent("TerrainPatcher")) {
string msg = "TerrainPatcher may be an optional dependency for SeaToSea, but its use is strongly recommended to ensure biomes appear as intended.";
SNUtil.createPopupWarning(msg, true/*, SNUtil.createPopupButton("Download", () => {
System.Diagnostics.Process.Start("https://github.com/Esper89/Subnautica-TerrainPatcher/releases/download/v0.4/TerrainPatcher-v0.4.zip");
Application.Quit(64);
}), SNUtil.createPopupButton("Ignore")*/);
SNUtil.log(msg+" You should add this mod if at all possible.");
}
if (!QModManager.API.QModServices.Main.ModPresent("AgonyRadialCraftingTabs")) {
string msg = "RadialTabs is recommended when using SeaToSea to ensure that all crafting nodes in fabricator UIs remain onscreen.";
SNUtil.createPopupWarning(msg, true/*, SNUtil.createPopupButton("Download", () => {
System.Diagnostics.Process.Start("https://www.nexusmods.com/Core/Libs/Common/Widgets/ModRequirementsPopUp?id=2624&game_id=1155");
Application.Quit(64);
}), SNUtil.createPopupButton("Ignore")*/);
SNUtil.log(msg+" You should add this mod if at all possible.");
}
}
private static void dumpAbandonedBaseTextures() {
string[] prefabs = new string[]{
"026c39c1-d0cc-442c-aa42-e574c9c281b2",
"0e394d55-da8c-4b3e-b038-979477ce77c1",
"255ed3c3-1973-40c0-9917-d16dd9a7018d",
"256a06d3-b861-487a-b8ac-050daa0d683d",
"2921736c-c898-4213-9615-ea1a72e28178",
"569f22e0-274d-49b0-ae5e-21ef0ce907ca",
"99b164ac-dfb4-4a14-b305-8666fa227717",
"c1139534-b3b9-4750-b60b-a77ca054b3dd",
"dd923ae3-20f6-47e0-87c0-ae2bc386607a"
};
HashSet<string> exported = new HashSet<string>();
foreach (string s in prefabs) {
GameObject go = ObjectUtil.lookupPrefab(s);
if (go) {
Renderer[] rr = go.GetComponentsInChildren<Renderer>(true);
//SNUtil.log("Exporting degasi base textures from "+s+": "+rr.Length+":"+string.Join(", ", rr.Select(r2 => r2.name)), modDLL);
foreach (Renderer r in rr) {
foreach (Material m in r.materials) {
if (m && m.mainTexture != null && m.mainTexture.name != null) {
string n = m.mainTexture.name.Replace(" (Instance)", "").ToLowerInvariant();
if (!exported.Contains(n)) {
SNUtil.log("Exporting degasi base textures from "+r.gameObject.GetFullHierarchyPath()+": "+n, modDLL);
degasiBaseTextures[n] = new Dictionary<string, Texture2D>();
foreach (string tex in m.GetTexturePropertyNames())
degasiBaseTextures[n][tex] = (Texture2D)m.GetTexture(tex);
if (degasiBaseTextures[n].Count > 0)
exported.Add(n);
}
}
}
}
}
}
}
public static bool hasDegasiBaseTextures(string n) {
return degasiBaseTextures.ContainsKey(n);
}
public static Texture2D getDegasiBaseTexture(string n, string type) {
return degasiBaseTextures[n].ContainsKey(type) ? degasiBaseTextures[n][type] : null;
}
private static void addSignalsAndRadio() {
XMLLocale.LocaleEntry e = SeaToSeaMod.signalLocale.getEntry("treaderpod");
treaderSignal = SignalManager.createSignal(e);
treaderSignal.addRadioTrigger(e.getField<string>("sound"));
treaderSignal.register("32e48451-8e81-428e-9011-baca82e9cd32", new Vector3(-1239, -360, -1193));
treaderSignal.addWorldgen();
/*
e = SeaToSeaMod.signalLocale.getEntry("dunearch");
duneArchWreckSignal = SignalManager.createSignal(e);
duneArchWreckSignal.addRadioTrigger(e.getField<string>("sound"));
duneArchWreckSignal.register("32e48451-8e81-428e-9011-baca82e9cd32", new Vector3(-1623, -355.6, -98.5));
duneArchWreckSignal.addWorldgen();
*/
e = SeaToSeaMod.signalLocale.getEntry("voidspike");
voidSpikeDirectionHint = SignalManager.createSignal(e);
voidSpikeDirectionHint.setStoryGate(PDAManager.getPage("voidpod").id);
voidSpikeDirectionHint.register("4c10bbd6-5100-4632-962e-69306b09222f", SpriteManager.Get(SpriteManager.Group.Pings, "Sunbeam"), VoidSpikesBiome.end500m);
voidSpikeDirectionHint.addWorldgen();
e = SeaToSeaMod.signalLocale.getEntry("sanctuary");
sanctuaryDirectionHint = SignalManager.createSignal(e);
sanctuaryDirectionHint.register("4c10bbd6-5100-4632-962e-69306b09222f", SpriteManager.Get(SpriteManager.Group.Pings, "Sunbeam"), CrashZoneSanctuaryBiome.biomeCenter.setY(-360));
sanctuaryDirectionHint.addWorldgen();
e = pdaLocale.getEntry("crashmesahint");
crashMesaRadio = SNUtil.addRadioMessage("crashmesaradio", e.getField<string>("radio"), e.getField<string>("radioSound"));
}
private static void onTechUnlocked(TechType tech, bool vb) {/*
if (tech == TechType.PrecursorKey_Orange) {
Story.StoryGoal.Execute(SeaToSeaMod.crashMesaRadio.key, SeaToSeaMod.crashMesaRadio.goalType);
}
if (tech == TechType.NuclearReactor || tech == TechType.HighCapacityTank || tech == TechType.PrecursorKey_Purple || tech == TechType.SnakeMushroom || tech == CraftingItems.getItem(CraftingItems.Items.DenseAzurite).TechType) {
Story.StoryGoal.Execute("RadioKoosh26", Story.GoalType.Radio); //pod 12
}*/
C2CItems.onTechUnlocked(tech);
}
private static void addOreGen() {
BasicCustomOre vent = CustomMaterials.getItem(CustomMaterials.Materials.VENT_CRYSTAL);
vent.registerWorldgen(BiomeType.Dunes_ThermalVent, 1, 3F);
vent.registerWorldgen(BiomeType.Mountains_ThermalVent, 1, 1.0F);
if (FCSIntegrationSystem.instance.isLoaded()) {
vent.registerWorldgen(BiomeType.UnderwaterIslands_Geyser, 1, 0.2F);
vent.registerWorldgen(BiomeType.DeepGrandReef_ThermalVent, 1, 0.4F);
}
BasicCustomOre irid = CustomMaterials.getItem(CustomMaterials.Materials.IRIDIUM);
irid.registerWorldgen(BiomeType.InactiveLavaZone_Corridor_Ceiling, 1, 1.2F);
irid.registerWorldgen(BiomeType.InactiveLavaZone_Corridor_Floor, 1, 0.3F);
irid.registerWorldgen(BiomeType.InactiveLavaZone_Corridor_Floor_Far, 1, 0.67F);
irid.registerWorldgen(BiomeType.InactiveLavaZone_Corridor_Wall, 1, 0.6F);
irid.registerWorldgen(BiomeType.InactiveLavaZone_Chamber_Ceiling, 1, 0.5F);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MAGNETITE.prefab, BiomeType.UnderwaterIslands_Geyser, 2.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_MAGNETITE.prefab, BiomeType.UnderwaterIslands_Geyser, 0.4F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_DIAMOND.prefab, BiomeType.UnderwaterIslands_Geyser, 0.25F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LITHIUM.prefab, BiomeType.UnderwaterIslands_Geyser, 1.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.QUARTZ.prefab, BiomeType.UnderwaterIslands_Geyser, 2.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.DIAMOND.prefab, BiomeType.UnderwaterIslands_Geyser, 1.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.QUARTZ.prefab, BiomeType.UnderwaterIslands_ValleyFloor, 2.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LITHIUM.prefab, BiomeType.UnderwaterIslands_ValleyFloor, 1F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_QUARTZ.prefab, BiomeType.UnderwaterIslands_ValleyFloor, 0.33F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_MAGNETITE.prefab, BiomeType.UnderwaterIslands_ValleyFloor, 0.15F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_DIAMOND.prefab, BiomeType.UnderwaterIslands_ValleyFloor, 0.2F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.UnderwaterIslands_Geyser, 0.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_MERCURY.prefab, BiomeType.UnderwaterIslands_Geyser, 0.15F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.UnderwaterIslands_ValleyFloor, 0.25F, 1);
LootDistributionHandler.EditLootDistributionData(purpleHolefish.ClassID, BiomeType.UnderwaterIslands_OpenDeep_CreatureOnly, 2.75F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_SULFUR.prefab, BiomeType.LostRiverCorridor_LakeFloor, 0.2F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_SULFUR.prefab, BiomeType.LostRiverJunction_LakeFloor, 0.2F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_SULFUR.prefab, BiomeType.BonesField_Corridor_Stream, 0.2F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_SULFUR.prefab, BiomeType.BonesField_Lake_Floor, 0.2F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_SULFUR.prefab, BiomeType.BonesField_LakePit_Floor, 0.4F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_SULFUR.prefab, BiomeType.BonesField_LakePit_Wall, 0.2F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_SULFUR.prefab, BiomeType.SkeletonCave_Lake_Floor, 0.2F, 1);
//CustomMaterials.getItem(CustomMaterials.Materials.).registerWorldgen(BiomeType.UnderwaterIslands_Geyser, 1, 8F);
/*
LootDistributionHandler.EditLootDistributionData(CraftData.GetClassIdForTechType(TechType.Magnetite), BiomeType.Dunes_ThermalVent, 2F, 1);
LootDistributionHandler.EditLootDistributionData(CraftData.GetClassIdForTechType(TechType.Magnetite), BiomeType.Mountains_ThermalVent, 2F, 1);
LootDistributionHandler.EditLootDistributionData(CraftData.GetClassIdForTechType(TechType.Magnetite), BiomeType.GrandReef_ThermalVent, 2F, 1);
LootDistributionHandler.EditLootDistributionData(CraftData.GetClassIdForTechType(TechType.Magnetite), BiomeType.DeepGrandReef_ThermalVent, 2F, 1);*/
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_MERCURY.prefab, BiomeType.KooshZone_CaveSpecial, 2F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.KooshZone_CaveSpecial, 4F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.KooshZone_CaveFloor, 0.75F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.KooshZone_CaveWall, 0.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.KooshZone_Geyser, 0.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_MERCURY.prefab, BiomeType.KooshZone_Geyser, 0.125F, 1);
foreach (KeyValuePair<Vector3, Tuple<float, int, float>> kvp in mercurySpawners) {
Tuple<float, int, float> vals = kvp.Value; //exclusion radius, target count, max range
int count = vals.Item2;
if (config.getBoolean(C2CConfig.ConfigEntries.HARDMODE))
count = Math.Max(1, count*2/3);
GenUtil.registerWorldgen(new PositionedPrefab(mercuryLootSpawner.ClassID, kvp.Key, Quaternion.identity, new Vector3(vals.Item1, count, vals.Item3)));
}
//LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.Dunes_CaveFloor, 0.05F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.Mountains_CaveFloor, 0.05F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.ActiveLavaZone_Falls_Wall, 0.25F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.ActiveLavaZone_Falls_Floor, 0.25F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.MERCURY.prefab, BiomeType.ActiveLavaZone_Falls_Floor_Far, 0.4F, 1);
/*
LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP1.prefab, BiomeType.CrashZone_Sand, 0.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP2.prefab, BiomeType.CrashZone_Sand, 0.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP3.prefab, BiomeType.CrashZone_Sand, 0.5F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP4.prefab, BiomeType.CrashZone_Sand, 0.5F, 1);
*/
LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP1.prefab, BiomeType.SeaTreaderPath_Path, 0.33F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP2.prefab, BiomeType.SeaTreaderPath_Path, 0.33F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP3.prefab, BiomeType.SeaTreaderPath_Path, 0.33F, 1);
LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP4.prefab, BiomeType.SeaTreaderPath_Path, 0.33F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP1.prefab, BiomeType.GrandReef_TreaderPath, 0.1F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP2.prefab, BiomeType.GrandReef_TreaderPath, 0.1F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP3.prefab, BiomeType.GrandReef_TreaderPath, 0.1F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.SCRAP4.prefab, BiomeType.GrandReef_TreaderPath, 0.1F, 1);
//LootDistributionHandler.EditLootDistributionData(VanillaResources.LARGE_DIAMOND.prefab, BiomeType.Mountains_IslandCaveFloor, 0.33F, 1);
}
private static void addCommands() {
// ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action>("voidsig", VoidSpikesBiome.instance.activateSignal);
//ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<float>>("spawnVKelp", spawnVentKelp);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<bool>>("triggerVoidFX", f => VoidSpikeLeviathanSystem.instance.doDistantRoar(Player.main, true, f));
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<bool>>("triggerVoidFlash", VoidSpikeLeviathanSystem.instance.doDebugFlash);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action>("voidLeviReefback", VoidSpikeLeviathan.makeReefbackTest);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action>("relockRecipes", relockRecipes);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<bool>>("c2cSMMAnyW", b => anywhereSeamothModuleCheatActive = b);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<bool>>("c2cTrackerAll", b => trackerShowAllCheatActive = b);
//ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action>("c2cTrackerSetAll", ExplorationTrackerPages.instance.markAllDiscovered);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<bool>>("c2cSGSA", b => fastSeaglideCheatActive = b);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<bool>>("c2cFRHS", b => SeamothHeatSinkModule.FREE_CHEAT = b);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<float>>("c2cENVHEAT", b => EnvironmentalDamageSystem.instance.TEMPERATURE_OVERRIDE = b);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<bool>>("c2cSMTempDebug", b => C2CMoth.temperatureDebugActive = b);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<string>>("c2cSignalUnlock", unlockSignal);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action<string>>("c2cpoi", POITeleportSystem.instance.jumpToPOI);
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action>("c2cRFLdebug", () => SNUtil.writeToChat("Rocket launch error: "+FinalLaunchAdditionalRequirementSystem.instance.hasAllCargo()+"; Missing scan="+LifeformScanningSystem.instance.hasScannedEverything()));
ConsoleCommandsHandler.Main.RegisterConsoleCommand<Action>("c2cRFLForce", FinalLaunchAdditionalRequirementSystem.instance.forceLaunch);
}
/*
private static void spawnVentKelp(float dist) {
GameObject obj = ObjectUtil.createWorldObject(C2CItems.kelp.ClassID, true, false);
obj.SetActive(false);
obj.transform.position = Player.main.transform.position+MainCamera.camera.transform.forward.normalized*dist;
LargeWorld.main.streamer.cellManager.RegisterEntity(obj);
obj.SetActive(true);
}*/
private static void relockRecipes() {
foreach (TechType tt in C2CRecipes.getRemovedVanillaUnlocks()) {
KnownTech.knownTech.Remove(tt);
}
}
private static void unlockSignal(string name) {
switch(name) {
case "treaderpod":
treaderSignal.fireRadio();
break;
case "crashmesa":
Story.StoryGoal.Execute(SeaToSeaMod.crashMesaRadio.key, SeaToSeaMod.crashMesaRadio.goalType);
break;
case "voidpod":
VoidSpikesBiome.instance.fireRadio();
break;
}
}
private static void addPDAEntries() {
foreach (XMLLocale.LocaleEntry e in pdaLocale.getEntries()) {
PDAManager.PDAPage page = PDAManager.createPage(e);
if (e.hasField("audio"))
page.setVoiceover(e.getField<string>("audio"));
if (e.hasField("header"))
page.setHeaderImage(TextureManager.getTexture(SeaToSeaMod.modDLL, "Textures/PDA/"+e.getField<string>("header")));
page.register();
}
}
/*
public static bool hasNoGasMask() {
return Inventory.main.equipment.GetCount(TechType.Rebreather) == 0 && Inventory.main.equipment.GetCount(rebreatherV2.TechType) == 0;
}*/
public static bool checkConditionAndShowPDAAndVoicelogIfNot(bool check, string page, PDAMessages.Messages msg) {
if (check) {
return true;
}
else {
if (PDAMessagePrompts.instance.trigger(PDAMessages.getAttr(msg).key)) {
if (!string.IsNullOrEmpty(page))
PDAManager.getPage(page).unlock(false);
}
return false;
}
}
public static bool playerCanHeal() {
Player ep = Player.main;
if (EnvironmentalDamageSystem.instance.isPlayerRecoveringFromPressure())
return false;
if (ep.IsSwimming() && ep.GetDepth() >= EnvironmentalDamageSystem.depthDamageStart && !LiquidBreathingSystem.instance.hasLiquidBreathing())
return false;
return true;
}
/*
public static void generateLavaCastleAzurite() {
List<GameObject> azurite = new List<GameObject>();
string azur = CustomMaterials.getItem(CustomMaterials.Materials.VENT_CRYSTAL).ClassID;
foreach (PrefabIdentifier pi in UnityEngine.Object.FindObjectsOfType<PrefabIdentifier>()) {
if (pi.ClassId == "407e40cf-69f2-4412-8ab6-45faac5c4ea2") {
for (int ang = 0; ang < 360; ang += 10) {
float a = UnityEngine.Random.Range(ang-5F, ang+5F);
float r = 16;
Vector3 dt = new Vector3(Mathf.Cos(a)*r, -UnityEngine.Random.Range(0, UnityEngine.Random.Range(25, 40)), Mathf.Sin(a)*r);
Vector3 vec = pi.transform.position+dt;
Ray ray = new Ray(vec, -dt.setY(0));
if (UWE.Utils.RaycastIntoSharedBuffer(ray, 24, Voxeland.GetTerrainLayerMask(), QueryTriggerInteraction.Ignore) > 0) {
RaycastHit hit = UWE.Utils.sharedHitBuffer[0];
if (hit.transform != null) {
bool flag = true;
foreach (PrefabIdentifier pi2 in WorldUtil.getObjectsNearWithComponent<PrefabIdentifier>(hit.point, 9F)) {
if (pi2.ClassId == azur) {
flag = false;
break;
}
}
if (!flag)
continue;
GameObject go = ObjectUtil.createWorldObject(azur);
go.transform.rotation = MathUtil.unitVecToRotation(hit.normal);
go.transform.Rotate(Vector3.up*UnityEngine.Random.Range(0F, 360F), Space.Self);
go.transform.position = hit.point;
azurite.Add(go);
}
}
}
}
}
string path = BuildingHandler.instance.getDumpFile("lavacastle_vents");
XmlDocument doc = new XmlDocument();
XmlElement rootnode = doc.CreateElement("Root");
doc.AppendChild(rootnode);
foreach (GameObject go in azurite) {
PositionedPrefab pfb = new PositionedPrefab(go.GetComponent<PrefabIdentifier>());
XmlElement e = doc.CreateElement("customprefab");
pfb.saveToXML(e);
doc.DocumentElement.AppendChild(e);
}
doc.Save(path);
}*/
public static void generateLRNestPlants() {
Vector3 p1 = new Vector3(-786, -762.6F, -321);
Vector3 p2 = new Vector3(-801, -764.9F, -280);
List<GameObject> plants = new List<GameObject>();
for (float f = 0; f <= 1; f += 0.05F) {
Vector3 vec = Vector3.Lerp(p1, p2, f);
for (int i = 0; i < 9; i++) {
Vector3 rot = UnityEngine.Random.rotationUniform.eulerAngles.normalized;
Ray ray = new Ray(vec, rot);
if (UWE.Utils.RaycastIntoSharedBuffer(ray, 6, Voxeland.GetTerrainLayerMask(), QueryTriggerInteraction.Ignore) > 0) {
RaycastHit hit = UWE.Utils.sharedHitBuffer[0];
if (hit.transform != null) {
bool flag = true;
foreach (PrefabIdentifier pi in WorldUtil.getObjectsNearWithComponent<PrefabIdentifier>(hit.point, 0.2F)) {
if (pi.ClassId == lrNestGrass.ClassID) {
flag = false;
break;
}
}
if (!flag)
continue;
GameObject go = ObjectUtil.createWorldObject(lrNestGrass.ClassID);
go.transform.rotation = MathUtil.unitVecToRotation(hit.normal);
go.transform.position = hit.point;
plants.Add(go);
}
}
}
}
string path = BuildingHandler.instance.getDumpFile("lr_nest");
XmlDocument doc = new XmlDocument();
XmlElement rootnode = doc.CreateElement("Root");
doc.AppendChild(rootnode);
CustomEgg egg = CustomEgg.getEgg(TechType.SpineEel);
foreach (GameObject go in plants) {
PositionedPrefab pfb = new PositionedPrefab(go.GetComponent<PrefabIdentifier>());
XmlElement e = doc.CreateElement("customprefab");
pfb.saveToXML(e);
doc.DocumentElement.AppendChild(e);
}
doc.Save(path);
}
}
}