3 Commits

Author SHA1 Message Date
65dc9f537b remove DLC and HRG 2022-11-27 20:08:16 +03:00
19d360ed46 update description 2022-10-01 21:21:38 +03:00
cde46735aa update description 2022-10-01 20:44:59 +03:00
6 changed files with 64 additions and 20 deletions

View File

@ -1,7 +1,7 @@
class LTI extends Info class LTI extends Info
config(LTI); config(LTI);
const LatestVersion = 1; const LatestVersion = 2;
const CfgRemoveItems = class'RemoveItems'; const CfgRemoveItems = class'RemoveItems';
const CfgOfficialWeapons = class'OfficialWeapons'; const CfgOfficialWeapons = class'OfficialWeapons';
@ -71,6 +71,8 @@ private function PreInit()
case `NO_CONFIG: case `NO_CONFIG:
`Log_Info("Config created"); `Log_Info("Config created");
case 1:
case MaxInt: case MaxInt:
`Log_Info("Config updated to version" @ LatestVersion); `Log_Info("Config updated to version" @ LatestVersion);
break; break;
@ -139,7 +141,13 @@ private function PostInit()
return; return;
} }
Trader.static.ModifyTrader(KFGRI, RemoveItems, CfgRemoveItems.default.bAll, LogLevel); Trader.static.ModifyTrader(
KFGRI,
RemoveItems,
CfgRemoveItems.default.bAll,
CfgRemoveItems.default.bHRG,
CfgRemoveItems.default.bDLC,
LogLevel);
ReadyToSync = true; ReadyToSync = true;
@ -185,7 +193,9 @@ public function bool CreateRepInfo(Controller C)
Self, Self,
LogLevel, LogLevel,
RemoveItems, RemoveItems,
CfgRemoveItems.default.bAll); CfgRemoveItems.default.bAll,
CfgRemoveItems.default.bHRG,
CfgRemoveItems.default.bDLC);
RepInfos.AddItem(RepInfo); RepInfos.AddItem(RepInfo);

View File

@ -35,7 +35,7 @@ public function AddMutator(Mutator Mut)
if (Mut == Self) return; if (Mut == Self) return;
if (Mut.Class == Class) if (Mut.Class == Class)
Mut.Destroy(); LTIMut(Mut).SafeDestroy();
else else
Super.AddMutator(Mut); Super.AddMutator(Mut);
} }

View File

@ -9,6 +9,8 @@ var private LTI LTI;
var private E_LogLevel LogLevel; var private E_LogLevel LogLevel;
var private Array<class<KFWeaponDefinition> > RemoveItems; var private Array<class<KFWeaponDefinition> > RemoveItems;
var private bool ReplaceMode; var private bool ReplaceMode;
var private bool RemoveHRG;
var private bool RemoveDLC;
var private int Recieved; var private int Recieved;
var private int SyncSize; var private int SyncSize;
@ -27,7 +29,7 @@ var private int WaitingGRI;
replication replication
{ {
if (bNetInitial && Role == ROLE_Authority) if (bNetInitial && Role == ROLE_Authority)
LogLevel, ReplaceMode, SyncSize; LogLevel, ReplaceMode, RemoveHRG, RemoveDLC, SyncSize;
} }
public simulated function bool SafeDestroy() public simulated function bool SafeDestroy()
@ -41,7 +43,9 @@ public function PrepareSync(
LTI _LTI, LTI _LTI,
E_LogLevel _LogLevel, E_LogLevel _LogLevel,
Array<class<KFWeaponDefinition> > _RemoveItems, Array<class<KFWeaponDefinition> > _RemoveItems,
bool _ReplaceMode) bool _ReplaceMode,
bool _RemoveHRG,
bool _RemoveDLC)
{ {
`Log_Trace(); `Log_Trace();
@ -49,6 +53,8 @@ public function PrepareSync(
LogLevel = _LogLevel; LogLevel = _LogLevel;
RemoveItems = _RemoveItems; RemoveItems = _RemoveItems;
ReplaceMode = _ReplaceMode; ReplaceMode = _ReplaceMode;
RemoveHRG = _RemoveHRG;
RemoveDLC = _RemoveDLC;
SyncSize = RemoveItems.Length; SyncSize = RemoveItems.Length;
} }
@ -216,7 +222,7 @@ private simulated reliable client function ClientSyncFinished()
NotificationRightText = ""; NotificationRightText = "";
NotificationPercent = 0; NotificationPercent = 0;
Trader.static.ModifyTrader(KFGRI, RemoveItems, ReplaceMode, LogLevel); Trader.static.ModifyTrader(KFGRI, RemoveItems, ReplaceMode, RemoveHRG, RemoveDLC, LogLevel);
`Log_Debug("ClientSyncFinished: Trader.static.ModifyTrader"); `Log_Debug("ClientSyncFinished: Trader.static.ModifyTrader");
ClearTimer(nameof(KeepNotification)); ClearTimer(nameof(KeepNotification));

View File

@ -3,6 +3,8 @@ class RemoveItems extends Object
config(LTI); config(LTI);
var public config bool bAll; var public config bool bAll;
var public config bool bHRG;
var public config bool bDLC;
var private config Array<String> Item; var private config Array<String> Item;
public static function InitConfig(int Version, int LatestVersion) public static function InitConfig(int Version, int LatestVersion)
@ -12,6 +14,10 @@ public static function InitConfig(int Version, int LatestVersion)
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(); ApplyDefault();
case 1:
default.bHRG = false;
default.bDLC = false;
default: break; default: break;
} }
@ -24,6 +30,8 @@ public static function InitConfig(int Version, int LatestVersion)
private static function ApplyDefault() private static function ApplyDefault()
{ {
default.bAll = false; default.bAll = false;
default.bHRG = false;
default.bDLC = false;
default.Item.Length = 0; default.Item.Length = 0;
default.Item.AddItem("KFGame.KFWeapDef_9mmDual"); default.Item.AddItem("KFGame.KFWeapDef_9mmDual");
} }
@ -43,6 +51,15 @@ public static function Array<class<KFWeaponDefinition> > Load(E_LogLevel LogLeve
} }
else else
{ {
if (default.bHRG)
{
`Log_Info("Remove all HRG items");
}
if (default.bDLC)
{
`Log_Info("Remove all DLC items");
}
foreach default.Item(ItemRaw, Line) foreach default.Item(ItemRaw, Line)
{ {
ItemWeapDef = class<KFWeaponDefinition>(DynamicLoadObject(ItemRaw, class'Class')); ItemWeapDef = class<KFWeaponDefinition>(DynamicLoadObject(ItemRaw, class'Class'));

View File

@ -69,6 +69,8 @@ public static simulated function ModifyTrader(
KFGameReplicationInfo KFGRI, KFGameReplicationInfo KFGRI,
Array<class<KFWeaponDefinition> > RemoveItems, Array<class<KFWeaponDefinition> > RemoveItems,
bool ReplaceMode, bool ReplaceMode,
bool RemoveHRG,
bool RemoveDLC,
E_LogLevel LogLevel) E_LogLevel LogLevel)
{ {
local KFGFxObject_TraderItems TraderItems; local KFGFxObject_TraderItems TraderItems;
@ -86,7 +88,9 @@ public static simulated function ModifyTrader(
foreach TraderItems.SaleItems(Item) foreach TraderItems.SaleItems(Item)
{ {
if (Item.WeaponDef != None if (Item.WeaponDef != None
&& RemoveItems.Find(Item.WeaponDef) == INDEX_NONE) && RemoveItems.Find(Item.WeaponDef) == INDEX_NONE
&& (!RemoveHRG || (RemoveHRG && InStr(Item.WeaponDef, "_HRG", true) == INDEX_NONE))
&& (!RemoveDLC || (RemoveDLC && Item.WeaponDef.default.SharedUnlockId == SCU_None)))
{ {
WeapDefs.AddItem(Item.WeaponDef); WeapDefs.AddItem(Item.WeaponDef);
} }

View File

@ -11,16 +11,16 @@ This is a heavily stripped-down version of [url=https://steamcommunity.com/share
If we're lucky with that then server operators will have more tools to fine-tune the server. If we're lucky with that then server operators will have more tools to fine-tune the server.
[h1]Whitelisted?[/h1] [h1]Whitelisted?[/h1]
No. But I really hope that it will be whitelisted. [b]No.[/b] But I really hope that it will be whitelisted.
[b]⚠️ I submitted whitelist request here:[/b] [b]⚠️ I submitted whitelist request here:[/b]
https://forums.tripwireinteractive.com/index.php?threads/whitelisting-mods-and-mutators.120340/ https://forums.tripwireinteractive.com/index.php?threads/whitelisting-mods-and-mutators.120340/post-2353665
[h1]Usage (single player)[/h1] [h1]Usage (single player)[/h1]
[olist] [olist]
[*]Subscribe to this mutator; [*]Subscribe to this mutator;
[*]Start KF2; [*]Start KF2;
[*]Open console (`) and input: [*]Open console (~) and input:
[b]open KF-BioticsLab?Mutator=LTI.LTIMut[/b] [b]open KF-BioticsLab?Mutator=LTI.LTIMut[/b]
(replace the map and add the parameters you need) (replace the map and add the parameters you need)
[*]<Enter>. [*]<Enter>.
@ -38,21 +38,28 @@ https://forums.tripwireinteractive.com/index.php?threads/whitelisting-mods-and-m
[*]Add mutator to server start parameters: [b]?Mutator=LTI.LTIMut[/b] and restart the server. [*]Add mutator to server start parameters: [b]?Mutator=LTI.LTIMut[/b] and restart the server.
[/olist] [/olist]
[h1]Important setup information[/h1]
The config should be created on first start, but now the game contains a bug that initializes the config values randomly if they are not explicitly set. Thus, the config may have incorrect values or not be created at all.
So if you are using this mutator for the first time, I highly recommend doing the following:
[olist]
[*]Create (modify) [b]KFLTI.ini[/b] manually. Put the following content there:
[b][LTI.LTI]
Version=0[/b]
[*]Start the game/server with LTI to generate the contents of the config
[*]Close the game/server
[/olist]
[b]Right now this is the only way to correctly create the default config.[/b]
Unfortunately I can't do anything about it because it's a game problem (not mutator). I hope TWI fixes this someday.
[h1]Setup (KFLTI.ini)[/h1] [h1]Setup (KFLTI.ini)[/h1]
Config will be created at the first start[b]*[/b].
[list] [list]
[*]Set [b]bOfficialWeaponsList=True[/b] to have an auto-updated list of all official weapons in the config (for a convenient copy-paste). [*]Set [b]bOfficialWeaponsList=True[/b] to have an auto-updated list of all official weapons in the config (for a convenient copy-paste).
[*]Use [b][LTI.RemoveItems][/b] to remove items from the trader inventory. [*]Use [b][LTI.RemoveItems][/b] to remove items from the trader inventory.
example: [b]Item=KFGame.KFWeapDef_Mac10[/b] will remove MAC10 from sale. example: [b]Item=KFGame.KFWeapDef_Mac10[/b] will remove MAC10 from sale.
[*]Set [b]bHRG=True[/b] to remove HRG items.
[*]Set [b]bDLC=True[/b] to remove DLC items.
[/list] [/list]
[h1]Troubleshooting[/h1]
[b](*)[/b] If your config is not created for some reason, create it manually with the following content:
[b][LTI.LTI]
Version=0
[/b]
Then start the server and check the file again - config content should be generated.
[h1]Sources[/h1] [h1]Sources[/h1]
[url=https://github.com/GenZmeY/KF2-LootedTraderInventory]https://github.com/GenZmeY/KF2-LootedTraderInventory[/url] [b](GNU GPLv3)[/b] [url=https://github.com/GenZmeY/KF2-LootedTraderInventory]https://github.com/GenZmeY/KF2-LootedTraderInventory[/url] [b](GNU GPLv3)[/b]