Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

FrameWork Considerations

Unlike MANY mods out there on Project Zomboid, Depraved Sense doesn’t have global values (aside from registries.lua). This is because global values are inherently slow to index on Project Zomboid, and often leads to tech debt in the longer run. So, you won’t find any singleton value containing every single piece of code of the framework. What Depraved Sense does instead, is use modules to keep code organized, and independent.

You will often need to require a specific module in order to use its code. For example, let’s say we want to access the util module TimerManager to create a timer. We would use require to get access to the module and use its code.

---Requiring our target module.
local TimerManager = require("DepravedSense/Utils/Time/TimerManager")

---A simple function that prints on the screen once called.
local function on_timer_end()
    print("Timed!")
end

---We then create a task with that function, which will be triggered in 2 seconds.
TimerManager.create_and_add_task(2.0, on_timer_end)

Annotations

If you take a glance at the code of Depraved Sense, you will notice that there are a lot of @param and @class comments. Those are annotations serve to assist programmers by offering context in what types the values are, and autocomplete during code. These are often analyzed by Lua LSPs like EmmyLua and LuaLS. It is highly recommended to install such LSP for your workspace, alongside Umbrella.

You can find the guide of its annotations right here.

Your own mod folder.

This guide assumes that you already have in hands a proper formatted mod folder to work with. If you don’t have one, you can learn it at PZWiki.

And don’t forget to add depraved_sense_nsfw on the require field of mod.info so your mod loads after Depraved Sense.

Don’t Be Afraid To Ask For Help!

No matter how skilled of a person you are, you will always deal with trouble. Things can go wrong, and sometimes be extra confusing. In cases where you feel lost, and without any sign of direction. DON’T BE AFRAID TO ASK FOR HELP! There will always be someone that will be willing to help you in your specific case.

You can either go at the LoversLab Forum, or Depraved Sense own Discord to ask for assistance!

About AI

It is often popular for beginners to let AI code for them. And, although Depraved Sense is not against AI, use on development, it is completely against vibe-coded mods with no regards with how everything works. These types of mods often cause more trouble at the end of day, with bugs appearing out of nowhere, and making maintenance a complete nightmare.

If you are a beginner, and don’t have a clue on how to code, use AI to learn how to, instead of doing it for you. Researching how a thing are done, or even using it to track down bugs on your own codebase is perfectly fine.

You can still use AI to help you alongside development, but keep in mind that AI by default has no idea how Zomboid works. It is far more difficult managing it, and giving context to it for beginners than to people already used to the tool. So, if you ignore this warning, and your own mod explodes in your face as soon as things break down, don’t say we didn’t warn you.