Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ public int Index

public ConfigurationEntry<float> OceanDepthMax = new(0, "Maximum ocean depth to spawn in. Ignored if min == max.");

public ConfigurationEntry<float> RotationX = new(0, "Rotate the spawned object on the x axis. Defaults to 0");

public ConfigurationEntry<float> RotationY = new(0, "Rotate the spawned object on the y axis. Defaults to 0");

public ConfigurationEntry<float> RotationZ = new(0, "Rotate the spawned object on the z axis. Defaults to 0");
#endregion
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Valheim.CustomRaids.Core;

namespace Valheim.CustomRaids.Spawns.Modifiers.General;

public class SpawnModifierRotatePrefab : ISpawnModifier
{
private static SpawnModifierRotatePrefab _instance;

public static SpawnModifierRotatePrefab Instance
{
get
{
return _instance ??= new SpawnModifierRotatePrefab();
}
}

public void Modify(SpawnContext context)
{
if (context.Spawn is null)
{
return;
}

float rotationX = context.Config.RotationX.Value;
float rotationY = context.Config.RotationY.Value;
float rotationZ = context.Config.RotationZ.Value;
#if DEBUG
Log.LogDebug($"Rotating object: x{rotationX}, y{rotationY}, z{rotationZ}");
#endif
context.Spawn.transform.Rotate(rotationX, rotationY, rotationZ);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static class SpawnModificationManager
static SpawnModificationManager()
{
SpawnModifiers.Add(SpawnModifierSetFaction.Instance);
SpawnModifiers.Add(SpawnModifierRotatePrefab.Instance);

SpawnModifiers.Add(SpawnModifierLoaderCLLC.BossAffix);
SpawnModifiers.Add(SpawnModifierLoaderCLLC.ExtraEffect);
Expand Down