diff --git a/Libraries/Core/Utils/Cloners/JsonCloner.cs b/Libraries/Core/Utils/Cloners/JsonCloner.cs
index 374c838f..87aa0ed8 100644
--- a/Libraries/Core/Utils/Cloners/JsonCloner.cs
+++ b/Libraries/Core/Utils/Cloners/JsonCloner.cs
@@ -1,8 +1,8 @@
namespace Core.Utils.Cloners;
-/**
- * Disabled as FastCloner library is 15% faster and consumes less memory than Json serialization
- */
+///
+/// Disabled as FastCloner library is 15% faster and consumes less memory than Json serialization
+///
public class JsonCloner : ICloner
{
protected JsonUtil _jsonUtil;
diff --git a/Libraries/Core/Utils/Cloners/ReflectionsCloner.cs b/Libraries/Core/Utils/Cloners/ReflectionsCloner.cs
index e705bdb5..472fcf87 100644
--- a/Libraries/Core/Utils/Cloners/ReflectionsCloner.cs
+++ b/Libraries/Core/Utils/Cloners/ReflectionsCloner.cs
@@ -7,9 +7,10 @@ using LogLevel = Core.Models.Spt.Logging.LogLevel;
namespace Core.Utils.Cloners;
-/**
- * Not in use at the moment
- */
+///
+/// Not in use at the moment
+///
+///
public class ReflectionsCloner(ISptLogger logger) : ICloner
{
private static Dictionary MemberInfoCache = new();
diff --git a/Libraries/Core/Utils/ImporterUtil.cs b/Libraries/Core/Utils/ImporterUtil.cs
index b2d2fa03..adb9343f 100644
--- a/Libraries/Core/Utils/ImporterUtil.cs
+++ b/Libraries/Core/Utils/ImporterUtil.cs
@@ -36,12 +36,14 @@ public class ImporterUtil
.ContinueWith(res => (T) res.Result);
}
- /**
- * Load files into objects recursively (asynchronous)
- * @param filepath Path to folder with files
- * @returns Promise
- * return T type associated with this class
- */
+ ///
+ /// Load files into objects recursively (asynchronous)
+ ///
+ /// Path to folder with files
+ ///
+ ///
+ ///
+ /// Task
protected async Task LoadRecursiveAsync(
string filepath,
Type loadedType,
diff --git a/Libraries/Core/Utils/RagfairOfferHolder.cs b/Libraries/Core/Utils/RagfairOfferHolder.cs
index 7c43fc30..bb837635 100644
--- a/Libraries/Core/Utils/RagfairOfferHolder.cs
+++ b/Libraries/Core/Utils/RagfairOfferHolder.cs
@@ -334,9 +334,9 @@ public class RagfairOfferHolder(
}
}
- /**
- * Clear out internal expiredOffers dictionary of all items
- */
+ ///
+ /// Clear out internal expiredOffers dictionary of all items
+ ///
public void ResetExpiredOfferIds()
{
lock (_expiredOfferIdsLock)
diff --git a/Libraries/Core/Utils/RandomUtil.cs b/Libraries/Core/Utils/RandomUtil.cs
index 2a2c54d9..39be2e39 100644
--- a/Libraries/Core/Utils/RandomUtil.cs
+++ b/Libraries/Core/Utils/RandomUtil.cs
@@ -307,20 +307,19 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner)
/// A biased random number within the specified range.
public double GetBiasedRandomNumber(double min, double max, double shift, double n)
{
- /**
- * This function generates a random number based on a gaussian distribution with an option to add a bias via shifting.
- *
- * Here's an example graph of how the probabilities can be distributed:
- * https://www.boost.org/doc/libs/1_49_0/libs/math/doc/sf_and_dist/graphs/normal_pdf.png
- *
- * Our parameter 'n' is sort of like σ (sigma) in the example graph.
- *
- * An 'n' of 1 means all values are equally likely. Increasing 'n' causes numbers near the edge to become less likely.
- * By setting 'shift' to whatever 'max' is, we can make values near 'min' very likely, while values near 'max' become extremely unlikely.
- *
- * Here's a place where you can play around with the 'n' and 'shift' values to see how the distribution changes:
- * http://jsfiddle.net/e08cumyx/
- */
+ // This function generates a random number based on a gaussian distribution with an option to add a bias via shifting.
+
+ // Here's an example graph of how the probabilities can be distributed:
+ // https://www.boost.org/doc/libs/1_49_0/libs/math/doc/sf_and_dist/graphs/normal_pdf.png
+
+ // Our parameter 'n' is sort of like σ (sigma) in the example graph.
+
+ // An 'n' of 1 means all values are equally likely. Increasing 'n' causes numbers near the edge to become less likely.
+ // By setting 'shift' to whatever 'max' is, we can make values near 'min' very likely, while values near 'max' become extremely unlikely.
+
+ // Here's a place where you can play around with the 'n' and 'shift' values to see how the distribution changes:
+ // http://jsfiddle.net/e08cumyx/
+
if (max < min)
{
_logger.Error($"Invalid argument, Bounded random number generation max is smaller than min({max} < {min}");
@@ -340,12 +339,11 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner)
if (shift > max - min)
{
- /**
- * If a rolled number is out of bounds (due to bias being applied), we roll it again.
- * As the shifting increases, the chance of rolling a number within bounds decreases.
- * A shift that is equal to the available range only has a 50% chance of rolling correctly, theoretically halving performance.
- * Shifting even further drops the success chance very rapidly - so we want to warn against that
- **/
+ // If a rolled number is out of bounds (due to bias being applied), we roll it again.
+ // As the shifting increases, the chance of rolling a number within bounds decreases.
+ // A shift that is equal to the available range only has a 50% chance of rolling correctly, theoretically halving performance.
+ // Shifting even further drops the success chance very rapidly - so we want to warn against that
+
_logger.Warning(
"Bias shift for random number generation is greater than the range of available numbers. This will have a severe performance impact"
);
diff --git a/Libraries/Core/Utils/Watermark.cs b/Libraries/Core/Utils/Watermark.cs
index 53a549d1..15dc1d73 100644
--- a/Libraries/Core/Utils/Watermark.cs
+++ b/Libraries/Core/Utils/Watermark.cs
@@ -121,7 +121,6 @@ public class Watermark
}
SetTitle();
- ResetCursor();
Draw();
}
@@ -144,11 +143,11 @@ public class Watermark
return versionTag;
}
- /**
- * Handle singleplayer/settings/version
- * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used
- * @returns string
- */
+ ///
+ /// Handle singleplayer/settings/version
+ /// Get text shown in game on screen, can't be translated as it breaks BSGs client when certain characters are used
+ ///
+ /// label text
public string GetInGameVersionLabel()
{
var sptVersion = /*ProgramStatics.SPT_VERSION ||*/ sptConfig.SptVersion;
@@ -159,29 +158,17 @@ public class Watermark
return $"{sptConfig.ProjectName} {versionTag}";
}
- /**
- * Set window title
- */
+ ///
+ /// Set window title
+ ///
protected void SetTitle()
{
Console.Title = versionLabel;
}
- /**
- * Reset console cursor to top
- */
- protected void ResetCursor()
- {
- /*
- if (!ProgramStatics.COMPILED) {
- process.stdout.write("\u001B[2J\u001B[0;0f");
- }
- */
- }
-
- /**
- * Draw the watermark
- */
+ ///
+ /// Draw watermark on screen
+ ///
protected void Draw()
{
var result = new List();
diff --git a/Server/Modding/ModLoadOrder.cs b/Server/Modding/ModLoadOrder.cs
index 316ada04..71b5a344 100644
--- a/Server/Modding/ModLoadOrder.cs
+++ b/Server/Modding/ModLoadOrder.cs
@@ -61,31 +61,6 @@ public class ModLoadOrder(ICloner cloner)
return loadBefore;
}
- /**
- * TODO: Is this not needed at all?
- */
- public HashSet GetModsOnLoadAfter(string mod)
- {
- if (!mods.ContainsKey(mod))
- {
- throw new Exception($"The mod {mod} does not exist!");
- }
-
- var config = mods[mod];
-
- var loadAfter = new HashSet(config.LoadAfter);
-
- foreach (var loadAfterMod in loadAfter)
- {
- if (!mods.ContainsKey(loadAfterMod))
- {
- loadAfter.Remove(loadAfterMod);
- }
- }
-
- return loadAfter;
- }
-
protected void InvertLoadBefore(string mod)
{
var loadBefore = GetModsOnLoadBefore(mod);
diff --git a/Server/Modding/ModValidator.cs b/Server/Modding/ModValidator.cs
index 2e21ba30..1b94b452 100644
--- a/Server/Modding/ModValidator.cs
+++ b/Server/Modding/ModValidator.cs
@@ -117,7 +117,7 @@ public class ModValidator(
}
// Returns if mod isnt compatible with this verison of spt
- if (!IsModCombatibleWithSpt(modToValidate))
+ if (!IsModCompatibleWithSpt(modToValidate))
{
errorsFound = true;
}
@@ -173,21 +173,21 @@ public class ModValidator(
return previndex - nextindex;
}
- /**
- * Check for duplicate mods loaded, show error if any
- * @param modPackageData map of mod package.json data
- */
+ ///
+ /// Check for duplicate mods loaded, show error if any
+ ///
+ /// Dictionary of mod package.json data
protected void CheckForDuplicateMods(Dictionary modPackageData)
{
- var grouppedMods = new Dictionary>();
+ var groupedMods = new Dictionary>();
foreach (var mod in modPackageData.Values)
{
var name = $"{mod.Author}-{mod.Name}";
- grouppedMods.Add(name, [..(grouppedMods.GetValueOrDefault(name) ?? []), mod]);
+ groupedMods.Add(name, [..(groupedMods.GetValueOrDefault(name) ?? []), mod]);
// if there's more than one entry for a given mod it means there's at least 2 mods with the same author and name trying to load.
- if (grouppedMods[name].Count > 1 && !skippedMods.Contains(name))
+ if (groupedMods[name].Count > 1 && !skippedMods.Contains(name))
{
skippedMods.Add(name);
}
@@ -200,24 +200,23 @@ public class ModValidator(
}
}
- /**
- * Returns an array of valid mods.
- *
- * @param mods mods to validate
- * @returns array of mod folder names
- */
+ ///
+ /// Returns an array of valid mods
+ ///
+ /// mods to validate
+ /// array of mod folder names
protected List GetValidMods(List mods)
{
return mods.Where(ValidMod).ToList();
}
- /**
- * Is the passed in mod compatible with the running server version
- * @param mod Mod to check compatibiltiy with SPT
- * @returns True if compatible
- */
- protected bool IsModCombatibleWithSpt(PackageJsonData mod)
+ ///
+ /// Is the passed in mod compatible with the running server version
+ ///
+ /// Mod to check compatibility with SPT
+ /// True if compatible
+ protected bool IsModCompatibleWithSpt(PackageJsonData mod)
{
var sptVersion = ProgramStatics.SPT_VERSION() ?? sptConfig.SptVersion;
var modName = $"{mod.Author}-${mod.Name}";
@@ -247,10 +246,10 @@ public class ModValidator(
return true;
}
- /**
- * Read loadorder.json (create if doesnt exist) and return sorted list of mods
- * @returns string array of sorted mod names
- */
+ ///
+ /// Read loadorder.json (create if doesnt exist) and return sorted list of mods
+ ///
+ /// string array of sorted mod names
public List SortModsLoadOrder()
{
// if loadorder.json exists: load it, otherwise generate load order
@@ -263,10 +262,10 @@ public class ModValidator(
return modLoadOrder.GetLoadOrder();
}
- /**
- * Compile mod and add into class property "imported"
- * @param mod Name of mod to compile/add
- */
+ ///
+ /// Compile mod and add into class property "imported"
+ ///
+ /// Name of mod to compile/add
protected void AddMod(SptMod mod)
{
// Add mod to imported list
@@ -281,12 +280,11 @@ public class ModValidator(
);
}
- /**
- * Checks if a given mod should be loaded or skipped.
- *
- * @param pkg mod package.json data
- * @returns
- */
+ ///
+ /// Checks if a given mod should be loaded or skipped
+ ///
+ /// mod package.json data
+ ///
protected bool ShouldSkipMod(PackageJsonData pkg)
{
return skippedMods.Contains($"{pkg.Author}-{pkg.Name}");
@@ -363,11 +361,11 @@ public class ModValidator(
return true;
}
- /**
- * Validate a mod passes a number of checks
- * @param modName name of mod in /mods/ to validate
- * @returns true if valid
- */
+ ///
+ /// Validate a mod passes a number of checks
+ ///
+ /// name of mod in /mods/ to validate
+ /// true if valid
protected bool ValidMod(SptMod mod)
{
var modName = mod.PackageJson.Name;
@@ -392,10 +390,10 @@ public class ModValidator(
logger.Error(localisationService.GetText("modloader-is_client_mod", modName));
return false;
}
-
+
if (containsJs || containsTs)
{
- // TODO, needs new localisation!
+ // TODO: needs new localisation!
logger.Error("The mod is an old server mod, JS/TS files detected");
return false;
}
diff --git a/Tools/ItemTplGenerator/ItemTplGenerator.cs b/Tools/ItemTplGenerator/ItemTplGenerator.cs
index 8d8dccdd..bbfe234d 100644
--- a/Tools/ItemTplGenerator/ItemTplGenerator.cs
+++ b/Tools/ItemTplGenerator/ItemTplGenerator.cs
@@ -76,10 +76,10 @@ public class ItemTplGenerator(
_logger.Info("Generating items finished");
}
- /**
- * Return an object containing all items in the game with a generated name
- * @returns An object containing a generated item name to item ID association
- */
+ ///
+ /// Return an object containing all items in the game with a generated name
+ ///
+ /// An object containing a generated item name to item ID association
private Dictionary GenerateItemsObject()
{
var itemsObject = new Dictionary();
@@ -175,10 +175,6 @@ public class ItemTplGenerator(
return orderedItemsObject;
}
- /**
- * @param orderedItemsObject The previously generated object of item name to item ID associations
- * @returns
- */
private Dictionary GenerateWeaponsObject()
{
var weaponsObject = new Dictionary();
@@ -230,11 +226,11 @@ public class ItemTplGenerator(
return orderedWeaponsObject;
}
- /**
- * Clear any non-alpha numeric characters, and fix multiple underscores
- * @param enumKey The enum key to sanitize
- * @returns The sanitized enum key
- */
+ ///
+ /// Clear any non-alpha numeric characters, and fix multiple underscores
+ ///
+ /// The enum key to sanitize
+ /// The sanitized enum key
private string SanitizeEnumKey(string enumKey)
{
return enumKey
@@ -323,11 +319,11 @@ public class ItemTplGenerator(
return true;
}
- /**
- * Generate a prefix for the passed in item
- * @param item The item to generate the prefix for
- * @returns The prefix of the given item
- */
+ ///
+ /// Generate a prefix for the passed in item
+ ///
+ /// The item to generate the prefix for
+ /// The prefix of the given item
private string GetItemPrefix(TemplateItem item)
{
var prefix = "";
@@ -422,11 +418,11 @@ public class ItemTplGenerator(
return GetAmmoPrefix(items[ammoItem]);
}
- /**
- * Return the name of the passed in item, formatted for use in an enum
- * @param item The item to generate the name for
- * @returns The name of the given item
- */
+ ///
+ /// Return the name of the passed in item, formatted for use in an enum
+ ///
+ /// The item to generate the name for
+ /// The name of the given item
private string GetItemName(TemplateItem item)
{
string? itemName = null;