ZenSleep V1
DEPRECATED! This version is no longer maintained - check out the new V2 version here (compatible with DayZ 1.28): https://steamcommunity.com/sharedfiles/filedetails/?id=3468961047 What Is This? This mod adds an immersive sleeping feature to the game. It is heavily based on and inspired by Lucian's old Medical Attention mod, so most of the credit goes to him (and ◣ ▲▼▲ for updating his mod to work with recent builds… (more)
DEPRECATED! This version is no longer maintained - check out the new V2 version here (compatible with DayZ 1.28): https://steamcommunity.com/sharedfiles/filedetails/?id=3468961047 What Is This? This mod adds an immersive sleeping feature to the game. It is heavily based on and inspired by Lucian's old Medical Attention mod, so most of the credit goes to him (and ◣ ▲▼▲ for updating his mod to work with recent builds of DayZ). It has been designed to be as intuitive and immersive as possible, but keep reading to learn about all the various features and behaviors of this mod. Much more info is in the included readme file. Player Guide: The following information might vary depending on the server settings you're playing on, but with the default settings the mod will behave like this: You have approximately 4-6 hours of full energy on a new character (real time, not server time). Your tiredness will deplete faster or slower depending on the activities you're doing. Sprinting around the map or basebuilding and carrying heavy items will result in you becoming tired faster, while taking it slow will result in a longer wake time. If your "tiredness" meter falls below 20%, your character will start yawning randomly. These yawns are audible to other players like the vanilla sickness sounds and can give your position away, so stay rested! If you allow your tiredness meter to fall below 10%, then you run the risk of randomly falling unconscious from tiredness. If you hit zero then your character will fall asleep on the spot. You can recover your rest using the "Lie Down" emote (NOT the "Lie Back" emote!) The longer you let your player stay sleeping, the faster your energy recovers. Sleeping next to a fire will not only protect you from potentially catching influenza, but will help you rest faster and recover more energy depending on the time of day. Sleeping inside buildings and tents will also allow you to recover energy faster. The fastest way to rest is in a building with a fire lit nearby (fire must be within 3 meters). Rest Limits: During the day you can only recover 50% of your energy sleeping without a fire, or 75% with a fire. During the night you can only recover 80% of your energy sleeping without a fire, or 100% with a fire. Sleeping inside buildings and tents (especially with a fire nearby) is the best way to recover your energy quickly. If your clothes are wet you might not be able to recover the maximum energy, so make sure to dry your clothes before sleeping. Certain drinks can also help you recover your energy (soda cans in particular). Certain meds will make you more sleepy (PO-X injectors especially, but also morphine & epinephrine). There are also some syringes you might find which you can use to keep yourself awake, or put other survivors to sleep... You can also fall asleep while driving (unless the server you play on has turned that option off), so make sure to utilize rest stops often on long drives! All of these features are adjustable on the server-side config so your experience may vary, make sure to check with your server operator for more info on how they set their server up with this mod. Server Owner Guide: Here is a video explaining most of the features of this mod: Video Guide Main Sleep Mod Features (All Configurable in ZenSleepConfig.json): - Sleep meter (configurable: always show, only show on inventory screen, or only show above certain tiredness %) - Random yawn sound when player gets tired (male & female sounds - audible to nearby players) - Chance to randomly fall unconscious when the player gets too tired - Random sleep sounds when player is resting (male & female sounds - audible to nearby players) - Many other small details (explanations are in the mod readme file) Max Rest While Sleeping: - 50% during the day with no fire - 75% during the day with a fire - 80% at night with no fire - 100% at night with a fire - Beware - if you sleep without a fire you might catch influenza (configurable) Other Notes: The mod will detect fires within 3m of the player, and if the fire is lit then it counts as a heat source. If you have issues with fires on certain maps or sleeping next to modded heat sources, try turning "HeatBuffCountsAsFire=true" on. Set DebugOn=1 in the config to get detailed messages explaining what the mod is doing and what values it is detecting. Rest Accelerators: Depending on where you are sleeping will affect how quickly you regenerate energy. The mod can tell when you are sleeping under a roof and if you have a fire lit nearby. - Asleep Outside With No Fire = 1x - Asleep Outside With A Fire = 5% faster - Asleep Inside House or Building With No Fire = 10% faster - Asleep Inside House or Building With A Fire = 20% faster Energy Drinks / Consumption Items: You can add your own energy drinks/consumption items in the json config. The default ones are: - Epinpehrine: +25% rest - Cola: +25% rest - Pipsi: +20% rest - Fronta: + 15% rest - Spite: +10% rest - Kvass: +5% rest The mod checks for energy drink items and rest object types with a "contains" check and is not case-sensitive. A negative value increases energy, a positive value decreases energy. So in other words, if you want to make all soda cans restore 20% of your energy you can just set the JSON config to have this entry: { "ItemType": "sodacan", "EnergyGained": -20 } Some meds will also negatively affect your energy: - AntiChemInjector (PO-X): -100% rest - Morphine: -20% rest Anesthetic & Stimulant Syringes: This mod also comes with 4 custom items: - Anesthetic Syringe (and "used" version) - Stimulant Syringe (and "used" version) The anesthetic syringe puts the player to sleep (can be used on self or others). The stimulant syringe maxes out your rest energy (can be used on self or others). These syringes are optional and can be disabled by simply not adding the types to your types.xml. (If you want to enable them spawning, just copy the text inside the provided types.xml from the mod folder and merge it into your server's types.xml) Rest Objects: You can add specific objects in the json config that affect how the player sleeps. Note: This feature is still in development and doesn't work 100% of the time on some objects. - MediumTent: Max rest during the day with no fire is 80%, you sleep 10% faster and no chance of influenza regardless of fire status. Default Mod Settings A detailed explanation of all the configuration settings is provided in the mod folder's readme. Credits: Lucian & ◣ ▲▼▲ Repacking: Unfortunately due to lack of time I can't maintain all of my mods all of the time. I do my best, but these mods are offered as-is. If there's a problem, you have the source code and my permission to fix it yourself and upload a fixed version to the workshop without any credit necessary. It's all free. As with all my mods the source code is open-source and free to use however you like. You can find the code on my GitHub - www.zenarchist.com Buy Me A Coffee / Contact Me: All my mods are free and open source, but it takes an enormous amount of time to put some of these mods together. If I've helped you out, please consider helping me buy my next coffee! I don't expect it, but I very much appreciate it. To contact me you can send me a message there too - I get an insane amount of messages so it's the best way for me to filter out the noise and focus on people who are willing to support my work with a coffee first: https://buymeacoffee.com/zenarchist Enjoy!
Patterns that can stall a single frame regardless of the load figure — see below.
Every server-visible override preserves its chain.
0.0149% of each server frame at 100 players (0.149 ms/s). Counts hook dispatch and timers only, not what the hooks do inside. Methodology.
Structural load of the 328 scripted mods analyzed, lightest on the left. This mod's bar is lit; 40 others share it. Ranked list.
Per-player hooks carry 99.7% of this mod's structural load. 0.149 ms/s in all.
2 hooks · 0.15 ms/s
2 hooks · 0.0004 ms/s
1 hook · 0.000002 ms/s
| Per-player hooksrun about 30 times a second for each player | 2 hooks | 0.15 ms/s | 99.7% | PlayerBase.CommandHandler, PlayerBase.OnScheduledTick |
| Event hooksrun when something happens: an inventory move, a hit, an action | 2 hooks | 0.0004 ms/s | 0.3% | PlayerBase.OnRPC, PlayerBase.OnVariablesSynchronized |
| Lifecycle hooksrun when an entity is created, loaded or deleted | 1 hook | 0.000002 ms/s | <0.1% | MissionServer.OnInit |
Counts how often each hook is dispatched and how many timers stay alive, not what the code inside does. Some rates are order-of-magnitude estimates; the methodology lists which.
Where this mod runs often
Hooks on per-frame and high-rate surfaces, with what their bodies call. Body work, not the hook itself, is what costs frame time.
Other findings
Per-player-per-frame hooks · 2 · warning
- PlayerBase.CommandHandler runs once per player per tick (~30 Hz/player): cost scales with population on the hottest per-player surface.
ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:933 - PlayerBase.OnScheduledTick runs once per player per tick (~30 Hz/player): cost scales with population on the hottest per-player surface.
ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:908
- PlayerBase.CommandHandler runs once per player per tick (~30 Hz/player): cost scales with population on the hottest per-player surface.
Which vanilla methods the mod hooks, which of them drop the chain, how often each hook fires, and which risky calls sit inside hot hooks.
How long hook bodies take, network cost, or engine-side load. Measured across live fleets, most server lag comes from the engine and world state, not mod script chains — a light footprint does not clear a mod of lag, and a heavy one does not convict it. Methodology.
Everything else
All 24 overrides
Surface is the dispatch tier the rubric can price (— = unpriced); server is whether the override exists on a dedicated server; super() shows whether the vanilla chain is preserved on a server.
| method | surface | server | super() | where |
|---|---|---|---|---|
ActionTargetsCursor.Update |
— | yes | ✓ | ZenSleep.pbo::scripts\5_mission\gui\WidgetOverrides.c:18 |
AnimatedActionBase.Start |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\classes\useractionscomponent\AnimatedActionBase.c:18 |
AntiChemInjector.OnApply |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\itembase\gear\medical\AntiChemInjector.c:3 |
EmoteManager.CanPlayEmote |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\classes\EmoteManager.c:4 |
EmoteManager.PlayEmote |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\classes\EmoteManager.c:17 |
Epinephrine.OnApply |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\itembase\gear\medical\Epinephrine.c:4 |
IngameHud.Init |
— | yes | ✓ | ZenSleep.pbo::scripts\5_mission\gui\IngameHud.c:15 |
IngameHud.SetTiredness |
— | yes | ✗ none | ZenSleep.pbo::scripts\5_mission\gui\IngameHud.c:37 |
IngameHud.RefreshHudVisibility |
— | yes | ✓ | ZenSleep.pbo::scripts\5_mission\gui\IngameHud.c:49 |
IngameHud.Show |
— | yes | ✓ | ZenSleep.pbo::scripts\5_mission\gui\IngameHud.c:137 |
ItemActionsWidget.Update |
— | yes | ✓ | ZenSleep.pbo::scripts\5_mission\gui\WidgetOverrides.c:4 |
MissionGameplay.OnUpdate |
T0 | yes | ✓ | ZenSleep.pbo::scripts\5_mission\mission\MissionGameplay.c:3 |
MissionServer.OnInit |
T3 | yes | ✓ | ZenSleep.pbo::scripts\5_mission\mission\MissionServer.c:3 |
ModifiersManager.Init |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\classes\playermodifiers\ModifiersManager.c:8 |
Morphine.OnApply |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\itembase\gear\medical\Morphine.c:3 |
PlayerBase.Init |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:80 |
PlayerBase.OnPlayerLoaded |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:96 |
PlayerBase.OnVariablesSynchronized |
T2 | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:144 |
PlayerBase.Consume |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:875 |
PlayerBase.OnScheduledTick |
T1 | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:908 |
PlayerBase.CommandHandler |
T1 | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:933 |
PlayerBase.OnRPC |
T2 | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:991 |
PlayerBase.OnUnconsciousStop |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:1030 |
PlayerBase.SpawnShockEffect |
— | yes | ✓ | ZenSleep.pbo::scripts\4_world\entities\manbase\PlayerBase.c:1041 |
Dispatch surfaces and timers the grade prices
| surface | tier | rate (Hz) | rate source | ms/s |
|---|---|---|---|---|
PlayerBase.OnScheduledTick | T1 | 3000.0 | measured | 0.0744 |
PlayerBase.CommandHandler | T1 | 3000.0 | measured | 0.0744 |
PlayerBase.OnVariablesSynchronized | T2 | 8.0 | placeholder | 0.0002 |
PlayerBase.OnRPC | T2 | 8.0 | placeholder | 0.0002 |
MissionServer.OnInit | T3 | 0.1 | placeholder | 0.0000 |
Includes 0.000 ms/s from placeholder-rated surfaces.
Load-order constraints (CfgPatches)
What each PBO declares: its addon identity and the addons it requires to be loaded first (requiredAddons). A partial load-order signal from the mod's own metadata.
ZenSleep.pbo
ZenSleeprequiredVersion 0.1 — requiresDZ_Scripts,DZ_Sounds_Effects
census 1.1 · findings 1.1 · hash 8780c18e516c286c