diff --git a/config/FutilityNicknames.ini b/config/FutilityNicknames.ini
index b7360f5..dc00372 100644
--- a/config/FutilityNicknames.ini
+++ b/config/FutilityNicknames.ini
@@ -28,11 +28,31 @@ colorPermissions=NCP_ForbidColor
; Futility replaces all whitespace characters (including tabulations,
; non-breaking spaces, etc.) instead of only ' '.
replaceSpacesWithUnderscores=true
+; Set this to `true` to remove single 'quotation marks' and `false` to
+; leave them. Default is `false`, same as on vanilla.
+removeSingleQuotationMarks=false
+; Set this to `true` to remove dobule 'quotation marks' and `false` to
+; leave them. Default is `true`, same as on vanilla.
+removeDoubleQuotationMarks=true
; Max allowed nickname length. Negative values disable any length limits.
;
-; NOTE: `0` resets all nicknames to be empty and, if `correctEmptyNicknames`
-; is set to `true`, they will be replaced with one of the fallback nicknames
-; (see `correctEmptyNicknames` and `fallbackNickname`).
+; NOTE #1: `0` resets all nicknames to be empty and,
+; if `correctEmptyNicknames` is set to `true`, they will be replaced with
+; one of the fallback nicknames
+; (see `correctEmptyNicknames` and `fallbackNickname`).
+; NOTE #2: Because of how color swapping in vanilla Killing Floor works,
+; every color swap makes text count as being about 4 characters longer.
+; So if one uses too many colors in the nickname, for drawing functions
+; it will appear to be longer than it actually is and it *will* mess up
+; UI. Unless you are using custom HUD it is recommended to keep this value
+; at default `20` and forbid colored nicknames
+; (by setting `colorPermissions=NCP_ForbidColor`). Or to allow only one
+; color (by setting `colorPermissions=NCP_ForceSingleColor` or
+; `colorPermissions=NCP_ForceTeamColor`) and reducing `maxNicknameLength`
+; to `16` (20 characters - 4 for color swap).
+; If you want to increase the limit above that, you can also do your
+; own research by testing nicknames of various length on
+; screen resolutions you care about.
maxNicknameLength=20
; Should we replace empty player nicknames with a random fallback nickname
; (defined in `fallbackNickname` array)?
@@ -48,4 +68,21 @@ fallbackNickname="Elk Meat"
fallbackNickname="Crab Meat"
fallbackNickname="Boar Meat"
fallbackNickname="Horker Meat"
-fallbackNickname="Bug Meat"
\ No newline at end of file
+fallbackNickname="Bug Meat"
+; Guaranteed order of applying changes (only chosen ones) is as following:
+; 1. Trim/simplify spaces;
+; 2. Remove single and double quotation marks;
+; 3. Enforce max limit of nickname's length;
+; 4. Replace empty nickname with fallback nickname (no further changes
+; will be applied to fallback nickname in that case);
+; 5. Enforce color limitation;
+; 6. Replace remaining whitespaces with underscores.
+;
+; NOTE #1: as follows from the instruction described above, no changes will
+; ever be applied to fallback nicknames (unless player's nickname
+; coincides with one by pure accident).
+; NOTE #2: whitespaces inside steam nicknames are converted into underscores
+; before they are passed into the game and this is a change Futility
+; cannot currently abort.
+; Therefore all changes relevant to whitespaces inside nicknames will only
+; be applied to in-game changes.
\ No newline at end of file
diff --git a/sources/Features/FutileNickames/FutileNickames.uc b/sources/Features/FutileNickames/FutilityNicknames.uc
similarity index 88%
rename from sources/Features/FutileNickames/FutileNickames.uc
rename to sources/Features/FutileNickames/FutilityNicknames.uc
index a3ff4b6..119040d 100644
--- a/sources/Features/FutileNickames/FutileNickames.uc
+++ b/sources/Features/FutileNickames/FutilityNicknames.uc
@@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with Acedia. If not, see .
*/
-class FutileNickames extends FeatureConfig
+class FutilityNicknames extends FeatureConfig
perobjectconfig
config(FutilityNicknames);
@@ -39,6 +39,8 @@ enum NicknameColorPermissions
var public config NicknameSpacesAction spacesAction;
var public config NicknameColorPermissions colorPermissions;
var public config bool replaceSpacesWithUnderscores;
+var public config bool removeSingleQuotationMarks;
+var public config bool removeDoubleQuotationMarks;
var public config bool correctEmptyNicknames;
var public config int maxNicknameLength;
var public config array fallbackNickname;
@@ -55,6 +57,10 @@ protected function AssociativeArray ToData()
_.text.FromString(string(colorPermissions)), true);
data.SetBool( P("replaceSpacesWithUnderscores"),
replaceSpacesWithUnderscores, true);
+ data.SetBool( P("removeSingleQuotationMarks"),
+ removeSingleQuotationMarks, true);
+ data.SetBool( P("removeDoubleQuotationMarks"),
+ removeDoubleQuotationMarks, true);
data.SetBool(P("correctEmptyNicknames"), correctEmptyNicknames, true);
data.SetInt(P("maxNicknameLength"), maxNicknameLength, true);
fallbackNicknamesData = __().collections.EmptyDynamicArray();
@@ -80,6 +86,10 @@ protected function FromData(AssociativeArray source)
source.GetText(P("colorPermissions")));
replaceSpacesWithUnderscores =
source.GetBool(P("replaceSpacesWithUnderscores"), true);
+ removeSingleQuotationMarks =
+ source.GetBool(P("removeSingleQuotationMarks"), true);
+ removeDoubleQuotationMarks =
+ source.GetBool(P("removeDoubleQuotationMarks"), true);
correctEmptyNicknames = source.GetBool(P("correctEmptyNicknames"), true);
maxNicknameLength = source.GetInt(P("correctEmptyNicknames"), 20);
fallbackNicknamesData = DynamicArray(source.GetItem(P("fallbackNickname")));
@@ -141,6 +151,8 @@ protected function DefaultIt()
spacesAction = NSA_DoNothing;
colorPermissions = NCP_ForbidColor;
replaceSpacesWithUnderscores = true;
+ removeSingleQuotationMarks = false;
+ removeDoubleQuotationMarks = true;
correctEmptyNicknames = true;
maxNicknameLength = 20;
if (fallbackNickname.length > 0) {
@@ -164,6 +176,8 @@ defaultproperties
spacesAction = NSA_DoNothing
colorPermissions = NCP_ForbidColor
replaceSpacesWithUnderscores = true
+ removeSingleQuotationMarks = false
+ removeDoubleQuotationMarks = true
correctEmptyNicknames = true
maxNicknameLength = 20
fallbackNickname(0) = "Fresh Meat"
diff --git a/sources/Features/FutileNickames/FutileNickames_Feature.uc b/sources/Features/FutileNickames/FutilityNicknames_Feature.uc
similarity index 82%
rename from sources/Features/FutileNickames/FutileNickames_Feature.uc
rename to sources/Features/FutileNickames/FutilityNicknames_Feature.uc
index b189de8..8839076 100644
--- a/sources/Features/FutileNickames/FutileNickames_Feature.uc
+++ b/sources/Features/FutileNickames/FutilityNicknames_Feature.uc
@@ -20,8 +20,8 @@
* You should have received a copy of the GNU General Public License
* along with Acedia. If not, see .
*/
-class FutileNickames_Feature extends Feature
- dependson(FutileNickames);
+class FutilityNicknames_Feature extends Feature
+ dependson(FutilityNicknames);
/**
* This feature's functionality is rather simple, but we will still break up
@@ -67,7 +67,7 @@ class FutileNickames_Feature extends Feature
// for nicknames, also reducing a sequence of whitespaces inside
// nickname to a single space, e.g. "my nick" becomes "my nick".
// Default is `NSA_DoNothing`, same as on vanilla.
-var private /*config*/ FutileNickames.NicknameSpacesAction spacesAction;
+var private /*config*/ FutilityNicknames.NicknameSpacesAction spacesAction;
// How to treat colored nicknames.
// * `NCP_ForbidColor` - completely strips down any color from nicknames;
@@ -78,7 +78,7 @@ var private /*config*/ FutileNickames.NicknameSpacesAction spacesAction;
// * `NCP_AllowAnyColor` - allows nickname to be colored in any way player
// wants.
// Default is `NCP_ForbidColor`, same as on vanilla.
-var private /*config*/ FutileNickames.NicknameColorPermissions colorPermissions;
+var private /*config*/ FutilityNicknames.NicknameColorPermissions colorPermissions;
// Set this to `true` if you wish to replace all whitespace characters with
// underscores and `false` to leave them as is.
@@ -86,12 +86,32 @@ var private /*config*/ FutileNickames.NicknameColorPermissions colorPermissions;
// Futility replaces all whitespace characters (including tabulations,
// non-breaking spaces, etc.) instead of only ' '.
var private /*config*/ bool replaceSpacesWithUnderscores;
+// Set this to `true` to remove single 'quotation marks' and `false` to
+// leave them. Default is `false`, same as on vanilla.
+var private /*config*/ bool removeSingleQuotationMarks;
+// Set this to `true` to remove dobule 'quotation marks' and `false` to
+// leave them. Default is `true`, same as on vanilla.
+var private /*config*/ bool removeDoubleQuotationMarks;
// Max allowed nickname length. Negative values disable any length limits.
//
-// NOTE: `0` resets all nicknames to be empty and, if `correctEmptyNicknames`
-// is set to `true`, they will be replaced with one of the fallback nicknames
-// (see `correctEmptyNicknames` and `fallbackNickname`).
+// NOTE #1: `0` resets all nicknames to be empty and,
+// if `correctEmptyNicknames` is set to `true`, they will be replaced with
+// one of the fallback nicknames
+// (see `correctEmptyNicknames` and `fallbackNickname`).
+// NOTE #2: Because of how color swapping in vanilla Killing Floor works,
+// every color swap makes text count as being about 4 characters longer.
+// So if one uses too many colors in the nickname, for drawing functions
+// it will appear to be longer than it actually is and it *will* mess up
+// UI. Unless you are using custom HUD it is recommended to keep this value
+// at default `20` and forbid colored nicknames
+// (by setting `colorPermissions=NCP_ForbidColor`). Or to allow only one
+// color (by setting `colorPermissions=NCP_ForceSingleColor` or
+// `colorPermissions=NCP_ForceTeamColor`) and reducing `maxNicknameLength`
+// to `16` (20 characters - 4 for color swap).
+// If you want to increase the limit above that, you can also do your
+// own research by testing nicknames of various length on
+// screen resolutions you care about.
var private /*config*/ int maxNicknameLength;
// Should we replace empty player nicknames with a random fallback nickname
@@ -103,11 +123,12 @@ var private /*config*/ array fallbackNickname;
// Guaranteed order of applying changes (only chosen ones) is as following:
// 1. Trim/simplify spaces;
-// 2. Enforce max limit of nickname's length;
-// 3. Replace empty nickname with fallback nickname (no further changes
+// 2. Remove single and double quotation marks;
+// 3. Enforce max limit of nickname's length;
+// 4. Replace empty nickname with fallback nickname (no further changes
// will be applied to fallback nickname in that case);
-// 4. Enforce color limitation;
-// 5. Replace remaining whitespaces with underscores.
+// 5. Enforce color limitation;
+// 6. Replace remaining whitespaces with underscores.
//
// NOTE #1: as follows from the instruction described above, no changes will
// ever be applied to fallback nicknames (unless player's nickname
@@ -150,12 +171,14 @@ protected function OnDisabled()
protected function SwapConfig(FeatureConfig config)
{
local bool configRequiresCensoring;
- local FutileNickames newConfig;
- newConfig = FutileNickames(config);
+ local FutilityNicknames newConfig;
+ newConfig = FutilityNicknames(config);
if (newConfig == none) {
return;
}
replaceSpacesWithUnderscores = newConfig.replaceSpacesWithUnderscores;
+ removeSingleQuotationMarks = newConfig.removeSingleQuotationMarks;
+ removeDoubleQuotationMarks = newConfig.removeDoubleQuotationMarks;
correctEmptyNicknames = newConfig.correctEmptyNicknames;
spacesAction = newConfig.spacesAction;
colorPermissions = newConfig.colorPermissions;
@@ -201,7 +224,7 @@ private function Text PickNextFallback()
return result;
}
-protected function SwapFallbackNicknames(FutileNickames newConfig)
+protected function SwapFallbackNicknames(FutilityNicknames newConfig)
{
local int i;
_.memory.FreeMany(fallbackNickname);
@@ -219,6 +242,8 @@ protected function SwapFallbackNicknames(FutileNickames newConfig)
private function bool IsAnyCensoringEnabled()
{
return ( replaceSpacesWithUnderscores
+ || removeSingleQuotationMarks
+ || removeDoubleQuotationMarks
|| correctEmptyNicknames
|| maxNicknameLength >= 0
|| colorPermissions != NCP_AllowAnyColor
@@ -280,6 +305,12 @@ private function CensorNickname(MutableText nickname, EPlayer affectedPlayer)
if (spacesAction != NSA_DoNothing) {
nickname.Simplify(spacesAction == NSA_Simplify);
}
+ if (removeSingleQuotationMarks) {
+ nickname.Replace(P("'"), P(""));
+ }
+ if (removeDoubleQuotationMarks) {
+ nickname.Replace(P("\""), P(""));
+ }
if (maxNicknameLength >= 0) {
nickname.Remove(maxNicknameLength);
}
@@ -335,6 +366,6 @@ private function ReplaceSpaces(MutableText nickname)
defaultproperties
{
- configClass = class'FutileNickames'
+ configClass = class'FutilityNicknames'
CODEPOINT_UNDERSCORE = 95 // '_'
}
\ No newline at end of file
diff --git a/sources/Manifest.uc b/sources/Manifest.uc
index 7d1d965..e95f9d9 100644
--- a/sources/Manifest.uc
+++ b/sources/Manifest.uc
@@ -23,5 +23,5 @@
defaultproperties
{
features(0) = class'Futility_Feature'
- features(1) = class'FutileNickames_Feature'
+ features(1) = class'FutilityNicknames_Feature'
}
\ No newline at end of file