Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Biome Handler #511

Merged
merged 19 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add example mod for biomes
  • Loading branch information
LeeTwentyThree committed Dec 18, 2023
commit 5f57cde4acb92678e3b057211c02f5f417360d90
34 changes: 34 additions & 0 deletions Example mod/BiomeHandlerExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using BepInEx;
using Nautilus.Assets;
using Nautilus.Assets.PrefabTemplates;
using Nautilus.Handlers;
using UnityEngine;

namespace Nautilus.Examples;

[BepInPlugin("com.snmodding.nautilus.biomehandler", "Nautilus Biome Example Mod", Nautilus.PluginInfo.PLUGIN_VERSION)]
[BepInDependency("com.snmodding.nautilus")]
public class BiomeHandlerExample : BaseUnityPlugin
{
private void Awake()
{
// Register the new biome into the game
var lilyPadsFogSettings = BiomeHandler.CreateBiomeSettings(new Vector3(20, 5, 6), 0.6f, Color.white, 0.45f,
new Color(0.18f, 0.604f, 0.404f), 0.05f, 20, 1, 1.25f, 20);
#if SUBNAUTICA
BiomeHandler.RegisterBiome("nautilusexamplebiome", lilyPadsFogSettings, new BiomeHandler.SkyReference("SkyKelpForest"));
#elif BELOWZERO
BiomeHandler.RegisterBiome("nautilusexamplebiome", lilyPadsFogSettings, new BiomeHandler.SkyReference("SkyLilyPads"));
#endif

// Create an atmosphere volume for the biome
PrefabInfo volumePrefabInfo = PrefabInfo.WithTechType("NautilusExampleBiomeSphereVolume");
CustomPrefab volumePrefab = new CustomPrefab(volumePrefabInfo);
AtmosphereVolumeTemplate volumeTemplate = new AtmosphereVolumeTemplate(volumePrefabInfo, AtmosphereVolumeTemplate.VolumeShape.Sphere, "nautilusexamplebiome");
volumePrefab.SetGameObject(volumeTemplate);
volumePrefab.Register();

// Add the biome somewhere to the world
CoordinatedSpawnsHandler.RegisterCoordinatedSpawn(new SpawnInfo(volumePrefabInfo.ClassID, new Vector3(-1400, -30, 600), Quaternion.identity));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections;
using Nautilus.Utility;
using UnityEngine;

namespace Nautilus.Assets.PrefabTemplates;
Expand Down