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
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
Allow atmos vol cell level changes (batch is dumb)
  • Loading branch information
LeeTwentyThree committed Dec 19, 2023
commit dcb148450c5b9ec960e6b70b7cd00c60c1f89056
11 changes: 9 additions & 2 deletions Nautilus/Assets/PrefabTemplates/AtmosphereVolumeTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public class AtmosphereVolumeTemplate : PrefabTemplate
/// The priority of this atmosphere volume. Atmosphere volumes with higher priorities override those with lower priorities. The default priority is 10.
/// </summary>
public int Priority { get; set; }

/// <summary>
/// Determines the loading distance of this atmosphere volume prefab. Default value is <see cref="LargeWorldEntity.CellLevel.Far"/>. Although vanilla prefabs always use Batch for this, this does not work with our custom systems.
/// </summary>
public LargeWorldEntity.CellLevel CellLevel { get; set; }

/// <summary>
/// Callback that will get called after the prefab is retrieved. Use this to modify or process your prefab further more.
Expand All @@ -41,11 +46,13 @@ public class AtmosphereVolumeTemplate : PrefabTemplate
/// <param name="shape">The shape of this atmosphere volume.</param>
/// <param name="overrideBiome">The biome type used by this atmosphere volume.</param>
/// <param name="priority">The priority of this atmosphere volume. Atmosphere volumes with higher priorities override those with lower priorities.</param>
public AtmosphereVolumeTemplate(PrefabInfo info, VolumeShape shape, string overrideBiome, int priority = 10) : base(info)
/// <param name="cellLevel">Determines the loading distance of this atmosphere volume prefab. Although vanilla prefabs always use Batch for this, this does not work with our custom systems.</param>
public AtmosphereVolumeTemplate(PrefabInfo info, VolumeShape shape, string overrideBiome, int priority = 10, LargeWorldEntity.CellLevel cellLevel = LargeWorldEntity.CellLevel.Far) : base(info)
{
Shape = shape;
OverrideBiome = overrideBiome;
Priority = priority;
CellLevel = cellLevel;
}

/// <summary>
Expand All @@ -66,7 +73,7 @@ public override IEnumerator GetPrefabAsync(TaskResult<GameObject> gameObject)
collider.isTrigger = true;

prefab.AddComponent<PrefabIdentifier>().ClassId = info.ClassID;
prefab.AddComponent<LargeWorldEntity>().cellLevel = LargeWorldEntity.CellLevel.Batch;
prefab.AddComponent<LargeWorldEntity>().cellLevel = CellLevel;

var atmosphereVolume = prefab.AddComponent<AtmosphereVolume>();
atmosphereVolume.overrideBiome = OverrideBiome;
Expand Down