diff --git a/config/Acedia.ini b/config/Acedia.ini
index 80b4ec9..fecbb06 100644
--- a/config/Acedia.ini
+++ b/config/Acedia.ini
@@ -1,255 +1,3 @@
-[Acedia.FixDualiesCost]
-; This feature fixes several issues, related to the selling price of both
-; single and dual pistols, all originating from the existence of dual weapons.
-; Most notable issue is the ability to "print" money by buying and
-; selling pistols in a certain way.
-;
-; Fix only works with vanilla pistols, as it's unpredictable what
-; custom ones can do and they can handle these issues on their own
-; in a better way.
-autoEnable=true
-; Some issues involve possible decrease in pistols' price and
-; don't lead to the exploit, but are still bugs and require fixing.
-; If you have a Deagle in your inventory and then get another one
-; (by either buying or picking it off the ground) - the price of resulting
-; dual pistols will be set to the price of the last deagle,
-; like the first one wasn't worth anything at all.
-; In particular this means that (prices are off-perk for more clarity):
-; 1. If you buy dual deagles (-1000 do$h) and then sell them at 75% of
-; the cost (+750 do$h), you lose 250 do$h;
-; 2. If you first buy a deagle (-500 do$h), then buy
-; the second one (-500 do$h) and then sell them, you'll only get
-; 75% of the cost of 1 deagle (+375 do$h), now losing 625 do$h;
-; 3. So if you already have bought a deagle (-500 do$h),
-; you can get a more expensive weapon by doing a stupid thing
-; and first selling your Deagle (+375 do$h),
-; then buying dual deagles (-1000 do$h).
-; If you sell them after that, you'll gain 75% of the cost of
-; dual deagles (+750 do$h), leaving you with losing only 375 do$h.
-; Of course, situations described above are only relevant if you're planning
-; to sell your weapons at some point and most players won't even
-; notice these issues.
-; But such an oversight still shouldn't exist in a game and we fix it by
-; setting sell value of dualies as a sum of values of each pistol.
-; Yet, fixing this issue leads to players having more expensive
-; (while fairly priced) weapons than on vanilla, technically making
-; the game easier. And some people might object to having that in
-; a whitelisted bug-fixing feature.
-; These people are, without a question, complete degenerates.
-; But making mods for only non-mentally challenged isn't inclusive.
-; So we add this option.
-; Set it to 'false' if you only want to fix ammo printing
-; and leave the rest of the bullshit as-is.
-allowSellValueIncrease=true
-
-
-[Acedia.FixAmmoSelling]
-; This feature addressed an oversight in vanilla code that
-; allows clients to sell weapon's ammunition.
-; Due to the implementation of ammo selling, this allows cheaters to
-; "print money" by buying and selling ammo over and over again.
-autoEnable=true
-; Due to how this fix works, players with level below 6 get charged less
-; than necessary by the shop and this fix must take the rest of
-; the cost by itself.
-; The problem is, due to how ammo purchase is coded, low-level (<6 lvl)
-; players can actually buy more ammo for "fixed" weapons than they can afford
-; by filling ammo for one or all weapons.
-; Setting this flag to 'true' will allow us to still take full cost
-; from them, putting them in "debt" (having negative dosh amount).
-; If you don't want to have players with negative dosh values on your server
-; as a side-effect of this fix, then leave this flag as 'false',
-; letting low level players buy ammo cheaper
-; (but not cheaper than lvl6 could).
-; NOTE: this issue doesn't affect level 6 players.
-; NOTE #2: this fix does give players below level 6 some
-; technical advantage compared to vanilla game, but this advantage
-; cannot exceed benefits of having level 6.
-allowNegativeDosh=false
-
-
-[Acedia.FixInventoryAbuse]
-; This feature addressed two issues with the inventory:
-; 1. Players carrying amount of weapons that shouldn't be allowed by the
-; weight limit.
-; 2. Players carrying two variants of the same gun.
-; For example carrying both M32 and camo M32.
-; Single and dual version of the same weapon are also considered
-; the same type of gun, so you shouldn't be able to carry
-; both MK23 and dual MK23 or dual handcannons and golden handcannon.
-; But cheaters do. But not with this fix.
-autoEnable=true
-; How often (in seconds) should we do inventory validation checks?
-; You shouldn't really worry about performance, but there's also no need to
-; do this check too often.
-checkInterval=0.25
-; For this fix to properly work, this array must contain an entry for
-; every dual weapon in the game (like pistols, with single and dual versions).
-; It's made configurable in case of custom dual weapons.
-dualiesClasses=(single=class'KFMod.SinglePickup',dual=class'KFMod.DualiesPickup')
-dualiesClasses=(single=class'KFMod.Magnum44Pickup',dual=class'KFMod.Dual44MagnumPickup')
-dualiesClasses=(single=class'KFMod.MK23Pickup',dual=class'KFMod.DualMK23Pickup')
-dualiesClasses=(single=class'KFMod.DeaglePickup',dual=class'KFMod.DualDeaglePickup')
-dualiesClasses=(single=class'KFMod.GoldenDeaglePickup',dual=class'KFMod.GoldenDualDeaglePickup')
-dualiesClasses=(single=class'KFMod.FlareRevolverPickup',dual=class'KFMod.DualFlareRevolverPickup')
-
-
-[Acedia.FixInfiniteNades]
-; This feature fixes a vulnerability in a code of 'Frag' that can allow
-; player to throw grenades even when he no longer has any.
-; There's also no cooldowns on the throw, which can lead to a server crash.
-autoEnable=true
-; Setting this flag to 'true' will allow to throw grenades by calling
-; 'ServerThrow' directly, as long as player has necessary ammo.
-; This can allow some players to throw grenades much quicker than intended,
-; therefore it's suggested to keep this flag set to 'false'.
-ignoreTossFlags=false
-
-
-[Acedia.FixDoshSpam]
-; This feature addressed two dosh-related issues:
-; 1. Crashing servers by spamming 'CashPickup' actors with 'TossCash';
-; 2. Breaking collision detection logic by stacking large amount of
-; 'CashPickup' actors in one place, which allows one to either
-; reach unintended locations or even instantly kill zeds.
-;
-; It fixes them by limiting speed, with which dosh can spawn, and
-; allowing this limit to decrease when there's already too much dosh
-; present on the map.
-autoEnable=true
-; Highest and lowest speed with which players can throw dosh wads.
-; It'll be evenly spread between all players.
-; For example, if speed is set to 6 and only one player will be spamming dosh,
-; - he'll be able to throw 6 wads of dosh per second;
-; but if all 6 players are spamming it, - each will throw only 1 per second.
-; NOTE: these speed values can be exceeded, since a player is guaranteed
-; to be able to throw at least one wad of dosh, if he didn't do so in awhile.
-; NOTE #2: if maximum value is less than minimum one,
-; the lowest (maximum one) will be used.
-doshPerSecondLimitMax=50
-doshPerSecondLimitMin=5
-; Amount of dosh pickups on the map at which we must set dosh per second
-; to 'doshPerSecondLimitMin'.
-; We use 'doshPerSecondLimitMax' when there's no dosh on the map and
-; scale linearly between them as it's amount grows.
-criticalDoshAmount=25
-
-
-[Acedia.FixSpectatorCrash]
-; This feature attempts to prevent server crashes caused by someone
-; quickly switching between being spectator and an active player.
-autoEnable=true
-; This fix will try to kick any player that switches between active player
-; and cooldown faster than time (in seconds) in this value.
-; NOTE: raising this value past default value of '0.25'
-; won't actually improve crash prevention, but might cause regular players to
-; get accidentally kicked.
-spectatorChangeTimeout=0.25
-; [ADVANCED] Don't change this setting unless you know what you're doing.
-; Allows you to turn off server blocking.
-; Players that don't respect timeout will still be kicked.
-; This might be needed if this fix conflicts with another mutator
-; that also changes 'numPlayers'.
-; This option is necessary to block aggressive enough server crash
-; attempts, but can cause compatibility issues with some mutators.
-; It's highly recommended to rewrite such a mutator to be compatible instead.
-; NOTE: fix should be compatible with most faked players-type mutators,
-; since this it remembers the difference between amount of
-; real players and 'numPlayers'.
-; After unblocking, it sets 'numPlayers' to
-; the current amount of real players + that difference.
-; So 4 players + 3 (=7 numPlayers) after kicking 1 player becomes
-; 3 players + 3 (=6 numPlayers).
-allowServerBlock=true
-
-
-[Acedia.FixFFHack]
-; This feature fixes a bug that can allow players to bypass server's
-; friendly fire limitations and teamkill.
-; Usual fixes apply friendly fire scale to suspicious damage themselves, which
-; also disables some of the environmental damage.
-; In oder to avoid that, this fix allows server owner to define precisely
-; to what damage types to apply the friendly fire scaling.
-; It should be all damage types related to projectiles.
-autoEnable=true
-; Defines a general rule for chosing whether or not to apply
-; friendly fire scaling.
-; This can be overwritten by exceptions ('alwaysScale' or 'neverScale').
-; Enabling scaling by default without any exceptions in 'neverScale' will
-; make this fix behave almost identically to Mutant's 'Explosives Fix Mutator'.
-scaleByDefault=false
-; Damage types, for which we should always reaaply friendly fire scaling.
-alwaysScale=Class'KFMod.DamTypeCrossbuzzsawHeadShot'
-alwaysScale=Class'KFMod.DamTypeCrossbuzzsaw'
-alwaysScale=Class'KFMod.DamTypeFrag'
-alwaysScale=Class'KFMod.DamTypePipeBomb'
-alwaysScale=Class'KFMod.DamTypeM203Grenade'
-alwaysScale=Class'KFMod.DamTypeM79Grenade'
-alwaysScale=Class'KFMod.DamTypeM79GrenadeImpact'
-alwaysScale=Class'KFMod.DamTypeM32Grenade'
-alwaysScale=Class'KFMod.DamTypeLAW'
-alwaysScale=Class'KFMod.DamTypeLawRocketImpact'
-alwaysScale=Class'KFMod.DamTypeFlameNade'
-alwaysScale=Class'KFMod.DamTypeFlareRevolver'
-alwaysScale=Class'KFMod.DamTypeFlareProjectileImpact'
-alwaysScale=Class'KFMod.DamTypeBurned'
-alwaysScale=Class'KFMod.DamTypeTrenchgun'
-alwaysScale=Class'KFMod.DamTypeHuskGun'
-alwaysScale=Class'KFMod.DamTypeCrossbow'
-alwaysScale=Class'KFMod.DamTypeCrossbowHeadShot'
-alwaysScale=Class'KFMod.DamTypeM99SniperRifle'
-alwaysScale=Class'KFMod.DamTypeM99HeadShot'
-alwaysScale=Class'KFMod.DamTypeShotgun'
-alwaysScale=Class'KFMod.DamTypeNailGun'
-alwaysScale=Class'KFMod.DamTypeDBShotgun'
-alwaysScale=Class'KFMod.DamTypeKSGShotgun'
-alwaysScale=Class'KFMod.DamTypeBenelli'
-alwaysScale=Class'KFMod.DamTypeSPGrenade'
-alwaysScale=Class'KFMod.DamTypeSPGrenadeImpact'
-alwaysScale=Class'KFMod.DamTypeSeekerSixRocket'
-alwaysScale=Class'KFMod.DamTypeSeekerRocketImpact'
-alwaysScale=Class'KFMod.DamTypeSealSquealExplosion'
-alwaysScale=Class'KFMod.DamTypeRocketImpact'
-alwaysScale=Class'KFMod.DamTypeBlowerThrower'
-alwaysScale=Class'KFMod.DamTypeSPShotgun'
-alwaysScale=Class'KFMod.DamTypeZEDGun'
-alwaysScale=Class'KFMod.DamTypeZEDGunMKII'
-alwaysScale=Class'KFMod.DamTypeZEDGunMKII'
-; Damage types, for which we should never reaply friendly fire scaling.
-;neverScale=Class'KFMod.???'
-
-
-[Acedia.FixZedTimeLags]
-; When zed time activates, game speed is immediately set to
-; 'zedTimeSlomoScale' (0.2 by default), defined, like all other variables,
-; in 'KFGameType'. Zed time lasts 'zedTimeDuration' seconds (3.0 by default),
-; but during last 'zedTimeDuration * 0.166' seconds (by default 0.498)
-; it starts to speed back up, causing game speed to update every tick.
-; This makes animations look more smooth when exiting zed-time.
-; However, updating speed every tick for that purpose seems like
-; an overkill and, combined with things like
-; increased tick rate, certain open maps and increased zed limit,
-; it can lead to noticable lags at the end of the zed time.
-; This fix limits amount of actual game speed updates, alleviating the issue.
-;
-; As a side effect it also fixes an issue where during zed time speed up
-; 'zedTimeSlomoScale' was assumed to be default value of '0.2'.
-; Now zed time will behave correctly with mods that change 'zedTimeSlomoScale'.
-autoEnable=true
-; Maximum amount of game speed updates upon leaving zed time.
-; 2 or 3 seem to provide a good enough result that,
-; i.e. it should be hard to notice difference with vanilla game behavior.
-; 1 is a smallest possible value, resulting in effectively removing any
-; smooting via speed up, simply changing speed from
-; the slowest (0.2) to the highest.
-; For the reference: on servers with default 30 tick rate there's usually
-; about 13 updates total (without this fix).
-maxGameSpeedUpdatesAmount=3
-; [ADVANCED] Don't change this setting unless you know what you're doing.
-; Compatibility setting that allows to keep 'GameInfo' 's 'Tick' event
-; from being disabled.
-; Useful when running Acedia along with custom 'GameInfo'
-; (that isn't 'KFGameType') that relies on 'Tick' event.
-; Note, however, that in order to keep this fix working properly,
-; it's on you to make sure 'KFGameType.Tick()' logic isn't executed.
-disableTick=true
\ No newline at end of file
+[Acedia.Packages]
+corePackage="AcediaCore_0_2"
+package="AcediaFixes"
\ No newline at end of file
diff --git a/config/AcediaAliases_Colors.ini b/config/AcediaAliases_Colors.ini
deleted file mode 100644
index 27c0935..0000000
--- a/config/AcediaAliases_Colors.ini
+++ /dev/null
@@ -1,165 +0,0 @@
-[Acedia.ColorAliasSource]
-; System colors
-record=(alias="text_default",value="rgb(255,255,255)")
-record=(alias="text_subtle",value="rgb(128,128,128)")
-record=(alias="text_emphasis",value="rgb(0,128,255)")
-record=(alias="text_ok",value="rgb(0,255,0)")
-record=(alias="text_warning",value="rgb(255,128,0)")
-record=(alias="text_failure",value="rgb(255,0,0)")
-record=(alias="type_number",value="rgb(181,137,0)")
-record=(alias="type_boolean",value="rgb(38,139,210)")
-record=(alias="type_string",value="rgb(211,54,130)")
-record=(alias="type_literal",value="rgb(42,161,152)")
-record=(alias="type_class",value="rgb(108,113,196)")
-; Pink colors
-record=(alias="Pink",value="rgb(255,192,203)")
-record=(alias="LightPink",value="rgb(255,182,193)")
-record=(alias="HotPink",value="rgb(255,105,180)")
-record=(alias="DeepPink",value="rgb(255,20,147)")
-record=(alias="PaleVioletRed",value="rgb(219,112,147)")
-record=(alias="MediumVioletRed",value="rgb(199,21,133)")
-; Red colors
-record=(alias="LightSalmon",value="rgb(255,160,122)")
-record=(alias="Salmon",value="rgb(250,128,114)")
-record=(alias="DarkSalmon",value="rgb(233,150,122)")
-record=(alias="LightCoral",value="rgb(240,128,128)")
-record=(alias="IndianRed",value="rgb(205,92,92)")
-record=(alias="Crimson",value="rgb(220,20,60)")
-record=(alias="Firebrick",value="rgb(178,34,34)")
-record=(alias="DarkRed",value="rgb(139,0,0)")
-record=(alias="Red",value="rgb(255,0,0)")
-; Orange colors
-record=(alias="OrangeRed",value="rgb(255,69,0)")
-record=(alias="Tomato",value="rgb(255,99,71)")
-record=(alias="Coral",value="rgb(255,127,80)")
-record=(alias="DarkOrange",value="rgb(255,140,0)")
-record=(alias="Orange",value="rgb(255,165,0)")
-; Yellow colors
-record=(alias="Yellow",value="rgb(255,255,0)")
-record=(alias="LightYellow",value="rgb(255,255,224)")
-record=(alias="LemonChiffon",value="rgb(255,250,205)")
-record=(alias="LightGoldenrodYellow",value="rgb(250,250,210)")
-record=(alias="PapayaWhip",value="rgb(255,239,213)")
-record=(alias="Moccasin",value="rgb(255,228,181)")
-record=(alias="PeachPuff",value="rgb(255,218,185)")
-record=(alias="PaleGoldenrod",value="rgb(238,232,170)")
-record=(alias="Khaki",value="rgb(240,230,140)")
-record=(alias="DarkKhaki",value="rgb(189,183,107)")
-record=(alias="Gold",value="rgb(255,215,0)")
-; Brown colors
-record=(alias="Cornsilk",value="rgb(255,248,220)")
-record=(alias="BlanchedAlmond",value="rgb(255,235,205)")
-record=(alias="Bisque",value="rgb(255,228,196)")
-record=(alias="NavajoWhite",value="rgb(255,222,173)")
-record=(alias="Wheat",value="rgb(245,222,179)")
-record=(alias="Burlywood",value="rgb(222,184,135)")
-record=(alias="Tan",value="rgb(210,180,140)")
-record=(alias="RosyBrown",value="rgb(188,143,143)")
-record=(alias="SandyBrown",value="rgb(244,164,96)")
-record=(alias="Goldenrod",value="rgb(218,165,32)")
-record=(alias="DarkGoldenrod",value="rgb(184,134,11)")
-record=(alias="Peru",value="rgb(205,133,63)")
-record=(alias="Chocolate",value="rgb(210,105,30)")
-record=(alias="SaddleBrown",value="rgb(139,69,19)")
-record=(alias="Sienna",value="rgb(160,82,45)")
-record=(alias="Brown",value="rgb(165,42,42)")
-record=(alias="Maroon",value="rgb(128,0,0)")
-; Green colors
-record=(alias="DarkOliveGreen",value="rgb(85,107,47)")
-record=(alias="Olive",value="rgb(128,128,0)")
-record=(alias="OliveDrab",value="rgb(107,142,35)")
-record=(alias="YellowGreen",value="rgb(154,205,50)")
-record=(alias="LimeGreen",value="rgb(50,205,50)")
-record=(alias="Lime",value="rgb(0,255,0)")
-record=(alias="LawnGreen",value="rgb(124,252,0)")
-record=(alias="Chartreuse",value="rgb(127,255,0)")
-record=(alias="GreenYellow",value="rgb(173,255,47)")
-record=(alias="SpringGreen",value="rgb(0,255,127)")
-record=(alias="MediumSpringGreen",value="rgb(0,250,154)")
-record=(alias="LightGreen",value="rgb(144,238,144)")
-record=(alias="PaleGreen",value="rgb(152,251,152)")
-record=(alias="DarkSeaGreen",value="rgb(143,188,143)")
-record=(alias="MediumAquamarine",value="rgb(102,205,170)")
-record=(alias="MediumSeaGreen",value="rgb(60,179,113)")
-record=(alias="SeaGreen",value="rgb(46,139,87)")
-record=(alias="ForestGreen",value="rgb(34,139,34)")
-record=(alias="Green",value="rgb(0,128,0)")
-record=(alias="DarkGreen",value="rgb(0,100,0)")
-; Cyan colors
-record=(alias="Aqua",value="rgb(0,255,255)")
-record=(alias="Cyan",value="rgb(0,255,255)")
-record=(alias="LightCyan",value="rgb(224,255,255)")
-record=(alias="PaleTurquoise",value="rgb(175,238,238)")
-record=(alias="Aquamarine",value="rgb(127,255,212)")
-record=(alias="Turquoise",value="rgb(64,224,208)")
-record=(alias="MediumTurquoise",value="rgb(72,209,204)")
-record=(alias="DarkTurquoise",value="rgb(0,206,209)")
-record=(alias="LightSeaGreen",value="rgb(32,178,170)")
-record=(alias="CadetBlue",value="rgb(95,158,160)")
-record=(alias="DarkCyan",value="rgb(0,139,139)")
-record=(alias="Teal",value="rgb(0,128,128)")
-; Blue colors
-record=(alias="LightSteelBlue",value="rgb(176,196,222)")
-record=(alias="PowderBlue",value="rgb(176,224,230)")
-record=(alias="LightBlue",value="rgb(173,216,230)")
-record=(alias="SkyBlue",value="rgb(135,206,235)")
-record=(alias="LightSkyBlue",value="rgb(135,206,250)")
-record=(alias="DeepSkyBlue",value="rgb(0,191,255)")
-record=(alias="DodgerBlue",value="rgb(30,144,255)")
-record=(alias="CornflowerBlue",value="rgb(100,149,237)")
-record=(alias="SteelBlue",value="rgb(70,130,180)")
-record=(alias="RoyalBlue",value="rgb(65,105,225)")
-record=(alias="Blue",value="rgb(0,0,255)")
-record=(alias="MediumBlue",value="rgb(0,0,205)")
-record=(alias="DarkBlue",value="rgb(0,0,139)")
-record=(alias="Navy",value="rgb(0,0,128)")
-record=(alias="MidnightBlue",value="rgb(25,25,112)")
-; Purple, violet, and magenta colors
-record=(alias="Lavender",value="rgb(230,230,250)")
-record=(alias="Thistle",value="rgb(216,191,216)")
-record=(alias="Plum",value="rgb(221,160,221)")
-record=(alias="Violet",value="rgb(238,130,238)")
-record=(alias="Orchid",value="rgb(218,112,214)")
-record=(alias="Fuchsia",value="rgb(255,0,255)")
-record=(alias="Magenta",value="rgb(255,0,255)")
-record=(alias="MediumOrchid",value="rgb(186,85,211)")
-record=(alias="MediumPurple",value="rgb(147,112,219)")
-record=(alias="BlueViolet",value="rgb(138,43,226)")
-record=(alias="DarkViolet",value="rgb(148,0,211)")
-record=(alias="DarkOrchid",value="rgb(153,50,204)")
-record=(alias="DarkMagenta",value="rgb(139,0,139)")
-record=(alias="Purple",value="rgb(128,0,128)")
-record=(alias="Indigo",value="rgb(75,0,130)")
-record=(alias="DarkSlateBlue",value="rgb(72,61,139)")
-record=(alias="SlateBlue",value="rgb(106,90,205)")
-record=(alias="MediumSlateBlue",value="rgb(123,104,238)")
-; White colors
-record=(alias="White",value="rgb(255,255,255)")
-record=(alias="Snow",value="rgb(255,250,250)")
-record=(alias="Honeydew",value="rgb(240,255,240)")
-record=(alias="MintCream",value="rgb(245,255,250)")
-record=(alias="Azure",value="rgb(240,255,255)")
-record=(alias="AliceBlue",value="rgb(240,248,255)")
-record=(alias="GhostWhite",value="rgb(248,248,255)")
-record=(alias="WhiteSmoke",value="rgb(245,245,245)")
-record=(alias="Seashell",value="rgb(255,245,238)")
-record=(alias="Beige",value="rgb(245,245,220)")
-record=(alias="OldLace",value="rgb(253,245,230)")
-record=(alias="FloralWhite",value="rgb(255,250,240)")
-record=(alias="Ivory",value="rgb(255,255,240)")
-record=(alias="AntiqueWhite",value="rgb(250,235,215)")
-record=(alias="Linen",value="rgb(250,240,230)")
-record=(alias="LavenderBlush",value="rgb(255,240,245)")
-record=(alias="MistyRose",value="rgb(255,228,225)")
-; Gray and black colors
-record=(alias="Gainsboro",value="rgb(220,220,220)")
-record=(alias="LightGray",value="rgb(211,211,211)")
-record=(alias="Silver",value="rgb(192,192,192)")
-record=(alias="Gray",value="rgb(169,169,169)")
-record=(alias="DimGray",value="rgb(128,128,128)")
-record=(alias="DarkGray",value="rgb(105,105,105)")
-record=(alias="LightSlateGray",value="rgb(119,136,153)")
-record=(alias="SlateGray",value="rgb(112,128,144)")
-record=(alias="DarkSlateGray",value="rgb(47,79,79)")
-record=(alias="Eigengrau",value="rgb(22,22,29)")
-record=(alias="Black",value="rgb(0,0,0)")
\ No newline at end of file
diff --git a/config/AcediaAliases_Tests.ini b/config/AcediaAliases_Tests.ini
deleted file mode 100644
index 850b0b4..0000000
--- a/config/AcediaAliases_Tests.ini
+++ /dev/null
@@ -1,17 +0,0 @@
-; For the puposes of testing alias functionality.
-; Changing these can break tests.
-;
-; If you don't plan to run tests or do not know what they are, -
-; feel free to remove this file.
-[Acedia.MockAliasSource]
-record=(alias="global",value="value")
-record=(alias="question",value="response")
-record=(alias="",value="empty")
-record=(alias="also",value="")
-[car MockAliases]
-Alias="Ford"
-Alias="Delorean"
-Alias="Audi"
-[sci:fi MockAliases]
-Alias="Spice"
-Alias="HardToBeAGod"
\ No newline at end of file
diff --git a/config/AcediaAliases_Weapons.ini b/config/AcediaAliases_Weapons.ini
deleted file mode 100644
index 067af09..0000000
--- a/config/AcediaAliases_Weapons.ini
+++ /dev/null
@@ -1,547 +0,0 @@
-[Acedia.WeaponAliasSource]
-; Field Medic weapons
-[KFMod:MP7MMedicGun WeaponAliases]
-Alias="MP7M"
-Alias="MP7"
-[KFMod:MP5MMedicGun WeaponAliases]
-Alias="MP5M"
-Alias="MP5"
-Alias="MP"
-Alias="M5"
-[KFMod:CamoMP5MMedicGun WeaponAliases]
-Alias="CamoMP5M"
-Alias="CamoMP5"
-Alias="CamoMP"
-Alias="CamoM5"
-[KFMod:M7A3MMedicGun WeaponAliases]
-Alias="M7A3"
-Alias="M7A"
-Alias="M7"
-[KFMod:KrissMMedicGun WeaponAliases]
-Alias="Schneidzekk"
-Alias="Schneidzek"
-Alias="Kriss"
-Alias="Kris"
-[KFMod:NeonKrissMMedicGun WeaponAliases]
-Alias="NeonSchneidzekk"
-Alias="NeonSchneidzek"
-Alias="NeonKriss"
-Alias="NeonKris"
-[KFMod:BlowerThrower WeaponAliases]
-Alias="BlowerThrower"
-Alias="Blower"
-Alias="Thrower"
-Alias="BThrower"
-Alias="PoopGun"
-Alias="BileGun"
-Alias="BloatGun"
-
-; Support Specialist weapons
-[KFMod:Shotgun WeaponAliases]
-Alias="Shotgun"
-[KFMod:CamoShotgun WeaponAliases]
-Alias="CamoShotgun"
-[KFMod:BoomStick WeaponAliases]
-Alias="HuntingShotgun"
-Alias="BoomStick"
-Alias="Hunting"
-[KFMod:KSGShotgun WeaponAliases]
-Alias="HSG-1Shotgun"
-Alias="HSG1Shotgun"
-Alias="HSGShotgun"
-Alias="HSG"
-Alias="KSG-1Shotgun"
-Alias="KSG1Shotgun"
-Alias="KSGShotgun"
-Alias="KSG"
-[KFMod:NeonKSGShotgun WeaponAliases]
-Alias="NeonHSG-1Shotgun"
-Alias="NeonHSG1Shotgun"
-Alias="NeonHSGShotgun"
-Alias="NeonHSG"
-Alias="NeonKSG-1Shotgun"
-Alias="NeonKSG1Shotgun"
-Alias="NeonKSGShotgun"
-Alias="NeonKSG"
-[KFMod:NailGun WeaponAliases]
-Alias="VladTheImpaler"
-Alias="VladImpaler"
-Alias="Vlad"
-Alias="Impaler"
-Alias="NailGun"
-Alias="Nails"
-Alias="Nail"
-[KFMod:SPAutoShotgun WeaponAliases]
-Alias="MultichamberZEDThrower"
-Alias="ZEDThrower"
-Alias="ZThrower"
-[KFMod:BenelliShotgun WeaponAliases]
-Alias="CombatShotgun"
-Alias="Combat"
-Alias="CShotgun"
-Alias="BenelliShotgun"
-Alias="BeneliShotgun"
-Alias="Benelli"
-Alias="Beneli"
-[KFMod:GoldenBenelliShotgun WeaponAliases]
-Alias="GoldCombatShotgun"
-Alias="GoldCombat"
-Alias="GoldCShotgun"
-Alias="GoldBenelliShotgun"
-Alias="GoldBeneliShotgun"
-Alias="GoldBenelli"
-Alias="GoldBeneli"
-[KFMod:AA12AutoShotgun WeaponAliases]
-Alias="AA12"
-Alias="AA12AutoShotgun"
-Alias="AA12Shotgun"
-[KFMod:GoldenAA12AutoShotgun WeaponAliases]
-Alias="GoldAA12"
-Alias="GoldAA12AutoShotgun"
-Alias="GoldAA12Shotgun"
-
-; Sharpshooter weapons
-[KFMod:Single WeaponAliases]
-Alias="9mmTactical"
-Alias="9mmTact"
-Alias="9mm"
-Alias="Single"
-Alias="Pistol"
-[KFMod:Dualies WeaponAliases]
-Alias="Dual9mms"
-Alias="Dual9mm"
-Alias="9mmDual"
-Alias="Dualies"
-Alias="Dual"
-[KFMod:Magnum44Pistol WeaponAliases]
-Alias="Magnum44Pistol"
-Alias="Magnum44"
-Alias="44Magnum"
-Alias="Magnum"
-Alias="44"
-[KFMod:Dual44Magnum WeaponAliases]
-Alias="DualMagnum44Pistols"
-Alias="DualMagnum44s"
-Alias="DualMagnums"
-Alias="DualMagnumPistols"
-Alias="Dual44Magnums"
-Alias="Dual44Magnum"
-Alias="DualMagnum"
-Alias="Dual44ss"
-Alias="Dual44"
-[KFMod:MK23Pistol WeaponAliases]
-Alias="MK23"
-Alias="MK"
-Alias="23"
-[KFMod:DualMK23Pistol WeaponAliases]
-Alias="DualMK23s"
-Alias="DualMK23"
-Alias="DualMKs"
-Alias="DualMK"
-Alias="Dual23s"
-Alias="Dual23"
-[KFMod:Deagle WeaponAliases]
-Alias="Handcannon"
-Alias="Deagle"
-Alias="HC"
-[KFMod:DualDeagle WeaponAliases]
-Alias="DualHandcannons"
-Alias="DualHC"
-Alias="DualDeagle"
-[KFMod:GoldenDeagle WeaponAliases]
-Alias="GoldHandcannon"
-Alias="GoldDeagle"
-Alias="GoldHC"
-[KFMod:GoldenDualDeagle WeaponAliases]
-Alias="GoldDualHandcannons"
-Alias="GoldDualHC"
-Alias="GoldDualDeagle"
-[KFMod:Winchester WeaponAliases]
-Alias="Winchester"
-Alias="LeverActionRifle"
-Alias="LAR"
-[KFMod:SPSniperRifle WeaponAliases]
-Alias="SPMusket"
-Alias="Musket"
-Alias="SPSniperRifle"
-Alias="SPRifle"
-Alias="SPSniper"
-Alias="SPMauler"
-Alias="Mauler"
-[KFMod:M14EBRBattleRifle WeaponAliases]
-Alias="M14EBR"
-Alias="M14"
-Alias="EBR"
-Alias="M14EBRRifle"
-Alias="M14EBRBattleRifle"
-[KFMod:Crossbow WeaponAliases]
-Alias="CompoundCrossbow"
-Alias="CCrossbow"
-Alias="Crossbow"
-Alias="XBow"
-[KFMod:M99SniperRifle WeaponAliases]
-Alias="M99AMR"
-Alias="M99"
-Alias="M99SniperRifle"
-Alias="M99Sniper"
-Alias="M99Rifle"
-Alias="M99SR"
-
-; Commando weapons
-[KFMod:Bullpup WeaponAliases]
-Alias="Bullpup"
-Alias="Bulpup"
-[KFMod:ThompsonSMG WeaponAliases]
-Alias="ThompsonSMG"
-Alias="Thompson"
-Alias="Thomp"
-Alias="TommyGun"
-Alias="TomyGun"
-Alias="Tommy"
-Alias="Tomy"
-[KFMod:SPThompsonSMG WeaponAliases]
-Alias="SPThompsonSMG"
-Alias="SPThompson"
-Alias="SPThomp"
-Alias="Dr.T'sLeadDeliverySystem"
-Alias="Dr.TsLeadDeliverySystem"
-Alias="DrT'sLeadDeliverySystem"
-Alias="DrTsLeadDeliverySystem"
-Alias="Dr.T'LeadDeliverySystem"
-Alias="Dr.TLeadDeliverySystem"
-Alias="DrT'LeadDeliverySystem"
-Alias="DrTLeadDeliverySystem"
-Alias="DrTDeliverySystem"
-Alias="DrTLeadSystem"
-Alias="DrTLeadDelivery"
-Alias="DrTDelivery"
-Alias="LeadDelivery"
-Alias="LeadSystem"
-Alias="DeliverySystem"
-Alias="LeadDS"
-Alias="LeadD"
-[KFMod:ThompsonDrumSMG WeaponAliases]
-Alias="ThompsonDrumSMG"
-Alias="ThompsonDrum"
-Alias="ThompDrum"
-Alias="RisingStormTommyGun"
-Alias="RisingStormTommy"
-Alias="RisingStormTomyGun"
-Alias="RisingStormTomy"
-Alias="RSTommyGun"
-Alias="RSTommy"
-Alias="RSTomyGun"
-Alias="RSTomy"
-[KFMod:AK47AssaultRifle WeaponAliases]
-Alias="AK47AssaultRifle"
-Alias="AK47Assault"
-Alias="AK47Rifle"
-Alias="AK47AR"
-Alias="AK47"
-Alias="AK"
-Alias="47"
-[KFMod:GoldenAK47AssaultRifle WeaponAliases]
-Alias="GoldAK47AssaultRifle"
-Alias="GoldAK47Assault"
-Alias="GoldAK47Rifle"
-Alias="GoldAK47AR"
-Alias="GoldAK47"
-Alias="GoldAK"
-Alias="Gold47"
-[KFMod:NeonAK47AssaultRifle WeaponAliases]
-Alias="NeonAK47AssaultRifle"
-Alias="NeonAK47Assault"
-Alias="NeonAK47Rifle"
-Alias="NeonAK47AR"
-Alias="NeonAK47"
-Alias="NeonAK"
-Alias="Neon47"
-[KFMod:M4AssaultRifle WeaponAliases]
-Alias="M4AssaultRifle"
-Alias="M4Assault"
-Alias="M4Rifle"
-Alias="M4"
-[KFMod:CamoM4AssaultRifle WeaponAliases]
-Alias="CamoM4AssaultRifle"
-Alias="CamoM4Assault"
-Alias="CamoM4Rifle"
-Alias="CamoM4"
-[KFMod:MKb42AssaultRifle WeaponAliases]
-Alias="MKb42AssaultRifle"
-Alias="MKb42Assault"
-Alias="MKb42Rifle"
-Alias="MKb42"
-Alias="MK42"
-Alias="MKb"
-[KFMod:SCARMK17AssaultRifle WeaponAliases]
-Alias="SCARMK17AssaultRifle"
-Alias="SCARMK17Assault"
-Alias="SCARMK17Rifle"
-Alias="SCARMKAssaultRifle"
-Alias="SCARMKAssault"
-Alias="SCARMKRifle"
-Alias="SCAR17AssaultRifle"
-Alias="SCAR17Assault"
-Alias="SCAR17Rifle"
-Alias="SCARAssaultRifle"
-Alias="SCARAssault"
-Alias="SCARRifle"
-Alias="SCAR17"
-Alias="SCARMK"
-Alias="SCAR"
-[KFMod:NeonSCARMK17AssaultRifle WeaponAliases]
-Alias="NeonSCARMK17AssaultRifle"
-Alias="NeonSCARMK17Assault"
-Alias="NeonSCARMK17Rifle"
-Alias="NeonSCARMKAssaultRifle"
-Alias="NeonSCARMKAssault"
-Alias="NeonSCARMKRifle"
-Alias="NeonSCAR17AssaultRifle"
-Alias="NeonSCAR17Assault"
-Alias="NeonSCAR17Rifle"
-Alias="NeonSCARAssaultRifle"
-Alias="NeonSCARAssault"
-Alias="NeonSCARRifle"
-Alias="NeonSCAR17"
-Alias="NeonSCARMK"
-Alias="NeonSCAR"
-[KFMod:FNFAL_ACOG_AssaultRifle WeaponAliases]FNFAL ACOG
-Alias="FNFALACOGAssaultRifle"
-Alias="FNFALACOGAssault"
-Alias="FNFALACOGRifle"
-Alias="FNFALAssaultRifle"
-Alias="FNFALAssault"
-Alias="FNFALRifle"
-Alias="FALACOGAssaultRifle"
-Alias="FALACOGAssault"
-Alias="FALACOGRifle"
-Alias="FALAssaultRifle"
-Alias="FALAssault"
-Alias="FALRifle"
-Alias="FNFALACOG"
-Alias="FNFAL"
-Alias="FALACOG"
-Alias="FAL"
-Alias="FN"
-
-; Berserker weapons
-[KFMod:Knife WeaponAliases]
-Alias="Knife"
-[KFMod:Machete WeaponAliases]
-Alias="Machete"
-Alias="Chete"
-[KFMod:Axe WeaponAliases]
-Alias="Axe"
-Alias="FireAxe"
-[KFMod:Katana WeaponAliases]
-Alias="Katana"
-[KFMod:GoldenKatana WeaponAliases]
-Alias="GoldKatana"
-[KFMod:Scythe WeaponAliases]
-Alias="Scythe"
-Alias="Scyte"
-Alias="Sickle"
-Alias="Sickl"
-[KFMod:Chainsaw WeaponAliases]
-Alias="Chainsaw"
-Alias="Saw"
-Alias="Denji"
-Alias="Pochita"
-[KFMod:GoldenChainsaw WeaponAliases]
-Alias="GoldChainsaw"
-Alias="GoldSaw"
-Alias="GoldDenji"
-Alias="GoldPochita"
-[KFMod:DwarfAxe WeaponAliases]
-Alias="DwarfsAxe"
-Alias="DwarfAxe"
-Alias="ShitAxe"
-Alias="CrapAxe"
-Alias="PushAxe"
-Alias="GnomeAxe"
-Alias="TrollAxe"
-Alias="NoobAxe"
-[KFMod:ClaymoreSword WeaponAliases]
-Alias="ClaymoreSword"
-Alias="ClaymoreBlade"
-Alias="Claymore"
-Alias="Claymor"
-Alias="ClaimoreSword"
-Alias="ClaimoreBlade"
-Alias="Claimore"
-Alias="Claimor"
-Alias="Sword"
-Alias="Blade"
-[KFMod:Crossbuzzsaw WeaponAliases]
-Alias="Crossbuzzsaw"
-Alias="Buzzsaw"
-Alias="Buzz"
-Alias="BuzzsawBow"
-Alias="BuzzBow"
-Alias="ZerkBow"
-
-; Firebug weapons
-[KFMod:MAC10MP WeaponAliases]
-Alias="MAC10MP"
-Alias="MAC10"
-Alias="MAC"
-[KFMod:FlareRevolver WeaponAliases]
-Alias="FlareRevolver"
-Alias="FireRevolver"
-Alias="FlareGun"
-Alias="Flares"
-Alias="Flare"
-[KFMod:DualFlareRevolver WeaponAliases]
-Alias="DualFlareRevolvers"
-Alias="DualFlareRevolver"
-Alias="DualFireRevolvers"
-Alias="DualFireRevolver"
-Alias="DualFlareGuns"
-Alias="DualFlareGun"
-Alias="DualFlares"
-Alias="DualFlare"
-[KFMod:FlameThrower WeaponAliases]
-Alias="FlameThrower"
-Alias="FireThrower"
-Alias="FThrower"
-Alias="Flamer"
-Alias="FireSpam"
-[KFMod:GoldenFlamethrower WeaponAliases]
-Alias="GoldFlameThrower"
-Alias="GoldFireThrower"
-Alias="GoldFThrower"
-Alias="GoldFlamer"
-Alias="GoldFireSpam"
-[KFMod:Trenchgun WeaponAliases]
-Alias="DragonsBreathTrenchgun"
-Alias="DragonsBreathGun"
-Alias="DragonsBreath"
-Alias="DragBreathTrenchgun"
-Alias="DragBreathGun"
-Alias="DragBreath"
-Alias="Trenchgun"
-Alias="FireShotgun"
-Alias="Flameshotgun"
-[KFMod:HuskGun WeaponAliases]
-Alias="HuskFireballLauncher"
-Alias="HuskFireball"
-Alias="FireballLauncher"
-Alias="HuskLauncher"
-Alias="HuskFirebalLauncher"
-Alias="HuskFirebal"
-Alias="FirebalLauncher"
-Alias="HuskGun"
-Alias="Husk"
-
-; Demolition weapons
-[KFMod:M79GrenadeLauncher WeaponAliases]
-Alias="M79GrenadeLauncher"
-Alias="M79Grenade"
-Alias="M79Launcher"
-Alias="M79NadeLauncher"
-Alias="M79Nade"
-Alias="M79"
-[KFMod:GoldenM79GrenadeLauncher WeaponAliases]
-Alias="GoldM79GrenadeLauncher"
-Alias="GoldM79Grenade"
-Alias="GoldM79Launcher"
-Alias="GoldM79NadeLauncher"
-Alias="GoldM79Nade"
-Alias="GoldM79"
-[KFMod:SPGrenadeLauncher WeaponAliases]
-Alias="SPGrenadeLauncher"
-Alias="SPNadeLauncher"
-Alias="SPLauncher"
-Alias="SPNade"
-Alias="TheOrcaBombPropeller"
-Alias="TheOrcaBombPropeler"
-Alias="TheOrcaBomb"
-Alias="TheOrca"
-Alias="TheOrcaLauncher"
-Alias="OrcaBombPropeller"
-Alias="OrcaBombPropeler"
-Alias="OrcaBomb"
-Alias="Orca"
-Alias="OrcaLauncher"
-[KFMod:PipeBombExplosive WeaponAliases]
-Alias="PipeBombExplosive"
-Alias="PipeExplosive"
-Alias="PipeBomb"
-Alias="Pipes"
-Alias="Pipe"
-[KFMod:SealSquealHarpoonBomber WeaponAliases]
-Alias="SealSquealHarpoonBomber"
-Alias="SealSquealHarpoon"
-Alias="SealSquealBomber"
-Alias="SealHarpoonBomber"
-Alias="SealHarpoon"
-Alias="SealBomber"
-Alias="SealSqueal"
-Alias="HarpoonBomber"
-Alias="Harpoon"
-Alias="Harp"
-[KFMod:SeekerSixRocketLauncher WeaponAliases]
-Alias="SeekerSixRocketLauncher"
-Alias="SeekerSixLauncher"
-Alias="Seeker6RocketLauncher"
-Alias="Seeker6Launcher"
-Alias="SeekerRocketLauncher"
-Alias="SeekerLauncher"
-Alias="SeekerSix"
-Alias="Seeker6"
-Alias="Seeker"
-Alias="SuckerSix"
-Alias="Sucker6"
-Alias="Sucker"
-[KFMod:M4203AssaultRifle WeaponAliases]
-Alias="M4203Assault"
-Alias="M4203Rifle"
-Alias="M4203"
-Alias="M4200"
-Alias="M420"
-Alias="M42"
-[KFMod:LAW WeaponAliases]
-Alias="LAW"
-[KFMod:M32GrenadeLauncher WeaponAliases]
-Alias="M32GrenadeLauncher"
-Alias="M32Grenade"
-Alias="M32Launcher"
-Alias="M32NadeLauncher"
-Alias="M32Nade"
-Alias="M32"
-[KFMod:CamoM32GrenadeLauncher WeaponAliases]
-Alias="CamoM32GrenadeLauncher"
-Alias="CamoM32Grenade"
-Alias="CamoM32Launcher"
-Alias="CamoM32NadeLauncher"
-Alias="CamoM32Nade"
-Alias="CamoM32"
-
-; Off-perk weapons
-[KFMod:ZEDGun WeaponAliases]
-Alias="ZedEradicationDevice"
-Alias="ZedEradication"
-Alias="ZedDevice"
-Alias="ZEDGun"
-Alias="ZED"
-[KFMod:ZEDMKIIWeapon WeaponAliases]
-Alias="ZedEradicationDeviceMKII"
-Alias="ZedEradicationMKII"
-Alias="ZedDeviceMKII"
-Alias="ZEDGunMKII"
-Alias="ZEDMKII"
-Alias="ZedEradicationDeviceMK2"
-Alias="ZedEradicationMK2"
-Alias="ZedDeviceMK2"
-Alias="ZEDGunMK2"
-Alias="ZEDMK2"
-Alias="ZedEradicationDeviceMK"
-Alias="ZedEradicationMK"
-Alias="ZedDeviceMK"
-Alias="ZEDGunMK"
-Alias="ZEDMK"
-Alias="ZedEradicationDevice2"
-Alias="ZedEradication2"
-Alias="ZedDevice2"
-Alias="ZEDGun2"
-Alias="ZED2"
\ No newline at end of file
diff --git a/config/AcediaSystem.ini b/config/AcediaSystem.ini
deleted file mode 100644
index ee08db7..0000000
--- a/config/AcediaSystem.ini
+++ /dev/null
@@ -1,180 +0,0 @@
-; Every single option in this config should be considered [ADVANCED]
-[Acedia.AliasService]
-; Changing these allows you to change in what sources `AliasesAPI`
-; looks for weapon and color aliases.
-weaponAliasesSource=Class'WeaponAliasSource'
-colorAliasesSource=Class'ColorAliasSource'
-; How often are different alias-storing objects are allowed to record
-; their updated data into a config.
-; Negative or zero values would be reset to `0.05`.
-saveInterval=0.05
-
-[Acedia.AliasHash]
-; Reasonable lower and upper limits on hash table capacity for
-; aliases' storage, that will be enforced if user requires something outside
-; those bounds.
-MINIMUM_CAPACITY=10
-MAXIMUM_CAPACITY=100000
-
-[Acedia.TestingService]
-; Allows you to run tests on server's start up. This option is to help run
-; tests quicker during development and should not be used for servers that are
-; setup for actually playing the game.
-runTestsOnStartUp=false
-; Use these flags to only run tests from particular test cases
-filterTestsByName=false
-filterTestsByGroup=false
-requiredName=""
-requiredGroup=""
-
-[Acedia.ConsoleAPI]
-; These should guarantee decent text output in console even at
-; 640x480 shit resolution
-; (and it look fine at normal resolutions as well)
-maxVisibleLineWidth=80
-maxTotalLineWidth=108
-
-[Acedia.ColorAPI]
-; Changing these values will alter color's definitions in `ColorAPI`,
-; changing how Acedia behaves
-Pink=(R=255,G=192,B=203,A=255)
-LightPink=(R=255,G=182,B=193,A=255)
-HotPink=(R=255,G=105,B=180,A=255)
-DeepPink=(R=255,G=20,B=147,A=255)
-PaleVioletRed=(R=219,G=112,B=147,A=255)
-MediumVioletRed=(R=199,G=21,B=133,A=255)
-LightSalmon=(R=255,G=160,B=122,A=255)
-Salmon=(R=250,G=128,B=114,A=255)
-DarkSalmon=(R=233,G=150,B=122,A=255)
-LightCoral=(R=240,G=128,B=128,A=255)
-IndianRed=(R=205,G=92,B=92,A=255)
-Crimson=(R=220,G=20,B=60,A=255)
-Firebrick=(R=178,G=34,B=34,A=255)
-DarkRed=(R=139,G=0,B=0,A=255)
-Red=(R=255,G=0,B=0,A=255)
-OrangeRed=(R=255,G=69,B=0,A=255)
-Tomato=(R=255,G=99,B=71,A=255)
-Coral=(R=255,G=127,B=80,A=255)
-DarkOrange=(R=255,G=140,B=0,A=255)
-Orange=(R=255,G=165,B=0,A=255)
-Yellow=(R=255,G=255,B=0,A=255)
-LightYellow=(R=255,G=255,B=224,A=255)
-LemonChiffon=(R=255,G=250,B=205,A=255)
-LightGoldenrodYellow=(R=250,G=250,B=210,A=255)
-PapayaWhip=(R=255,G=239,B=213,A=255)
-Moccasin=(R=255,G=228,B=181,A=255)
-PeachPuff=(R=255,G=218,B=185,A=255)
-PaleGoldenrod=(R=238,G=232,B=170,A=255)
-Khaki=(R=240,G=230,B=140,A=255)
-DarkKhaki=(R=189,G=183,B=107,A=255)
-Gold=(R=255,G=215,B=0,A=255)
-Cornsilk=(R=255,G=248,B=220,A=255)
-BlanchedAlmond=(R=255,G=235,B=205,A=255)
-Bisque=(R=255,G=228,B=196,A=255)
-NavajoWhite=(R=255,G=222,B=173,A=255)
-Wheat=(R=245,G=222,B=179,A=255)
-Burlywood=(R=222,G=184,B=135,A=255)
-TanColor=(R=210,G=180,B=140,A=255)
-RosyBrown=(R=188,G=143,B=143,A=255)
-SandyBrown=(R=244,G=164,B=96,A=255)
-Goldenrod=(R=218,G=165,B=32,A=255)
-DarkGoldenrod=(R=184,G=134,B=11,A=255)
-Peru=(R=205,G=133,B=63,A=255)
-Chocolate=(R=210,G=105,B=30,A=255)
-SaddleBrown=(R=139,G=69,B=19,A=255)
-Sienna=(R=160,G=82,B=45,A=255)
-Brown=(R=165,G=42,B=42,A=255)
-Maroon=(R=128,G=0,B=0,A=255)
-DarkOliveGreen=(R=85,G=107,B=47,A=255)
-Olive=(R=128,G=128,B=0,A=255)
-OliveDrab=(R=107,G=142,B=35,A=255)
-YellowGreen=(R=154,G=205,B=50,A=255)
-LimeGreen=(R=50,G=205,B=50,A=255)
-Lime=(R=0,G=255,B=0,A=255)
-LawnGreen=(R=124,G=252,B=0,A=255)
-Chartreuse=(R=127,G=255,B=0,A=255)
-GreenYellow=(R=173,G=255,B=47,A=255)
-SpringGreen=(R=0,G=255,B=127,A=255)
-MediumSpringGreen=(R=0,G=250,B=154,A=255)
-LightGreen=(R=144,G=238,B=144,A=255)
-PaleGreen=(R=152,G=251,B=152,A=255)
-DarkSeaGreen=(R=143,G=188,B=143,A=255)
-MediumAquamarine=(R=102,G=205,B=170,A=255)
-MediumSeaGreen=(R=60,G=179,B=113,A=255)
-SeaGreen=(R=46,G=139,B=87,A=255)
-ForestGreen=(R=34,G=139,B=34,A=255)
-Green=(R=0,G=128,B=0,A=255)
-DarkGreen=(R=0,G=100,B=0,A=255)
-Aqua=(R=0,G=255,B=255,A=255)
-Cyan=(R=0,G=255,B=255,A=255)
-LightCyan=(R=224,G=255,B=255,A=255)
-PaleTurquoise=(R=175,G=238,B=238,A=255)
-Aquamarine=(R=127,G=255,B=212,A=255)
-Turquoise=(R=64,G=224,B=208,A=255)
-MediumTurquoise=(R=72,G=209,B=204,A=255)
-DarkTurquoise=(R=0,G=206,B=209,A=255)
-LightSeaGreen=(R=32,G=178,B=170,A=255)
-CadetBlue=(R=95,G=158,B=160,A=255)
-DarkCyan=(R=0,G=139,B=139,A=255)
-Teal=(R=0,G=128,B=128,A=255)
-LightSteelBlue=(R=176,G=196,B=222,A=255)
-PowderBlue=(R=176,G=224,B=230,A=255)
-LightBlue=(R=173,G=216,B=230,A=255)
-SkyBlue=(R=135,G=206,B=235,A=255)
-LightSkyBlue=(R=135,G=206,B=250,A=255)
-DeepSkyBlue=(R=0,G=191,B=255,A=255)
-DodgerBlue=(R=30,G=144,B=255,A=255)
-CornflowerBlue=(R=100,G=149,B=237,A=255)
-SteelBlue=(R=70,G=130,B=180,A=255)
-RoyalBlue=(R=65,G=105,B=225,A=255)
-Blue=(R=0,G=0,B=255,A=255)
-MediumBlue=(R=0,G=0,B=205,A=255)
-DarkBlue=(R=0,G=0,B=139,A=255)
-Navy=(R=0,G=0,B=128,A=255)
-MidnightBlue=(R=25,G=25,B=112,A=255)
-Lavender=(R=230,G=230,B=250,A=255)
-Thistle=(R=216,G=191,B=216,A=255)
-Plum=(R=221,G=160,B=221,A=255)
-Violet=(R=238,G=130,B=238,A=255)
-Orchid=(R=218,G=112,B=214,A=255)
-Fuchsia=(R=255,G=0,B=255,A=255)
-Magenta=(R=255,G=0,B=255,A=255)
-MediumOrchid=(R=186,G=85,B=211,A=255)
-MediumPurple=(R=147,G=112,B=219,A=255)
-BlueViolet=(R=138,G=43,B=226,A=255)
-DarkViolet=(R=148,G=0,B=211,A=255)
-DarkOrchid=(R=153,G=50,B=204,A=255)
-DarkMagenta=(R=139,G=0,B=139,A=255)
-Purple=(R=128,G=0,B=128,A=255)
-Indigo=(R=75,G=0,B=130,A=255)
-DarkSlateBlue=(R=72,G=61,B=139,A=255)
-SlateBlue=(R=106,G=90,B=205,A=255)
-MediumSlateBlue=(R=123,G=104,B=238,A=255)
-White=(R=255,G=255,B=255,A=255)
-Snow=(R=255,G=250,B=250,A=255)
-Honeydew=(R=240,G=255,B=240,A=255)
-MintCream=(R=245,G=255,B=250,A=255)
-Azure=(R=240,G=255,B=255,A=255)
-AliceBlue=(R=240,G=248,B=255,A=255)
-GhostWhite=(R=248,G=248,B=255,A=255)
-WhiteSmoke=(R=245,G=245,B=245,A=255)
-Seashell=(R=255,G=245,B=238,A=255)
-Beige=(R=245,G=245,B=220,A=255)
-OldLace=(R=253,G=245,B=230,A=255)
-FloralWhite=(R=255,G=250,B=240,A=255)
-Ivory=(R=255,G=255,B=240,A=255)
-AntiqueWhite=(R=250,G=235,B=215,A=255)
-Linen=(R=250,G=240,B=230,A=255)
-LavenderBlush=(R=255,G=240,B=245,A=255)
-MistyRose=(R=255,G=228,B=225,A=255)
-Gainsboro=(R=220,G=220,B=220,A=255)
-LightGray=(R=211,G=211,B=211,A=255)
-Silver=(R=192,G=192,B=192,A=255)
-DarkGray=(R=169,G=169,B=169,A=255)
-Gray=(R=128,G=128,B=128,A=255)
-DimGray=(R=105,G=105,B=105,A=255)
-LightSlateGray=(R=119,G=136,B=153,A=255)
-SlateGray=(R=112,G=128,B=144,A=255)
-DarkSlateGray=(R=47,G=79,B=79,A=255)
-Eigengrau=(R=22,G=22,B=29,A=255)
-Black=(R=0,G=0,B=0,A=255)
\ No newline at end of file
diff --git a/docs/Aliases.md b/docs/Aliases.md
deleted file mode 100644
index 8bbdc63..0000000
--- a/docs/Aliases.md
+++ /dev/null
@@ -1,138 +0,0 @@
-# Aliases
-
-Aliases are `string` values that act as human-readable synonyms to some other `string` values.
-
-Often, when using some console commands, users are forced to type into exact class names of objects in **UnrealScript** (e.g., commands to give someone an M14EBR take form similar to `mutate give KFmod.M14EBRBattleRifle`), but such names can be cumbersome to remember and type.
-
-Aliases solve this problem by allowing players to instead type `mutate give $ebr`, where `$` denotes that following word `ebr` is an alias that will be automatically resolved into `KFmod.M14EBRBattleRifle`.
-
-## Alias names
-
-Alias can be any `string` consisting of ASCII character, although for practical reasons it is better to use only letters, digits and `_` character. Otherwise using them might become more difficult, partially defeating their purpose.
-
-Aliases are case-insensitive, so `EBR`, `Ebr` and `ebr` are all considered the same alias.
-
-## Alias sources
-
-Sources essentially act as aliases databases: matching each alias to some value. They can be used to separate aliases that describe different categories of objects: weapons, zeds, colors, etc..
-
-Inside each source aliases and their values are expected to be in many-to-one relationship: many aliases can mean the same value, but each alias can only mean one value. However, two different sources can each contain the same alias and make it point to different values. So it's important for the game to know what source contains what type of aliases.
-
-In case there are several aliases with the same name in the database, - **Acedia** will warn you about it, but won't actually remove duplicates, instead letting the source use the first it finds.
-
-By default **Acedia** offers 4 different alias sources:
-
-* `WeaponAliasSource` (*AcediaAliases_Weapons.ini*) - source filled with aliases for weapons (by default contains aliases to every vanilla weapon);
-* `ColorAliasSource` (*AcediaAliases_Colors.ini*) - source filled with aliases for colors (by default contains a decent amount of pre-defined colors);
-* `AliasSource` (*AcediaAliases.ini*) - unused source that can, nevertheless, be utilized by server admins or other packages (by default empty);
-* `MockAliasSource` (*AcediaAliases_Tests.ini*) - source that is used for testing whether aliases functionality works correctly, avoid changing it if you intend to run tests for **Acedia**'s functionality.
-
-### [Advanced] Changing meaning of alias sources
-
-Even though some of the above sources have rather specific names, only use of `MockAliasSource` is hardcoded: admins can, in theory, move all aliases into any source they like. They'll just have to tell **Acedia** where to look for them by changing *AcediaSystem.ini*'s section *Acedia.AliasService* to point at appropriate source:
-
-```ini
-weaponAliasesSource=Class'Acedia.WeaponAliasSource'
-colorAliasesSource=Class'Acedia.ColorAliasSource'
-```
-
-Specifically, you can move all aliases to a single source (for example `AliasSource`) and tell **Acedia** to look for weapon and color aliases there:
-
-```ini
-weaponAliasesSource=Class'Acedia.AliasSource'
-colorAliasesSource=Class'Acedia.AliasSource'
-```
-
-## How sources are stored
-
-Alias sources are stored in appropriate *ini*-files in two ways that can be mixed with each other however you like.
-
-### 1. Flat array `record`
-
-First way is to define a set alias-value pairs in section of the alias source. Example from the color alias source:
-
-```ini
-[Acedia.ColorAliasSource]
-; Pink colors
-record=(alias="Pink",value="rgb(255,192,203)")
-record=(alias="LightPink",value="rgb(255,182,193)")
-record=(alias="HotPink",value="rgb(255,105,180)")
-record=(alias="DeepPink",value="rgb(255,20,147)")
-record=(alias="PaleVioletRed",value="rgb(219,112,147)")
-record=(alias="MediumVioletRed",value="rgb(199,21,133)")
-```
-
-If you want several different aliases to point to the same value, just add a record for each of them:
-
-```ini
-record=(alias="Pink",value="rgb(255,192,203)")
-record=(alias="Punk",value="rgb(255,192,203)")
-record=(alias="Bunk",value="rgb(255,192,203)")
-```
-
-Just avoid having several records for the same alias in one source.
-
-### 2. Per-object-config
-
-If you need to define several aliases for one value it might be better to use per-object-configuration with named objects: each of them stores an array of aliases, while the corresponding value is recorded as object's name. Example from weapons alias source:
-
-```ini
-[KFMod:MP5MMedicGun WeaponAliases]
-Alias="MP5M"
-Alias="MP5"
-Alias="MP"
-Alias="M5"
-```
-
-Here aliases are defined in every line that starts with `Alias=`. Their value `KFMod:MP5MMedicGun` is defined as a first part of the config section (`:` is going to be translated to `.`, more on that below) and the second part `WeaponAliases` indicates that this is a record for `WeaponAliasSource`.
-
-Each source has it's own identification for per-object-config records:
-
-* For `WeaponAliasSource` it is `WeaponAliases`;
-* For `ColorAliasSource` it is `ColorAliases`;
-* For `MockAliasSource` it is `MockAliases`;
-* For `AliasSource` it is just `Aliases`.
-
-#### Limitations of the second way
-
-Because alias' value must be a part of the *ini*-file section there are certain limitations imposed on what that value can be (for example having `.` or `]` inside value's name will confuse **Unreal Engine**'s config parser, so you can't use them). There is not official, complete list of forbidden characters, but it is suggested you keep them limited to sequence of letters, numbers and `_` character.
-
-If you do need to store some weird string as a value, - first test that it does load correctly and, if not, use the first way to define it's aliases.
-
-But `.` being a forbidden symbol is too harsh of a limitation, since we mainly want to store class names via per-object-configs. Because of that any alias values defined the second way will load `:` as `.` from a config. This change allows us to define classes as values at the cost of preventing the use of `:`.
-
-## [Technical] Defining new alias sources
-
-If you make a module using **Acedia** and want to add another alias source you simply need to decide on the names of your:
-
-* Alias source (suppose it's `NewSource`);
-* Helper class for second way (*per-object-config*) of defining aliases (suppose it's `NewAliases`)
-* Config file, where their data will be stored (suppose it's `MyNewAliases.ini`);
-
-then create two classes, like that:
-
-```java
-class NewSource extends AliasSource
- config(MyNewAliases);
-
-defaultproperties
-{
- configName = "MyNewAliases"
- aliasesClass = class'NewAliases'
-}
-```
-
-```java
-class NewAliases extends Aliases
- perObjectConfig
- config(MyNewAliases);
-
-defaultproperties
-{
- sourceClass = class'NewSource'
-}
-```
-
-and put them in your manifest.
-
-For more examples check out source code for `ColorAliasSource`, `WeaponAliasSource`, `MockAliasSource`.
diff --git a/docs/Colors.md b/docs/Colors.md
deleted file mode 100644
index 94b1481..0000000
--- a/docs/Colors.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Colors
-
-The main, and possibly only, notable thing abotu **Acedia**'s colors is it's support for parsing their text representation. To be precise, **Acedia** understands:
-
-1. Hex color definitions in format of `#ffc0cb`;
-2. RGB color definitions that look like either `rgb(255,192,203)` or `rgb(r=255,g=192,b=203)`;
-3. RGBA color definitions that look like either `rgb(255,192,203,13)` or `rgb(r=255,g=192,b=203,a=13)`;
-4. Alias color definitions that **Acedia** looks up from color-specific alias source and look like any other alias reference: `$pink`.
-
-You should be able to use any form you like while working with **Acedia**.
-
-## [Technical] Color fixing
-
-Killing floor's standard methods of rendering colored `string`s make use of inserting 4-byte sequence into them: first bytes denotes the start of the sequence, 3 following bytes denote rgb color components. Unfortunately these methods also have issues with rendering `string`s if you specify certain values (`0` and `10`) as red-green-blue color components.
-
-You can freely use colors with these components, since **Acedia** automatically should fix them for you (by replacing them with indistinguishably close, but valid color) whenever it matters.
diff --git a/sources/Core/AcediaActor.uc b/sources/Core/AcediaActor.uc
deleted file mode 100644
index ce51fee..0000000
--- a/sources/Core/AcediaActor.uc
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Actor base class to be used to Acedia instead of an `Actor`.
- * The only difference is defined `_` member that provides convenient access to
- * Acedia's API.
- * It isn't guaranteed that `default._` will be defined for `AcediaActor`s.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class AcediaActor extends Actor
- abstract;
-
-var protected Global _;
-
-public final function Text T(string string)
-{
- return _.text.FromString(string);
-}
-
-event PreBeginPlay()
-{
- super.PreBeginPlay();
- if (_ == none)
- {
- _ = Global(class'Global'.static.GetInstance());
- default._ = _;
- }
-}
-
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/AcediaObject.uc b/sources/Core/AcediaObject.uc
deleted file mode 100644
index 2d451cf..0000000
--- a/sources/Core/AcediaObject.uc
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Object base class to be used to Acedia instead of an `Object`.
- * The only difference is defined `_` member that provides convenient access to
- * Acedia's API.
- * Since `Global` is an actor, we wish to avoid storing it's instance in
- * the object because it can mess with garbage collection on level change.
- * So we provide an accessor function `_()` instead.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class AcediaObject extends Object
- abstract;
-
-public final function Text T(string string)
-{
- return _().text.FromString(string);
-}
-
-public static final function Global _()
-{
- return Global(class'Global'.static.GetInstance());
-}
-
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/AcediaReplicationInfo.uc b/sources/Core/AcediaReplicationInfo.uc
deleted file mode 100644
index 74141ed..0000000
--- a/sources/Core/AcediaReplicationInfo.uc
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Facilitates some core replicated functions between client and server.
- * Copyright 2019 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class AcediaReplicationInfo extends ReplicationInfo;
-
-var public PlayerController linkOwner;
-
-replication
-{
- reliable if (role == ROLE_Authority)
- linkOwner;
-}
-
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/AliasHash.uc b/sources/Core/Aliases/AliasHash.uc
deleted file mode 100644
index 43da820..0000000
--- a/sources/Core/Aliases/AliasHash.uc
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * A class, implementing a hash-table-based dictionary for quick access to
- * aliases' values.
- * It does not support dynamic hash table capacity change and
- * requires to set the size upfront.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class AliasHash extends AcediaObject
- dependson(AliasSource)
- config(AcediaSystem);
-
-// Reasonable lower and upper limits on hash table capacity,
-// that will be enforced if user requires something outside those bounds
-var private config const int MINIMUM_CAPACITY;
-var private config const int MAXIMUM_CAPACITY;
-
-// Bucket of alias-value pairs, with the same alias hash.
-struct PairBucket
-{
- var array pairs;
-};
-var private array hashTable;
-
-/**
- * Initializes caller `AliasHash`.
- *
- * Calling this function again will clear all existing data and will create
- * a brand new hash table.
- *
- * @param desiredCapacity Desired capacity of the underlying hash table.
- * Will be clamped between `MINIMUM_CAPACITY` and `MAXIMUM_CAPACITY`.
- * Not specifying anything as this parameter creates a hash table of
- * size `MINIMUM_CAPACITY`.
- * @return A reference to a caller object to allow for function chaining.
- */
-public final function AliasHash Initialize(optional int desiredCapacity)
-{
- desiredCapacity = Clamp(desiredCapacity, MINIMUM_CAPACITY,
- MAXIMUM_CAPACITY);
- hashTable.length = 0;
- hashTable.length = desiredCapacity;
- return self;
-}
-
-// Helper method that is needed as a replacement for `%`, since it is
-// an operation on `float`s in UnrealScript and does not have enough precision
-// to work with hashes.
-// Assumes positive input.
-private function int Remainder(int number, int divisor)
-{
- local int quotient;
- quotient = number / divisor;
- return (number - quotient * divisor);
-}
-
-// Finds indices for:
-// 1. Bucked that contains specified alias (`bucketIndex`);
-// 2. Pair for specified alias in the bucket's collection (`pairIndex`).
-// `bucketIndex` is always found,
-// `pairIndex` is valid iff method returns `true`.
-private final function bool FindPairIndices(
- string alias,
- out int bucketIndex,
- out int pairIndex)
-{
- local int i;
- local array bucketPairs;
- // `Locs()` is used because aliases are case-insensitive.
- bucketIndex = _().text.GetHash(Locs(alias));
- if (bucketIndex < 0) {
- bucketIndex *= -1;
- }
- bucketIndex = Remainder(bucketIndex, hashTable.length);
- // Check if bucket actually has given alias.
- bucketPairs = hashTable[bucketIndex].pairs;
- for (i = 0; i < bucketPairs.length; i += 1)
- {
- if (bucketPairs[i].alias ~= alias)
- {
- pairIndex = i;
- return true;
- }
- }
- return false;
-}
-
-/**
- * Finds a value for a given alias.
- *
- * @param alias Alias for which we need to find a value.
- * Aliases are case-insensitive.
- * @param value If given alias is present in caller `AliasHash`, -
- * it's value will be written in this variable.
- * Otherwise value is undefined.
- * @return `true` if we found value, `false` otherwise.
- */
-public final function bool Find(string alias, out string value)
-{
- local int bucketIndex;
- local int pairIndex;
- if (FindPairIndices(alias, bucketIndex, pairIndex))
- {
- value = hashTable[bucketIndex].pairs[pairIndex].value;
- return true;
- }
- return false;
-}
-
-/**
- * Checks if caller `AliasHash` contains given alias.
- *
- * @param alias Alias to check for belonging to caller `AliasHash`.
- * Aliases are case-insensitive.
- * @return `true` if caller `AliasHash` contains the value for a given alias
- * and `false` otherwise.
- */
-public final function bool Contains(string alias)
-{
- local int bucketIndex;
- local int pairIndex;
- return FindPairIndices(alias, bucketIndex, pairIndex);
-}
-
-/**
- * Inserts new record for alias `alias` for value of `value`.
- *
- * If there is already a value for a given `alias` - it will be overwritten.
- *
- * @param alias Alias to insert. Aliases are case-insensitive.
- * @param value Value for a given alias to store.
- * @return A reference to a caller object to allow for function chaining.
- */
-public final function AliasHash Insert(string alias, string value)
-{
- local int bucketIndex;
- local int pairIndex;
- local AliasSource.AliasValuePair newRecord;
- newRecord.value = value;
- newRecord.alias = alias;
- if (!FindPairIndices(alias, bucketIndex, pairIndex)) {
- pairIndex = hashTable[bucketIndex].pairs.length;
- }
- hashTable[bucketIndex].pairs[pairIndex] = newRecord;
- return self;
-}
-
-/**
- * Inserts new record for alias `alias` for value of `value`.
- *
- * If there is already a value for a given `alias`, - new value will be
- * discarded and `AliasHash` will not be changed.
- *
- * @param alias Alias to insert. Aliases are case-insensitive.
- * @param value Value for a given alias to store.
- * @param existingValue Value that will correspond to a given alias after
- * this method's execution. If insertion was successful - given `value`,
- * otherwise (if there already was a record for an `alias`)
- * it will return value that already existed in caller `AliasHash`.
- * @return `true` if given alias-value pair was inserted and `false` otherwise.
- */
-public final function bool InsertIfMissing(
- string alias,
- string value,
- out string existingValue)
-{
- local int bucketIndex;
- local int pairIndex;
- local AliasSource.AliasValuePair newRecord;
- newRecord.value = value;
- newRecord.alias = alias;
- existingValue = value;
- if (FindPairIndices(alias, bucketIndex, pairIndex)) {
- existingValue = hashTable[bucketIndex].pairs[pairIndex].value;
- return false;
- }
- pairIndex = hashTable[bucketIndex].pairs.length;
- hashTable[bucketIndex].pairs[pairIndex] = newRecord;
- return true;
-}
-
-/**
- * Removes record, corresponding to a given alias `alias`.
- *
- * @param alias Alias for which all records must be removed.
- * @return `true` if record was removed, `false` if id did not
- * (can only happen when `AliasHash` did not have any records for `alias`).
- */
-public final function bool Remove(string alias)
-{
- local int bucketIndex;
- local int pairIndex;
- if (FindPairIndices(alias, bucketIndex, pairIndex)) {
- hashTable[bucketIndex].pairs.Remove(pairIndex, 1);
- return true;
- }
- return false;
-}
-
-defaultproperties
-{
- MINIMUM_CAPACITY = 10
- MAXIMUM_CAPACITY = 100000
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/AliasService.uc b/sources/Core/Aliases/AliasService.uc
deleted file mode 100644
index ac9cd94..0000000
--- a/sources/Core/Aliases/AliasService.uc
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Service that handles pending saving of aliases data into configs.
- * Adding aliases into `AliasSource`s causes corresponding configs to update.
- * This service allows to delay and spread config rewrites over time,
- * which should help in case someone dynamically adds a lot of
- * different aliases.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class AliasService extends Service
- config(AcediaSystem);
-
-// Objects for which we are yet to write configs
-var private array sourcesPendingToSave;
-var private array aliasesPendingToSave;
-// How often should we do it.
-// Negative or zero values would be reset to `0.05`.
-var public config const float saveInterval;
-
-// To avoid creating yet another object for aliases system we will
-// keep config variable pointing to weapon, color, etc. `AliasSource`
-// subclasses here. It's not the best regarding separation of responsibility,
-// but should make config files less fragmented.
-// Changing these allows you to change in what sources `AliasesAPI`
-// looks for weapon and color aliases.
-var public config const class weaponAliasesSource;
-var public config const class colorAliasesSource;
-
-protected function OnLaunch()
-{
- local float actualInterval;
- actualInterval = saveInterval;
- if (actualInterval <= 0)
- {
- actualInterval = 0.05;
- }
- SetTimer(actualInterval, true);
-}
-
-protected function OnShutdown()
-{
- SaveAllPendingObjects();
-}
-
-public final function PendingSaveSource(AliasSource sourceToSave)
-{
- local int i;
- if (sourceToSave == none) return;
- // Starting searching from the end of an array will make situations when
- // we add several aliases to a single source in a row more efficient.
- for (i = sourcesPendingToSave.length - 1;i >= 0; i -= 1) {
- if (sourcesPendingToSave[i] == sourceToSave) return;
- }
- sourcesPendingToSave[sourcesPendingToSave.length] = sourceToSave;
-}
-
-public final function PendingSaveObject(Aliases objectToSave)
-{
- local int i;
- if (objectToSave == none) return;
- // Starting searching from the end of an array will make situations when
- // we add several aliases to a single `Aliases` object in a row
- // more efficient.
- for (i = aliasesPendingToSave.length - 1;i >= 0; i -= 1) {
- if (aliasesPendingToSave[i] == objectToSave) return;
- }
- aliasesPendingToSave[aliasesPendingToSave.length] = objectToSave;
-}
-
-/**
- * Forces saving of the next object (either `AliasSource` or `Aliases`)
- * in queue to the config file.
- *
- * Does not reset the timer until next saving.
- */
-private final function DoSaveNextPendingObject()
-{
- if (sourcesPendingToSave.length > 0)
- {
- if (sourcesPendingToSave[0] != none) {
- sourcesPendingToSave[0].SaveConfig();
- }
- sourcesPendingToSave.Remove(0, 1);
- return;
- }
- if (aliasesPendingToSave.length > 0)
- {
- aliasesPendingToSave[0].SaveOrClear();
- aliasesPendingToSave.Remove(0, 1);
- }
-}
-
-/**
- * Forces saving of all objects (both `AliasSource`s or `Aliases`s) in queue
- * to their config files.
- */
-private final function SaveAllPendingObjects()
-{
- local int i;
- for (i = 0; i < sourcesPendingToSave.length; i += 1) {
- if (sourcesPendingToSave[i] == none) continue;
- sourcesPendingToSave[i].SaveConfig();
- }
- for (i = 0; i < aliasesPendingToSave.length; i += 1) {
- aliasesPendingToSave[i].SaveOrClear();
- }
- sourcesPendingToSave.length = 0;
- aliasesPendingToSave.length = 0;
-}
-
-event Timer()
-{
- DoSaveNextPendingObject();
-}
-
-defaultproperties
-{
- saveInterval = 0.05
- weaponAliasesSource = class'WeaponAliasSource'
- colorAliasesSource = class'ColorAliasSource'
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/AliasSource.uc b/sources/Core/Aliases/AliasSource.uc
deleted file mode 100644
index 6f863ea..0000000
--- a/sources/Core/Aliases/AliasSource.uc
+++ /dev/null
@@ -1,379 +0,0 @@
-/**
- * Aliases allow users to define human-readable and easier to use
- * "synonyms" to some symbol sequences (mainly names of UnrealScript classes).
- * This class implements an alias database that stores aliases inside
- * standard config ini-files.
- * Several `AliasSource`s are supposed to exist separately, each storing
- * aliases of particular kind: for weapon, zeds, colors, etc..
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class AliasSource extends Singleton
- config(AcediaAliases);
-
-// Name of the configurational file (without extension) where
-// this `AliasSource`'s data will be stored.
-var private const string configName;
-
-// (Sub-)class of `Aliases` objects that this `AliasSource` uses to store
-// aliases in per-object-config manner.
-// Leaving this variable `none` will produce an `AliasSource` that can
-// only store aliases in form of `record=(alias="...",value="...")`.
-var public const class aliasesClass;
-// Storage for all objects of `aliasesClass` class in the config.
-// Exists after `OnCreated()` event and is maintained up-to-date at all times.
-var private array loadedAliasObjects;
-
-// Links alias to a value.
-// An array of these structures (without duplicate `alias` records) defines
-// a function from the space of aliases to the space of values.
-struct AliasValuePair
-{
- var string alias;
- var string value;
-};
-// Aliases data for saving and loading on a disk (ini-file).
-// Name is chosen to make configurational files more readable.
-var private config array record;
-// Hash table for a faster access to value by alias' name.
-// It contains same records as `record` array + aliases from
-// `loadedAliasObjects` objects when there are no duplicate aliases.
-// Otherwise only stores first loaded alias.
-var private AliasHash hash;
-
-
-// How many times bigger capacity of `hash` should be, compared to amount of
-// initially loaded data from a config.
-var private const float HASH_TABLE_SCALE;
-
-// Load and hash all the data `AliasSource` creation.
-protected function OnCreated()
-{
- local int entriesAmount;
- if (!AssertAliasesClassIsOwnedByMe()) {
- return;
- }
- // Load and hash
- entriesAmount = LoadData();
- hash = AliasHash(_.memory.Allocate(class'AliasHash'));
- hash.Initialize(int(entriesAmount * HASH_TABLE_SCALE));
- HashValidAliases();
-}
-
-// Ensures invariant of our `Aliases` class only belonging to us by
-// itself ourselves otherwise.
-private final function bool AssertAliasesClassIsOwnedByMe()
-{
- if (aliasesClass == none) return true;
- if (aliasesClass.default.sourceClass == class) return true;
- _.logger.Failure("`AliasSource`-`Aliases` class pair is incorrectly"
- @ "setup for source `" $ string(class) $ "`. Omitting it.");
- Destroy();
- return false;
-}
-
-// This method loads all the defined aliases from the config file and
-// returns how many entries are there are total.
-// Does not change data, including fixing duplicates.
-private final function int LoadData()
-{
- local int i;
- local int entriesAmount;
- local array objectNames;
- entriesAmount = record.length;
- if (aliasesClass == none) {
- return entriesAmount;
- }
- objectNames =
- GetPerObjectNames(configName, string(aliasesClass.name), MaxInt);
- loadedAliasObjects.length = objectNames.length;
- for (i = 0; i < objectNames.length; i += 1)
- {
- loadedAliasObjects[i] = new(none, objectNames[i]) aliasesClass;
- entriesAmount += loadedAliasObjects[i].GetAliases().length;
- }
- return entriesAmount;
-}
-
-/**
- * Simply checks if given alias is present in caller `AliasSource`.
- *
- * @param alias Alias to check, case-insensitive.
- * @return `true` if present, `false` otherwise.
- */
-public function bool ContainsAlias(string alias)
-{
- return hash.Contains(alias);
-}
-
-/**
- * Tries to look up a value, stored for given alias in caller `AliasSource` and
- * reports error upon failure.
- *
- * Also see `Try()` method.
- *
- * @param alias Alias, for which method will attempt to look up a value.
- * Case-insensitive.
- * @param value If passed `alias` was recorded in caller `AliasSource`,
- * it's corresponding value will be written in this variable.
- * Otherwise value is undefined.
- * @return `true` if lookup was successful (alias present in 'AliasSource`)
- * and correct value was written into `value`, `false` otherwise.
- */
-public function bool Resolve(string alias, out string value)
-{
- return hash.Find(alias, value);
-}
-
-/**
- * Tries to look up a value, stored for given alias in caller `AliasSource` and
- * silently returns given `alias` value upon failure.
- *
- * Also see `Resolve()` method.
- *
- * @param alias Alias, for which method will attempt to look up a value.
- * Case-insensitive.
- * @return Value corresponding to a given alias, if it was present in
- * caller `AliasSource` and value of `alias` parameter instead.
- */
-public function string Try(string alias)
-{
- local string result;
- if (hash.Find(alias, result)) {
- return result;
- }
- return alias;
-}
-
-/**
- * Adds another alias to the caller `AliasSource`.
- * If alias with the same name as `aliasToAdd` already exists, -
- * method overwrites it.
- *
- * Can fail iff `aliasToAdd` is an invalid alias.
- *
- * When adding alias to an object (`saveInObject == true`) alias `aliasToAdd`
- * will be altered by changing any ':' inside it into a '.'.
- * This is a necessary measure to allow storing class names in
- * config files via per-object-config.
- *
- * NOTE: This call will cause update of an ini-file. That update can be
- * slightly delayed, so do not make assumptions about it's immediacy.
- *
- * NOTE #2: Removing alias would require this method to go through the
- * whole `AliasSource` to remove possible duplicates.
- * This means that unless you can guarantee that there is no duplicates, -
- * performing a lot of alias additions during run-time can be costly.
- *
- * @param aliasToAdd Alias that you want to add to caller source.
- * Alias names are case-insensitive.
- * @param aliasValue Intended value of this alias.
- * @param saveInObject Setting this to `true` will make `AliasSource` save
- * given alias in per-object-config storage, while keeping it at default
- * `false` will just add alias to the `record=` storage.
- * If caller `AliasSource` does not support per-object-config storage, -
- * this flag will be ignores.
- * @return `true` if alias was added and `false` otherwise (alias was invalid).
- */
-public final function bool AddAlias(
- string aliasToAdd,
- string aliasValue,
- optional bool saveInObject)
-{
- local AliasValuePair newPair;
- if (_.alias.IsAliasValid(aliasToAdd)) {
- return false;
- }
- if (hash.Contains(aliasToAdd)) {
- RemoveAlias(aliasToAdd);
- }
- // We might not be able to use per-object-config storage
- if (saveInObject && aliasesClass == none) {
- saveInObject = false;
- _.logger.Warning("Cannot save alias in object for source `"
- $ string(class)
- $ "`, because it does not have appropriate `Aliases` class setup.");
- }
- // Save
- if (saveInObject) {
- GetAliasesObjectWithValue(aliasValue).AddAlias(aliasToAdd);
- }
- else
- {
- newPair.alias = aliasToAdd;
- newPair.value = aliasValue;
- record[record.length] = newPair;
- }
- hash.Insert(aliasToAdd, aliasValue);
- AliasService(class'AliasService'.static.Require()).PendingSaveSource(self);
- return true;
-}
-
-/**
- * Removes alias (all records with it, in case of duplicates) from
- * the caller `AliasSource`.
- *
- * Cannot fail.
- *
- * NOTE: This call will cause update of an ini-file. That update can be
- * slightly delayed, so do not make assumptions about it's immediacy.
- *
- * NOTE #2: removing alias requires this method to go through the
- * whole `AliasSource` to remove possible duplicates, which can make
- * performing a lot of alias removal during run-time costly.
- *
- * @param aliasToRemove Alias that you want to remove from caller source.
- */
-public final function RemoveAlias(string aliasToRemove)
-{
- local int i;
- local bool removedAliasFromRecord;
- hash.Remove(aliasToRemove);
- while (i < record.length)
- {
- if (record[i].alias ~= aliasToRemove)
- {
- record.Remove(i, 1);
- removedAliasFromRecord = true;
- }
- else {
- i += 1;
- }
- }
- for (i = 0; i < loadedAliasObjects.length; i += 1) {
- loadedAliasObjects[i].RemoveAlias(aliasToRemove);
- }
- if (removedAliasFromRecord)
- {
- AliasService(class'AliasService'.static.Require())
- .PendingSaveSource(self);
- }
-}
-
-// Performs initial hashing of every record with valid alias.
-// In case of duplicate or invalid aliases - method will skip them
-// and log warnings.
-private final function HashValidAliases()
-{
- if (hash == none) {
- _.logger.Warning("Alias source `" $ string(class) $ "` called"
- $ "`HashValidAliases()` function without creating an `AliasHasher`"
- $ "instance first. This should not have happened.");
- return;
- }
- HashValidAliasesFromRecord();
- HashValidAliasesFromPerObjectConfig();
-}
-
-private final function LogDuplicateAliasWarning(
- string alias,
- string existingValue)
-{
- _.logger.Warning("Alias source `" $ string(class)
- $ "` has duplicate record for alias \"" $ alias
- $ "\". This is likely due to an erroneous config. \"" $ existingValue
- $ "\" value will be used.");
-}
-
-private final function LogInvalidAliasWarning(string invalidAlias)
-{
- _.logger.Warning("Alias source `" $ string(class)
- $ "` contains invalid alias name \"" $ invalidAlias
- $ "\". This alias will not be loaded.");
-}
-
-private final function HashValidAliasesFromRecord()
-{
- local int i;
- local bool isDuplicate;
- local string existingValue;
- for (i = 0; i < record.length; i += 1)
- {
- if (!_.alias.IsAliasValid(record[i].alias))
- {
- LogInvalidAliasWarning(record[i].alias);
- continue;
- }
- isDuplicate = !hash.InsertIfMissing(record[i].alias, record[i].value,
- existingValue);
- if (isDuplicate) {
- LogDuplicateAliasWarning(record[i].alias, existingValue);
- }
- }
-}
-
-private final function HashValidAliasesFromPerObjectConfig()
-{
- local int i, j;
- local bool isDuplicate;
- local string existingValue;
- local string objectValue;
- local array objectAliases;
- for (i = 0; i < loadedAliasObjects.length; i += 1)
- {
- objectValue = loadedAliasObjects[i].GetValue();
- objectAliases = loadedAliasObjects[i].GetAliases();
- for (j = 0; j < objectAliases.length; j += 1)
- {
- if (!_.alias.IsAliasValid(objectAliases[j]))
- {
- LogInvalidAliasWarning(objectAliases[j]);
- continue;
- }
- isDuplicate = !hash.InsertIfMissing(objectAliases[j], objectValue,
- existingValue);
- if (isDuplicate) {
- LogDuplicateAliasWarning(objectAliases[j], existingValue);
- }
- }
- }
-}
-
-// Tries to find a loaded `Aliases` config object that stores aliases for
-// the given value. If such object does not exists - creates a new one.
-private final function Aliases GetAliasesObjectWithValue(string value)
-{
- local int i;
- local Aliases newAliasesObject;
- // This method only makes sense if this `AliasSource` supports
- // per-object-config storage.
- if (aliasesClass == none)
- {
- _.logger.Warning("`GetAliasesObjectForValue()` function was called for "
- $ "alias source with `aliasesClass == none`."
- $ "This should not happen.");
- return none;
- }
- for (i = 0; i < loadedAliasObjects.length; i += 1)
- {
- if (loadedAliasObjects[i].GetValue() ~= value) {
- return loadedAliasObjects[i];
- }
- }
- newAliasesObject = new(none, value) aliasesClass;
- loadedAliasObjects[loadedAliasObjects.length] = newAliasesObject;
- return newAliasesObject;
-}
-
-defaultproperties
-{
- // Source main parameters
- configName = "AcediaAliases"
- aliasesClass = class'Aliases'
- // HashTable twice the size of data entries should do it
- HASH_TABLE_SCALE = 2.0
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/Aliases.uc b/sources/Core/Aliases/Aliases.uc
deleted file mode 100644
index 8b30683..0000000
--- a/sources/Core/Aliases/Aliases.uc
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * This is a simple helper object for `AliasSource` that can store
- * an array of aliases in config files in a per-object-config manner.
- * One `Aliases` object can store several aliases for a single value.
- * It is recommended that you do not try to access these objects directly.
- * Class name `Aliases` is chosen to make configuration files
- * more readable.
- * It's only interesting function is storing '.'s as ':' in it's config,
- * which is necessary to allow storing aliases for class names via
- * these objects (since UnrealScript's cannot handle '.'s in object's names
- * in it's configs).
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class Aliases extends AcediaObject
- perObjectConfig
- config(AcediaAliases);
-
-// Link to the `AliasSource` that uses `Aliases` objects of this class.
-// To ensure that any `Aliases` sub-class only belongs to one `AliasSource`.
-var public const class sourceClass;
-
-// Aliases, recorded by this `Aliases` object that all mean the same value,
-// defined by this object's name `string(self.name)`.
-var protected config array alias;
-
-// Since '.'s in values are converted into ':' for storage purposes,
-// we need methods to convert between "storage" and "actual" value version.
-// `ToStorageVersion()` and `ToActualVersion()` do that.
-private final function string ToStorageVersion(string actualValue)
-{
- return Repl(actualValue, ".", ":");
-}
-
-private final function string ToActualVersion(string storageValue)
-{
- return Repl(storageValue, ":", ".");
-}
-
-/**
- * Returns value that caller's `Aliases` object's aliases point to.
- *
- * @return Value, stored by this object.
- */
-public final function string GetValue()
-{
- return ToActualVersion(string(self.name));
-}
-
-/**
- * Returns array of aliases that caller `Aliases` tells us point to it's value.
- *
- * @return Array of all aliases, stored by caller `Aliases` object.
- */
-public final function array GetAliases()
-{
- return alias;
-}
-
-/**
- * [For inner use by `AliasSource`] Adds new alias to this object.
- *
- * Does no duplicates checks through for it's `AliasSource` and
- * neither it updates relevant `AliasHash`,
- * but will prevent adding duplicate records inside it's own storage.
- *
- * @param aliasToAdd Alias to add to caller `Aliases` object.
- */
-public final function AddAlias(string aliasToAdd)
-{
- local int i;
- for (i = 0; i < alias.length; i += 1) {
- if (alias[i] ~= aliasToAdd) return;
- }
- alias[alias.length] = ToStorageVersion(aliasToAdd);
- AliasService(class'AliasService'.static.Require())
- .PendingSaveObject(self);
-}
-
-/**
- * [For inner use by `AliasSource`] Removes alias from this object.
- *
- * Does not update relevant `AliasHash`.
- *
- * Will prevent adding duplicate records inside it's own storage.
- *
- * @param aliasToRemove Alias to remove from caller `Aliases` object.
- */
-public final function RemoveAlias(string aliasToRemove)
-{
- local int i;
- local bool removedAlias;
- while (i < alias.length)
- {
- if (alias[i] ~= aliasToRemove)
- {
- alias.Remove(i, 1);
- removedAlias = true;
- }
- else {
- i += 1;
- }
- }
- if (removedAlias)
- {
- AliasService(class'AliasService'.static.Require())
- .PendingSaveObject(self);
- }
-}
-
-/**
- * If this object still has any alias records, - forces a rewrite of it's data
- * into the config file, otherwise - removes it's record entirely.
- */
-public final function SaveOrClear()
-{
- if (alias.length <= 0) {
- ClearConfig();
- }
- else {
- SaveConfig();
- }
-}
-
-defaultproperties
-{
- sourceClass = class'AliasSource'
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/AliasesAPI.uc b/sources/Core/Aliases/AliasesAPI.uc
deleted file mode 100644
index d231640..0000000
--- a/sources/Core/Aliases/AliasesAPI.uc
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * Provides convenient access to Aliases-related functions.
- * Copyright 2019 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class AliasesAPI extends Singleton;
-
-/**
- * Checks that passed value is a valid alias name.
- *
- * A valid name is any name consisting out of 128 ASCII symbols.
- *
- * @param aliasToCheck Alias to check for validity.
- * @return `true` if `aliasToCheck` is a valid alias and `false` otherwise.
- */
-public final function bool IsAliasValid(string aliasToCheck)
-{
- return _.text.IsASCIIString(aliasToCheck);
-}
-
-/**
- * Provides an easier access to the instance of the `AliasSource` of
- * the given class.
- *
- * Can fail if `customSourceClass` is incorrectly defined.
- *
- * @param customSourceClass Class of the source we want.
- * @return Instance of the requested `AliasSource`,
- * `none` if `customSourceClass` is incorrectly defined.
- */
-public final function AliasSource GetCustomSource(
- class customSourceClass)
-{
- return AliasSource(customSourceClass.static.GetInstance(true));
-}
-
-/**
- * Returns `AliasSource` that is designated in configuration files as
- * a source for weapon aliases.
- *
- * NOTE: while by default weapon aliases source will contain only weapon
- * aliases, you should not assume that. Acedia allows admins to store all
- * the aliases in the same config.
- *
- * @return Reference to the `AliasSource` that contains weapon aliases.
- * Can return `none` if no source for weapons was configured or
- * the configured source is incorrectly defined.
- */
-public final function AliasSource GetWeaponSource()
-{
- local AliasSource weaponSource;
- local class sourceClass;
- sourceClass = class'AliasService'.default.weaponAliasesSource;
- if (sourceClass == none) {
- _.logger.Failure("No weapon aliases source configured for Acedia's"
- @ "alias API. Error is most likely cause by erroneous config.");
- return none;
- }
- weaponSource = AliasSource(sourceClass.static.GetInstance(true));
- if (weaponSource == none) {
- _.logger.Failure("`AliasSource` class `" $ string(sourceClass) $ "` is"
- @ "configured to store weapon aliases, but it seems to be invalid."
- @ "This is a bug and not configuration file problem, but issue"
- @ "might be avoided by using a different `AliasSource`.");
- return none;
- }
- return weaponSource;
-}
-
-/**
- * Returns `AliasSource` that is designated in configuration files as
- * a source for color aliases.
- *
- * NOTE: while by default color aliases source will contain only color aliases,
- * you should not assume that. Acedia allows admins to store all the aliases
- * in the same config.
- *
- * @return Reference to the `AliasSource` that contains color aliases.
- * Can return `none` if no source for colors was configured or
- * the configured source is incorrectly defined.
- */
-public final function AliasSource GetColorSource()
-{
- local AliasSource colorSource;
- local class sourceClass;
- sourceClass = class'AliasService'.default.colorAliasesSource;
- if (sourceClass == none) {
- _.logger.Failure("No color aliases source configured for Acedia's"
- @ "alias API. Error is most likely cause by erroneous config.");
- return none;
- }
- colorSource = AliasSource(sourceClass.static.GetInstance(true));
- if (colorSource == none) {
- _.logger.Failure("`AliasSource` class `" $ string(sourceClass) $ "` is"
- @ "configured to store color aliases, but it seems to be invalid."
- @ "This is a bug and not configuration file problem, but issue"
- @ "might be avoided by using a different `AliasSource`.");
- return none;
- }
- return colorSource;
-}
-
-/**
- * Tries to look up a value, stored for given alias in an `AliasSource`
- * configured to store weapon aliases. Reports error on failure.
- *
- * Lookup of alias can fail if either alias does not exist in weapon alias
- * source or weapon alias source itself does not exist
- * (due to either faulty configuration or incorrect definition).
- * To determine if weapon alias source exists you can check
- * `_.alias.GetWeaponSource()` value.
- *
- * Also see `TryWeapon()` method.
- *
- * @param alias Alias, for which method will attempt to look up a value.
- * Case-insensitive.
- * @param value If passed `alias` was recorded as a weapon alias,
- * it's corresponding value will be written in this variable.
- * Otherwise value is undefined.
- * @return `true` if lookup was successful and `false` otherwise.
- */
-public final function bool ResolveWeapon(string alias, out string result)
-{
- local AliasSource source;
- source = GetWeaponSource();
- if (source != none) {
- return source.Resolve(alias, result);
- }
- return false;
-}
-
-/**
- * Tries to look up a value, stored for given alias in an `AliasSource`
- * configured to store weapon aliases and silently returns given `alias`
- * value upon failure.
- *
- * Lookup of alias can fail if either alias does not exist in weapon alias
- * source or weapon alias source itself does not exist
- * (due to either faulty configuration or incorrect definition).
- * To determine if weapon alias source exists you can check
- * `_.alias.GetWeaponSource()` value.
- *
- * Also see `ResolveWeapon()` method.
- *
- * @param alias Alias, for which method will attempt to look up a value.
- * Case-insensitive.
- * @return Weapon value corresponding to a given alias, if it was present in
- * the weapon alias source and value of `alias` parameter instead.
- */
-public function string TryWeapon(string alias)
-{
- local AliasSource source;
- source = GetWeaponSource();
- if (source != none) {
- return source.Try(alias);
- }
- return alias;
-}
-
-/**
- * Tries to look up a value, stored for given alias in an `AliasSource`
- * configured to store color aliases. Reports error on failure.
- *
- * Lookup of alias can fail if either alias does not exist in color alias
- * source or color alias source itself does not exist
- * (due to either faulty configuration or incorrect definition).
- * To determine if color alias source exists you can check
- * `_.alias.GetColorSource()` value.
- *
- * Also see `TryColor()` method.
- *
- * @param alias Alias, for which method will attempt to look up a value.
- * Case-insensitive.
- * @param value If passed `alias` was recorded as a color alias,
- * it's corresponding value will be written in this variable.
- * Otherwise value is undefined.
- * @return `true` if lookup was successful and `false` otherwise.
- */
-public final function bool ResolveColor(string alias, out string result)
-{
- local AliasSource source;
- source = GetColorSource();
- if (source != none) {
- return source.Resolve(alias, result);
- }
- return false;
-}
-
-/**
- * Tries to look up a value, stored for given alias in an `AliasSource`
- * configured to store color aliases and silently returns given `alias`
- * value upon failure.
- *
- * Lookup of alias can fail if either alias does not exist in color alias
- * source or color alias source itself does not exist
- * (due to either faulty configuration or incorrect definition).
- * To determine if color alias source exists you can check
- * `_.alias.GetColorSource()` value.
- *
- * Also see `ResolveColor()` method.
- *
- * @param alias Alias, for which method will attempt to look up a value.
- * Case-insensitive.
- * @return Color value corresponding to a given alias, if it was present in
- * the color alias source and value of `alias` parameter instead.
- */
-public function string TryColor(string alias)
-{
- local AliasSource source;
- source = GetColorSource();
- if (source != none) {
- return source.Try(alias);
- }
- return alias;
-}
-
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/BuiltInSources/ColorAliasSource.uc b/sources/Core/Aliases/BuiltInSources/ColorAliasSource.uc
deleted file mode 100644
index 5cd75cf..0000000
--- a/sources/Core/Aliases/BuiltInSources/ColorAliasSource.uc
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Source intended for color aliases.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class ColorAliasSource extends AliasSource
- config(AcediaAliases_Colors);
-
-defaultproperties
-{
- configName = "AcediaAliases_Colors"
- aliasesClass = class'ColorAliases'
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/BuiltInSources/ColorAliases.uc b/sources/Core/Aliases/BuiltInSources/ColorAliases.uc
deleted file mode 100644
index d0998b6..0000000
--- a/sources/Core/Aliases/BuiltInSources/ColorAliases.uc
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Per-object-configuration intended for color aliases.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class ColorAliases extends Aliases
- perObjectConfig
- config(AcediaAliases_Colors);
-
-defaultproperties
-{
- sourceClass = class'ColorAliasSource'
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/BuiltInSources/WeaponAliasSource.uc b/sources/Core/Aliases/BuiltInSources/WeaponAliasSource.uc
deleted file mode 100644
index 0cf1bc4..0000000
--- a/sources/Core/Aliases/BuiltInSources/WeaponAliasSource.uc
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Source intended for weapon aliases.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class WeaponAliasSource extends AliasSource
- config(AcediaAliases_Weapons);
-
-defaultproperties
-{
- configName = "AcediaAliases_Weapons"
- aliasesClass = class'WeaponAliases'
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/BuiltInSources/WeaponAliases.uc b/sources/Core/Aliases/BuiltInSources/WeaponAliases.uc
deleted file mode 100644
index 82acd45..0000000
--- a/sources/Core/Aliases/BuiltInSources/WeaponAliases.uc
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Per-object-configuration intended for weapon aliases.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class WeaponAliases extends Aliases
- perObjectConfig
- config(AcediaAliases_Weapons);
-
-defaultproperties
-{
- sourceClass = class'WeaponAliasSource'
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/Tests/MockAliasSource.uc b/sources/Core/Aliases/Tests/MockAliasSource.uc
deleted file mode 100644
index d724501..0000000
--- a/sources/Core/Aliases/Tests/MockAliasSource.uc
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Source intended for testing aliases.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class MockAliasSource extends AliasSource
- config(AcediaAliases_Tests);
-
-defaultproperties
-{
- configName = "AcediaAliases_Tests"
- aliasesClass = class'MockAliases'
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/Tests/MockAliases.uc b/sources/Core/Aliases/Tests/MockAliases.uc
deleted file mode 100644
index 83eeef3..0000000
--- a/sources/Core/Aliases/Tests/MockAliases.uc
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Per-object-configuration intended for testing aliases.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class MockAliases extends Aliases
- perObjectConfig
- config(AcediaAliases_Tests);
-
-defaultproperties
-{
- sourceClass = class'MockAliasSource'
-}
\ No newline at end of file
diff --git a/sources/Core/Aliases/Tests/TEST_Aliases.uc b/sources/Core/Aliases/Tests/TEST_Aliases.uc
deleted file mode 100644
index be51505..0000000
--- a/sources/Core/Aliases/Tests/TEST_Aliases.uc
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * Set of tests for Aliases system.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class TEST_Aliases extends TestCase
- abstract;
-
-protected static function TESTS()
-{
- Test_AliasHash();
- Test_AliasLoading();
-}
-
-protected static function Test_AliasLoading()
-{
- Context("Testing loading aliases from a mock object `MockAliasSource`.");
- SubTest_AliasLoadingCorrect();
- SubTest_AliasLoadingIncorrect();
-}
-
-protected static function SubTest_AliasLoadingCorrect()
-{
- local AliasSource source;
- local string outValue;
-
- Issue("`Resolve()` fails to return alias that should be loaded.");
- source = _().alias.GetCustomSource(class'MockAliasSource');
- TEST_ExpectTrue(source.Resolve("Global", outValue));
- TEST_ExpectTrue(outValue == "value");
- TEST_ExpectTrue(source.Resolve("ford", outValue));
- TEST_ExpectTrue(outValue == "car");
-
- Issue("`Try()` fails to return alias that should be loaded.");
- TEST_ExpectTrue(source.Try("question") == "response");
- TEST_ExpectTrue(source.Try("delorean") == "car");
-
- Issue("`ContainsAlias()` reports alias, that should be present,"
- @ "as missing.");
- TEST_ExpectTrue(source.ContainsAlias("Global"));
- TEST_ExpectTrue(source.ContainsAlias("audi"));
-
- Issue("Aliases in per-object-configs incorrectly handle ':'.");
- TEST_ExpectTrue(source.Try("HardToBeAGod") == "sci.fi");
-
- Issue("Aliases with empty values in alias name or their value are handled"
- @ "incorrectly.");
- TEST_ExpectTrue(source.Try("") == "empty");
- TEST_ExpectTrue(source.Try("also") == "");
-}
-
-protected static function SubTest_AliasLoadingIncorrect()
-{
- local AliasSource source;
- local string outValue;
- Context("Testing loading aliases from a mock object `MockAliasSource`.");
- Issue("`AliasAPI` cannot return value custom source.");
- source = _().alias.GetCustomSource(class'MockAliasSource');
- TEST_ExpectNotNone(source);
-
- Issue("`Resolve()` reports success of finding inexistent alias.");
- source = _().alias.GetCustomSource(class'MockAliasSource');
- TEST_ExpectFalse(source.Resolve("noSuchThing", outValue));
-
- Issue("`Try()` does not return given value for non-existent alias.");
- TEST_ExpectTrue(source.Try("TheHellIsThis") == "TheHellIsThis");
-
- Issue("`ContainsAlias()` reports inexistent alias as present.");
- TEST_ExpectFalse(source.ContainsAlias("FordК"));
-}
-
-protected static function Test_AliasHash()
-{
- Context("Testing `AliasHasher`.");
- SubTest_AliasHashInsertingRemoval();
-}
-
-protected static function SubTest_AliasHashInsertingRemoval()
-{
- local AliasHash hasher;
- local string outValue;
- hasher = new class'AliasHash';
- hasher.Initialize();
- Issue("`AliasHash` cannot properly store added aliases.");
- hasher.Insert("alias", "value").Insert("one", "more");
- TEST_ExpectTrue(hasher.Contains("alias"));
- TEST_ExpectTrue(hasher.Contains("one"));
- TEST_ExpectTrue(hasher.Find("alias", outValue));
- TEST_ExpectTrue(outValue == "value");
- TEST_ExpectTrue(hasher.Find("one", outValue));
- TEST_ExpectTrue(outValue == "more");
-
- Issue("`AliasHash` reports hashing aliases that never were hashed.");
- TEST_ExpectFalse(hasher.Contains("alia"));
-
- Issue("`AliasHash` cannot properly remove stored aliases.");
- hasher.Remove("alias");
- TEST_ExpectFalse(hasher.Contains("alias"));
- TEST_ExpectTrue(hasher.Contains("one"));
- TEST_ExpectFalse(hasher.Find("alias", outValue));
- outValue = "wrong";
- TEST_ExpectTrue(hasher.Find("one", outValue));
- TEST_ExpectTrue(outValue == "more");
-
- Issue("`InsertIfMissing()` function cannot properly store added aliases.");
- TEST_ExpectTrue(hasher.InsertIfMissing("another", "var", outValue));
- TEST_ExpectTrue(hasher.Find("another", outValue));
- TEST_ExpectTrue(outValue == "var");
-
- Issue("`InsertIfMissing()` function incorrectly resolves a conflict with"
- @ "an existing value.");
- TEST_ExpectFalse(hasher.InsertIfMissing("one", "something", outValue));
- TEST_ExpectTrue(outValue == "more");
-}
-
-defaultproperties
-{
- caseName = "Aliases"
-}
\ No newline at end of file
diff --git a/sources/Core/Color/ColorAPI.uc b/sources/Core/Color/ColorAPI.uc
deleted file mode 100644
index 6a72cb0..0000000
--- a/sources/Core/Color/ColorAPI.uc
+++ /dev/null
@@ -1,812 +0,0 @@
-/**
- * API that provides functions for working with color.
- * It has a wide range of pre-defined colors and some functions that
- * allow to quickly assemble color from rgb(a) values, parse it from
- * a `Text`/string or load it from an alias.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class ColorAPI extends Singleton
- dependson(Parser)
- config(AcediaSystem);
-
-/**
- * Enumeration for ways to represent `Color` as a `string`.
- */
-enum ColorDisplayType
-{
- // Hex format; for pink: #ffc0cb
- CLRDISPLAY_HEX,
- // RGB format; for pink: rgb(255,192,203)
- CLRDISPLAY_RGB,
- // RGBA format; for opaque pink: rgb(255,192,203,255)
- CLRDISPLAY_RGBA,
- // RGB format with tags; for pink: rgb(r=255,g=192,b=203)
- CLRDISPLAY_RGB_TAG,
- // RGBA format with tags; for pink: rgb(r=255,g=192,b=203,a=255)
- CLRDISPLAY_RGBA_TAG
-};
-
-// Some useful predefined color values.
-// They are marked as `config` to allow server admins to mess about with
-// colors if they want to.
-// Pink colors
-var public config const Color Pink;
-var public config const Color LightPink;
-var public config const Color HotPink;
-var public config const Color DeepPink;
-var public config const Color PaleVioletRed;
-var public config const Color MediumVioletRed;
-// Red colors
-var public config const Color LightSalmon;
-var public config const Color Salmon;
-var public config const Color DarkSalmon;
-var public config const Color LightCoral;
-var public config const Color IndianRed;
-var public config const Color Crimson;
-var public config const Color Firebrick;
-var public config const Color DarkRed;
-var public config const Color Red;
-// Orange colors
-var public config const Color OrangeRed;
-var public config const Color Tomato;
-var public config const Color Coral;
-var public config const Color DarkOrange;
-var public config const Color Orange;
-// Yellow colors
-var public config const Color Yellow;
-var public config const Color LightYellow;
-var public config const Color LemonChiffon;
-var public config const Color LightGoldenrodYellow;
-var public config const Color PapayaWhip;
-var public config const Color Moccasin;
-var public config const Color PeachPuff;
-var public config const Color PaleGoldenrod;
-var public config const Color Khaki;
-var public config const Color DarkKhaki;
-var public config const Color Gold;
-// Brown colors
-var public config const Color Cornsilk;
-var public config const Color BlanchedAlmond;
-var public config const Color Bisque;
-var public config const Color NavajoWhite;
-var public config const Color Wheat;
-var public config const Color Burlywood;
-var public config const Color TanColor; // `Tan()` already taken by a function
-var public config const Color RosyBrown;
-var public config const Color SandyBrown;
-var public config const Color Goldenrod;
-var public config const Color DarkGoldenrod;
-var public config const Color Peru;
-var public config const Color Chocolate;
-var public config const Color SaddleBrown;
-var public config const Color Sienna;
-var public config const Color Brown;
-var public config const Color Maroon;
-// Green colors
-var public config const Color DarkOliveGreen;
-var public config const Color Olive;
-var public config const Color OliveDrab;
-var public config const Color YellowGreen;
-var public config const Color LimeGreen;
-var public config const Color Lime;
-var public config const Color LawnGreen;
-var public config const Color Chartreuse;
-var public config const Color GreenYellow;
-var public config const Color SpringGreen;
-var public config const Color MediumSpringGreen;
-var public config const Color LightGreen;
-var public config const Color PaleGreen;
-var public config const Color DarkSeaGreen;
-var public config const Color MediumAquamarine;
-var public config const Color MediumSeaGreen;
-var public config const Color SeaGreen;
-var public config const Color ForestGreen;
-var public config const Color Green;
-var public config const Color DarkGreen;
-// Cyan colors
-var public config const Color Aqua;
-var public config const Color Cyan;
-var public config const Color LightCyan;
-var public config const Color PaleTurquoise;
-var public config const Color Aquamarine;
-var public config const Color Turquoise;
-var public config const Color MediumTurquoise;
-var public config const Color DarkTurquoise;
-var public config const Color LightSeaGreen;
-var public config const Color CadetBlue;
-var public config const Color DarkCyan;
-var public config const Color Teal;
-// Blue colors
-var public config const Color LightSteelBlue;
-var public config const Color PowderBlue;
-var public config const Color LightBlue;
-var public config const Color SkyBlue;
-var public config const Color LightSkyBlue;
-var public config const Color DeepSkyBlue;
-var public config const Color DodgerBlue;
-var public config const Color CornflowerBlue;
-var public config const Color SteelBlue;
-var public config const Color RoyalBlue;
-var public config const Color Blue;
-var public config const Color MediumBlue;
-var public config const Color DarkBlue;
-var public config const Color Navy;
-var public config const Color MidnightBlue;
-// Purple, violet, and magenta colors
-var public config const Color Lavender;
-var public config const Color Thistle;
-var public config const Color Plum;
-var public config const Color Violet;
-var public config const Color Orchid;
-var public config const Color Fuchsia;
-var public config const Color Magenta;
-var public config const Color MediumOrchid;
-var public config const Color MediumPurple;
-var public config const Color BlueViolet;
-var public config const Color DarkViolet;
-var public config const Color DarkOrchid;
-var public config const Color DarkMagenta;
-var public config const Color Purple;
-var public config const Color Indigo;
-var public config const Color DarkSlateBlue;
-var public config const Color SlateBlue;
-var public config const Color MediumSlateBlue;
-// White colors
-var public config const Color White;
-var public config const Color Snow;
-var public config const Color Honeydew;
-var public config const Color MintCream;
-var public config const Color Azure;
-var public config const Color AliceBlue;
-var public config const Color GhostWhite;
-var public config const Color WhiteSmoke;
-var public config const Color Seashell;
-var public config const Color Beige;
-var public config const Color OldLace;
-var public config const Color FloralWhite;
-var public config const Color Ivory;
-var public config const Color AntiqueWhite;
-var public config const Color Linen;
-var public config const Color LavenderBlush;
-var public config const Color MistyRose;
-// Gray and black colors
-var public config const Color Gainsboro;
-var public config const Color LightGray;
-var public config const Color Silver;
-var public config const Color DarkGray;
-var public config const Color Gray;
-var public config const Color DimGray;
-var public config const Color LightSlateGray;
-var public config const Color SlateGray;
-var public config const Color DarkSlateGray;
-var public config const Color Eigengrau;
-var public config const Color Black;
-
-// Escape code point is used to change output's color and is used in
-// Unreal Engine's `string`s.
-var private const int CODEPOINT_ESCAPE;
-var private const int CODEPOINT_SMALL_A;
-
-/**
- * Creates opaque color from (red, green, blue) triplet.
- *
- * @param red Red component, range from 0 to 255.
- * @param green Green component, range from 0 to 255.
- * @param blue Blue component, range from 0 to 255.
- * @return `Color` with specified red, green and blue component and
- * alpha component of `255`.
- */
-public final function Color RGB(byte red, byte green, byte blue)
-{
- local Color result;
- result.r = red;
- result.g = green;
- result.b = blue;
- result.a = 255;
- return result;
-}
-
-/**
- * Creates color from (red, green, blue, alpha) quadruplet.
- *
- * @param red Red component, range from 0 to 255.
- * @param green Green component, range from 0 to 255.
- * @param blue Blue component, range from 0 to 255.
- * @param alpha Alpha component, range from 0 to 255.
- * @return `Color` with specified red, green, blue and alpha component.
- */
-public final function Color RGBA(byte red, byte green, byte blue, byte alpha)
-{
- local Color result;
- result.r = red;
- result.g = green;
- result.b = blue;
- result.a = alpha;
- return result;
-}
-
-/**
- * Compares two colors for exact equality of red, green and blue components.
- * Alpha component is ignored.
- *
- * @param color1 Color to compare
- * @param color2 Color to compare
- * @return `true` if colors' red, green and blue components are equal
- * and `false` otherwise.
- */
-public final function bool AreEqual(Color color1, Color color2, optional bool fixColors)
-{
- if (fixColors) {
- color1 = FixColor(color1);
- color2 = FixColor(color2);
- }
- if (color1.r != color2.r) return false;
- if (color1.g != color2.g) return false;
- if (color1.b != color2.b) return false;
- return true;
-}
-
-/**
- * Compares two colors for exact equality of red, green, blue
- * and alpha components.
- *
- * @param color1 Color to compare
- * @param color2 Color to compare
- * @return `true` if colors' red, green, blue and alpha components are equal
- * and `false` otherwise.
- */
-public final function bool AreEqualWithAlpha(Color color1, Color color2, optional bool fixColors)
-{
- if (fixColors) {
- color1 = FixColor(color1);
- color2 = FixColor(color2);
- }
- if (color1.r != color2.r) return false;
- if (color1.g != color2.g) return false;
- if (color1.b != color2.b) return false;
- if (color1.a != color2.a) return false;
- return true;
-}
-
-/**
- * Killing floor's standard methods of rendering colored `string`s
- * make use of inserting 4-byte sequence into them: first bytes denotes
- * the start of the sequence, 3 following bytes denote rgb color components.
- * Unfortunately these methods also have issues with rendering `string`s
- * if you specify certain values (`0` and `10`) of rgb color components.
- *
- * This function "fixes" components by replacing them with close and valid
- * color component values (adds `1` to the component).
- */
-public final function byte FixColorComponent(byte colorComponent)
-{
- if (colorComponent == 0 || colorComponent == 10)
- {
- return colorComponent + 1;
- }
- return colorComponent;
-}
-
-/**
- * Killing floor's standard methods of rendering colored `string`s
- * make use of inserting 4-byte sequence into them: first bytes denotes
- * the start of the sequence, 3 following bytes denote rgb color components.
- * Unfortunately these methods also have issues with rendering `string`s
- * if you specify certain values (`0` and `10`) as rgb color components.
- *
- * This function "fixes" given `Color`'s components by replacing them with
- * close and valid color values (using `FixColorComponent()` method),
- * resulting in a `Color` that looks almost the same, but is suitable to be
- * included into 4-byte color change sequence.
- *
- * Since alpha component is never used in color-change sequences,
- * it is never affected.
- */
-public final function Color FixColor(Color colorToFix)
-{
- colorToFix.r = FixColorComponent(colorToFix.r);
- colorToFix.g = FixColorComponent(colorToFix.g);
- colorToFix.b = FixColorComponent(colorToFix.b);
- return colorToFix;
-}
-
-/**
- * Returns 4-gyte sequence for color change to a given color.
- *
- * To make returned tag work in most sequences, the value of given color is
- * auto "fixed" (see `FixColor()` for details).
- * There is an option to skip color fixing, but method will still change
- * `0` components to `1`, since they cannot otherwise be used in a tag at all.
- *
- * Also see `GetColorTagRGB()`.
- *
- * @param colorToUse Color to which tag must change the text.
- * It's alpha value (`colorToUse.a`) is discarded.
- * @param doNotFixComponents Minimizes changes to color components
- * (only allows to change `0` components to `1` before creating a tag).
- * @return `string` containing 4-byte sequence that will swap text's color to
- * a given one in standard Unreal Engine's UI.
- */
-public final function string GetColorTag(
- Color colorToUse,
- optional bool doNotFixComponents)
-{
- if (!doNotFixComponents) {
- colorToUse = FixColor(colorToUse);
- }
- colorToUse.r = Max(1, colorToUse.r);
- colorToUse.g = Max(1, colorToUse.g);
- colorToUse.b = Max(1, colorToUse.b);
- return Chr(CODEPOINT_ESCAPE)
- $ Chr(colorToUse.r)
- $ Chr(colorToUse.g)
- $ Chr(colorToUse.b);
-}
-
-/**
- * Returns 4-gyte sequence for color change to a given color.
- *
- * To make returned tag work in most sequences, the value of given color is
- * auto "fixed" (see `FixColor()` for details).
- * There is an option to skip color fixing, but method will still change
- * `0` components to `1`, since they cannot otherwise be used in a tag at all.
- *
- * Also see `GetColorTag()`.
- *
- * @param red Red component of color to which tag must
- * change the text.
- * @param green Green component of color to which tag must
- * change the text.
- * @param blue Blue component of color to which tag must
- * change the text.
- * @param doNotFixComponents Minimizes changes to color components
- * (only allows to change `0` components to `1` before creating a tag).
- * @return `string` containing 4-byte sequence that will swap text's color to
- * a given one in standard Unreal Engine's UI.
- */
-public final function string GetColorTagRGB(
- int red,
- int green,
- int blue,
- optional bool doNotFixComponents)
-{
- if (!doNotFixComponents)
- {
- red = FixColorComponent(red);
- green = FixColorComponent(green);
- blue = FixColorComponent(blue);
- }
- red = Max(1, red);
- green = Max(1, green);
- blue = Max(1, blue);
- return Chr(CODEPOINT_ESCAPE) $ Chr(red) $ Chr(green) $ Chr(blue);
-}
-
-// Helper function that converts `byte` with values between 0 and 15 into
-// a corresponding hex letter
-private final function string ByteToHexCharacter(byte component)
-{
- component = Clamp(component, 0, 15);
- if (component < 10) {
- return string(component);
- }
- return Chr(component - 10 + CODEPOINT_SMALL_A);
-}
-
-// `byte` to `string` in hex
-private final function string ComponentToHex(byte component)
-{
- local byte high4Bits, low4Bits;
- low4Bits = component % 16;
- if (component >= 16) {
- high4Bits = (component - low4Bits) / 16;
- }
- else {
- high4Bits = 0;
- }
- return ByteToHexCharacter(high4Bits) $ ByteToHexCharacter(low4Bits);
-}
-
-/**
- * Displays given color as a string in a given style
- * (hex color representation by default).
- *
- * @param colorToConvert Color to display as a `string`.
- * @param displayType `enum` value, describing how should color
- * be displayed.
- * @return `string` representation of a given color in a given style.
- */
-public final function string ToStringType(
- Color colorToConvert,
- optional ColorDisplayType displayType)
-{
- if (displayType == CLRDISPLAY_HEX) {
- return "#" $ ComponentToHex(colorToConvert.r)
- $ ComponentToHex(colorToConvert.g)
- $ ComponentToHex(colorToConvert.b);
- }
- else if (displayType == CLRDISPLAY_RGB)
- {
- return "rgb(" $ string(colorToConvert.r) $ ","
- $ string(colorToConvert.g) $ ","
- $ string(colorToConvert.b) $ ")";
- }
- else if (displayType == CLRDISPLAY_RGBA)
- {
- return "rgba(" $ string(colorToConvert.r) $ ","
- $ string(colorToConvert.g) $ ","
- $ string(colorToConvert.b) $ ","
- $ string(colorToConvert.a) $ ")";
- }
- else if (displayType == CLRDISPLAY_RGB_TAG)
- {
- return "rgb(r=" $ string(colorToConvert.r) $ ","
- $ "g=" $ string(colorToConvert.g) $ ","
- $ "b=" $ string(colorToConvert.b) $ ")";
- }
- //else if (displayType == CLRDISPLAY_RGBA_TAG)
- return "rgba(r=" $ string(colorToConvert.r) $ ","
- $ "g=" $ string(colorToConvert.g) $ ","
- $ "b=" $ string(colorToConvert.b) $ ","
- $ "a=" $ string(colorToConvert.a) $ ")";
-}
-
-/**
- * Displays given color as a string in RGB or RGBA format, depending on
- * whether color is opaque.
- *
- * @param colorToConvert Color to display as a `string` in `CLRDISPLAY_RGB`
- * style if `colorToConvert.a == 255` and `CLRDISPLAY_RGBA` otherwise.
- * @return `string` representation of a given color in a given style.
- */
-public final function string ToString(Color colorToConvert)
-{
- if (colorToConvert.a < 255) {
- return ToStringType(colorToConvert, CLRDISPLAY_RGBA);
- }
- return ToStringType(colorToConvert, CLRDISPLAY_RGB);
-}
-
-// Parses color in `CLRDISPLAY_RGB` and `CLRDISPLAY_RGB_TAG` representations.
-private final function Color ParseRGB(Parser parser)
-{
- local int redComponent;
- local int greenComponent;
- local int blueComponent;
- local Parser.ParserState initialParserState;
- initialParserState = parser.GetCurrentState();
- parser.Match("rgb(", true)
- .MInteger(redComponent).Match(",")
- .MInteger(greenComponent).Match(",")
- .MInteger(blueComponent).Match(")");
- if (!parser.Ok())
- {
- parser.RestoreState(initialParserState).Match("rgb(", true)
- .Match("r=", true).MInteger(redComponent).Match(",")
- .Match("g=", true).MInteger(greenComponent).Match(",")
- .Match("b=", true).MInteger(blueComponent).Match(")");
- }
- return RGB(redComponent, greenComponent, blueComponent);
-}
-
-// Parses color in `CLRDISPLAY_RGBA` and `CLRDISPLAY_RGBA_TAG` representations.
-private final function Color ParseRGBA(Parser parser)
-{
- local int redComponent;
- local int greenComponent;
- local int blueComponent;
- local int alphaComponent;
- local Parser.ParserState initialParserState;
- initialParserState = parser.GetCurrentState();
- parser.Match("rgba(", true)
- .MInteger(redComponent).Match(",")
- .MInteger(greenComponent).Match(",")
- .MInteger(blueComponent).Match(",")
- .MInteger(alphaComponent).Match(")");
- if (!parser.Ok())
- {
- parser.RestoreState(initialParserState).Match("rgba(", true)
- .Match("r=", true).MInteger(redComponent).Match(",")
- .Match("g=", true).MInteger(greenComponent).Match(",")
- .Match("b=", true).MInteger(blueComponent).Match(",")
- .Match("a=", true).MInteger(alphaComponent).Match(")");
- }
- return RGBA(redComponent, greenComponent, blueComponent, alphaComponent);
-}
-
-// Parses color in `CLRDISPLAY_HEX` representation.
-private final function Color ParseHexColor(Parser parser)
-{
- local int redComponent;
- local int greenComponent;
- local int blueComponent;
- parser.Match("#")
- .MUnsignedInteger(redComponent, 16, 2)
- .MUnsignedInteger(greenComponent, 16, 2)
- .MUnsignedInteger(blueComponent, 16, 2);
- return RGB(redComponent, greenComponent, blueComponent);
-}
-
-/**
- * Uses given parser to try and parse a color in any of the
- * `ColorDisplayType` representations.
- *
- * @param parser Parser that method would use to parse color from
- * wherever it left. It's confirmed state will not be changed.
- * Do not treat `parser` bein in a non-failed state as a confirmation of
- * successful parsing: color parsing might fail regardless.
- * Check return value for that.
- * @param resultingColor Parsed color will be written here if parsing is
- * successful, otherwise value is undefined.
- * If parsed color did not specify alpha component - 255 will be used.
- * @return `true` if parsing was successful and false otherwise.
- */
-public final function bool ParseWith(Parser parser, out Color resultingColor)
-{
- local bool successfullyParsed;
- local string colorAlias;
- local Parser colorParser;
- local Parser.ParserState initialParserState;
- if (parser == none) return false;
- resultingColor.a = 0xff;
- colorParser = parser;
- initialParserState = parser.GetCurrentState();
- if (parser.Match("$").MUntil(colorAlias,, true).Ok())
- {
- colorParser = _.text.ParseString(_.alias.TryColor(colorAlias));
- initialParserState = colorParser.GetCurrentState();
- }
- else {
- parser.RestoreState(initialParserState);
- }
- resultingColor = ParseRGB(colorParser);
- if (!colorParser.Ok())
- {
- colorParser.RestoreState(initialParserState);
- resultingColor = ParseRGBA(colorParser);
- }
- if (!colorParser.Ok())
- {
- colorParser.RestoreState(initialParserState);
- resultingColor = ParseHexColor(colorParser);
- }
- successfullyParsed = colorParser.Ok();
- if (colorParser != parser) {
- _.memory.Free(colorParser);
- }
- return successfullyParsed;
-}
-
-/**
- * Parses a color in any of the `ColorDisplayType` representations from the
- * beginning of a given `string`.
- *
- * @param stringWithColor String, that contains color definition at
- * the beginning. Anything after color definition is not used.
- * @param resultingColor Parsed color will be written here if parsing is
- * successful, otherwise value is undefined.
- * If parsed color did not specify alpha component - 255 will be used.
- * @param stringType How to treat given `string`,
- * see `StringType` for more details.
- * @return `true` if parsing was successful and false otherwise.
- */
-public final function bool ParseString(
- string stringWithColor,
- out Color resultingColor,
- optional Text.StringType stringType)
-{
- local bool successfullyParsed;
- local Parser colorParser;
- colorParser = _.text.ParseString(stringWithColor, stringType);
- successfullyParsed = ParseWith(colorParser, resultingColor);
- _.memory.Free(colorParser);
- return successfullyParsed;
-}
-
-/**
- * Parses a color in any of the `ColorDisplayType` representations from the
- * beginning of a given `Text`.
- *
- * @param textWithColor `Text`, that contains color definition at
- * the beginning. Anything after color definition is not used.
- * @param resultingColor Parsed color will be written here if parsing is
- * successful, otherwise value is undefined.
- * If parsed color did not specify alpha component - 255 will be used.
- * @return `true` if parsing was successful and false otherwise.
- */
-public final function bool ParseText(
- Text textWithColor,
- out Color resultingColor)
-{
- local bool successfullyParsed;
- local Parser colorParser;
- colorParser = _.text.Parse(textWithColor);
- successfullyParsed = ParseWith(colorParser, resultingColor);
- _.memory.Free(colorParser);
- return successfullyParsed;
-}
-
-/**
- * Parses a color in any of the `ColorDisplayType` representations from the
- * beginning of a given raw data.
- *
- * @param rawDataWithColor Raw data, that contains color definition at
- * the beginning. Anything after color definition is not used.
- * @param resultingColor Parsed color will be written here if parsing is
- * successful, otherwise value is undefined.
- * If parsed color did not specify alpha component - 255 will be used.
- * @return `true` if parsing was successful and false otherwise.
- */
-public final function bool ParseRaw(
- array rawDataWithColor,
- out Color resultingColor)
-{
- local bool successfullyParsed;
- local Parser colorParser;
- colorParser = _.text.ParseRaw(rawDataWithColor);
- successfullyParsed = ParseWith(colorParser, resultingColor);
- _.memory.Free(colorParser);
- return successfullyParsed;
-}
-
-defaultproperties
-{
- Pink=(R=255,G=192,B=203,A=255)
- LightPink=(R=255,G=182,B=193,A=255)
- HotPink=(R=255,G=105,B=180,A=255)
- DeepPink=(R=255,G=20,B=147,A=255)
- PaleVioletRed=(R=219,G=112,B=147,A=255)
- MediumVioletRed=(R=199,G=21,B=133,A=255)
- LightSalmon=(R=255,G=160,B=122,A=255)
- Salmon=(R=250,G=128,B=114,A=255)
- DarkSalmon=(R=233,G=150,B=122,A=255)
- LightCoral=(R=240,G=128,B=128,A=255)
- IndianRed=(R=205,G=92,B=92,A=255)
- Crimson=(R=220,G=20,B=60,A=255)
- Firebrick=(R=178,G=34,B=34,A=255)
- DarkRed=(R=139,G=0,B=0,A=255)
- Red=(R=255,G=0,B=0,A=255)
- OrangeRed=(R=255,G=69,B=0,A=255)
- Tomato=(R=255,G=99,B=71,A=255)
- Coral=(R=255,G=127,B=80,A=255)
- DarkOrange=(R=255,G=140,B=0,A=255)
- Orange=(R=255,G=165,B=0,A=255)
- Yellow=(R=255,G=255,B=0,A=255)
- LightYellow=(R=255,G=255,B=224,A=255)
- LemonChiffon=(R=255,G=250,B=205,A=255)
- LightGoldenrodYellow=(R=250,G=250,B=210,A=255)
- PapayaWhip=(R=255,G=239,B=213,A=255)
- Moccasin=(R=255,G=228,B=181,A=255)
- PeachPuff=(R=255,G=218,B=185,A=255)
- PaleGoldenrod=(R=238,G=232,B=170,A=255)
- Khaki=(R=240,G=230,B=140,A=255)
- DarkKhaki=(R=189,G=183,B=107,A=255)
- Gold=(R=255,G=215,B=0,A=255)
- Cornsilk=(R=255,G=248,B=220,A=255)
- BlanchedAlmond=(R=255,G=235,B=205,A=255)
- Bisque=(R=255,G=228,B=196,A=255)
- NavajoWhite=(R=255,G=222,B=173,A=255)
- Wheat=(R=245,G=222,B=179,A=255)
- Burlywood=(R=222,G=184,B=135,A=255)
- TanColor=(R=210,G=180,B=140,A=255)
- RosyBrown=(R=188,G=143,B=143,A=255)
- SandyBrown=(R=244,G=164,B=96,A=255)
- Goldenrod=(R=218,G=165,B=32,A=255)
- DarkGoldenrod=(R=184,G=134,B=11,A=255)
- Peru=(R=205,G=133,B=63,A=255)
- Chocolate=(R=210,G=105,B=30,A=255)
- SaddleBrown=(R=139,G=69,B=19,A=255)
- Sienna=(R=160,G=82,B=45,A=255)
- Brown=(R=165,G=42,B=42,A=255)
- Maroon=(R=128,G=0,B=0,A=255)
- DarkOliveGreen=(R=85,G=107,B=47,A=255)
- Olive=(R=128,G=128,B=0,A=255)
- OliveDrab=(R=107,G=142,B=35,A=255)
- YellowGreen=(R=154,G=205,B=50,A=255)
- LimeGreen=(R=50,G=205,B=50,A=255)
- Lime=(R=0,G=255,B=0,A=255)
- LawnGreen=(R=124,G=252,B=0,A=255)
- Chartreuse=(R=127,G=255,B=0,A=255)
- GreenYellow=(R=173,G=255,B=47,A=255)
- SpringGreen=(R=0,G=255,B=127,A=255)
- MediumSpringGreen=(R=0,G=250,B=154,A=255)
- LightGreen=(R=144,G=238,B=144,A=255)
- PaleGreen=(R=152,G=251,B=152,A=255)
- DarkSeaGreen=(R=143,G=188,B=143,A=255)
- MediumAquamarine=(R=102,G=205,B=170,A=255)
- MediumSeaGreen=(R=60,G=179,B=113,A=255)
- SeaGreen=(R=46,G=139,B=87,A=255)
- ForestGreen=(R=34,G=139,B=34,A=255)
- Green=(R=0,G=128,B=0,A=255)
- DarkGreen=(R=0,G=100,B=0,A=255)
- Aqua=(R=0,G=255,B=255,A=255)
- Cyan=(R=0,G=255,B=255,A=255)
- LightCyan=(R=224,G=255,B=255,A=255)
- PaleTurquoise=(R=175,G=238,B=238,A=255)
- Aquamarine=(R=127,G=255,B=212,A=255)
- Turquoise=(R=64,G=224,B=208,A=255)
- MediumTurquoise=(R=72,G=209,B=204,A=255)
- DarkTurquoise=(R=0,G=206,B=209,A=255)
- LightSeaGreen=(R=32,G=178,B=170,A=255)
- CadetBlue=(R=95,G=158,B=160,A=255)
- DarkCyan=(R=0,G=139,B=139,A=255)
- Teal=(R=0,G=128,B=128,A=255)
- LightSteelBlue=(R=176,G=196,B=222,A=255)
- PowderBlue=(R=176,G=224,B=230,A=255)
- LightBlue=(R=173,G=216,B=230,A=255)
- SkyBlue=(R=135,G=206,B=235,A=255)
- LightSkyBlue=(R=135,G=206,B=250,A=255)
- DeepSkyBlue=(R=0,G=191,B=255,A=255)
- DodgerBlue=(R=30,G=144,B=255,A=255)
- CornflowerBlue=(R=100,G=149,B=237,A=255)
- SteelBlue=(R=70,G=130,B=180,A=255)
- RoyalBlue=(R=65,G=105,B=225,A=255)
- Blue=(R=0,G=0,B=255,A=255)
- MediumBlue=(R=0,G=0,B=205,A=255)
- DarkBlue=(R=0,G=0,B=139,A=255)
- Navy=(R=0,G=0,B=128,A=255)
- MidnightBlue=(R=25,G=25,B=112,A=255)
- Lavender=(R=230,G=230,B=250,A=255)
- Thistle=(R=216,G=191,B=216,A=255)
- Plum=(R=221,G=160,B=221,A=255)
- Violet=(R=238,G=130,B=238,A=255)
- Orchid=(R=218,G=112,B=214,A=255)
- Fuchsia=(R=255,G=0,B=255,A=255)
- Magenta=(R=255,G=0,B=255,A=255)
- MediumOrchid=(R=186,G=85,B=211,A=255)
- MediumPurple=(R=147,G=112,B=219,A=255)
- BlueViolet=(R=138,G=43,B=226,A=255)
- DarkViolet=(R=148,G=0,B=211,A=255)
- DarkOrchid=(R=153,G=50,B=204,A=255)
- DarkMagenta=(R=139,G=0,B=139,A=255)
- Purple=(R=128,G=0,B=128,A=255)
- Indigo=(R=75,G=0,B=130,A=255)
- DarkSlateBlue=(R=72,G=61,B=139,A=255)
- SlateBlue=(R=106,G=90,B=205,A=255)
- MediumSlateBlue=(R=123,G=104,B=238,A=255)
- White=(R=255,G=255,B=255,A=255)
- Snow=(R=255,G=250,B=250,A=255)
- Honeydew=(R=240,G=255,B=240,A=255)
- MintCream=(R=245,G=255,B=250,A=255)
- Azure=(R=240,G=255,B=255,A=255)
- AliceBlue=(R=240,G=248,B=255,A=255)
- GhostWhite=(R=248,G=248,B=255,A=255)
- WhiteSmoke=(R=245,G=245,B=245,A=255)
- Seashell=(R=255,G=245,B=238,A=255)
- Beige=(R=245,G=245,B=220,A=255)
- OldLace=(R=253,G=245,B=230,A=255)
- FloralWhite=(R=255,G=250,B=240,A=255)
- Ivory=(R=255,G=255,B=240,A=255)
- AntiqueWhite=(R=250,G=235,B=215,A=255)
- Linen=(R=250,G=240,B=230,A=255)
- LavenderBlush=(R=255,G=240,B=245,A=255)
- MistyRose=(R=255,G=228,B=225,A=255)
- Gainsboro=(R=220,G=220,B=220,A=255)
- LightGray=(R=211,G=211,B=211,A=255)
- Silver=(R=192,G=192,B=192,A=255)
- Gray=(R=169,G=169,B=169,A=255)
- DimGray=(R=128,G=128,B=128,A=255)
- DarkGray=(R=105,G=105,B=105,A=255)
- LightSlateGray=(R=119,G=136,B=153,A=255)
- SlateGray=(R=112,G=128,B=144,A=255)
- DarkSlateGray=(R=47,G=79,B=79,A=255)
- Eigengrau=(R=22,G=22,B=29,A=255)
- Black=(R=0,G=0,B=0,A=255)
- CODEPOINT_SMALL_A = 97
- CODEPOINT_ESCAPE = 27
-}
\ No newline at end of file
diff --git a/sources/Core/Color/Tests/TEST_ColorAPI.uc b/sources/Core/Color/Tests/TEST_ColorAPI.uc
deleted file mode 100644
index fc21a3d..0000000
--- a/sources/Core/Color/Tests/TEST_ColorAPI.uc
+++ /dev/null
@@ -1,507 +0,0 @@
-/**
- * Set of tests for Color API.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class TEST_ColorAPI extends TestCase
- abstract;
-
-protected static function TESTS()
-{
- Test_ColorCreation();
- Test_EqualityCheck();
- Test_ColorFixing();
- Test_ToString();
- Test_Parse();
- Test_GetTag();
-}
-
-protected static function Test_ColorCreation()
-{
- Context("Testing `ColorAPI`'s functions for creating color structures.");
- SubTest_ColorCreationRGB();
- SubTest_ColorCreationRGBA();
-}
-
-protected static function SubTest_ColorCreationRGB()
-{
- local Color createdColor;
- Issue("`RGB() function does not set red, green and blue components"
- @ "correctly.");
- createdColor = _().color.RGB(145, 67, 237);
- TEST_ExpectTrue(createdColor.r == 145);
- TEST_ExpectTrue(createdColor.g == 67);
- TEST_ExpectTrue(createdColor.b == 237);
-
- Issue("`RGB() function does not set alpha component to 255.");
- TEST_ExpectTrue(createdColor.a == 255);
-
- Issue("`RGB() function does not set special values (border values"
- @ "`0`, `255` and value `10`, incorrect for coloring a `string`) for"
- @"red, green and blue components correctly.");
- createdColor = _().color.RGB(0, 10, 255);
- TEST_ExpectTrue(createdColor.r == 0);
- TEST_ExpectTrue(createdColor.g == 10);
- TEST_ExpectTrue(createdColor.b == 255);
-
- Issue("`RGB() function does not set alpha value to 255.");
- TEST_ExpectTrue(createdColor.a == 255);
-}
-
-protected static function SubTest_ColorCreationRGBA()
-{
- local Color createdColor;
- Issue("`RGBA() function does not set red, green, blue, alpha"
- @ "components correctly.");
- createdColor = _().color.RGBA(93, 245, 1, 67);
- TEST_ExpectTrue(createdColor.r == 93);
- TEST_ExpectTrue(createdColor.g == 245);
- TEST_ExpectTrue(createdColor.b == 1);
- TEST_ExpectTrue(createdColor.a == 67);
-
- Issue("`RGBA() function does not set special values (border values"
- @ "`0`, `255` and value `10`, incorrect for coloring a `string`) for"
- @"red, green, blue components correctly.");
- createdColor = _().color.RGBA(0, 10, 10, 255);
- TEST_ExpectTrue(createdColor.r == 0);
- TEST_ExpectTrue(createdColor.g == 10);
- TEST_ExpectTrue(createdColor.b == 10);
- TEST_ExpectTrue(createdColor.a == 255);
-}
-
-protected static function Test_EqualityCheck()
-{
- Context("Testing `ColorAPI`'s functions for color equality check.");
- SubTest_EqualityCheckNotFixed();
- SubTest_EqualityCheckFixed();
-}
-
-protected static function SubTest_EqualityCheckNotFixed()
-{
- local Color color1, color2, color3;
- color1 = _().color.RGB(45, 10, 19);
- color2 = _().color.RGB(45, 11, 19);
- color3 = _().color.RGBA(45, 10, 19, 178);
- Issue("`AreEqual()` does not recognized equal colors as such.");
- TEST_ExpectTrue(_().color.AreEqual(color1, color1));
-
- Issue("`AreEqual()` does not recognized colors that differ only in alpha"
- @ "channel as equal.");
- TEST_ExpectTrue(_().color.AreEqual(color1, color3));
-
- Issue("`AreEqual()` does not recognized different colors as such.");
- TEST_ExpectFalse(_().color.AreEqual(color1, color2));
-
- Issue("`AreEqualWithAlpha()` does not recognized equal colors as such.");
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(color1, color1));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(color3, color3));
-
- Issue("`AreEqualWithAlpha()` does not recognized different colors"
- @ "as such.");
- TEST_ExpectFalse(_().color.AreEqualWithAlpha(color1, color2));
- TEST_ExpectFalse(_().color.AreEqualWithAlpha(color1, color3));
-}
-
-protected static function SubTest_EqualityCheckFixed()
-{
- local Color color1, color2, color3;
- color1 = _().color.RGB(45, 10, 0);
- color2 = _().color.RGB(45, 239, 19);
- color3 = _().color.RGBA(45, 11, 1, 178);
- Issue("`AreEqual()` does not recognized equal colors as such (with color"
- @ "auto-fix).");
- TEST_ExpectTrue(_().color.AreEqual(color1, color1, true));
-
- Issue("`AreEqual()` does not recognized colors that differ only in alpha"
- @ "channel as equal (with color auto-fix).");
- TEST_ExpectTrue(_().color.AreEqual(color1, color3, true));
-
- Issue("`AreEqual()` does not recognized different colors as such"
- @ "(with color auto-fix).");
- TEST_ExpectFalse(_().color.AreEqual(color1, color2, true));
-
- Issue("`AreEqualWithAlpha()` does not recognized equal colors as such"
- @ "(with color auto-fix).");
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(color1, color1, true));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(color3, color3, true));
-
- Issue("`AreEqualWithAlpha()` does not recognized different colors as such"
- @ "(with color auto-fix).");
- TEST_ExpectFalse(_().color.AreEqualWithAlpha(color1, color2, true));
- TEST_ExpectFalse(_().color.AreEqualWithAlpha(color1, color3, true));
-}
-
-protected static function Test_ColorFixing()
-{
- local Color validColor, brokenColor;
- validColor = _().color.RGB(23, 179, 244);
- brokenColor = _().color.RGB(10, 35, 0);
- Context("Testing `ColorAPI`'s functions for fixing color components for"
- @ "game's native render functions.");
- Issue("`FixColorComponent()` does not \"fix\" values it is expected to,"
- @ "the way it is expected to.");
- TEST_ExpectTrue(_().color.FixColorComponent(0) == 1);
- TEST_ExpectTrue(_().color.FixColorComponent(10) == 11);
-
- Issue("`FixColorComponent()` changes values it should not.");
- TEST_ExpectTrue(_().color.FixColorComponent(9) == 9);
- TEST_ExpectTrue(_().color.FixColorComponent(255) == 255);
- TEST_ExpectTrue(_().color.FixColorComponent(87) == 87);
-
- Issue("`FixColor()` changes colors it should not.");
- TEST_ExpectTrue(
- _().color.AreEqualWithAlpha(validColor,
- _().color.FixColor(validColor)));
-
- Issue("`FixColor()` doesn't fix color it should fix in an expected way.");
- TEST_ExpectTrue(
- _().color.AreEqualWithAlpha(_().color.RGB(11, 35, 1),
- _().color.FixColor(brokenColor)));
-
- Issue("`FixColor()` affects alpha channel.");
- TEST_ExpectTrue(_().color.FixColor(validColor).a == 255);
- validColor.a = 0;
- TEST_ExpectTrue(_().color.FixColor(validColor).a == 0);
- validColor.a = 10;
- TEST_ExpectTrue(_().color.FixColor(validColor).a == 10);
-}
-
-protected static function Test_ToString()
-{
- Context("Testing `ColorAPI`'s `ToString()` function.");
- SubTest_ToStringType();
- SubTest_ToString();
-}
-
-protected static function SubTest_ToStringType()
-{
- local Color normalColor, borderValueColor;
- normalColor = _().color.RGBA(24, 232, 187, 34);
- borderValueColor = _().color.RGBA(0, 255, 255, 0);
- Issue("`ToStringType()` improperly works with `CLRDISPLAY_HEX` option.");
- TEST_ExpectTrue(_().color.ToStringType(normalColor) ~= "#18e8bb");
- TEST_ExpectTrue(_().color.ToStringType(borderValueColor) ~= "#00ffff");
-
- Issue("`ToStringType()` improperly works with `CLRDISPLAY_RGB` option.");
- TEST_ExpectTrue(_().color.ToStringType(normalColor, CLRDISPLAY_RGB)
- ~= "rgb(24,232,187)");
- TEST_ExpectTrue(_().color.ToStringType(borderValueColor, CLRDISPLAY_RGB)
- ~= "rgb(0,255,255)");
-
- Issue("`ToStringType()` improperly works with `CLRDISPLAY_RGBA` option.");
- TEST_ExpectTrue(_().color.ToStringType(normalColor, CLRDISPLAY_RGBA)
- ~= "rgba(24,232,187,34)");
- TEST_ExpectTrue(_().color.ToStringType(borderValueColor, CLRDISPLAY_RGBA)
- ~= "rgba(0,255,255,0)");
-
- Issue("`ToStringType()` improperly works with `CLRDISPLAY_RGB_TAG`"
- @ "option.");
- TEST_ExpectTrue(_().color.ToStringType(normalColor, CLRDISPLAY_RGB_TAG)
- ~= "rgb(r=24,g=232,b=187)");
- TEST_ExpectTrue(_().color.ToStringType(borderValueColor, CLRDISPLAY_RGB_TAG)
- ~= "rgb(r=0,g=255,b=255)");
-
- Issue("`ToStringType()` improperly works with `CLRDISPLAY_RGBA_TAG`"
- @ "option.");
- TEST_ExpectTrue(_().color.ToStringType(normalColor, CLRDISPLAY_RGBA_TAG)
- ~= "rgba(r=24,g=232,b=187,a=34)");
- TEST_ExpectTrue(
- _().color.ToStringType(borderValueColor, CLRDISPLAY_RGBA_TAG)
- ~= "rgba(r=0,g=255,b=255,a=0)");
-}
-
-protected static function SubTest_ToString()
-{
- local Color opaqueColor, transparentColor;
- opaqueColor = _().color.RGBA(143, 211, 43, 255);
- transparentColor = _().color.RGBA(234, 32, 145, 13);
- Issue("`ToString()` improperly converts color with opaque color.");
- TEST_ExpectTrue(_().color.ToString(opaqueColor) ~= "rgb(143,211,43)");
- Issue("`ToString()` improperly converts color with transparent color.");
- TEST_ExpectTrue(_().color.ToString(transparentColor)
- ~= "rgba(234,32,145,13)");
-}
-
-protected static function Test_GetTag()
-{
- Context("Testing `ColorAPI`'s functionality of creating 4-byte color"
- @ "change sequences.");
- SubTest_GetTagColor();
- SubTest_GetTagRGB();
-}
-
-protected static function SubTest_GetTagColor()
-{
- local Color normalColor, borderColor;
- normalColor = _().color.RGB(143, 211, 43);
- borderColor = _().color.RGB(10, 0, 255);
- Issue("`GetColorTag()` does not properly convert colors.");
- TEST_ExpectTrue(_().color.GetColorTag(normalColor)
- == (Chr(27) $ Chr(143) $ Chr(211) $ Chr(43)));
- TEST_ExpectTrue(_().color.GetColorTag(borderColor)
- == (Chr(27) $ Chr(11) $ Chr(1) $ Chr(255)));
-
- Issue("`GetColorTag()` does not properly convert colors when asked not to"
- @ "fix components.");
- TEST_ExpectTrue(_().color.GetColorTag(normalColor, true)
- == (Chr(27) $ Chr(143) $ Chr(211) $ Chr(43)));
- TEST_ExpectTrue(_().color.GetColorTag(borderColor, true)
- == (Chr(27) $ Chr(10) $ Chr(1) $ Chr(255)));
-}
-
-protected static function SubTest_GetTagRGB()
-{
- Issue("`GetColorTagRGB()` does not properly convert colors.");
- TEST_ExpectTrue(_().color.GetColorTagRGB(143, 211, 43)
- == (Chr(27) $ Chr(143) $ Chr(211) $ Chr(43)));
- TEST_ExpectTrue(_().color.GetColorTagRGB(10, 0, 255)
- == (Chr(27) $ Chr(11) $ Chr(1) $ Chr(255)));
-
- Issue("`GetColorTagRGB()` does not properly convert colors when asked"
- @ "not to fix components.");
- TEST_ExpectTrue(_().color.GetColorTagRGB(143, 211, 43, true)
- == (Chr(27) $ Chr(143) $ Chr(211) $ Chr(43)));
- TEST_ExpectTrue(_().color.GetColorTagRGB(10, 0, 255, true)
- == (Chr(27) $ Chr(10) $ Chr(1) $ Chr(255)));
-}
-
-protected static function Test_Parse()
-{
- Context("Testing `ColorAPI`'s parsing functionality.");
- SubTest_ParseWithParser();
- SubTest_ParseStringPlain();
- SubTest_ParseStringColored();
- SubTest_ParseStringFormatted();
- SubTest_ParseText();
- SubTest_ParseRaw();
-}
-
-protected static function SubTest_ParseWithParser()
-{
- local Color expectedColor, resultColor;
- expectedColor = _().color.RGBA(154, 255, 0, 187);
- Issue("`ParseWith()` cannot parse hex colors.");
- TEST_ExpectTrue(_().color.ParseWith(_().text.ParseString("#9aff00"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseWith()` cannot parse rgb colors.");
- TEST_ExpectTrue(_().color.ParseWith(_().text.ParseString("rgb(154,255,0)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseWith()` cannot parse rgba colors.");
- TEST_ExpectTrue(_().color.ParseWith(
- _().text.ParseString("rgba(154,255,0,187)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseWith()` cannot parse rgb colors with tags.");
- TEST_ExpectTrue(_().color.ParseWith(
- _().text.ParseString("rgb(r=154,g=255,b=0)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseWith()` cannot parse rgba colors with tags.");
- TEST_ExpectTrue(_().color.ParseWith(
- _().text.ParseString("rgba(r=154,g=255,b=0,a=187)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseWith()` reports success when parsing invalid color string.");
- TEST_ExpectFalse(_().color.ParseWith( _().text.ParseString("#9aff0g"),
- resultColor));
-}
-
-protected static function SubTest_ParseStringPlain()
-{
- local Color expectedColor, resultColor;
- expectedColor = _().color.RGBA(154, 255, 0, 187);
- Issue("`ParseString()` cannot parse hex colors.");
- TEST_ExpectTrue(_().color.ParseString("#9aff00", resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString()` cannot parse rgb colors.");
- TEST_ExpectTrue(_().color.ParseString("rgb(154,255,0)", resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString()` cannot parse rgba colors.");
- TEST_ExpectTrue(_().color.ParseString("rgba(154,255,0,187)", resultColor));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseString()` cannot parse rgb colors with tags.");
- TEST_ExpectTrue(_().color.ParseString("rgb(r=154,g=255,b=0)", resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString()` cannot parse rgba colors with tags.");
- TEST_ExpectTrue(_().color.ParseString( "rgba(r=154,g=255,b=0,a=187)",
- resultColor));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseString()` reports success when parsing invalid color string.");
- TEST_ExpectFalse(_().color.ParseString("#9aff0g", resultColor));
-}
-
-protected static function SubTest_ParseStringColored()
-{
- local Color expectedColor, resultColor;
- expectedColor = _().color.RGBA(154, 255, 0, 187);
- Issue("`ParseString(STRING_Colored)` cannot parse hex colors.");
- TEST_ExpectTrue(_().color.ParseString(
- "#9af" $ Chr(27) $ Chr(45) $ Chr(234) $ Chr(24) $ "f00",
- resultColor, STRING_Colored));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString(STRING_Colored)` cannot parse rgb colors.");
- TEST_ExpectTrue(_().color.ParseString(
- "rgb(154,2" $ Chr(27) $ Chr(23) $ Chr(32) $ Chr(53) $ "55,0)",
- resultColor, STRING_Colored));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString(STRING_Colored)` cannot parse rgba colors.");
- TEST_ExpectTrue(_().color.ParseString(
- "rgba(154,255,0,187" $ Chr(27) $ Chr(133) $ Chr(234) $ Chr(10) $ ")",
- resultColor, STRING_Colored));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseString(STRING_Colored)` cannot parse rgb colors with tags.");
- TEST_ExpectTrue(_().color.ParseString(
- "rg" $ Chr(27) $ Chr(26) $ Chr(234) $ Chr(125) $ "b(r=154,g=255,b=0)",
- resultColor, STRING_Colored));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString(STRING_Colored)` cannot parse rgba colors with tags.");
- TEST_ExpectTrue(_().color.ParseString(
- "rgba(r=154,g=255,b" $ Chr(27) $ Chr(1) $ Chr(4) $ Chr(7) $ "=0,a=187)",
- resultColor, STRING_Colored));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-}
-
-protected static function SubTest_ParseStringFormatted()
-{
- local Color expectedColor, resultColor;
- expectedColor = _().color.RGBA(154, 255, 0, 187);
- Issue("`ParseString(STRING_Formatted)` cannot parse hex colors.");
- TEST_ExpectTrue(_().color.ParseString(
- "#9a{#4753d5 ff0}0",
- resultColor, STRING_Formatted));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString(STRING_Formatted)` cannot parse rgb colors.");
- TEST_ExpectTrue(_().color.ParseString(
- "rg{rgb(45,67,123) b(154,25}5,0)",
- resultColor, STRING_Formatted));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString(STRING_Formatted)` cannot parse rgba colors.");
- TEST_ExpectTrue(_().color.ParseString(
- "rgba(154,2{#34d1a7 }55,0,187)",
- resultColor, STRING_Formatted));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseString(STRING_Formatted)` cannot parse rgb colors with tags.");
- TEST_ExpectTrue(_().color.ParseString(
- "rgb(r{#34d1a7 }=154,g=255,b=0)",
- resultColor, STRING_Formatted));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseString(STRING_Formatted)` cannot parse rgba colors with"
- @ "tags.");
- TEST_ExpectTrue(_().color.ParseString(
- "r{rgb(12,12,253) gba(r=154,g=255,b=0,a=187)}",
- resultColor, STRING_Formatted));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-}
-
-protected static function SubTest_ParseText()
-{
- local Color expectedColor, resultColor;
- expectedColor = _().color.RGBA(154, 255, 0, 187);
- Issue("`ParseText()` cannot parse hex colors.");
- TEST_ExpectTrue(_().color.ParseText(_().text.FromString("#9aff00"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseText()` cannot parse rgb colors.");
- TEST_ExpectTrue(_().color.ParseText(_().text.FromString("rgb(154,255,0)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseText()` cannot parse rgba colors.");
- TEST_ExpectTrue(_().color.ParseText(
- _().text.FromString("rgba(154,255,0,187)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseText()` cannot parse rgb colors with tags.");
- TEST_ExpectTrue(_().color.ParseText(
- _().text.FromString("rgb(r=154,g=255,b=0)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseText()` cannot parse rgba colors with tags.");
- TEST_ExpectTrue(_().color.ParseText(
- _().text.FromString("rgba(r=154,g=255,b=0,a=187)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseText()` reports success when parsing invalid color string.");
- TEST_ExpectFalse(_().color.ParseText( _().text.FromString("#9aff0g"),
- resultColor));
-}
-
-protected static function SubTest_ParseRaw()
-{
- local Color expectedColor, resultColor;
- expectedColor = _().color.RGBA(154, 255, 0, 187);
- Issue("`ParseRaw()` cannot parse hex colors.");
- TEST_ExpectTrue(_().color.ParseRaw( _().text.StringToRaw("#9aff00"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseRaw()` cannot parse rgb colors.");
- TEST_ExpectTrue(_().color.ParseRaw( _().text.StringToRaw("rgb(154,255,0)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseRaw()` cannot parse rgba colors.");
- TEST_ExpectTrue(_().color.ParseRaw(
- _().text.StringToRaw("rgba(154,255,0,187)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseRaw()` cannot parse rgb colors with tags.");
- TEST_ExpectTrue(_().color.ParseRaw(
- _().text.StringToRaw("rgb(r=154,g=255,b=0)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqual(resultColor, expectedColor));
-
- Issue("`ParseRaw()` cannot parse rgba colors with tags.");
- TEST_ExpectTrue(_().color.ParseRaw(
- _().text.StringToRaw("rgba(r=154,g=255,b=0,a=187)"),
- resultColor));
- TEST_ExpectTrue(_().color.AreEqualWithAlpha(resultColor, expectedColor));
-
- Issue("`ParseRaw()` reports success when parsing invalid color string.");
- TEST_ExpectFalse(_().color.ParseRaw(_().text.StringToRaw("#9aff0g"),
- resultColor));
-}
-
-defaultproperties
-{
- caseName = "Colors"
-}
\ No newline at end of file
diff --git a/sources/Core/Console/ConsoleAPI.uc b/sources/Core/Console/ConsoleAPI.uc
deleted file mode 100644
index 5365626..0000000
--- a/sources/Core/Console/ConsoleAPI.uc
+++ /dev/null
@@ -1,280 +0,0 @@
-/**
- * API that provides functions for outputting text in
- * Killing Floor's console. It takes care of coloring output and breaking up
- * long lines (since allowing game to handle line breaking completely
- * messes up console output).
- *
- * Actual output is taken care of by `ConsoleWriter` objects that this
- * API generates.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class ConsoleAPI extends Singleton
- config(AcediaSystem);
-
-/**
- * Main issue with console output in Killing Floor is
- * automatic line breaking of long enough messages:
- * it breaks formatting and can lead to an ugly text overlapping.
- * To fix this we will try to break up user's output into lines ourselves,
- * before game does it for us.
- *
- * We are not 100% sure how Killing Floor decides when to break the line,
- * but it seems to calculate how much text can actually fit in a certain
- * area on screen.
- * There are two issues:
- * 1. We do not know for sure what this limit value is.
- * Even if we knew how to compute it, we cannot do that in server mode,
- * since it depends on a screen resolution and font, which
- * can vary for different players.
- * 2. Even invisible characters, such as color change sequences,
- * that do not take any space on the screen, contribute towards
- * that limit. So for a heavily colored text we will have to
- * break line much sooner than for the plain text.
- * Both issues are solved by introducing two limits that users themselves
- * are allowed to change: visible character limit and total character limit.
- * ~ Total character limit will be a hard limit on a character amount in
- * a line (including hidden ones used for color change sequences) that
- * will be used to prevent Killing Floor's native line breaks.
- * ~ Visible character limit will be a lower limit on amount of actually
- * visible character. It introduction basically reserves some space that can be
- * used only for color change sequences. Without this limit lines with
- * colored lines will appear to be shorter that mono-colored ones.
- * Visible limit will help to alleviate this problem.
- *
- * For example, if we set total limit to `120` and visible limit to `80`:
- * 1. Line not formatted with color will all break at
- * around length of `80`.
- * 2. Since color change sequence consists of 4 characters:
- * we can fit up to `(120 - 80) / 4 = 10` color swaps into each line,
- * while still breaking them at a around the same length of `80`.
- * ~ To differentiate our line breaks from line breaks intended by
- * the user, we will also add 2 symbols worth of padding in front of all our
- * output:
- * 1. Before intended new line they will be just two spaces.
- * 2. After our line break we will replace first space with "|" to indicate
- * that we had to break a long line.
- *
- * Described measures are not perfect:
- * 1. Since Killing Floor's console doe not use monospaced font,
- * the same amount of characters on the line does not mean lines of
- * visually the same length;
- * 2. Heavily enough colored lines are still going to be shorter;
- * 3. Depending on a resolution, default limits may appear to either use
- * too little space (for high resolutions) or, on the contrary,
- * not prevent native line breaks (low resolutions).
- * In these cases user might be required to manually set limits;
- * 4. There are probably more.
- * But if seems to provide good enough results for the average use case.
- */
-
-/**
- * Configures how text will be rendered in target console(s).
- */
-struct ConsoleDisplaySettings
-{
- // What color to use for text by default
- var Color defaultColor;
- // How many visible characters in be displayed in a line?
- var int maxVisibleLineWidth;
- // How many total characters can be output at once?
- var int maxTotalLineWidth;
-};
-// We will store data for `ConsoleDisplaySettings` separately for the ease of
-// configuration.
-var private config Color defaultColor;
-var private config int maxVisibleLineWidth;
-var private config int maxTotalLineWidth;
-
-/**
- * Return current global visible limit that describes how many (at most)
- * visible characters can be output in the console line.
- *
- * Instances of `ConsoleWriter` are initialized with this value,
- * but can later change this value independently.
- * Changes to global values do not affect already created `ConsoleWriters`.
- *
- * @return Current global visible limit.
- */
-public final function int GetVisibleLineLength()
-{
- return maxVisibleLineWidth;
-}
-
-/**
- * Sets current global visible limit that describes how many (at most) visible
- * characters can be output in the console line.
- *
- * Instances of `ConsoleWriter` are initialized with this value,
- * but can later change this value independently.
- * Changes to global values do not affect already created `ConsoleWriters`.
- *
- * @param newMaxVisibleLineWidth New global visible character limit.
- */
-public final function SetVisibleLineLength(int newMaxVisibleLineWidth)
-{
- maxVisibleLineWidth = newMaxVisibleLineWidth;
-}
-
-/**
- * Return current global total limit that describes how many (at most)
- * characters can be output in the console line.
- *
- * Instances of `ConsoleWriter` are initialized with this value,
- * but can later change this value independently.
- * Changes to global values do not affect already created `ConsoleWriters`.
- *
- * @return Current global total limit.
- */
-public final function int GetTotalLineLength()
-{
- return maxTotalLineWidth;
-}
-
-/**
- * Sets current global total limit that describes how many (at most)
- * characters can be output in the console line, counting both visible symbols
- * and color change sequences.
- *
- * Instances of `ConsoleWriter` are initialized with this value,
- * but can later change this value independently.
- * Changes to global values do not affect already created `ConsoleWriters`.
- *
- * @param newMaxTotalLineWidth New global total character limit.
- */
-public final function SetTotalLineLength(int newMaxTotalLineWidth)
-{
- maxTotalLineWidth = newMaxTotalLineWidth;
-}
-
-/**
- * Return current global total limit that describes how many (at most)
- * characters can be output in the console line.
- *
- * Instances of `ConsoleWriter` are initialized with this value,
- * but can later change this value independently.
- * Changes to global values do not affect already created `ConsoleWriters`.
- *
- * @return Current default output color.
- */
-public final function Color GetDefaultColor(int newMaxTotalLineWidth)
-{
- return defaultColor;
-}
-
-/**
- * Sets current global default color for console output.,
- *
- * Instances of `ConsoleWriter` are initialized with this value,
- * but can later change this value independently.
- * Changes to global values do not affect already created `ConsoleWriters`.
- *
- * @param newMaxTotalLineWidth New global default output color.
- */
-public final function SetDefaultColor(Color newDefaultColor)
-{
- defaultColor = newDefaultColor;
-}
-
-/**
- * Returns borrowed `ConsoleWriter` instance that will write into
- * consoles of all players.
- *
- * @return ConsoleWriter Borrowed `ConsoleWriter` instance, configured to
- * write into consoles of all players.
- * Never `none`.
- */
-public final function ConsoleWriter ForAll()
-{
- local ConsoleDisplaySettings globalSettings;
- globalSettings.defaultColor = defaultColor;
- globalSettings.maxTotalLineWidth = maxTotalLineWidth;
- globalSettings.maxVisibleLineWidth = maxVisibleLineWidth;
- return ConsoleWriter(_.memory.Claim(class'ConsoleWriter'))
- .Initialize(globalSettings).ForAll();
-}
-
-/**
- * Returns borrowed `ConsoleWriter` instance that will write into
- * console of the player with a given controller.
- *
- * @param targetController Player, to whom console we want to write.
- * If `none` - returned `ConsoleWriter` would be configured to
- * throw messages away.
- * @return Borrowed `ConsoleWriter` instance, configured to
- * write into consoles of all players.
- * Never `none`.
- */
-public final function ConsoleWriter For(PlayerController targetController)
-{
- local ConsoleDisplaySettings globalSettings;
- globalSettings.defaultColor = defaultColor;
- globalSettings.maxTotalLineWidth = maxTotalLineWidth;
- globalSettings.maxVisibleLineWidth = maxVisibleLineWidth;
- return ConsoleWriter(_.memory.Claim(class'ConsoleWriter'))
- .Initialize(globalSettings).ForController(targetController);
-}
-
-/**
- * Returns new `ConsoleWriter` instance that will write into
- * consoles of all players.
- * Should be freed after use.
- *
- * @return ConsoleWriter New `ConsoleWriter` instance, configured to
- * write into consoles of all players.
- * Never `none`.
- */
-public final function ConsoleWriter MakeForAll()
-{
- local ConsoleDisplaySettings globalSettings;
- globalSettings.defaultColor = defaultColor;
- globalSettings.maxTotalLineWidth = maxTotalLineWidth;
- globalSettings.maxVisibleLineWidth = maxVisibleLineWidth;
- return ConsoleWriter(_.memory.Allocate(class'ConsoleWriter'))
- .Initialize(globalSettings).ForAll();
-}
-
-/**
- * Returns new `ConsoleWriter` instance that will write into
- * console of the player with a given controller.
- * Should be freed after use.
- *
- * @param targetController Player, to whom console we want to write.
- * If `none` - returned `ConsoleWriter` would be configured to
- * throw messages away.
- * @return New `ConsoleWriter` instance, configured to
- * write into consoles of all players.
- * Never `none`.
- */
-public final function ConsoleWriter MakeFor(PlayerController targetController)
-{
- local ConsoleDisplaySettings globalSettings;
- globalSettings.defaultColor = defaultColor;
- globalSettings.maxTotalLineWidth = maxTotalLineWidth;
- globalSettings.maxVisibleLineWidth = maxVisibleLineWidth;
- return ConsoleWriter(_.memory.Allocate(class'ConsoleWriter'))
- .Initialize(globalSettings).ForController(targetController);
-}
-
-defaultproperties
-{
- defaultColor = (R=255,G=255,B=255,A=255)
- // These should guarantee decent text output even at
- // 640x480 shit resolution
- maxVisibleLineWidth = 80
- maxTotalLineWidth = 108
-}
\ No newline at end of file
diff --git a/sources/Core/Console/ConsoleBuffer.uc b/sources/Core/Console/ConsoleBuffer.uc
deleted file mode 100644
index a7f477a..0000000
--- a/sources/Core/Console/ConsoleBuffer.uc
+++ /dev/null
@@ -1,393 +0,0 @@
-/**
- * Object that provides a buffer functionality for Killing Floor's (in-game)
- * console output: it accepts content that user want to output and breaks it
- * into lines that will be well-rendered according to the given
- * `ConsoleDisplaySettings`.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class ConsoleBuffer extends AcediaObject
- dependson(Text)
- dependson(ConsoleAPI);
-
-/**
- * `ConsoleBuffer` works by breaking it's input into words, counting how much
- * space they take up and only then deciding to which line to append them
- * (new or the next, new one).
- */
-
-var private int CODEPOINT_ESCAPE;
-var private int CODEPOINT_NEWLINE;
-var private int COLOR_SEQUENCE_LENGTH;
-
-// Display settings according to which to format our output
-var private ConsoleAPI.ConsoleDisplaySettings displaySettings;
-
-/**
- * This structure is used to both share results of our work and for tracking
- * information about the line we are currently filling.
- */
-struct LineRecord
-{
- // Contents of the line, in `STRING_Colored` format
- var string contents;
- // Is this a wrapped line?
- // `true` means that this line was supposed to be part part of another,
- // singular line of text, that had to be broken into smaller pieces.
- // Such lines will start with "|" in front of them in Acedia's
- // `ConsoleWriter`.
- var bool wrappedLine;
- // Information variables that describe how many visible and total symbols
- // (visible + color change sequences) are stored int the `line`
- var int visibleSymbolsStored;
- var int totalSymbolsStored;
- // Does `contents` contain a color change sequence?
- // Non-empty line can have no such sequence if they consist of whitespaces.
- var private bool colorInserted;
- // If `colorInserted == true`, stores the last inserted color.
- var private Color endColor;
-};
-// Lines that are ready to be output to the console
-var private array completedLines;
-
-// Line we are currently building
-var private LineRecord currentLine;
-// Word we are currently building, colors of it's characters will be
-// automatically converted into `STRCOLOR_Struct`, according to the default
-// color setting at the time of their addition.
-var private array wordBuffer;
-// Amount of color swaps inside `wordBuffer`
-var private int colorSwapsInWordBuffer;
-
-/**
- * Returns current setting used by this buffer to break up it's input into
- * lines fit to be output in console.
- *
- * @return Currently used `ConsoleDisplaySettings`.
- */
-public final function ConsoleAPI.ConsoleDisplaySettings GetSettings()
-{
- return displaySettings;
-}
-
-/**
- * Sets new setting to be used by this buffer to break up it's input into
- * lines fit to be output in console.
- *
- * It is recommended (although not required) to call `Flush()` before
- * changing settings. Not doing so would not lead to any errors or warnings,
- * but can lead to some wonky results and is considered an undefined behavior.
- *
- * @param newSettings New `ConsoleDisplaySettings` to be used.
- * @return Returns caller `ConsoleBuffer` to allow for method chaining.
- */
-public final function ConsoleBuffer SetSettings(
- ConsoleAPI.ConsoleDisplaySettings newSettings)
-{
- displaySettings = newSettings;
- return self;
-}
-
-/**
- * Does caller `ConsoleBuffer` has any completed lines that can be output?
- *
- * "Completed line" means that nothing else will be added to it.
- * So negative (`false`) response does not mean that the buffer is empty, -
- * it can still contain an uncompleted and non-empty line that can still be
- * expanded with `InsertString()`. If you want to completely empty the buffer -
- * call the `Flush()` method.
- * Also see `IsEmpty()`.
- *
- * @return `true` if caller `ConsoleBuffer` has no completed lines and
- * `false` otherwise.
- */
-public final function bool HasCompletedLines()
-{
- return (completedLines.length > 0);
-}
-
-/**
- * Does caller `ConsoleBuffer` has any unprocessed input?
- *
- * Note that `ConsoleBuffer` can be non-empty, but no completed line if it
- * currently builds one.
- * See `Flush()` and `HasCompletedLines()` methods.
- *
- * @return `true` if `ConsoleBuffer` is completely empty
- * (either did not receive or already returned all processed input) and
- * `false` otherwise.
- */
-public final function bool IsEmpty()
-{
- if (HasCompletedLines()) return false;
- if (currentLine.totalSymbolsStored > 0) return false;
- if (wordBuffer.length > 0) return false;
- return true;
-}
-
-/**
- * Clears the buffer of all data, but leaving current settings intact.
- * After this calling method `IsEmpty()` should return `true`.
- *
- * @return Returns caller `ConsoleBuffer` to allow method chaining.
- */
-public final function ConsoleBuffer Clear()
-{
- local LineRecord newLineRecord;
- currentLine = newLineRecord;
- completedLines.length = 0;
- return self;
-}
-
-/**
- * Inserts a string into the buffer. This method does not automatically break
- * the line after the `input`, call `Flush()` or add line feed symbol "\n"
- * at the end of the `input` if you want that.
- *
- * @param input `string` to be added to the current line in caller
- * `ConsoleBuffer`.
- * @param inputType How to treat given `string` regarding coloring.
- * @return Returns caller `ConsoleBuffer` to allow method chaining.
- */
-public final function ConsoleBuffer InsertString(
- string input,
- Text.StringType inputType)
-{
- local int inputConsumed;
- local array rawInput;
- rawInput = _().text.StringToRaw(input, inputType);
- while (rawInput.length > 0)
- {
- // Fill word buffer, remove consumed input from `rawInput`
- inputConsumed = 0;
- while (inputConsumed < rawInput.length)
- {
- if (_().text.IsWhitespace(rawInput[inputConsumed])) break;
- InsertIntoWordBuffer(rawInput[inputConsumed]);
- inputConsumed += 1;
- }
- rawInput.Remove(0, inputConsumed);
- // If we didn't encounter any whitespace symbols - bail
- if (rawInput.length <= 0) {
- return self;
- }
- FlushWordBuffer();
- // Dump whitespaces into lines
- inputConsumed = 0;
- while (inputConsumed < rawInput.length)
- {
- if (!_().text.IsWhitespace(rawInput[inputConsumed])) break;
- AppendWhitespaceToCurrentLine(rawInput[inputConsumed]);
- inputConsumed += 1;
- }
- rawInput.Remove(0, inputConsumed);
- }
- return self;
-}
-
-/**
- * Returns (and makes caller `ConsoleBuffer` forget) next completed line that
- * can be output to console in `STRING_Colored` format.
- *
- * If there are no completed line to return - returns an empty one.
- *
- * @return Next completed line that can be output, in `STRING_Colored` format.
- */
-public final function LineRecord PopNextLine()
-{
- local LineRecord result;
- if (completedLines.length <= 0) return result;
- result = completedLines[0];
- completedLines.Remove(0, 1);
- return result;
-}
-
-/**
- * Forces all buffered data into "completed line" array, making it retrievable
- * by `PopNextLine()`.
- *
- * @return Next completed line that can be output, in `STRING_Colored` format.
- */
-public final function ConsoleBuffer Flush()
-{
- FlushWordBuffer();
- BreakLine(false);
- return self;
-}
-
-// It is assumed that passed characters are not whitespace, -
-// responsibility to check is on the one calling this method.
-private final function InsertIntoWordBuffer(Text.Character newCharacter)
-{
- local int newCharacterIndex;
- local Color oldColor, newColor;
- newCharacterIndex = wordBuffer.length;
- // Fix text color in the buffer to remember default color, if we use it.
- newCharacter.color =
- _().text.GetCharacterColor(newCharacter, displaySettings.defaultColor);
- newCharacter.colorType = STRCOLOR_Struct;
- wordBuffer[newCharacterIndex] = newCharacter;
- if (newCharacterIndex <= 0) {
- return;
- }
- oldColor = wordBuffer[newCharacterIndex].color;
- newColor = wordBuffer[newCharacterIndex - 1].color;
- if (!_().color.AreEqual(oldColor, newColor, true)) {
- colorSwapsInWordBuffer += 1;
- }
-}
-
-// Pushes whole `wordBuffer` into lines
-private final function FlushWordBuffer()
-{
- local int i;
- local Color newColor;
- if (!WordCanFitInCurrentLine() && WordCanFitInNewLine()) {
- BreakLine(true);
- }
- for (i = 0; i < wordBuffer.length; i += 1)
- {
- if (!CanAppendNonWhitespaceIntoLine(wordBuffer[i])) {
- BreakLine(true);
- }
- newColor = wordBuffer[i].color;
- if (MustSwapColorsFor(newColor))
- {
- currentLine.contents $= _().color.GetColorTag(newColor);
- currentLine.totalSymbolsStored += COLOR_SEQUENCE_LENGTH;
- currentLine.colorInserted = true;
- currentLine.endColor = newColor;
- }
- currentLine.contents $= Chr(wordBuffer[i].codePoint);
- currentLine.totalSymbolsStored += 1;
- currentLine.visibleSymbolsStored += 1;
- }
- wordBuffer.length = 0;
- colorSwapsInWordBuffer = 0;
-}
-
-private final function BreakLine(bool makeWrapped)
-{
- local LineRecord newLineRecord;
- if (currentLine.visibleSymbolsStored > 0) {
- completedLines[completedLines.length] = currentLine;
- }
- currentLine = newLineRecord;
- currentLine.wrappedLine = makeWrapped;
-}
-
-private final function bool MustSwapColorsFor(Color newColor)
-{
- if (!currentLine.colorInserted) return true;
- return !_().color.AreEqual(currentLine.endColor, newColor, true);
-}
-
-private final function bool CanAppendWhitespaceIntoLine()
-{
- // We always allow to append at least something into empty line,
- // otherwise we can never insert it anywhere
- if (currentLine.totalSymbolsStored <= 0) return true;
- if (currentLine.totalSymbolsStored >= displaySettings.maxTotalLineWidth)
- {
- return false;
- }
- if (currentLine.visibleSymbolsStored >= displaySettings.maxVisibleLineWidth)
- {
- return false;
- }
- return true;
-}
-
-private final function bool CanAppendNonWhitespaceIntoLine(
- Text.Character nextCharacter)
-{
- // We always allow to insert at least something into empty line,
- // otherwise we can never insert it anywhere
- if (currentLine.totalSymbolsStored <= 0) {
- return true;
- }
- // Check if we can fit a single character by fitting a whitespace symbol.
- if (!CanAppendWhitespaceIntoLine()) {
- return false;
- }
- if (!MustSwapColorsFor(nextCharacter.color)) {
- return true;
- }
- // Can we fit character + color swap sequence?
- return ( currentLine.totalSymbolsStored + COLOR_SEQUENCE_LENGTH + 1
- <= displaySettings.maxTotalLineWidth);
-}
-
-// For performance reasons assumes that passed character is a whitespace,
-// the burden of checking is on the caller.
-private final function AppendWhitespaceToCurrentLine(Text.Character whitespace)
-{
- if (_().text.IsCodePoint(whitespace, CODEPOINT_NEWLINE)) {
- BreakLine(true);
- return;
- }
- if (!CanAppendWhitespaceIntoLine()) {
- BreakLine(true);
- }
- currentLine.contents $= Chr(whitespace.codePoint);
- currentLine.totalSymbolsStored += 1;
- currentLine.visibleSymbolsStored += 1;
-}
-
-private final function bool WordCanFitInNewLine()
-{
- local int totalCharactersInWord;
- if (wordBuffer.length <= 0) return true;
- if (wordBuffer.length > displaySettings.maxVisibleLineWidth) {
- return false;
- }
- // `(colorSwapsInWordBuffer + 1)` counts how many times we must
- // switch color inside a word + 1 for setting initial color
- totalCharactersInWord = wordBuffer.length
- + (colorSwapsInWordBuffer + 1) * COLOR_SEQUENCE_LENGTH;
- return (totalCharactersInWord <= displaySettings.maxTotalLineWidth);
-}
-
-private final function bool WordCanFitInCurrentLine()
-{
- local int totalLimit, visibleLimit;
- local int totalCharactersInWord;
- if (wordBuffer.length <= 0) return true;
- totalLimit =
- displaySettings.maxTotalLineWidth - currentLine.totalSymbolsStored;
- visibleLimit =
- displaySettings.maxVisibleLineWidth - currentLine.visibleSymbolsStored;
- // Visible symbols check
- if (wordBuffer.length > visibleLimit) {
- return false;
- }
- // Total symbols check
- totalCharactersInWord = wordBuffer.length
- + colorSwapsInWordBuffer * COLOR_SEQUENCE_LENGTH;
- if (MustSwapColorsFor(wordBuffer[0].color)) {
- totalCharactersInWord += COLOR_SEQUENCE_LENGTH;
- }
- return (totalCharactersInWord <= totalLimit);
-}
-
-defaultproperties
-{
- CODEPOINT_ESCAPE = 27
- CODEPOINT_NEWLINE = 10
- // CODEPOINT_ESCAPE + + +
- COLOR_SEQUENCE_LENGTH = 4
-}
\ No newline at end of file
diff --git a/sources/Core/Console/ConsoleWriter.uc b/sources/Core/Console/ConsoleWriter.uc
deleted file mode 100644
index 7408530..0000000
--- a/sources/Core/Console/ConsoleWriter.uc
+++ /dev/null
@@ -1,373 +0,0 @@
-/**
- * Object that provides simple access to console output.
- * Can either write to a certain player's console or to all consoles at once.
- * Supports "fancy" and "raw" output (for more details @see `ConsoleAPI`).
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class ConsoleWriter extends AcediaObject
- dependson(ConsoleAPI)
- dependson(ConnectionService);
-
-// Prefixes we output before every line to signify whether they were broken
-// or not
-var private string NEWLINE_PREFIX;
-var private string BROKENLINE_PREFIX;
-
-/**
- * Describes current output target of the `ConsoleWriter`.
- */
-enum ConsoleWriterTarget
-{
- // No one. Can happed if our target disconnects.
- CWTARGET_None,
- // A certain player.
- CWTARGET_Player,
- // All players.
- CWTARGET_All
-};
-var private ConsoleWriterTarget targetType;
-// Controller of the player that will receive output passed
-// to this `ConsoleWriter`.
-// Only used when `targetType == CWTARGET_Player`
-var private PlayerController outputTarget;
-var private ConsoleBuffer outputBuffer;
-
-var private ConsoleAPI.ConsoleDisplaySettings displaySettings;
-
-public final function ConsoleWriter Initialize(
- ConsoleAPI.ConsoleDisplaySettings newDisplaySettings)
-{
- displaySettings = newDisplaySettings;
- if (outputBuffer == none) {
- outputBuffer = ConsoleBuffer(_().memory.Allocate(class'ConsoleBuffer'));
- }
- else {
- outputBuffer.Clear();
- }
- outputBuffer.SetSettings(displaySettings);
- return self;
-}
-
-/**
- * Return current default color for caller `ConsoleWriter`.
- *
- * This method returns default color, i.e. color that will be used if no other
- * is specified by text you're outputting.
- * If color is specified, this value will be ignored.
- *
- * This value is not synchronized with the global value from `ConsoleAPI`
- * (or such value from any other `ConsoleWriter`) and affects only
- * output produced by this `ConsoleWriter`.
- *
- * @return Current default color.
- */
-public final function Color GetColor()
-{
- return displaySettings.defaultColor;
-}
-
-/**
- * Sets default color for caller 'ConsoleWriter`'s output.
- *
- * This only changes default color, i.e. color that will be used if no other is
- * specified by text you're outputting.
- * If color is specified, this value will be ignored.
- *
- * This value is not synchronized with the global value from `ConsoleAPI`
- * (or such value from any other `ConsoleWriter`) and affects only
- * output produced by this `ConsoleWriter`.
- *
- * @param newDefaultColor New color to use when none specified by text itself.
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter SetColor(Color newDefaultColor)
-{
- displaySettings.defaultColor = newDefaultColor;
- if (outputBuffer != none) {
- outputBuffer.SetSettings(displaySettings);
- }
- return self;
-}
-
-/**
- * Return current visible limit that describes how many (at most)
- * visible characters can be output in the console line.
- *
- * This value is not synchronized with the global value from `ConsoleAPI`
- * (or such value from any other `ConsoleWriter`) and affects only
- * output produced by this `ConsoleWriter`.
- *
- * @return Current global visible limit.
- */
-public final function int GetVisibleLineLength()
-{
- return displaySettings.maxVisibleLineWidth;
-}
-
-/**
- * Sets current visible limit that describes how many (at most) visible
- * characters can be output in the console line.
- *
- * This value is not synchronized with the global value from `ConsoleAPI`
- * (or such value from any other `ConsoleWriter`) and affects only
- * output produced by this `ConsoleWriter`.
- *
- * @param newVisibleLimit New global visible limit.
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter SetVisibleLineLength(
- int newMaxVisibleLineWidth
-)
-{
- displaySettings.maxVisibleLineWidth = newMaxVisibleLineWidth;
- if (outputBuffer != none) {
- outputBuffer.SetSettings(displaySettings);
- }
- return self;
-}
-
-/**
- * Return current total limit that describes how many (at most)
- * characters can be output in the console line.
- *
- * This value is not synchronized with the global value from `ConsoleAPI`
- * (or such value from any other `ConsoleWriter`) and affects only
- * output produced by this `ConsoleWriter`.
- *
- * @return Current global total limit.
- */
-public final function int GetTotalLineLength()
-{
- return displaySettings.maxTotalLineWidth;
-}
-
-/**
- * Sets current total limit that describes how many (at most)
- * characters can be output in the console line.
- *
- * This value is not synchronized with the global value from `ConsoleAPI`
- * (or such value from any other `ConsoleWriter`) and affects only
- * output produced by this `ConsoleWriter`.
- *
- * @param newTotalLimit New global total limit.
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter SetTotalLineLength(int newMaxTotalLineWidth)
-{
- displaySettings.maxTotalLineWidth = newMaxTotalLineWidth;
- if (outputBuffer != none) {
- outputBuffer.SetSettings(displaySettings);
- }
- return self;
-}
-
-/**
- * Configures caller `ConsoleWriter` to output to all players.
- * `Flush()` will be automatically called between target change.
- *
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter ForAll()
-{
- Flush();
- targetType = CWTARGET_All;
- return self;
-}
-
-/**
- * Configures caller `ConsoleWriter` to output only to a player,
- * given by a passed `PlayerController`.
- * `Flush()` will be automatically called between target change.
- *
- * @param targetController Player, to whom console we want to write.
- * If `none` - caller `ConsoleWriter` would be configured to
- * throw messages away.
- * @return ConsoleWriter Returns caller `ConsoleWriter` to allow for
- * method chaining.
- */
-public final function ConsoleWriter ForController(
- PlayerController targetController
-)
-{
- Flush();
- if (targetController != none)
- {
- targetType = CWTARGET_Player;
- outputTarget = targetController;
- }
- else {
- targetType = CWTARGET_None;
- }
- return self;
-}
-
-/**
- * Returns type of current target for the caller `ConsoleWriter`.
- *
- * @return `ConsoleWriterTarget` value, describing current target of
- * the caller `ConsoleWriter`.
- */
-public final function ConsoleWriterTarget CurrentTarget()
-{
- if (targetType == CWTARGET_Player && outputTarget == none) {
- targetType = CWTARGET_None;
- }
- return targetType;
-}
-
-/**
- * Returns `PlayerController` of the player to whom console caller
- * `ConsoleWriter` is outputting messages.
- *
- * @return `PlayerController` of the player to whom console caller
- * `ConsoleWriter` is outputting messages.
- * Returns `none` iff it currently outputs to every player or to no one.
- */
-public final function PlayerController GetTargetPlayerController()
-{
- if (targetType == CWTARGET_All) return none;
- return outputTarget;
-}
-
-/**
- * Outputs all buffered input and moves further output onto a new line.
- *
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter Flush()
-{
- outputBuffer.Flush();
- SendBuffer();
- return self;
-}
-
-/**
- * Writes a formatted string into console.
- *
- * Does not trigger console output, for that use `WriteLine()` or `Flush()`.
- *
- * To output a different type of string into a console, use `WriteT()`.
- *
- * @param message Formatted string to output.
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter Write(string message)
-{
- outputBuffer.InsertString(message, STRING_Formatted);
- return self;
-}
-
-/**
- * Writes a formatted string into console.
- * Result will be output immediately, starts a new line.
- *
- * To output a different type of string into a console, use `WriteLineT()`.
- *
- * @param message Formatted string to output.
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter WriteLine(string message)
-{
- outputBuffer.InsertString(message, STRING_Formatted);
- Flush();
- return self;
-}
-
-/**
- * Writes a `string` of specified type into console.
- *
- * Does not trigger console output, for that use `WriteLineT()` or `Flush()`.
- *
- * To output a formatted string you might want to simply use `Write()`.
- *
- * @param message String of a given type to output.
- * @param inputType Type of the string method should output.
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter WriteT(
- string message,
- Text.StringType inputType)
-{
- outputBuffer.InsertString(message, inputType);
- return self;
-}
-
-/**
- * Writes a `string` of specified type into console.
- * Result will be output immediately, starts a new line.
- *
- * To output a formatted string you might want to simply use `WriteLine()`.
- *
- * @param message String of a given type to output.
- * @param inputType Type of the string method should output.
- * @return Returns caller `ConsoleWriter` to allow for method chaining.
- */
-public final function ConsoleWriter WriteLineT(
- string message,
- Text.StringType inputType)
-{
- outputBuffer.InsertString(message, inputType);
- Flush();
- return self;
-}
-
-// Send all completed lines from an `outputBuffer`
-private final function SendBuffer()
-{
- local string prefix;
- local ConnectionService service;
- local ConsoleBuffer.LineRecord nextLineRecord;
- while (outputBuffer.HasCompletedLines())
- {
- nextLineRecord = outputBuffer.PopNextLine();
- if (nextLineRecord.wrappedLine) {
- prefix = NEWLINE_PREFIX;
- }
- else {
- prefix = BROKENLINE_PREFIX;
- }
- service = ConnectionService(class'ConnectionService'.static.Require());
- SendConsoleMessage(service, prefix $ nextLineRecord.contents);
- }
-}
-
-// Assumes `service != none`, caller function must ensure that.
-private final function SendConsoleMessage(
- ConnectionService service,
- string message)
-{
- local int i;
- local array connections;
- if (targetType != CWTARGET_All)
- {
- if (outputTarget != none) {
- outputTarget.ClientMessage(message);
- }
- return;
- }
- connections = service.GetActiveConnections();
- for (i = 0; i < connections.length; i += 1) {
- connections[i].controllerReference.ClientMessage(message);
- }
-}
-
-defaultproperties
-{
- NEWLINE_PREFIX = "| "
- BROKENLINE_PREFIX = " "
-}
\ No newline at end of file
diff --git a/sources/Core/Data/JSON/JArray.uc b/sources/Core/Data/JSON/JArray.uc
deleted file mode 100644
index d160b54..0000000
--- a/sources/Core/Data/JSON/JArray.uc
+++ /dev/null
@@ -1,351 +0,0 @@
-/**
- * This class implements JSON array storage capabilities.
- * Array stores ordered JSON values that can be referred by their index.
- * It can contain any mix of JSON value types and cannot have any gaps,
- * i.e. in array of length N, there must be a valid value for all indices
- * from 0 to N-1.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class JArray extends JSON;
-
-// Data will simply be stored as an array of JSON values
-var private array data;
-
-// Return type of value stored at a given index.
-// Returns `JSON_Undefined` if and only if given index is out of bounds.
-public final function JType GetTypeOf(int index)
-{
- if (index < 0) return JSON_Undefined;
- if (index >= data.length) return JSON_Undefined;
-
- return data[index].type;
-}
-
-// Returns current length of this array.
-public final function int GetLength()
-{
- return data.length;
-}
-
-// Changes length of this array.
-// In case of the increase - fills new indices with `null` values.
-public final function SetLength(int newLength)
-{
- local int i;
- local int oldLength;
- oldLength = data.length;
- data.length = newLength;
- if (oldLength >= newLength)
- {
- return;
- }
- i = oldLength;
- while (i < newLength)
- {
- SetNull(i);
- i += 1;
- }
-}
-
-// Following functions are getters for various types of variables.
-// Getter for null value simply checks if it's null
-// and returns true/false as a result.
-// Getters for simple types (number, string, boolean) can have optional
-// default value specified, that will be returned if requested variable
-// doesn't exist or has a different type.
-// Getters for object and array types don't take default values and
-// will simply return `none`.
-public final function float GetNumber(int index, optional float defaultValue)
-{
- if (index < 0) return defaultValue;
- if (index >= data.length) return defaultValue;
- if (data[index].type != JSON_Number) return defaultValue;
-
- return data[index].numberValue;
-}
-
-public final function string GetString(int index, optional string defaultValue)
-{
- if (index < 0) return defaultValue;
- if (index >= data.length) return defaultValue;
- if (data[index].type != JSON_String) return defaultValue;
-
- return data[index].stringValue;
-}
-
-public final function bool GetBoolean(int index, optional bool defaultValue)
-{
- if (index < 0) return defaultValue;
- if (index >= data.length) return defaultValue;
- if (data[index].type != JSON_Boolean) return defaultValue;
-
- return data[index].booleanValue;
-}
-
-public final function bool IsNull(int index)
-{
- if (index < 0) return false;
- if (index >= data.length) return false;
-
- return (data[index].type == JSON_Null);
-}
-
-public final function JArray GetArray(int index)
-{
- if (index < 0) return none;
- if (index >= data.length) return none;
- if (data[index].type != JSON_Array) return none;
-
- return JArray(data[index].complexValue);
-}
-
-public final function JObject GetObject(int index)
-{
- if (index < 0) return none;
- if (index >= data.length) return none;
- if (data[index].type != JSON_Object) return none;
-
- return JObject(data[index].complexValue);
-}
-
-// Following functions provide simple setters for boolean, string, number
-// and null values.
-// If passed index is negative - does nothing.
-// If index lies beyond array length (`>= GetLength()`), -
-// these functions will expand array in the same way as `GetLength()` function.
-// This can be prevented by setting optional parameter `preventExpansion` to
-// `false` (nothing will be done in this case).
-// They return object itself, allowing user to chain calls like this:
-// `array.SetNumber("num1", 1).SetNumber("num2", 2);`.
-public final function JArray SetNumber
-(
- int index,
- float value,
- optional bool preventExpansion
-)
-{
- local JStorageAtom newStorageValue;
- if (index < 0) return self;
-
- if (index >= data.length)
- {
- if (preventExpansion)
- {
- return self;
- }
- else
- {
- SetLength(index + 1);
- }
- }
- newStorageValue.type = JSON_Number;
- newStorageValue.numberValue = value;
- data[index] = newStorageValue;
- return self;
-}
-
-public final function JArray SetString
-(
- int index,
- string value,
- optional bool preventExpansion
-)
-{
- local JStorageAtom newStorageValue;
- if (index < 0) return self;
-
- if (index >= data.length)
- {
- if (preventExpansion)
- {
- return self;
- }
- else
- {
- SetLength(index + 1);
- }
- }
- newStorageValue.type = JSON_String;
- newStorageValue.stringValue = value;
- data[index] = newStorageValue;
- return self;
-}
-
-public final function JArray SetBoolean
-(
- int index,
- bool value,
- optional bool preventExpansion
-)
-{
- local JStorageAtom newStorageValue;
- if (index < 0) return self;
-
- if (index >= data.length)
- {
- if (preventExpansion)
- {
- return self;
- }
- else
- {
- SetLength(index + 1);
- }
- }
- newStorageValue.type = JSON_Boolean;
- newStorageValue.booleanValue = value;
- data[index] = newStorageValue;
- return self;
-}
-
-public final function JArray SetNull
-(
- int index,
- optional bool preventExpansion
-)
-{
- local JStorageAtom newStorageValue;
- if (index < 0) return self;
-
- if (index >= data.length)
- {
- if (preventExpansion)
- {
- return self;
- }
- else
- {
- SetLength(index + 1);
- }
- }
- newStorageValue.type = JSON_Null;
- data[index] = newStorageValue;
- return self;
-}
-
-// JSON array and object types don't have setters, but instead have
-// functions to create a new, empty array/object under a certain name.
-// If passed index is negative - does nothing.
-// If index lies beyond array length (`>= GetLength()`), -
-// these functions will expand array in the same way as `GetLength()` function.
-// This can be prevented by setting optional parameter `preventExpansion` to
-// `false` (nothing will be done in this case).
-// They return object itself, allowing user to chain calls like this:
-// `array.CreateObject("sub object").CreateArray("sub array");`.
-public final function JArray CreateArray
-(
- int index,
- optional bool preventExpansion
-)
-{
- local JStorageAtom newStorageValue;
- if (index < 0) return self;
-
- if (index >= data.length)
- {
- if (preventExpansion)
- {
- return self;
- }
- else
- {
- SetLength(index + 1);
- }
- }
- newStorageValue.type = JSON_Array;
- newStorageValue.complexValue = _.json.newArray();
- data[index] = newStorageValue;
- return self;
-}
-
-public final function JArray CreateObject
-(
- int index,
- optional bool preventExpansion
-)
-{
- local JStorageAtom newStorageValue;
- if (index < 0) return self;
-
- if (index >= data.length)
- {
- if (preventExpansion)
- {
- return self;
- }
- else
- {
- SetLength(index + 1);
- }
- }
- newStorageValue.type = JSON_Object;
- newStorageValue.complexValue = _.json.newObject();
- data[index] = newStorageValue;
- return self;
-}
-
-// Wrappers for setter functions that don't take index or
-// `preventExpansion` parameters and add/create value at the end of the array.
-public final function JArray AddNumber(float value)
-{
- return SetNumber(data.length, value);
-}
-
-public final function JArray AddString(string value)
-{
- return SetString(data.length, value);
-}
-
-public final function JArray AddBoolean(bool value)
-{
- return SetBoolean(data.length, value);
-}
-
-public final function JArray AddNull()
-{
- return SetNull(data.length);
-}
-
-public final function JArray AddArray()
-{
- return CreateArray(data.length);
-}
-
-public final function JArray AddObject()
-{
- return CreateObject(data.length);
-}
-
-// Removes up to `amount` (minimum of `1`) of values, starting from
-// a given index.
-// If `index` falls outside array boundaries - nothing will be done.
-// Returns `true` if value was actually removed and `false` if it didn't exist.
-public final function bool RemoveValue(int index, optional int amount)
-{
- if (index < 0) return false;
- if (index >= data.length) return false;
-
- amount = Max(amount, 1);
- amount = Min(amount, data.length - index);
- data.Remove(index, amount);
- return true;
-}
-
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/Data/JSON/JObject.uc b/sources/Core/Data/JSON/JObject.uc
deleted file mode 100644
index 9d81cf8..0000000
--- a/sources/Core/Data/JSON/JObject.uc
+++ /dev/null
@@ -1,265 +0,0 @@
-/**
- * This class implements JSON object storage capabilities.
- * Whenever one wants to store JSON data, they need to define such object.
- * It stores name-value pairs, where names are strings and values can be:
- * ~ Boolean, string, null or number (float in this implementation) data;
- * ~ Other JSON objects;
- * ~ JSON Arrays (see `JArray` class).
- *
- * This implementation provides getters and setters for boolean, string,
- * null or number types that allow to freely set and fetch their values
- * by name.
- * JSON objects and arrays can be fetched by getters, but you cannot
- * add existing object or array to another object. Instead one has to create
- * a new, empty object with a certain name and then fill it with data.
- * This allows to avoid loop situations, where object is contained in itself.
- * Functions to remove existing values are also provided and are applicable
- * to all variable types.
- * Setters can also be used to overwrite any value by a different value,
- * even of a different type.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class JObject extends JSON;
-
-// We will store all our properties as a simple array of name-value pairs.
-struct JProperty
-{
- var string name;
- var JStorageAtom value;
-};
-var private array properties;
-
-// Returns index of name-value pair in `properties` for a given name.
-// Returns `-1` if such a pair does not exist.
-private final function int GetPropertyIndex(string name)
-{
- local int i;
- for (i = 0; i < properties.length; i += 1)
- {
- if (name == properties[i].name)
- {
- return i;
- }
- }
- return -1;
-}
-
-// Returns `JType` of a variable with a given name in our properties.
-// This function can be used to check if certain variable exists
-// in this object, since if such variable does not exist -
-// function will return `JSON_Undefined`.
-public final function JType GetTypeOf(string name)
-{
- local int index;
- index = GetPropertyIndex(name);
- if (index < 0) return JSON_Undefined;
-
- return properties[index].value.type;
-}
-
-// Following functions are getters for various types of variables.
-// Getter for null value simply checks if it's null
-// and returns true/false as a result.
-// Getters for simple types (number, string, boolean) can have optional
-// default value specified, that will be returned if requested variable
-// doesn't exist or has a different type.
-// Getters for object and array types don't take default values and
-// will simply return `none`.
-public final function float GetNumber(string name, optional float defaultValue)
-{
- local int index;
- index = GetPropertyIndex(name);
- if (index < 0) return defaultValue;
- if (properties[index].value.type != JSON_Number) return defaultValue;
-
- return properties[index].value.numberValue;
-}
-
-public final function string GetString
-(
- string name,
- optional string defaultValue
-)
-{
- local int index;
- index = GetPropertyIndex(name);
- if (index < 0) return defaultValue;
- if (properties[index].value.type != JSON_String) return defaultValue;
-
- return properties[index].value.stringValue;
-}
-
-public final function bool GetBoolean(string name, optional bool defaultValue)
-{
- local int index;
- index = GetPropertyIndex(name);
- if (index < 0) return defaultValue;
- if (properties[index].value.type != JSON_Boolean) return defaultValue;
-
- return properties[index].value.booleanValue;
-}
-
-public final function bool IsNull(string name)
-{
- local int index;
- index = GetPropertyIndex(name);
- if (index < 0) return false;
- if (properties[index].value.type != JSON_Null) return false;
-
- return (properties[index].value.type == JSON_Null);
-}
-
-public final function JArray GetArray(string name)
-{
- local int index;
- index = GetPropertyIndex(name);
- if (index < 0) return none;
- if (properties[index].value.type != JSON_Array) return none;
-
- return JArray(properties[index].value.complexValue);
-}
-
-public final function JObject GetObject(string name)
-{
- local int index;
- index = GetPropertyIndex(name);
- if (index < 0) return none;
- if (properties[index].value.type != JSON_Object) return none;
-
- return JObject(properties[index].value.complexValue);
-}
-
-// Following functions provide simple setters for boolean, string, number
-// and null values.
-// They return object itself, allowing user to chain calls like this:
-// `object.SetNumber("num1", 1).SetNumber("num2", 2);`.
-public final function JObject SetNumber(string name, float value)
-{
- local int index;
- local JProperty newProperty;
- index = GetPropertyIndex(name);
- if (index < 0)
- {
- index = properties.length;
- }
-
- newProperty.name = name;
- newProperty.value.type = JSON_Number;
- newProperty.value.numberValue = value;
- properties[index] = newProperty;
- return self;
-}
-
-public final function JObject SetString(string name, string value)
-{
- local int index;
- local JProperty newProperty;
- index = GetPropertyIndex(name);
- if (index < 0)
- {
- index = properties.length;
- }
- newProperty.name = name;
- newProperty.value.type = JSON_String;
- newProperty.value.stringValue = value;
- properties[index] = newProperty;
- return self;
-}
-
-public final function JObject SetBoolean(string name, bool value)
-{
- local int index;
- local JProperty newProperty;
- index = GetPropertyIndex(name);
- if (index < 0)
- {
- index = properties.length;
- }
- newProperty.name = name;
- newProperty.value.type = JSON_Boolean;
- newProperty.value.booleanValue = value;
- properties[index] = newProperty;
- return self;
-}
-
-public final function JObject SetNull(string name)
-{
- local int index;
- local JProperty newProperty;
- index = GetPropertyIndex(name);
- if (index < 0)
- {
- index = properties.length;
- }
- newProperty.name = name;
- newProperty.value.type = JSON_Null;
- properties[index] = newProperty;
- return self;
-}
-
-// JSON array and object types don't have setters, but instead have
-// functions to create a new, empty array/object under a certain name.
-// They return object itself, allowing user to chain calls like this:
-// `object.CreateObject("folded object").CreateArray("names list");`.
-public final function JObject CreateArray(string name)
-{
- local int index;
- local JProperty newProperty;
- index = GetPropertyIndex(name);
- if (index < 0)
- {
- index = properties.length;
- }
- newProperty.name = name;
- newProperty.value.type = JSON_Array;
- newProperty.value.complexValue = _.json.newArray();
- properties[index] = newProperty;
- return self;
-}
-
-public final function JObject CreateObject(string name)
-{
- local int index;
- local JProperty newProperty;
- index = GetPropertyIndex(name);
- if (index < 0)
- {
- index = properties.length;
- }
- newProperty.name = name;
- newProperty.value.type = JSON_Object;
- newProperty.value.complexValue = _.json.newObject();
- properties[index] = newProperty;
- return self;
-}
-
-// Removes values with a given name.
-// Returns `true` if value was actually removed and `false` if it didn't exist.
-public final function bool RemoveValue(string name)
-{
- local int index;
- index = GetPropertyIndex(name);
- if (index < 0) return false;
-
- properties.Remove(index, 1);
- return true;
-}
-
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/Data/JSON/JSON.uc b/sources/Core/Data/JSON/JSON.uc
deleted file mode 100644
index 8a94157..0000000
--- a/sources/Core/Data/JSON/JSON.uc
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * JSON is an open standard file format, and data interchange format,
- * that uses human-readable text to store and transmit data objects
- * consisting of name–value pairs and array data types.
- * For more information refer to https://en.wikipedia.org/wiki/JSON
- * This is a base class for implementation of JSON data storage for Acedia.
- * It does not implement parsing and printing from/into human-readable
- * text representation, just provides means to store such information.
- *
- * JSON data is stored as an object (represented via `JSONObject`) that
- * contains a set of name-value pairs, where value can be
- * a number, string, boolean value, another object or
- * an array (represented by `JSONArray`).
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class JSON extends AcediaActor
- abstract;
-
-// Enumeration for possible types of JSON values.
-enum JType
-{
- // Technical type, used to indicate that requested value is missing.
- // Undefined values are not part of JSON format.
- JSON_Undefined,
- // An empty value, in teste representation defined by a single word "null".
- JSON_Null,
- // A number, recorded as a float.
- // JSON itself doesn't specify whether number is an integer or float.
- JSON_Number,
- // A string.
- JSON_String,
- // A bool value.
- JSON_Boolean,
- // Array of other JSON values, stored without names;
- // Single array can contain any mix of value types.
- JSON_Array,
- // Another JSON object, i.e. associative array of name-value pairs
- JSON_Object
-};
-
-// Stores a single JSON value
-struct JStorageAtom
-{
- // What type is stored exactly?
- // Depending on that, uses one of the other fields as a storage.
- var protected JType type;
- var protected float numberValue;
- var protected string stringValue;
- var protected bool booleanValue;
- // Used for storing both JSON objects and arrays.
- var protected JSON complexValue;
-};
-
-// TODO: Rewrite JSON object to use more efficient storage data structures
-// that will support subtypes:
-// ~ Number: byte, int, float
-// ~ String: string, class
-// (maybe move to auto generated code?).
-// TODO: Add cleanup queue to efficiently and without crashes clean up
-// removed objects.
-// TODO: Add `JValue` - a reference type for number / string / boolean / null
-// TODO: Add accessors for last values.
-// TODO: Add path-getters.
-// TODO: Add iterators.
-// TODO: Add parsing/printing.
-// TODO: Add functions for deep copy.
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/Data/JSON/JSONAPI.uc b/sources/Core/Data/JSON/JSONAPI.uc
deleted file mode 100644
index 8e88fa6..0000000
--- a/sources/Core/Data/JSON/JSONAPI.uc
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Provides convenient access to JSON-related functions.
- * Copyright 2019 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class JSONAPI extends Singleton;
-
-public function JObject newObject()
-{
- local JObject newObject;
- newObject = Spawn(class'JObject');
- return newObject;
-}
-
-public function JArray newArray()
-{
- local JArray newArray;
- newArray = Spawn(class'JArray');
- return newArray;
-}
-
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/Data/JSON/Tests/TEST_JSON.uc b/sources/Core/Data/JSON/Tests/TEST_JSON.uc
deleted file mode 100644
index f9801c4..0000000
--- a/sources/Core/Data/JSON/Tests/TEST_JSON.uc
+++ /dev/null
@@ -1,711 +0,0 @@
-/**
- * Set of tests for JSON data storage, implemented via
- * `JObject` and `JArray`.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class TEST_JSON extends TestCase
- abstract;
-
-protected static function TESTS()
-{
- local JObject jsonData;
- jsonData = _().json.newObject();
- Test_ObjectGetSetRemove();
- Test_ArrayGetSetRemove();
-}
-
-protected static function Test_ObjectGetSetRemove()
-{
- SubTest_Undefined();
- SubTest_StringGetSetRemove();
- SubTest_BooleanGetSetRemove();
- SubTest_NumberGetSetRemove();
- SubTest_NullGetSetRemove();
- SubTest_MultipleVariablesGetSet();
- SubTest_Object();
-}
-
-protected static function Test_ArrayGetSetRemove()
-{
- Context("Testing get/set/remove functions for JSON arrays");
- SubTest_ArrayUndefined();
- SubTest_ArrayStringGetSetRemove();
- SubTest_ArrayBooleanGetSetRemove();
- SubTest_ArrayNumberGetSetRemove();
- SubTest_ArrayNullGetSetRemove();
- SubTest_ArrayMultipleVariablesStorage();
- SubTest_ArrayMultipleVariablesRemoval();
- SubTest_ArrayRemovingMultipleVariablesAtOnce();
- SubTest_ArrayExpansions();
-}
-
-protected static function SubTest_Undefined()
-{
- local JObject testJSON;
- testJSON = _().json.newObject();
-
- Context("Testing how `JObject` handles undefined values");
- Issue("Undefined variable doesn't have proper type.");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_var") == JSON_Undefined);
-
- Issue("There is a variable in an empty object after `GetTypeOf` call.");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_var") == JSON_Undefined);
-
- Issue("Getters don't return default values for undefined variables.");
- TEST_ExpectTrue(testJSON.GetNumber("some_var", 0) == 0);
- TEST_ExpectTrue(testJSON.GetString("some_var", "") == "");
- TEST_ExpectTrue(testJSON.GetBoolean("some_var", false) == false);
- TEST_ExpectNone(testJSON.GetObject("some_var"));
- TEST_ExpectNone(testJSON.GetArray("some_var"));
-}
-
-protected static function SubTest_BooleanGetSetRemove()
-{
- local JObject testJSON;
- testJSON = _().json.newObject();
- testJSON.SetBoolean("some_boolean", true);
-
- Context("Testing `JObject`'s get/set/remove functions for" @
- "boolean variables");
- Issue("Boolean type isn't properly set by `SetBoolean`");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_boolean") == JSON_Boolean);
-
- Issue("Variable value is incorrectly assigned by `SetBoolean`");
- TEST_ExpectTrue(testJSON.GetBoolean("some_boolean") == true);
-
- Issue("Variable value isn't correctly reassigned by `SetBoolean`");
- testJSON.SetBoolean("some_boolean", false);
- TEST_ExpectTrue(testJSON.GetBoolean("some_boolean") == false);
-
- Issue( "Getting boolean variable as a wrong type" @
- "doesn't yield default value");
- TEST_ExpectTrue(testJSON.GetNumber("some_boolean", 7) == 7);
-
- Issue("Boolean variable isn't being properly removed");
- testJSON.RemoveValue("some_boolean");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_boolean") == JSON_Undefined);
-
- Issue( "Getters don't return default value for missing key that" @
- "previously stored boolean value, that got removed");
- TEST_ExpectTrue(testJSON.GetBoolean("some_boolean", true) == true);
-}
-
-protected static function SubTest_StringGetSetRemove()
-{
- local JObject testJSON;
- testJSON = _().json.newObject();
- testJSON.SetString("some_string", "first string");
-
- Context("Testing `JObject`'s get/set/remove functions for" @
- "string variables");
- Issue("String type isn't properly set by `SetString`");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_string") == JSON_String);
-
- Issue("Value is incorrectly assigned by `SetString`");
- TEST_ExpectTrue(testJSON.GetString("some_string") == "first string");
-
- Issue( "Providing default variable value makes 'GetString'" @
- "return wrong value");
- TEST_ExpectTrue( testJSON.GetString("some_string", "alternative")
- == "first string");
-
- Issue("Variable value isn't correctly reassigned by `SetString`");
- testJSON.SetString("some_string", "new string!~");
- TEST_ExpectTrue(testJSON.GetString("some_string") == "new string!~");
-
- Issue( "Getting string variable as a wrong type" @
- "doesn't yield default value");
- TEST_ExpectTrue(testJSON.GetBoolean("some_string", true) == true);
-
- Issue("String variable isn't being properly removed");
- testJSON.RemoveValue("some_string");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_string") == JSON_Undefined);
-
- Issue( "Getters don't return default value for missing key that" @
- "previously stored string value, but got removed");
- TEST_ExpectTrue(testJSON.GetString("some_string", "other") == "other");
-}
-
-protected static function SubTest_NumberGetSetRemove()
-{
- local JObject testJSON;
- testJSON = _().json.newObject();
- testJSON.SetNumber("some_number", 3.5);
-
- Context("Testing `JObject`'s get/set/remove functions for" @
- "number variables");
- Issue("Number type isn't properly set by `SetNumber`");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_number") == JSON_Number);
-
- Issue("Value is incorrectly assigned by `SetNumber`");
- TEST_ExpectTrue(testJSON.GetNumber("some_number") == 3.5);
-
- Issue( "Providing default variable value makes 'GetNumber'" @
- "return wrong value");
- TEST_ExpectTrue(testJSON.GetNumber("some_number", 5) == 3.5);
-
- Issue("Variable value isn't correctly reassigned by `SetNumber`");
- testJSON.SetNumber("some_number", 7);
- TEST_ExpectTrue(testJSON.GetNumber("some_number") == 7);
-
- Issue( "Getting number variable as a wrong type" @
- "doesn't yield default value.");
- TEST_ExpectTrue(testJSON.GetString("some_number", "default") == "default");
-
- Issue("Number type isn't being properly removed");
- testJSON.RemoveValue("some_number");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_number") == JSON_Undefined);
-
- Issue( "Getters don't return default value for missing key that" @
- "previously stored number value, that got removed");
- TEST_ExpectTrue(testJSON.GetNumber("some_number", 13) == 13);
-}
-
-protected static function SubTest_NullGetSetRemove()
-{
- local JObject testJSON;
- testJSON = _().json.newObject();
-
- Context("Testing `JObject`'s get/set/remove functions for" @
- "null values");
- Issue("Undefined variable is incorrectly considered `null`");
- TEST_ExpectFalse(testJSON.IsNull("some_var"));
-
- Issue("Number variable is incorrectly considered `null`");
- testJSON.SetNumber("some_var", 4);
- TEST_ExpectFalse(testJSON.IsNull("some_var"));
-
- Issue("Boolean variable is incorrectly considered `null`");
- testJSON.SetBoolean("some_var", true);
- TEST_ExpectFalse(testJSON.IsNull("some_var"));
-
- Issue("String variable is incorrectly considered `null`");
- testJSON.SetString("some_var", "string");
- TEST_ExpectFalse(testJSON.IsNull("some_var"));
-
- Issue("Null value is incorrectly assigned");
- testJSON.SetNull("some_var");
- TEST_ExpectTrue(testJSON.IsNull("some_var"));
-
- Issue("Null type isn't properly set by `SetNumber`");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_var") == JSON_Null);
-
- Issue("Null value isn't being properly removed.");
- testJSON.RemoveValue("some_var");
- TEST_ExpectTrue(testJSON.GetTypeOf("some_var") == JSON_Undefined);
-}
-
-protected static function SubTest_MultipleVariablesGetSet()
-{
- local int i;
- local bool correctValue, allValuesCorrect;
- local JObject testJSON;
- testJSON = _().json.newObject();
- Context("Testing how `JObject` handles addition, change and removal" @
- "of relatively large (hundreds) number of variables");
- for (i = 0; i < 2000; i += 1)
- {
- testJSON.SetNumber("num" $ string(i), 4 * i*i - 2.6 * i + 0.75);
- }
- for (i = 0; i < 500; i += 1)
- {
- testJSON.SetString("num" $ string(i), "str" $ string(Sin(i)));
- }
- for (i = 1500; i < 2000; i += 1)
- {
- testJSON.RemoveValue("num" $ string(i));
- }
- allValuesCorrect = true;
- for (i = 0; i < 200; i += 1)
- {
- if (i < 500)
- {
- correctValue = ( testJSON.GetString("num" $ string(i))
- == ("str" $ string(Sin(i))) );
- Issue("Variables are incorrectly overwritten");
- }
- else if(i < 1500)
- {
- correctValue = ( testJSON.GetNumber("num" $ string(i))
- == 4 * i*i - 2.6 * i + 0.75);
- Issue("Variables are lost");
- }
- else
- {
- correctValue = ( testJSON.GetTypeOf("num" $ string(i))
- == JSON_Undefined);
- Issue("Variables aren't removed");
- }
- if (!correctValue)
- {
- allValuesCorrect = false;
- break;
- }
- }
- TEST_ExpectTrue(allValuesCorrect);
-}
-
-protected static function SubTest_Object()
-{
- local JObject testObject;
- Context("Testing setters and getters for folded objects");
- testObject = _().json.newObject();
- testObject.CreateObject("folded");
- testObject.GetObject("folded").CreateObject("folded");
- testObject.SetString("out", "string outside");
- testObject.GetObject("folded").SetNumber("mid", 8);
- testObject.GetObject("folded")
- .GetObject("folded")
- .SetString("in", "string inside");
-
- Issue("Addressing variables in root object doesn't work");
- TEST_ExpectTrue(testObject.GetString("out", "default") == "string outside");
-
- Issue("Addressing variables in folded object doesn't work");
- TEST_ExpectTrue(testObject.GetObject("folded").GetNumber("mid", 1) == 8);
-
- Issue("Addressing plain variables in folded (twice) object doesn't work");
- TEST_ExpectTrue(testObject.GetObject("folded").GetObject("folded")
- .GetString("in", "default") == "string inside");
-}
-
-protected static function SubTest_ArrayUndefined()
-{
- local JArray testJSON;
- testJSON = _().json.newArray();
- Context("Testing how `JArray` handles undefined values");
- Issue("Undefined variable doesn't have `JSON_Undefined` type");
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_Undefined);
-
- Issue("There is a variable in an empty object after `GetTypeOf` call");
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_Undefined);
-
- Issue("Negative index refers to a defined value");
- TEST_ExpectTrue(testJSON.GetTypeOf(-1) == JSON_Undefined);
-
- Issue("Getters don't return default values for undefined variables");
- TEST_ExpectTrue(testJSON.GetNumber(0, 0) == 0);
- TEST_ExpectTrue(testJSON.GetString(0, "") == "");
- TEST_ExpectTrue(testJSON.GetBoolean(0, false) == false);
- TEST_ExpectNone(testJSON.GetObject(0));
- TEST_ExpectNone(testJSON.GetArray(0));
-
- Issue( "Getters don't return user-defined default values for" @
- "undefined variables");
- TEST_ExpectTrue(testJSON.GetNumber(0, 10) == 10);
- TEST_ExpectTrue(testJSON.GetString(0, "test") == "test");
- TEST_ExpectTrue(testJSON.GetBoolean(0, true) == true);
-}
-
-protected static function SubTest_ArrayBooleanGetSetRemove()
-{
- local JArray testJSON;
- testJSON = _().json.newArray();
- testJSON.SetBoolean(0, true);
-
- Context("Testing `JArray`'s get/set/remove functions for" @
- "boolean variables");
- Issue("Boolean type isn't properly set by `SetBoolean`");
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_Boolean);
-
- Issue("Value is incorrectly assigned by `SetBoolean`");
- TEST_ExpectTrue(testJSON.GetBoolean(0) == true);
- testJSON.SetBoolean(0, false);
-
- Issue("Variable value isn't correctly reassigned by `SetBoolean`");
- TEST_ExpectTrue(testJSON.GetBoolean(0) == false);
-
- Issue( "Getting boolean variable as a wrong type" @
- "doesn't yield default value");
- TEST_ExpectTrue(testJSON.GetNumber(0, 7) == 7);
-
- Issue("Boolean variable isn't being properly removed");
- testJSON.RemoveValue(0);
- TEST_ExpectTrue( testJSON.GetTypeOf(0) == JSON_Undefined);
-
- Issue( "Getters don't return default value for missing key that" @
- "previously stored boolean value, but got removed");
- TEST_ExpectTrue(testJSON.GetBoolean(0, true) == true);
-}
-
-protected static function SubTest_ArrayStringGetSetRemove()
-{
- local JArray testJSON;
- testJSON = _().json.newArray();
- testJSON.SetString(0, "first string");
-
- Context("Testing `JArray`'s get/set/remove functions for" @
- "string variables");
- Issue("String type isn't properly set by `SetString`");
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_String);
-
- Issue("Value is incorrectly assigned by `SetString`");
- TEST_ExpectTrue(testJSON.GetString(0) == "first string");
-
- Issue( "Providing default variable value makes 'GetString'" @
- "return incorrect value");
- TEST_ExpectTrue(testJSON.GetString(0, "alternative") == "first string");
-
- Issue("Variable value isn't correctly reassigned by `SetString`");
- testJSON.SetString(0, "new string!~");
- TEST_ExpectTrue(testJSON.GetString(0) == "new string!~");
-
- Issue( "Getting string variable as a wrong type" @
- "doesn't yield default value");
- TEST_ExpectTrue(testJSON.GetBoolean(0, true) == true);
-
- Issue("Boolean variable isn't being properly removed");
- testJSON.RemoveValue(0);
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_Undefined);
-
- Issue( "Getters don't return default value for missing key that" @
- "previously stored string value, but got removed");
- TEST_ExpectTrue(testJSON.GetString(0, "other") == "other");
-}
-
-protected static function SubTest_ArrayNumberGetSetRemove()
-{
- local JArray testJSON;
- testJSON = _().json.newArray();
- testJSON.SetNumber(0, 3.5);
-
- Context("Testing `JArray`'s get/set/remove functions for" @
- "number variables");
- Issue("Number type isn't properly set by `SetNumber`");
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_Number);
-
- Issue("Value is incorrectly assigned by `SetNumber`");
- TEST_ExpectTrue(testJSON.GetNumber(0) == 3.5);
-
- Issue( "Providing default variable value makes 'GetNumber'" @
- "return incorrect value");
- TEST_ExpectTrue(testJSON.GetNumber(0, 5) == 3.5);
-
- Issue("Variable value isn't correctly reassigned by `SetNumber`");
- testJSON.SetNumber(0, 7);
- TEST_ExpectTrue(testJSON.GetNumber(0) == 7);
-
- Issue( "Getting number variable as a wrong type" @
- "doesn't yield default value");
- TEST_ExpectTrue(testJSON.GetString(0, "default") == "default");
-
- Issue("Number type isn't being properly removed");
- testJSON.RemoveValue(0);
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_Undefined);
-
- Issue( "Getters don't return default value for missing key that" @
- "previously stored number value, but got removed");
- TEST_ExpectTrue(testJSON.GetNumber(0, 13) == 13);
-}
-
-protected static function SubTest_ArrayNullGetSetRemove()
-{
- local JArray testJSON;
- testJSON = _().json.newArray();
-
- Context("Testing `JArray`'s get/set/remove functions for" @
- "null values");
-
- Issue("Undefined variable is incorrectly considered `null`");
- TEST_ExpectFalse(testJSON.IsNull(0));
- TEST_ExpectFalse(testJSON.IsNull(2));
- TEST_ExpectFalse(testJSON.IsNull(-1));
-
- Issue("Number variable is incorrectly considered `null`");
- testJSON.SetNumber(0, 4);
- TEST_ExpectFalse(testJSON.IsNull(0));
-
- Issue("Boolean variable is incorrectly considered `null`");
- testJSON.SetBoolean(0, true);
- TEST_ExpectFalse(testJSON.IsNull(0));
-
- Issue("String variable is incorrectly considered `null`");
- testJSON.SetString(0, "string");
- TEST_ExpectFalse(testJSON.IsNull(0));
-
- Issue("Null value is incorrectly assigned");
- testJSON.SetNull(0);
- TEST_ExpectTrue(testJSON.IsNull(0));
-
- Issue("Null type isn't properly set by `SetNumber`");
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_Null);
-
- Issue("Null value isn't being properly removed");
- testJSON.RemoveValue(0);
- TEST_ExpectTrue(testJSON.GetTypeOf(0) == JSON_Undefined);
-}
-
-// Returns following array:
-// [10.0, "test string", "another string", true, 0.0, {"var": 7.0}]
-protected static function JArray Prepare_Array()
-{
- local JArray testArray;
- testArray = _().json.newArray();
- testArray.AddNumber(10.0f)
- .AddString("test string")
- .AddString("another string")
- .AddBoolean(true)
- .AddNumber(0.0f)
- .AddObject();
- testArray.GetObject(5).SetNumber("var", 7);
- return testArray;
-}
-
-protected static function SubTest_ArrayMultipleVariablesStorage()
-{
- local JArray testArray;
- testArray = Prepare_Array();
-
- Context("Testing how `JArray` handles adding and" @
- "changing several variables");
- Issue("Stored values are compromised.");
- TEST_ExpectTrue(testArray.GetNumber(0) == 10.0f);
- TEST_ExpectTrue(testArray.GetString(1) == "test string");
- TEST_ExpectTrue(testArray.GetString(2) == "another string");
- TEST_ExpectTrue(testArray.GetBoolean(3) == true);
- TEST_ExpectTrue(testArray.GetNumber(4) == 0.0f);
- TEST_ExpectTrue(testArray.GetObject(5).GetNumber("var") == 7);
-
- Issue("Values incorrectly change their values.");
- testArray.SetString(3, "new string");
- TEST_ExpectTrue(testArray.GetString(3) == "new string");
-
- Issue( "After overwriting boolean value with a different type," @
- "attempting go get it as a boolean gives old value," @
- "instead of default");
- TEST_ExpectTrue(testArray.GetBoolean(3, false) == false);
-
- Issue("Type of the variable is incorrectly changed.");
- TEST_ExpectTrue(testArray.GetTypeOf(3) == JSON_String);
-}
-
-protected static function SubTest_ArrayMultipleVariablesRemoval()
-{
- local JArray testArray;
- testArray = Prepare_Array();
- // Test removing variables
- // After `Prepare_Array`, our array should be:
- // [10.0, "test string", "another string", true, 0.0, {"var": 7.0}]
-
- Context("Testing how `JArray` handles adding and" @
- "removing several variables");
- Issue("Values are incorrectly removed");
- testArray.RemoveValue(2);
- // [10.0, "test string", true, 0.0, {"var": 7.0}]
- Issue("Values are incorrectly removed");
- TEST_ExpectTrue(testArray.GetNumber(0) == 10.0);
- TEST_ExpectTrue(testArray.GetString(1) == "test string");
- TEST_ExpectTrue(testArray.GetBoolean(2) == true);
- TEST_ExpectTrue(testArray.GetNumber(3) == 0.0f);
- TEST_ExpectTrue(testArray.GetTypeOf(4) == JSON_Object);
-
- Issue("First element incorrectly removed");
- testArray.RemoveValue(0);
- // ["test string", true, 0.0, {"var": 7.0}]
- TEST_ExpectTrue(testArray.GetString(0) == "test string");
- TEST_ExpectTrue(testArray.GetBoolean(1) == true);
- TEST_ExpectTrue(testArray.GetNumber(2) == 0.0f);
- TEST_ExpectTrue(testArray.GetTypeOf(3) == JSON_Object);
- TEST_ExpectTrue(testArray.GetObject(3).GetNumber("var") == 7.0);
-
- Issue("Last element incorrectly removed");
- testArray.RemoveValue(3);
- // ["test string", true, 0.0]
- TEST_ExpectTrue(testArray.GetLength() == 3);
- TEST_ExpectTrue(testArray.GetString(0) == "test string");
- TEST_ExpectTrue(testArray.GetBoolean(1) == true);
- TEST_ExpectTrue(testArray.GetNumber(2) == 0.0f);
-
- Issue("Removing all elements is handled incorrectly");
- testArray.RemoveValue(0);
- testArray.RemoveValue(0);
- testArray.RemoveValue(0);
- TEST_ExpectTrue(testArray.Getlength() == 0);
- TEST_ExpectTrue(testArray.GetTypeOf(0) == JSON_Undefined);
-}
-
-protected static function SubTest_ArrayRemovingMultipleVariablesAtOnce()
-{
- local JArray testArray;
- testArray = _().json.newArray();
- testArray.AddNumber(10.0f)
- .AddString("test string")
- .AddString("another string")
- .AddNumber(7.0);
-
- Context("Testing how `JArray`' handles removing" @
- "multiple elements at once");
- Issue("Multiple values are incorrectly removed");
- testArray.RemoveValue(1, 2);
- TEST_ExpectTrue(testArray.GetLength() == 2);
- TEST_ExpectTrue(testArray.GetNumber(1) == 7.0);
-
- testArray.AddNumber(4.0f)
- .AddString("test string")
- .AddString("another string")
- .AddNumber(8.0);
-
- // Current array:
- // [10.0, 7.0, 4.0, "test string", "another string", 8.0]
- Issue("Last value is incorrectly removed");
- testArray.RemoveValue(5, 1);
- TEST_ExpectTrue(testArray.GetLength() == 5);
- TEST_ExpectTrue(testArray.GetString(4) == "another string");
-
- // Current array:
- // [10.0, 7.0, 4.0, "test string", "another string"]
- Issue("Tail elements are incorrectly removed");
- testArray.RemoveValue(3, 4);
- TEST_ExpectTrue(testArray.GetLength() == 3);
- TEST_ExpectTrue(testArray.GetNumber(0) == 10.0);
- TEST_ExpectTrue(testArray.GetNumber(2) == 4.0);
-
- Issue("Array empties incorrectly");
- testArray.RemoveValue(0, testArray.GetLength());
- TEST_ExpectTrue(testArray.GetLength() == 0);
- TEST_ExpectTrue(testArray.GetTypeOf(0) == JSON_Undefined);
- TEST_ExpectTrue(testArray.GetTypeOf(1) == JSON_Undefined);
-}
-
-protected static function SubTest_ArrayExpansions()
-{
- local JArray testArray;
- testArray = _().json.newArray();
-
- Context("Testing how `JArray`' handles expansions/shrinking " @
- "via `SetLength()`");
- Issue("`SetLength()` doesn't properly expand empty array");
- testArray.SetLength(2);
- TEST_ExpectTrue(testArray.GetLength() == 2);
- TEST_ExpectTrue(testArray.GetTypeOf(0) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(1) == JSON_Null);
-
- Issue("`SetLength()` doesn't properly expand non-empty array");
- testArray.AddNumber(1);
- testArray.SetLength(4);
- TEST_ExpectTrue(testArray.GetLength() == 4);
- TEST_ExpectTrue(testArray.GetTypeOf(0) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(1) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(2) == JSON_Number);
- TEST_ExpectTrue(testArray.GetTypeOf(3) == JSON_Null);
- TEST_ExpectTrue(testArray.GetNumber(2) == 1);
- SubSubTest_ArraySetNumberExpansions();
- SubSubTest_ArraySetStringExpansions();
- SubSubTest_ArraySetBooleanExpansions();
-}
-
-protected static function SubSubTest_ArraySetNumberExpansions()
-{
- local JArray testArray;
- testArray = _().json.newArray();
-
- Context("Testing how `JArray`' handles expansions via" @
- "`SetNumber()` function");
- Issue("Setters don't create correct first element");
- testArray.SetNumber(0, 1);
- TEST_ExpectTrue(testArray.GetLength() == 1);
- TEST_ExpectTrue(testArray.GetNumber(0) == 1);
-
- Issue( "`SetNumber()` doesn't properly define array when setting" @
- "value out-of-bounds");
- testArray = _().json.newArray();
- testArray.AddNumber(1);
- testArray.SetNumber(4, 2);
- TEST_ExpectTrue(testArray.GetLength() == 5);
- TEST_ExpectTrue(testArray.GetNumber(0) == 1);
- TEST_ExpectTrue(testArray.GetTypeOf(1) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(2) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(3) == JSON_Null);
- TEST_ExpectTrue(testArray.GetNumber(4) == 2);
-
- Issue("`SetNumber()` expands array even when it told not to");
- testArray.SetNumber(6, 7, true);
- TEST_ExpectTrue(testArray.GetLength() == 5);
- TEST_ExpectTrue(testArray.GetNumber(6) == 0);
- TEST_ExpectTrue(testArray.GetTypeOf(5) == JSON_Undefined);
- TEST_ExpectTrue(testArray.GetTypeOf(6) == JSON_Undefined);
-}
-
-protected static function SubSubTest_ArraySetStringExpansions()
-{
- local JArray testArray;
- testArray = _().json.newArray();
-
- Context("Testing how `JArray`' handles expansions via" @
- "`SetString()` function");
- Issue("Setters don't create correct first element");
- testArray.SetString(0, "str");
- TEST_ExpectTrue(testArray.GetLength() == 1);
- TEST_ExpectTrue(testArray.GetString(0) == "str");
-
- Issue( "`SetString()` doesn't properly define array when setting" @
- "value out-of-bounds");
- testArray = _().json.newArray();
- testArray.AddString("str");
- testArray.SetString(4, "str2");
- TEST_ExpectTrue(testArray.GetLength() == 5);
- TEST_ExpectTrue(testArray.GetString(0) == "str");
- TEST_ExpectTrue(testArray.GetTypeOf(1) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(2) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(3) == JSON_Null);
- TEST_ExpectTrue(testArray.GetString(4) == "str2");
-
- Issue("`SetString()` expands array even when it told not to");
- testArray.SetString(6, "new string", true);
- TEST_ExpectTrue(testArray.GetLength() == 5);
- TEST_ExpectTrue(testArray.GetString(6) == "");
- TEST_ExpectTrue(testArray.GetTypeOf(5) == JSON_Undefined);
- TEST_ExpectTrue(testArray.GetTypeOf(6) == JSON_Undefined);
-}
-
-protected static function SubSubTest_ArraySetBooleanExpansions()
-{
- local JArray testArray;
- testArray = _().json.newArray();
-
- Context("Testing how `JArray`' handles expansions via" @
- "`SetBoolean()` function");
- Issue("Setters don't create correct first element");
- testArray.SetBoolean(0, false);
- TEST_ExpectTrue(testArray.GetLength() == 1);
- TEST_ExpectTrue(testArray.GetBoolean(0) == false);
-
- Issue( "`SetBoolean()` doesn't properly define array when setting" @
- "value out-of-bounds");
- testArray = _().json.newArray();
- testArray.AddBoolean(true);
- testArray.SetBoolean(4, true);
- TEST_ExpectTrue(testArray.GetLength() == 5);
- TEST_ExpectTrue(testArray.GetBoolean(0) == true);
- TEST_ExpectTrue(testArray.GetTypeOf(1) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(2) == JSON_Null);
- TEST_ExpectTrue(testArray.GetTypeOf(3) == JSON_Null);
- TEST_ExpectTrue(testArray.GetBoolean(4) == true);
-
- Issue("`SetBoolean()` expands array even when it told not to");
- testArray.SetBoolean(6, true, true);
- TEST_ExpectTrue(testArray.GetLength() == 5);
- TEST_ExpectTrue(testArray.GetBoolean(6) == false);
- TEST_ExpectTrue(testArray.GetTypeOf(5) == JSON_Undefined);
- TEST_ExpectTrue(testArray.GetTypeOf(6) == JSON_Undefined);
-}
-
-defaultproperties
-{
- caseName = "JSON"
-}
\ No newline at end of file
diff --git a/sources/Core/Events/Broadcast/BroadcastEvents.uc b/sources/Core/Events/Broadcast/BroadcastEvents.uc
deleted file mode 100644
index 61cacfc..0000000
--- a/sources/Core/Events/Broadcast/BroadcastEvents.uc
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * Event generator for events, related to broadcasting messages
- * through standard Unreal Script means:
- * 1. text messages, typed by a player;
- * 2. localized messages, identified by a LocalMessage class and id.
- * Allows to make decisions whether or not to propagate certain messages.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class BroadcastEvents extends Events
- abstract;
-
-struct LocalizedMessage
-{
- // Every localized message is described by a class and id.
- // For example, consider 'KFMod.WaitingMessage':
- // if passed 'id' is '1',
- // then it's supposed to be a message about new wave,
- // but if passed 'id' is '2',
- // then it's about completing the wave.
- var class class;
- var int id;
- // Localized messages in unreal script can be passed along with
- // optional arguments, described by variables below.
- var PlayerReplicationInfo relatedPRI1;
- var PlayerReplicationInfo relatedPRI2;
- var Object relatedObject;
-};
-
-static function bool CallCanBroadcast(Actor broadcaster, int recentSentTextSize)
-{
- local int i;
- local bool result;
- local array< class > listeners;
- listeners = GetListeners();
- for (i = 0;i < listeners.length;i += 1)
- {
- result = class(listeners[i])
- .static.CanBroadcast(broadcaster, recentSentTextSize);
- if (!result) return false;
- }
- return true;
-}
-
-static function bool CallHandleText
-(
- Actor sender,
- out string message,
- name messageType
-)
-{
- local int i;
- local bool result;
- local array< class > listeners;
- listeners = GetListeners();
- for (i = 0;i < listeners.length;i += 1)
- {
- result = class(listeners[i])
- .static.HandleText(sender, message, messageType);
- if (!result) return false;
- }
- return true;
-}
-
-static function bool CallHandleTextFor
-(
- PlayerController receiver,
- Actor sender,
- out string message,
- name messageType
-)
-{
- local int i;
- local bool result;
- local array< class > listeners;
- listeners = GetListeners();
- for (i = 0;i < listeners.length;i += 1)
- {
- result = class(listeners[i])
- .static.HandleTextFor(receiver, sender, message, messageType);
- if (!result) return false;
- }
- return true;
-}
-
-static function bool CallHandleLocalized
-(
- Actor sender,
- LocalizedMessage message
-)
-{
- local int i;
- local bool result;
- local array< class > listeners;
- listeners = GetListeners();
- for (i = 0;i < listeners.length;i += 1)
- {
- result = class(listeners[i])
- .static.HandleLocalized(sender, message);
- if (!result) return false;
- }
- return true;
-}
-
-static function bool CallHandleLocalizedFor
-(
- PlayerController receiver,
- Actor sender,
- LocalizedMessage message
-)
-{
- local int i;
- local bool result;
- local array< class > listeners;
- listeners = GetListeners();
- for (i = 0;i < listeners.length;i += 1)
- {
- result = class(listeners[i])
- .static.HandleLocalizedFor(receiver, sender, message);
- if (!result) return false;
- }
- return true;
-}
-
-defaultproperties
-{
- relatedListener = class'BroadcastListenerBase'
-}
\ No newline at end of file
diff --git a/sources/Core/Events/Broadcast/BroadcastHandler.uc b/sources/Core/Events/Broadcast/BroadcastHandler.uc
deleted file mode 100644
index fd98140..0000000
--- a/sources/Core/Events/Broadcast/BroadcastHandler.uc
+++ /dev/null
@@ -1,197 +0,0 @@
-/**
- * 'BroadcastHandler' class that used by Acedia to catch
- * broadcasting events. For Acedia to work properly it needs to be added to
- * the very beginning of the broadcast handlers' chain.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-// TODO: make it work from any place in the chain.
-class BroadcastHandler extends Engine.BroadcastHandler
- dependson(BroadcastEvents);
-
-// The way vanilla 'BroadcastHandler' works - it can check if broadcast is
-// possible for any actor, but for actually sending the text messages it will
-// try to extract player's data from it
-// and will simply pass 'none' if it can't.
-// We remember senders in this array in order to pass real ones to our events.
-// Array instead of variable is to account for folded calls
-// (when handling of broadcast events leads to another message generation).
-var private array storedSenders;
-
-// We want to insert our code in some of the functions between
-// 'AllowsBroadcast' check and actual broadcasting,
-// so we can't just use a 'super.AllowsBroadcast()' call.
-// Instead we first manually do this check, then perform our logic and then
-// make a super call, but with 'blockAllowsBroadcast' flag set to 'true',
-// which causes overloaded 'AllowsBroadcast()' to omit actual checks.
-var private bool blockAllowsBroadcast;
-
-// Functions below simply reroute vanilla's broadcast events to
-// Acedia's 'BroadcastEvents', while keeping original senders
-// and blocking 'AllowsBroadcast()' as described in comments for
-// 'storedSenders' and 'blockAllowsBroadcast'.
-
-public function bool HandlerAllowsBroadcast(Actor broadcaster, int sentTextNum)
-{
- local bool canBroadcast;
- // Check listeners
- canBroadcast = class'BroadcastEvents'.static
- .CallCanBroadcast(broadcaster, sentTextNum);
- // Check other broadcast handlers (if present)
- if (canBroadcast && nextBroadcastHandler != none)
- {
- canBroadcast = nextBroadcastHandler
- .HandlerAllowsBroadcast(broadcaster, sentTextNum);
- }
- return canBroadcast;
-}
-
-function Broadcast(Actor sender, coerce string message, optional name type)
-{
- local bool canTryToBroadcast;
- if (!AllowsBroadcast(sender, Len(message)))
- return;
- canTryToBroadcast = class'BroadcastEvents'.static
- .CallHandleText(sender, message, type);
- if (canTryToBroadcast)
- {
- storedSenders[storedSenders.length] = sender;
- blockAllowsBroadcast = true;
- super.Broadcast(sender, message, type);
- blockAllowsBroadcast = false;
- storedSenders.length = storedSenders.length - 1;
- }
-}
-
-function BroadcastTeam
-(
- Controller sender,
- coerce string message,
- optional name type
-)
-{
- local bool canTryToBroadcast;
- if (!AllowsBroadcast(sender, Len(message)))
- return;
- canTryToBroadcast = class'BroadcastEvents'.static
- .CallHandleText(sender, message, type);
- if (canTryToBroadcast)
- {
- storedSenders[storedSenders.length] = sender;
- blockAllowsBroadcast = true;
- super.BroadcastTeam(sender, message, type);
- blockAllowsBroadcast = false;
- storedSenders.length = storedSenders.length - 1;
- }
-}
-
-event AllowBroadcastLocalized
-(
- Actor sender,
- class message,
- optional int switch,
- optional PlayerReplicationInfo relatedPRI1,
- optional PlayerReplicationInfo relatedPRI2,
- optional Object optionalObject
-)
-{
- local bool canTryToBroadcast;
- local BroadcastEvents.LocalizedMessage packedMessage;
- if (!AllowsBroadcast(sender, Len(message)))
- return;
- packedMessage.class = message;
- packedMessage.id = switch;
- packedMessage.relatedPRI1 = relatedPRI1;
- packedMessage.relatedPRI2 = relatedPRI2;
- packedMessage.relatedObject = optionalObject;
- canTryToBroadcast = class'BroadcastEvents'.static
- .CallHandleLocalized(sender, packedMessage);
- if (canTryToBroadcast)
- {
- super.AllowBroadcastLocalized( sender, message, switch,
- relatedPRI1, relatedPRI2,
- optionalObject);
- }
-}
-
-function bool AllowsBroadcast(actor broadcaster, int len)
-{
- if (blockAllowsBroadcast)
- return true;
- return super.AllowsBroadcast(broadcaster, len);
-}
-
-function bool AcceptBroadcastText
-(
- PlayerController receiver,
- PlayerReplicationInfo senderPRI,
- out string message,
- optional name type
-)
-{
- local bool canBroadcast;
- local Actor sender;
- if (senderPRI != none)
- {
- sender = PlayerController(senderPRI.owner);
- }
- if (sender == none && storedSenders.length > 0)
- {
- sender = storedSenders[storedSenders.length - 1];
- }
- canBroadcast = class'BroadcastEvents'.static
- .CallHandleTextFor(receiver, sender, message, type);
- if (!canBroadcast)
- {
- return false;
- }
- return super.AcceptBroadcastText(receiver, senderPRI, message, type);
-}
-
-
-function bool AcceptBroadcastLocalized
-(
- PlayerController receiver,
- Actor sender,
- class message,
- optional int switch,
- optional PlayerReplicationInfo relatedPRI1,
- optional PlayerReplicationInfo relatedPRI2,
- optional Object obj
-)
-{
- local bool canBroadcast;
- local BroadcastEvents.LocalizedMessage packedMessage;
- packedMessage.class = message;
- packedMessage.id = switch;
- packedMessage.relatedPRI1 = relatedPRI1;
- packedMessage.relatedPRI2 = relatedPRI2;
- packedMessage.relatedObject = obj;
- canBroadcast = class'BroadcastEvents'.static
- .CallHandleLocalizedFor(receiver, sender, packedMessage);
- if (!canBroadcast)
- {
- return false;
- }
- return super.AcceptBroadcastLocalized( receiver, sender, message, switch,
- relatedPRI1, relatedPRI2, obj);
-}
-
-defaultproperties
-{
- blockAllowsBroadcast = false
-}
\ No newline at end of file
diff --git a/sources/Core/Events/Broadcast/BroadcastListenerBase.uc b/sources/Core/Events/Broadcast/BroadcastListenerBase.uc
deleted file mode 100644
index 6cf6b0d..0000000
--- a/sources/Core/Events/Broadcast/BroadcastListenerBase.uc
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Listener for events, related to broadcasting messages
- * through standard Unreal Script means:
- * 1. text messages, typed by a player;
- * 2. localized messages, identified by a LocalMessage class and id.
- * Allows to make decisions whether or not to propagate certain messages.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class BroadcastListenerBase extends Listener
- abstract;
-
-static final function PlayerController GetController(Actor sender)
-{
- local Pawn senderPawn;
- senderPawn = Pawn(sender);
- if (senderPawn != none) return PlayerController(senderPawn.controller);
- return PlayerController(sender);
-}
-
-// This event is called whenever registered broadcast handlers are asked if
-// they'd allow given actor ('broadcaster') to broadcast a text message,
-// given that none so far rejected it and he recently already broadcasted
-// or tried to broadcast 'recentSentTextSize' symbols of text
-// (that value is periodically reset in 'GameInfo',
-// by default should be each second).
-// NOTE: this function is ONLY called when someone tries to
-// broadcast TEXT messages.
-// If one of the listeners returns 'false', -
-// it will be treated just like one of broadcasters returning 'false'
-// in 'AllowsBroadcast' and this method won't be called for remaining
-// active listeners.
-static function bool CanBroadcast(Actor broadcaster, int recentSentTextSize)
-{
- return true;
-}
-
-// This event is called whenever a someone is trying to broadcast
-// a text message (typically the typed by a player).
-// This function is called once per message and allows you to change it
-// (by changing 'message' argument) before any of the players receive it.
-// Return 'true' to allow the message through.
-// If one of the listeners returns 'false', -
-// it will be treated just like one of broadcasters returning 'false'
-// in 'AcceptBroadcastText' and this method won't be called for remaining
-// active listeners.
-static function bool HandleText
-(
- Actor sender,
- out string message,
- optional name messageType
-)
-{
- return true;
-}
-
-// This event is similar to 'HandleText', but is called for every player
-// the message is sent to.
-// If allows you to alter the message, but the changes are accumulated
-// as events go through the players.
-static function bool HandleTextFor
-(
- PlayerController receiver,
- Actor sender,
- out string message,
- optional name messageType
-)
-{
- return true;
-}
-
-// This event is called whenever a localized message is trying to
-// get broadcasted to a certain player ('receiver').
-// Return 'true' to allow the message through.
-// If one of the listeners returns 'false', -
-// it will be treated just like one of broadcasters returning 'false'
-// in 'AcceptBroadcastText' and this method won't be called for remaining
-// active listeners.
-static function bool HandleLocalized
-(
- Actor sender,
- BroadcastEvents.LocalizedMessage message
-)
-{
- return true;
-}
-
-// This event is similar to 'HandleLocalized', but is called for
-// every player the message is sent to.
-static function bool HandleLocalizedFor
-(
- PlayerController receiver,
- Actor sender,
- BroadcastEvents.LocalizedMessage message
-)
-{
- return true;
-}
-
-defaultproperties
-{
- relatedEvents = class'BroadcastEvents'
-}
-
- // Text messages can (optionally) have their type specified.
- // Examples of it are names 'Say' and 'CriticalEvent'.
\ No newline at end of file
diff --git a/sources/Core/Events/Events.uc b/sources/Core/Events/Events.uc
deleted file mode 100644
index 4f6a0a0..0000000
--- a/sources/Core/Events/Events.uc
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * One of the two classes that make up a core of event system in Acedia.
- *
- * 'Events' (or it's child) class shouldn't be instantiated.
- * Usually module would provide '...Events' class that defines
- * certain set of static functions that can generate event calls to
- * all it's active listeners.
- * If you're simply using modules someone made, -
- * you don't need to bother yourself with further specifics.
- * If you wish to create your own event generator,
- * then first create a '...ListenerBase' object
- * (more about it in the description of 'Listener' class)
- * and set 'relatedListener' variable to point to it's class.
- * Then for each event create a caller function in your 'Event' class,
- * following this template:
- * ____________________________________________________________________________
- * | static function CallEVENT_NAME()
- * | {
- * | local int i;
- * | local array< class > listeners;
- * | listeners = GetListeners();
- * | for (i = 0; i < listeners.length; i += 1)
- * | {
- * | class<...ListenerBase>(listeners[i])
- * | .static.EVENT_NAME();
- * | }
- * | }
- * |___________________________________________________________________________
- * If each listener must indicate whether it gives it's permission for
- * something to happen, then use this template:
- * ____________________________________________________________________________
- * | static function CallEVENT_NAME()
- * | {
- * | local int i;
- * | local bool result;
- * | local array< class > listeners;
- * | listeners = GetListeners();
- * | for (i = 0; i < listeners.length; i += 1)
- * | {
- * | result = class<...ListenerBase>(listeners[i])
- * | .static.EVENT_NAME();
- * | if (!result) return false;
- * | }
- * | return true;
- * | }
- * |___________________________________________________________________________
- * For concrete example look at
- * 'MutatorEvents' and 'MutatorListenerBase'.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class Events extends Object
- abstract;
-
-var private array< class > listeners;
-
-var public const class relatedListener;
-
-// Even class can also auto-spawn a `Service`,
-// in case it's require to generate events
-var public const class connectedServiceClass;
-// Set this to `true`if you want `connectedServiceClass` service to also
-// auto-shutdown whenever no-one listens to the events.
-var public const bool shutDownServiceWithoutListeners;
-
-static public final function array< class > GetListeners()
-{
- return default.listeners;
-}
-
-// Make given listener active.
-// If listener was already activated also returns 'false'.
-static public final function bool ActivateListener(class newListener)
-{
- local int i;
- if (newListener == none) return false;
- if (!ClassIsChildOf(newListener, default.relatedListener)) return false;
-
- // Spawn service, if absent
- if ( default.listeners.length == 0
- && default.connectedServiceClass != none) {
- default.connectedServiceClass.static.Require();
- }
- // Add listener
- for (i = 0;i < default.listeners.length;i += 1)
- {
- if (default.listeners[i] == newListener) {
- return false;
- }
- }
- default.listeners[default.listeners.length] = newListener;
- return true;
-}
-
-// Make given listener inactive.
-// If listener wasn't active returns 'false'.
-static public final function bool DeactivateListener(class listener)
-{
- local int i;
- local bool removedListener;
- local Service service;
- if (listener == none) return false;
-
- // Remove listener
- for (i = 0; i < default.listeners.length; i += 1)
- {
- if (default.listeners[i] == listener)
- {
- default.listeners.Remove(i, 1);
- removedListener = true;
- break;
- }
- }
- // Remove unneeded service
- if ( default.shutDownServiceWithoutListeners
- && default.listeners.length == 0
- && default.connectedServiceClass != none)
- {
- service = Service(default.connectedServiceClass.static.GetInstance());
- if (service != none) {
- service.Destroy();
- }
- }
- return removedListener;
-}
-
-static public final function bool IsActiveListener(class listener)
-{
- local int i;
- if (listener == none) return false;
-
- for (i = 0; i < default.listeners.length; i += 1)
- {
- if (default.listeners[i] == listener)
- {
- return true;
- }
- }
- return false;
-}
-
-defaultproperties
-{
- relatedListener = class'Listener'
-}
\ No newline at end of file
diff --git a/sources/Core/Events/Listener.uc b/sources/Core/Events/Listener.uc
deleted file mode 100644
index b5f0fe6..0000000
--- a/sources/Core/Events/Listener.uc
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * One of the two classes that make up a core of event system in Acedia.
- *
- * 'Listener' (or it's child) class shouldn't be instantiated.
- * Usually module would provide '...ListenerBase' class that defines
- * certain set of static functions, corresponding to events it can listen to.
- * In order to handle those events you must create it's child class and
- * override said functions. But they will only be called if
- * 'SetActive(true)' is called for that child class.
- * To create you own '...ListenerBase' class you need to define
- * a static function for each event you wish it to catch and
- * set 'relatedEvents' variable to point at the 'Events' class
- * that will generate your events.
- * For concrete example look at
- * 'ConnectionEvents' and 'ConnectionListenerBase'.
- * Copyright 2019 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class Listener extends Object
- abstract;
-
-var public const class relatedEvents;
-
-
-static public final function SetActive(bool active)
-{
- if (active)
- {
- default.relatedEvents.static.ActivateListener(default.class);
- }
- else
- {
- default.relatedEvents.static.DeactivateListener(default.class);
- }
-}
-
-static public final function IsActive(bool active)
-{
- default.relatedEvents.static.IsActiveListener(default.class);
-}
-
-defaultproperties
-{
- relatedEvents = class'Events'
-}
\ No newline at end of file
diff --git a/sources/Core/Events/Mutator/MutatorEvents.uc b/sources/Core/Events/Mutator/MutatorEvents.uc
deleted file mode 100644
index 542c320..0000000
--- a/sources/Core/Events/Mutator/MutatorEvents.uc
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Event generator that repeats events of a mutator.
- * Copyright 2019 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class MutatorEvents extends Events
- abstract;
-
-static function bool CallCheckReplacement(Actor other, out byte isSuperRelevant)
-{
- local int i;
- local bool result;
- local array< class > listeners;
- listeners = GetListeners();
- for (i = 0; i < listeners.length; i += 1)
- {
- result = class(listeners[i])
- .static.CheckReplacement(other, isSuperRelevant);
- if (!result) return false;
- }
- return true;
-}
-
-static function bool CallMutate(string command, PlayerController sendingPlayer)
-{
- local int i;
- local bool result;
- local array< class > listeners;
- listeners = GetListeners();
- for (i = 0; i < listeners.length;i += 1)
- {
- result = class(listeners[i])
- .static.Mutate(command, sendingPlayer);
- if (!result) return false;
- }
- return true;
-}
-
-defaultproperties
-{
- relatedListener = class'MutatorListenerBase'
-}
\ No newline at end of file
diff --git a/sources/Core/Events/Mutator/MutatorListenerBase.uc b/sources/Core/Events/Mutator/MutatorListenerBase.uc
deleted file mode 100644
index 74c4311..0000000
--- a/sources/Core/Events/Mutator/MutatorListenerBase.uc
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Listener for events, normally propagated by mutators.
- * Copyright 2019 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class MutatorListenerBase extends Listener
- abstract;
-
-// This event is called whenever 'CheckReplacement'
-// check is propagated through mutators.
-// If one of the listeners returns 'false', -
-// it will be treated just like a mutator returning 'false'
-// in 'CheckReplacement' and
-// this method won't be called for remaining active listeners.
-static function bool CheckReplacement(Actor other, out byte isSuperRelevant)
-{
- return true;
-}
-
-// This event is called whenever 'Mutate' is propagated through mutators.
-// If one of the listeners returns 'false', -
-// this method won't be called for remaining active listeners or mutators.
-// If all listeners return 'true', -
-// mutate command will be further propagated to the rest of the mutators.
-static function bool Mutate(string command, PlayerController sendingPlayer)
-{
- return true;
-}
-
-defaultproperties
-{
- relatedEvents = class'MutatorEvents'
-}
\ No newline at end of file
diff --git a/sources/Core/Feature.uc b/sources/Core/Feature.uc
deleted file mode 100644
index fc29a7b..0000000
--- a/sources/Core/Feature.uc
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Feature represents a certain subset of Acedia's functionality that
- * can be enabled or disabled, according to server owner's wishes.
- * In the current version of Acedia enabling or disabling a feature requires
- * manually editing configuration file and restarting a server.
- * Factually feature is just a collection of settings with one universal
- * 'isActive' setting that tells Acedia whether or not to load a feature.
- * Copyright 2019 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class Feature extends Singleton
- abstract
- config(Acedia);
-
-// Setting that tells Acedia whether or not to enable this feature
-// during initialization.
-// Only it's default value is ever used.
-var private config bool autoEnable;
-
-// Listeners listed here will be automatically activated.
-var public const array< class > requiredListeners;
-
-// Sets whether to enable this feature by default.
-public static final function SetAutoEnable(bool doEnable)
-{
- default.autoEnable = doEnable;
- StaticSaveConfig();
-}
-
-public static final function bool IsAutoEnabled()
-{
- return default.autoEnable;
-}
-
-// Whether feature is enabled is determined by
-public static final function bool IsEnabled()
-{
- return (GetInstance() != none);
-}
-
-// Enables feature of given class.
-public static final function Feature EnableMe()
-{
- local Feature newInstance;
- if (IsEnabled())
- {
- return Feature(GetInstance());
- }
- default.blockSpawning = false;
- newInstance = class'Acedia'.static.GetInstance().Spawn(default.class);
- default.blockSpawning = true;
- return newInstance;
-}
-
-public static final function bool DisableMe()
-{
- local Feature myself;
- myself = Feature(GetInstance());
- if (myself != none)
- {
- myself.Destroy();
- return true;
- }
- return false;
-}
-
-// Event functions that are called when
-protected function OnEnabled(){}
-protected function OnDisabled(){}
-
-// Set listeners' status
-private static function SetListenersActiveSatus(bool newStatus)
-{
- local int i;
- for (i = 0; i < default.requiredListeners.length; i += 1)
- {
- if (default.requiredListeners[i] == none) continue;
- default.requiredListeners[i].static.SetActive(newStatus);
- }
-}
-
-protected function OnCreated()
-{
- default.blockSpawning = true;
- SetListenersActiveSatus(true);
- OnEnabled();
-}
-
-protected function OnDestroyed()
-{
- SetListenersActiveSatus(false);
- OnDisabled();
-}
-
-defaultproperties
-{
- autoEnable = false
- DrawType = DT_None
- // Prevent spawning this feature by any other means than 'EnableMe()'.
- blockSpawning = true
- // Features are server-only actors
- remoteRole = ROLE_None
-}
\ No newline at end of file
diff --git a/sources/Core/Logger/LoggerAPI.uc b/sources/Core/Logger/LoggerAPI.uc
deleted file mode 100644
index 8b2f5d8..0000000
--- a/sources/Core/Logger/LoggerAPI.uc
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * API that provides functions quick access to Acedia's
- * logging functionality.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class LoggerAPI extends Singleton;
-
-var private LoggerService logService;
-
-protected function OnCreated()
-{
- logService = LoggerService(class'LoggerService'.static.Require());
-}
-
-public final function Track(string message)
-{
- if (logService == none)
- {
- class'LoggerService'.static.LogMessageToKFLog(LOG_Track, message);
- return;
- }
- logService.LogMessage(LOG_Track, message);
-}
-
-public final function Debug(string message)
-{
- if (logService == none)
- {
- class'LoggerService'.static.LogMessageToKFLog(LOG_Debug, message);
- return;
- }
- logService.LogMessage(LOG_Debug, message);
-}
-
-public final function Info(string message)
-{
- if (logService == none)
- {
- class'LoggerService'.static.LogMessageToKFLog(LOG_Info, message);
- return;
- }
- logService.LogMessage(LOG_Info, message);
-}
-
-public final function Warning(string message)
-{
- if (logService == none)
- {
- class'LoggerService'.static.LogMessageToKFLog(LOG_Warning, message);
- return;
- }
- logService.LogMessage(LOG_Warning, message);
-}
-
-public final function Failure(string message)
-{
- if (logService == none)
- {
- class'LoggerService'.static.LogMessageToKFLog(LOG_Failure, message);
- return;
- }
- logService.LogMessage(LOG_Failure, message);
-}
-
-public final function Fatal(string message)
-{
- if (logService == none)
- {
- class'LoggerService'.static.LogMessageToKFLog(LOG_Fatal, message);
- return;
- }
- logService.LogMessage(LOG_Fatal, message);
-}
-
-defaultproperties
-{
-}
\ No newline at end of file
diff --git a/sources/Core/Logger/LoggerService.uc b/sources/Core/Logger/LoggerService.uc
deleted file mode 100644
index 3dd8d85..0000000
--- a/sources/Core/Logger/LoggerService.uc
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Logger that allows to separate log messages into several levels of
- * significance and lets users and admins to access only the ones they want
- * and/or receive notifications when they happen.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class LoggerService extends Service
- config(AcediaLogger);
-
-// Log levels, available in Acedia.
-enum LogLevel
-{
- // For the purposes of "tracing" the code, when trying to figure out
- // where exactly problems occurred.
- // Should not be used in any released version of
- // your packages/mutators.
- LOG_Track,
- // Information that can be used to track down errors that occur on
- // other people's systems, that developer cannot otherwise pinpoint.
- // Should be used with purpose of tracking a certain issue and
- // not "just in case".
- LOG_Debug,
- // Information about important events that should be occurring under
- // normal conditions, such as initializations/shutdowns,
- // successful completion of significant events, configuration assumptions.
- // Should not occur too often.
- LOG_Info,
- // For recoverable issues, anything that might cause errors or
- // oddities in behavior.
- // Should be used sparingly, i.e. player disconnecting might cause
- // interruption in some logic, but should not cause a warning,
- // since it is something expected to happen normally.
- LOG_Warning,
- // Use this for errors, - events that some operation cannot recover from,
- // but still does not require your module to shut down.
- LOG_Failure,
- // Anything that does not allow your module or game to function,
- // completely irrecoverable failure state.
- LOG_Fatal
-};
-
-var private const string kfLogPrefix;
-var private const string traceLevelName;
-var private const string DebugLevelName;
-var private const string infoLevelName;
-var private const string warningLevelName;
-var private const string errorLevelName;
-var private const string fatalLevelName;
-
-var private config array< class > registeredManifests;
-var private config bool logTraceInKFLog;
-var private config bool logDebugInKFLog;
-var private config bool logInfoInKFLog;
-var private config bool logWarningInKFLog;
-var private config bool logErrorInKFLog;
-var private config bool logFatalInKFLog;
-
-var private array traceMessages;
-var private array debugMessages;
-var private array infoMessages;
-var private array warningMessages;
-var private array errorMessages;
-var private array fatalMessages;
-
-public final function bool ShouldAddToKFLog(LogLevel messageLevel)
-{
- if (messageLevel == LOG_Trace && logTraceInKFLog) return true;
- if (messageLevel == LOG_Debug && logDebugInKFLog) return true;
- if (messageLevel == LOG_Info && logInfoInKFLog) return true;
- if (messageLevel == LOG_Warning && logWarningInKFLog) return true;
- if (messageLevel == LOG_Error && logErrorInKFLog) return true;
- if (messageLevel == LOG_Fatal && logFatalInKFLog) return true;
- return false;
-}
-
-public final static function LogMessageToKFLog
-(
- LogLevel messageLevel,
- string message
-)
-{
- local string levelPrefix;
- levelPrefix = default.kfLogPrefix;
- switch (messageLevel)
- {
- case LOG_Trace:
- levelPrefix = levelPrefix $ default.traceLevelName;
- break;
- case LOG_Debug:
- levelPrefix = levelPrefix $ default.debugLevelName;
- break;
- case LOG_Info:
- levelPrefix = levelPrefix $ default.infoLevelName;
- break;
- case LOG_Warning:
- levelPrefix = levelPrefix $ default.warningLevelName;
- break;
- case LOG_Error:
- levelPrefix = levelPrefix $ default.errorLevelName;
- break;
- case LOG_Fatal:
- levelPrefix = levelPrefix $ default.fatalLevelName;
- break;
- default:
- }
- Log(levelPrefix @ message);
-}
-
-public final function LogMessage(LogLevel messageLevel, string message)
-{
- switch (messageLevel)
- {
- case LOG_Trace:
- traceMessages[traceMessages.length] = message;
- case LOG_Debug:
- debugMessages[debugMessages.length] = message;
- case LOG_Info:
- infoMessages[infoMessages.length] = message;
- case LOG_Warning:
- warningMessages[warningMessages.length] = message;
- case LOG_Error:
- errorMessages[errorMessages.length] = message;
- case LOG_Fatal:
- fatalMessages[fatalMessages.length] = message;
- default:
- }
- if (ShouldAddToKFLog(messageLevel))
- {
- LogMessageToKFLog(messageLevel, message);
- }
-}
-
-defaultproperties
-{
- // Log everything by default, if someone does not like it -
- // he/she can disable it themselves.
- logTraceInKFLog = true
- logDebugInKFLog = true
- logInfoInKFLog = true
- logWarningInKFLog = true
- logErrorInKFLog = true
- logFatalInKFLog = true
- // Parts of the prefix for our log messages, redirected into kf log file.
- kfLogPrefix = "Acedia:"
- traceLevelName = "Trace"
- debugLevelName = "Debug"
- infoLevelName = "Info"
- warningLevelName = "Warning"
- errorLevelName = "Error"
- fatalLevelName = "Fatal"
-}
\ No newline at end of file
diff --git a/sources/Core/Memory/MemoryAPI.uc b/sources/Core/Memory/MemoryAPI.uc
deleted file mode 100644
index 810e72a..0000000
--- a/sources/Core/Memory/MemoryAPI.uc
+++ /dev/null
@@ -1,290 +0,0 @@
-/**
- * API that provides functions for managing objects and actors by providing
- * easy and general means to create and destroy them, that allow to make use of
- * temporary `Object`s in a more efficient way.
- * This is a low-level API that most users of Acedia, most likely,
- * would not have to use, since creation of most objects would use their own
- * wrapper functions around this API.
- * Copyright 2020 Anton Tarasenko
- *------------------------------------------------------------------------------
- * This file is part of Acedia.
- *
- * Acedia is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License, or
- * (at your option) any later version.
- *
- * Acedia is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Acedia. If not, see .
- */
-class MemoryAPI extends Singleton;
-
-// This variable counts ticks and should be different each new tick.
-var private int currentTick;
-
-// Stores instance of an `Object` that can be borrowed from the pool.
-struct BorrowableRecord
-{
- // Borrowable instance
- var Object instance;
- // Was this object borrowed?
- // This flag will persist unless object was explicitly freed,
- // even if borrowed reference timed out.
- var bool borrowed;
- // When was this object borrowed?
- // Used to automatically free borrowed objects after the tick has passed.
- var int borrowTick;
-};
-
-// Available object pools
-var private array borrowPool;
-
-// Checks if instance in the given `record` is borrowed.
-private final function bool IsBorrowed(BorrowableRecord record)
-{
- // `record.borrowed` means instance was borrowed,
- // but not explicitly freed;
- // `record.borrowTick >= currentTick` means that rights to the borrowed
- // instance hasn't yet ran out.
- return (record.borrowed && record.borrowTick >= currentTick);
-}
-
-// Loads a reference to class instance from it's string representation.
-private final function class