Skip to main content

Prefab List

Version History

Build VersionChange DateChange TypeDescription
6760422025-06-21stableCurrent version

Overview

The prefablist module contains an auto-generated list of all prefab files in Don't Starve Together. This file is generated by exportprefabs.lua and provides the PREFABFILES table that the game uses to load all available prefabs during initialization.

Generated Content

PREFABFILES

Type: table

Status: stable

Description: Array table containing the names of all prefab files in the game. This table is automatically generated and should not be manually edited.

Structure:

PREFABFILES = {
"prefab_name_1",
"prefab_name_2",
-- ... 1400+ prefab files
}

Example Usage:

-- Iterate through all prefab files
for i, prefab_file in ipairs(PREFABFILES) do
print("Prefab file:", prefab_file)
end

-- Check if a specific prefab file exists
local function IsPrefabFileRegistered(name)
for i, prefab_file in ipairs(PREFABFILES) do
if prefab_file == name then
return true
end
end
return false
end

-- Usage
if IsPrefabFileRegistered("wilson") then
print("Wilson prefab file is registered")
end

Categories of Prefabs

The prefab list includes various categories of game objects:

Characters

-- Player characters
"wilson", "willow", "wolfgang", "wendy", "wx78", "wickerbottom",
"woodie", "wes", "waxwell", "wathgrithr", "webber", "winona",
"warly", "wormwood", "wurt", "walter", "wanda"

Items and Tools

-- Basic tools
"axe", "pickaxe", "shovel", "hammer", "pitchfork"

-- Weapons
"spear", "sword_lunarplant", "hambat", "batbat", "tentaclespike"

-- Armor
"armor_grass", "armor_wood", "armor_marble", "armor_ruins"

Structures

-- Basic structures
"campfire", "firepit", "coldfirepit", "treasurechest", "icebox"

-- Crafting stations
"scienceprototyper", "resurrectionstatue", "tent", "cookpot"

Creatures

-- Hostile creatures
"spider", "hound", "tallbird", "beefalo", "koalefant"

-- Bosses
"deerclops", "bearger", "dragonfly", "moose", "antlion", "klaus"

Plants and Resources

-- Trees and plants
"evergreens", "deciduoustrees", "grass", "sapling", "berrybush"

-- Resources
"rocks", "flint", "goldnugget", "log", "cutstone"

Special Effects

-- Visual effects
"fx", "fire", "campfirefire", "torchfire", "explode_small"

-- Particle systems
"smoke_plant", "steam", "splash_spiderweb"

File Generation

The PREFABFILES table is automatically generated by the exportprefabs.lua script. This ensures that:

  1. Completeness - All prefab files are included
  2. Accuracy - No missing or incorrect entries
  3. Consistency - Updates automatically with game changes
  4. Performance - Optimized loading order

Generation Process:

-- The export script scans the prefabs directory and creates:
PREFABFILES = {
-- Automatically populated from /prefabs/*.lua files
}

Usage in Game Systems

Prefab Loading

-- The game loads all prefabs during initialization
for i, prefab_file in ipairs(PREFABFILES) do
require("prefabs/"..prefab_file)
end

Mod Integration

-- Mods can add additional prefabs
table.insert(PREFABFILES, "my_custom_prefab")

-- Or check for prefab existence
local function HasPrefabFile(name)
return table.contains(PREFABFILES, name)
end

Development Tools

-- Count total prefabs
print("Total prefab files:", #PREFABFILES)

-- Find prefabs by pattern
local function FindPrefabsMatching(pattern)
local matches = {}
for i, prefab_file in ipairs(PREFABFILES) do
if string.find(prefab_file, pattern) then
table.insert(matches, prefab_file)
end
end
return matches
end

-- Find all character prefabs
local characters = FindPrefabsMatching("^w") -- Most characters start with 'w'

Current Statistics

Based on build version 676042:

  • Total Prefab Files: 1,431
  • Characters: 17 playable characters
  • Bosses: 20+ major boss creatures
  • Items: 300+ tools, weapons, and equipment
  • Structures: 100+ buildable structures
  • Creatures: 200+ mobs and animals
  • Resources: 150+ harvestable materials

Important Notes

Auto-Generated File

  • Do not manually edit - Changes will be overwritten
  • Generated by: exportprefabs.lua script
  • Updates: Automatically with each game build

Load Order

  • Prefabs are loaded in array order
  • Dependencies are handled by the prefab system
  • Missing files will cause load errors

Naming Conventions

  • Prefab file names match their primary prefab name
  • Underscores separate words: ancient_tree
  • No file extensions in the table