Project Zomboid

Project Zomboid

TwisTonFire – Orderly Chaos
 此主题已被置顶,因此可能具有重要性
TwisTonFire  [开发者] 16 小时以前
Mod Authors: How to exclude your items from my clutter pile:
TwisTonFire – Clutter-Pile Exclusion API (for other mods)

What this is:
A tiny API that lets your mod exclude items from TwisTonFire’s clutter-pile system.

Excluded items:
  • Do not count toward pile creation thresholds.
  • Are not auto-absorbed into existing piles.
  • Never get rerouted into a pile; they remain loose on the floor.

Works in SP and MP. You do not need to overwrite any TwisTonFire files.




Quick start (soft dependency – recommended)
Add a small Lua file in your mod, e.g.
media/lua/shared/mymod_exclude_pile.lua

-- Only run if TwisTonFire’s API is present (no hard dependency). Events.OnGameStart.Add(function() if not TWF_GC_RegisterExclusions then return end -- 1) Exclude by fullType strings (Module.Item) TWF_GC_RegisterExclusions({ FullTypes = { "YourMod.YourBackpack", "Base.GoldRing", } }) -- 2) (Optional) Add custom logic: exclude a category/type pattern TWF_GC_RegisterExclusions(function(item) -- Examples: -- return item.getDisplayCategory and item:getDisplayCategory() == "Bicycle" -- return item.getType and item:getType() == "Saddlebag" return false end) end)

This is a soft dependency: if the TwisTonFire clutter module isn’t loaded, nothing breaks.




Alternative (hard dependency)
If you want to require the API, add TwisTonFire as a required mod in your mod.info, then:

require "TWF_GC_Exclusions" Events.OnGameStart.Add(function() TWF_GC_RegisterExclusions({ FullTypes = {"YourMod.SpecialItem"} }) end)

Defaults already excluded by TwisTonFire
Bicycle.Basket Bicycle.Crate Bicycle.Saddlebag

Typical use cases
  • Keep containers loose — backpacks, crates, saddlebags, decorative props, etc.
  • Blacklist style — name items (or rules) to exclude; use a predicate to exclude by category/type.
  • Mixed behavior — exclude only certain variants (e.g., colorways) via specific fullTypes.
最后由 TwisTonFire 编辑于; 16 小时以前