-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fully treat SpawnRandom monobehaviour on server-side spawning, add a …
…cache for prefab placeholder and SpawnRandom parsing
- Loading branch information
1 parent
48412cf
commit c529216
Showing
7 changed files
with
169 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]; | ||
} | ||
} | ||
} |
Oops, something went wrong.