first commit

This commit is contained in:
2025-07-06 00:23:46 +02:00
commit 38f50c8819
1788 changed files with 112878 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
using NitroxModel.DataStructures.Unity;
namespace NitroxServer.Resources;
public interface IPrefabAsset
{
public NitroxTransform Transform { get; set; }
public string ClassId { get; }
}

View File

@@ -0,0 +1,12 @@
using System;
using NitroxModel.DataStructures.Unity;
using NitroxServer.GameLogic.Entities;
namespace NitroxServer.Resources;
[Serializable]
/// <summary>
/// Some PrefabPlaceholders spawn GameObjects that are always there (decor, environment ...)
/// And some others spawn a GameObject with an EntitySlot in which case this field is not null.
/// </summary>
public record struct PrefabPlaceholderAsset(string ClassId, NitroxEntitySlot? EntitySlot = null, NitroxTransform Transform = null) : IPrefabAsset;

View File

@@ -0,0 +1,9 @@
using System.Collections.Generic;
using NitroxModel.DataStructures.Unity;
namespace NitroxServer.Resources;
public record struct PrefabPlaceholderRandomAsset(List<string> ClassIds, NitroxTransform Transform = null, string ClassId = null) : IPrefabAsset
{
public NitroxTransform Transform { get; set; } = Transform;
}

View File

@@ -0,0 +1,11 @@
using System;
using NitroxModel.DataStructures.Unity;
namespace NitroxServer.Resources;
[Serializable]
/// <param name="PrefabAssets">
/// All attached PrefabPlaceholders (and PrefabPlaceholdersGroup). Is in sync with PrefabPlaceholdersGroup.prefabPlaceholders
/// </param>
public record struct PrefabPlaceholdersGroupAsset(string ClassId, IPrefabAsset[] PrefabAssets, NitroxTransform Transform = null) : IPrefabAsset;

View File

@@ -0,0 +1,23 @@
using System.Collections.Generic;
using NitroxServer.Helper;
namespace NitroxServer.Resources;
public class RandomSpawnSpoofer
{
private readonly Dictionary<string, string[]> randomPossibilitiesByClassId;
public RandomSpawnSpoofer(Dictionary<string, string[]> randomPossibilitiesByClassId)
{
this.randomPossibilitiesByClassId = randomPossibilitiesByClassId;
}
public void PickRandomClassIdIfRequired(ref string classId)
{
if (randomPossibilitiesByClassId.TryGetValue(classId, out string[] choices))
{
int randomIndex = XORRandom.NextIntRange(0, choices.Length);
classId = choices[randomIndex];
}
}
}