Worldentities
Based on game build 714014 | Last updated: 2026-03-10
Overview
Worldentities is a simple utility module that ensures essential world-scoped entities—specifically pocket dimension containers—are present and properly initialized for every world and shard before entity instantiation occurs during world load. It operates on the raw save data table (savedata.ents) and guarantees at least one instance of each required prefab type exists by inserting placeholder position data ({x=0,z=0}) if none is found.
Usage example
local worldentities = require("worldentities")
-- During world load, after loading savedata but before entity spawning:
worldentities.AddWorldEntities(savedata)
Dependencies & tags
Components used: None identified.
Tags: None identified.
Properties
No public properties.
Main functions
AddWorldEntities(savedata)
- Description: Ensures that all required pocket dimension container prefabs defined in
prefabs/pocketdimensioncontainer_defs.luahave at least one entry insavedata.ents. If an entry is missing, it creates a placeholder position ({x=0,z=0}) to allow the save system to instantiate it later. - Parameters:
savedata(table) — The world save data table, expected to contain anentskey mapping prefab names to arrays of entity spawn data. - Returns: Nothing.
- Error states: None documented. Assumes
savedata.entsis a valid table and thatPOCKETDIMENSIONCONTAINER_DEFSis properly loaded.
Events & listeners
None identified.