-
Notifications
You must be signed in to change notification settings - Fork 6
ZenAntiCombatLogout
Source: https://github.com/ZenarchistCode/ZenAntiCombatLogout
NOTE: This mod is included in my modpack and can be enabled/disabled via ZenAntiCombatLogout in ZenModPackConfig.json

This mod adds automated combat-logout detection and prevention functionality to the server.
I got tired of dealing with reports of combat logging on my servers, so I decided to make an automatic solution. It's not perfect, but for me it's better than nothing.
Once a player is flagged as being engaged in combat, their logout timer is increased significantly (5 minutes by default).
If they exit the game before their logout timer expires, their character will stay on the server until the timer expires, giving other players time to find them before their character disappears.
You can also apply various penalties in the JSON config which I'll explain below.
Whenever a player shoots at another player, or deals any kind of melee damage, both players will be flagged as being engaged in combat.
Whenever a grenade, landmine or other explosive detonates, all players within a 30m radius will be flagged as being engaged in combat (can be increased/decreased/disabled in config).
You can also trigger the combat flag when a player fires a gun, regardless of whether it was at another player or not (disabled by default).
You can also trigger the combat flag when a bullet impact is detected near a player (disabled by default).
You can make the mod spawn a road flare on a player if they exit the game before their logout timer finishes to reveal their character's location (disabled by default).
You can kill a player for exiting the game before their logout timer finishes (disabled by default).
I've designed the mod to limit its impact on server performance, there shouldn't be any issues with the default config even on high pop servers.
If you turn the TriggerOnBulletImpactRadius setting on, there may be a hit to performance on servers with lots of gunfire as every time a bullet impacts a surface the server will scan for nearby players to flag as being in combat. This feature is experimental and it's disabled by default. It shouldn't really be needed, the default method for detecting gunshots at players should suffice in 99% of circumstances.
The mod may potentially be less accurate at detecting gunshots fired at players more than 1km away especially if the player raises their rifle to compensate for bullet drop, but in my testing it seems to work most of the time at long distances and I had no issues detecting close-quarters gunfights.
Should work for all guns including modded rifles, but let me know if you encounter any bugs or issues.
So with the default config, the mod behaves as follows:
If a player shoots a gun at another player (or multiple players), regardless of whether the bullet deals damage to the other player, all players involved will be flagged as being in combat.
If a player shoots a gun while standing within ~5m of another player(s), all players will be flagged as being in combat (regardless of whether they are friends/squadmates or not).
If a player throws a grenade that explodes (or a chem gas grenade), all players within a 30m radius of the explosion will be flagged as being in combat.
Once a player is flagged as being in combat, the server saves a timestamp of when the combat began, and a countdown begins (5 minutes by default). If the player attempts to logout (or Alt F4's, crashes or disconnects from the server) then their character will stay on the server for the duration of the timer.
When the player logs out before their combat log timer expires, a message will be displayed on the logout window explaining why their timer is extended and the potential penalty they will suffer (no penalties by default, but this can be adjusted in the JSON config).
This gives any players engaged in combat plenty of time to find the player and kill them, resulting in less admin requests/server reports from your players.
The messages are stringtable'd and translated to all languages, but if the language translation is wrong for your language feel free to repack the mod and change the stringtable.csv file.
Config file: profiles/Zenarchist/ZenAntiCombatLogoutConfig.json
{
"ConfigVersion": "1.29.1", // Don't touch
"CombatLogoutSecs": 300, // Seconds til player character disconnects if logging out after combat
"DisableExitButtonSecs": 5, // How long to disable EXIT button before allowing force-disconnect
"NotifyPlayerOfPenalty": 1, // Whether or not to notify the player of what is happening
"TriggerOnGunshot": 0, // If enabled (1), then trigger combat log timer for any gunshot
"TriggerForExpansionAI": 0, // If enabled (1), then trigger for player vs Expansion AI bots
"TriggerOnBulletImpactRadius": 0, // This is the meters within a bullet impact to trigger PVP timer
"TriggerOnExplosiveRadius": 30, // This is the meters within an explosion to trigger PVP timer
"DropFlareOnPlayer": 0, // If enabled (1) and a player force-disconnects from PVP, drop a lit flare under them
"KillPlayer": 0, // If enabled (1) and a player force-disconnects from PVP, kill their character immediately
"DiscordWebhooks": [ // A list of Discord webhooks to send potential attempted combat-log situations (for admins)
"OnlyWorksIfZenDiscordAPIPresent"
]
}All my mods are open-source and published under the Mozilla Public License Version 2.0. Any mods based on my code must be open-source - no obfuscation!
You can modify/reupload/repack my mods if you like, but please credit any original authors/3D model/3rd-party asset creators, and keep in mind any future updates I make will not be automatically applied to repacked mods so make sure to check back from time to time for bugfixes and improvements.
If you find my mods useful, please consider buying me a coffee - it's not expected but very much appreciated: https://buymeacoffee.com/zenarchist
- General Setup Guide
- Core Mod Setup Guide
- ZenModPack Master Config
- Various Info
- Known Bugs & Issues
- Report Bug
My utility style mods for debugging etc.
Mods which affect game mechanics:
- ZenAlcohol
- ZenAllowMapBagSlot
- ZenAntiCombatLogout
- ZenAutoConvertStash
- ZenAutoStackItems
- ZenAutoWinterDetect
- ZenAutoRun
- ZenBasebuildingConfig
- ZenBatteryPASPersistence
- ZenBetterChatFont
- ZenBrokenGlasses
- ZenBuildingDescription
- ZenCarAttachments
- ZenCarBatteryIcon
- ZenCarCompass
- ZenCarGlovebox
- ZenCarsCutDownTrees
- ZenCanteenTablets
- ZenCatchRain
- ZenCauseOfDeath
- ZenChickenCoops
- ZenCraftingSounds
- ZenCraftRagHands
- ZenComboLocks
- ZenCombineJSON
- ZenDropRuinedClothing
- ZenDynamicZoneLoot
- ZenEarPlugs
- ZenFireFuel
- ZenFireWood
- ZenFireplaceStick
- ZenFishingConfig
- ZenFixCarAttachmentGUI
- ZenGraves
- ZenGroundCleaning
- ZenHideGearInCars
- ZenHints
- ZenHologram
- ZenHologramControls
- ZenImmersiveChatHUD
- ZenImmersiveLogin
- ZenInformWeaponStateBug
- ZenInventoryAnimation
- ZenKnifeGardens
- ZenLeftovers
- ZenLogPiles
- ZenMagObfuscation
- ZenMap
- ZenMicCheck
- ZenNotifications
- ZenOpenCansRock
- ZenPainting
- ZenPimpMyRide
- ZenRadioPlugin
- ZenRebuildableWells
- ZenRepairJSON
- ZenRepairPumps
- ZenRepairWells
- ZenServerGUI
- ZenShove
- ZenSplitUI
- ZenSleep
- ZenStaminaSlope
- ZenTerritories
- ZenWeaponEngrave
- ZenWoodHealth
- ZenZombieDoors
Mods which add gear to the game:
- ZenArtillery
- ZenBackwardsCaps
- ZenBookshelf
- ZenBunnyMasks
- ZenCamoCamp
- ZenCarWorkbench
- ZenChess
- ZenChristmasTreeCraft
- ZenConcussionGrenade
- ZenDoubleArmbands
- ZenFlask
- ZenFlint
- ZenGhillie
- ZenJameson
- ZenLadders
- ZenMusic
- ZenNotes
- ZenRaidAlarm
- ZenRaybans
- ZenRunes
- ZenStaticObjects
- ZenSwissKnife
- ZenTimeBomb
- ZenTireRack
- ZenTreasure
- ZenTreehouse
- ZenVikingAxe
- ZenZippoLighter
Mods which run purely server-side:
- ZenBloodDrips
- ZenCampSites
- ZenDynamicZoneLoot
- ZenLootCyclingDetection
- ZenNightConfig
- ZenPersistentTrees
- ZenShelterCargo
- ZenTreesplosions
- ZenZombieController
- ZenZombieConfig
- ZenJameson
My standalone mods