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
config(LTI);
const LatestVersion = 1;
const LatestVersion = 2;
const CfgRemoveItems = class'RemoveItems';
const CfgOfficialWeapons = class'OfficialWeapons';
@ -71,6 +71,8 @@ private function PreInit()
case `NO_CONFIG:
`Log_Info("Config created");
case 1:
case MaxInt:
`Log_Info("Config updated to version" @ LatestVersion);
break;
@ -139,7 +141,13 @@ private function PostInit()
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;
@ -185,7 +193,9 @@ public function bool CreateRepInfo(Controller C)
Self,
LogLevel,
RemoveItems,
CfgRemoveItems.default.bAll);
CfgRemoveItems.default.bAll,
CfgRemoveItems.default.bHRG,
CfgRemoveItems.default.bDLC);
RepInfos.AddItem(RepInfo);

View File

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

View File

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

View File

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

View File

@ -69,6 +69,8 @@ public static simulated function ModifyTrader(
KFGameReplicationInfo KFGRI,
Array<class<KFWeaponDefinition> > RemoveItems,
bool ReplaceMode,
bool RemoveHRG,
bool RemoveDLC,
E_LogLevel LogLevel)
{
local KFGFxObject_TraderItems TraderItems;
@ -86,7 +88,9 @@ public static simulated function ModifyTrader(
foreach TraderItems.SaleItems(Item)
{
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);
}

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.
[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]
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]
[olist]
[*]Subscribe to this mutator;
[*]Start KF2;
[*]Open console (`) and input:
[*]Open console (~) and input:
[b]open KF-BioticsLab?Mutator=LTI.LTIMut[/b]
(replace the map and add the parameters you need)
[*]<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.
[/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]
Config will be created at the first start[b]*[/b].
[list]
[*]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.
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]
[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]
[url=https://github.com/GenZmeY/KF2-LootedTraderInventory]https://github.com/GenZmeY/KF2-LootedTraderInventory[/url] [b](GNU GPLv3)[/b]