Fix: Killing the client will no longer save your items (#557)
* alt-f4 is for timmys and rats, not chads like Chomp * peer review fixes --------- Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
This commit is contained in:
@@ -17,5 +17,6 @@
|
|||||||
"SecuredContainer": false
|
"SecuredContainer": false
|
||||||
},
|
},
|
||||||
"questItems": true,
|
"questItems": true,
|
||||||
"specialSlotItems": false
|
"specialSlotItems": false,
|
||||||
|
"wipeOnRaidStart": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ public record LostOnDeathConfig : BaseConfig
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonPropertyName("questItems")]
|
[JsonPropertyName("questItems")]
|
||||||
public bool QuestItems { get; set; }
|
public bool QuestItems { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("wipeOnRaidStart")]
|
||||||
|
public bool WipeOnRaidStart { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public record LostEquipment
|
public record LostEquipment
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class LocationLifecycleService(
|
|||||||
protected readonly RagfairConfig _ragfairConfig = configServer.GetConfig<RagfairConfig>();
|
protected readonly RagfairConfig _ragfairConfig = configServer.GetConfig<RagfairConfig>();
|
||||||
protected readonly HideoutConfig _hideoutConfig = configServer.GetConfig<HideoutConfig>();
|
protected readonly HideoutConfig _hideoutConfig = configServer.GetConfig<HideoutConfig>();
|
||||||
protected readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
|
protected readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
|
||||||
|
protected readonly LostOnDeathConfig _lostOnDeathConfig = configServer.GetConfig<LostOnDeathConfig>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle client/match/local/start
|
/// Handle client/match/local/start
|
||||||
@@ -128,9 +129,25 @@ public class LocationLifecycleService(
|
|||||||
|
|
||||||
GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive, true, true);
|
GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive, true, true);
|
||||||
|
|
||||||
|
// Handle Player Inventory Wiping checks for alt-f4 prevention
|
||||||
|
HandlePreRaidInventoryChecks(request.PlayerSide, playerProfile.CharacterData.PmcData, sessionId);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle Pre Raid checks Alt-F4 Prevention and player inventory wiping
|
||||||
|
/// </summary>
|
||||||
|
protected void HandlePreRaidInventoryChecks(string playerSide, PmcData pmcData, string sessionId)
|
||||||
|
{
|
||||||
|
// If config enabled, remove players equipped items to prevent alt-F4 from persisting items
|
||||||
|
if (string.Equals(playerSide, "pmc", StringComparison.OrdinalIgnoreCase) && _lostOnDeathConfig.WipeOnRaidStart)
|
||||||
|
{
|
||||||
|
logger.Debug("Wiping player inventory on raid start to prevent alt-f4");
|
||||||
|
inRaidHelper.DeleteInventory(pmcData, sessionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replace map exits with scav exits when player is scavving
|
/// Replace map exits with scav exits when player is scavving
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user