Project Zomboid

Project Zomboid

Common Sense
 This topic has been pinned, so it's probably important
Braven  [developer] 18 May, 2023 @ 5:11pm
For Modders
Here's a simple to understand, but in-depth guide for how to make your Mod compatible with the Common Sense mod. If you need any help, you can write a comment here. However I would appreciate it if you could join my Discord server[discord.com] because it'd be much better to have a conversation there.

I ask that you subscribe to this Discussion so you don't miss out on updates. This will rarely be updated, if at all, because all of this is supposed to be future proof. However, we wouldn't want your mod(s) breaking due to an update would we?

Prying Mechanic
This mechanic allows the Player to pry open doors, windows, etc. from Structures and Vehicles.

This is done through a list of allowed items that Common Sense keeps track of.
You can extend this functionality to any equipment item you want through code, be it Vanilla or Custom items. It is possible to both add and remove items from this list at any time without problem, allowing for a close, dynamic control over what can be used and what can't, when and how you want.

To add an item to the list, call the CommonSense.AddPryingTool function, and provide a String containing the ID (Module and Name) of the item.
Example:
CommonSense.AddPryingTool("Module.ItemName")

To remove an item to the list, call the CommonSense.RemovePryingTool function, and provide a String containing the ID (Module and Name) of the item.
Example:
CommonSense.RemovePryingTool("Module.ItemName")

Below is an example that calls a function on Game Start called ExtendToCommonSense It will then add the Shovel item to the list of items that can be used to pry stuff open.
local ExtendToCommonSense = function () CommonSense.AddPryingTool("Base.Shovel") end Events.OnGameStart.Add(ExtendToCommonSense);

Still need help?
Join my Discord server[discord.gg] now! I'm more active there and will gladly help you with any issues you might have.
Last edited by Braven; 28 May, 2023 @ 12:45pm