Debugcommands
Based on game build 714014 | Last updated: 2026-03-21
Overview
The debugcommands module provides an extensive collection of console commands and helper functions designed for developers and testers working with Don't Starve Together. This component serves as the primary interface for debugging game systems, spawning test entities, manipulating world state, verifying UI components, and exporting data for analysis. Commands cover entity spawning (prefabs, layouts, static structures), component manipulation (health, sanity, domestication, skills), world system control (weather, season, moon phase, moonstorms), event testing (Lava Arena, Year of the Catcoon, achievements), and data export utilities (scrapbook generation, hash collision testing, topology visualization). Most functions operate on the master simulation and require console access. The module integrates with numerous game components including riftspawner, moonstormmanager, domesticatable, skinner, combat, inventory, and workable to enable comprehensive testing scenarios.
Usage example
-- Spawn a grid of test entities at console position
d_spawnlist({"beefalo", "spider", "tree"}, 3)
-- Set player skin mode and clothing
d_skin_mode("normal_skin")
d_clothing("winter_hat")
-- Start a moonstorm at current position
d_startmoonstorm()
-- Test combat DPS on selected entity
d_testdps(10, ConsoleWorldEntityUnderMouse())
-- Generate scrapbook data for all prefabs
d_createscrapbookdata(true)
-- Unlock all achievements for testing
d_unlockallachievements()
Dependencies & tags
External dependencies:
scrapbook_prefabs-- Required at start of chunkwx78_moduledefs-- Required in d_allcircuits for module definitionsprefabs/skilltree_defs-- Required in skill tree functions for definitionsscreens/thankyoupopup-- Required in d_test_thank_youskin_gifts-- Required in d_test_thank_you for gift typesscreens/skinsitempopup-- Required in d_test_skins_popupscreens/giftitempopup-- Required in d_test_skins_giftscreens/redux/itemboxopenerpopup-- Required in d_test_mystery_boxTheWorld-- Used for world components, events, and map accessTheSim-- Used for persistent string and entity findingTheFrontEnd-- Used for pushing UI screensTheInventory-- Used for getting full inventory in d_cycle_clothingTheGenericKV-- Used in d_unlockaffinitiesAllRecipes-- Iterated in d_playeritemsPrefabs-- Lookup table for prefab validationTUNING-- Used for lunar hail cooldownSTRINGS-- Used for skill tree string lookupTileGroupManager-- Used for tile filtering in explore functionsTENDENCY-- Used in d_domesticatedbeefaloConsoleWorldPosition-- Global function for getting spawn positionConsoleCommandPlayer-- Global function for getting player entityc_spawn-- Console command for spawningc_give-- Console command for giving itemsc_announce-- Console command for announcementsSpawnPrefab-- Global function for spawning prefabsVector3-- Used for position calculationsTheItems-- Report event progress for achievementsTheNet-- GetUserID for achievement reportingConsoleWorldEntityUnderMouse-- Get entity under cursor for hidingWORLD_TILES-- Lookup tile IDs in d_groundTILE_SCALE-- Scale coordinates in layout spawningNODE_TYPE-- Set node type in topologySpawnSaveRecord-- Spawn layout entitiesEnts-- Pass to LoadPostPassFunctionOrValue-- Resolve data functionPickSomeWithDups-- Select random hat/weapon in d_islandstartGetAllWinterOrnamentPrefabs-- Get list of ornamentsEventAchievements-- Get active achievement IDsworldtiledefs-- Required for turf definitionsmap/object_layout-- Required for layout spawning logicprefabs/oceanfishdef-- Required for fish definitionsjson-- Encode achievement datac_mat-- Console material commandc_select-- Console select commandDebugSpawn-- Debug spawn functionprefabs/farm_plant_defs-- Required to access PLANT_DEFS for farm related spawnsprefabs/fertilizer_nutrient_defs-- Required to access SORTED_FERTILIZERScooking-- Required to access recipe data and recipe_cardsprefabs/pillow_defs-- Required to iterate pillow materialsTheInput-- Used to get world position for spawningTheCookbook-- Used to learn food stats and add recipesALL_HAT_PREFAB_NAMES-- Used to list all hat prefabsPROTOTYPER_DEFS-- Used to list all crafting stationsGLOBAL-- Accessed for console commands like c_spawn, c_remove, c_selecttechtree-- Required to check recipe tech levelsprefabs/waxed_plant_common-- Required to wax plantsThePlayer-- Accessed for position, HUD, and componentsAllPlayers-- Accessed to get first player for sound testing
Components used:
riftspawner-- Accessed via TheWorld.components.riftspawner for rift managementsharkboimanager-- Accessed via TheWorld.components.sharkboimanager for ocean arenaropebridgemanager-- Accessed via TheWorld.components.ropebridgemanager for bridge destructionrabbitkingmanager-- Accessed via TheWorld.components.rabbitkingmanager for rabbit king creationskilltreeupdater-- Accessed via player.components.skilltreeupdater for skill resetweather-- Accessed via TheWorld.net.components.weather for lunar haildomesticatable-- Accessed on beefalo for domestication statsrideable-- Accessed on beefalo for saddle equippinghealth-- Accessed on walls for setting percentbuilder-- Accessed on player for unlocking recipesscenariorunner-- Added and configured on spawned entitiesskinner-- Accessed on player for skin/clothing changesinventoryitem-- Accessed on items for landing state during teleportwalkableplatform-- Accessed on boat for player snappingknownlocations-- Accessed on creature for home locationcombat-- Accessed on creature for target settingfollower-- Accessed on spiders for leader settingstackable-- Accessed on items for stack sizeworkable-- Accessed in d_stalkersetup to modify work leftrepairable-- Accessed in d_stalkersetup to trigger onrepairedhideandseekhider-- Accessed in d_hidekitcoon and d_allcustomhidingspots to force hidinglavaarenaevent-- Accessed in d_lavaarena_speech to get Boarlordspecialeventsetup-- Accessed in d_hidekitcoons to setup eventhunter-- Accessed in d_hunt to force huntsanity-- Accessed in d_islandstart to set percentpetleash-- Accessed in d_waxwellworker and d_waxwellprotector to spawn petyotc_racestats-- Accessed in d_ratracer to set statsinventory-- Accessed in d_ratracer to give itemcyclable-- Used to set step on singing shellsgrowable-- Used to advance growth stages on plantsmoonstormmanager-- Used to start/stop moonstorms on TheWorldnamed-- Used to set names on recipe cardsfiniteuses-- Read to dump item durabilityperishable-- Read to dump item spoil timeedible-- Read to dump food valuesweapon-- Read to dump weapon damageplanardamage-- Read to dump planar damagearmor-- Read to dump armor statslunarthrall_plantspawner-- Used to spawn moon plant on targetactivatable-- Checked in scrapbook data generationburnable-- Checked for canlight and ignorefuelcentipedebody-- Set num_torso in d_spawncentipedechildspawner-- Accessed for dependency calculationequippable-- Accessed for dapperness and equipsloterasablepaper-- Accessed for erased_prefabfishable-- Checked for scrapbook datafloater-- Accessed in d_tweak_floaterforgerepair-- Accessed for repairmaterialforgerepairable-- Accessed for repairmaterialfuel-- Accessed for fueltype and fuelvaluefueled-- Accessed for maxfuel and rateharvestable-- Checked for scrapbook datainspectable-- Accessed for nameoverrideinsulator-- Accessed for GetInsulationlocomotor-- Used to Stop or WalkForwardlootdropper-- Accessed for GetAllPossibleLootmigrationmanager-- Accessed on TheWorld for debug datamutatedbuzzardcircler-- Used to SetCircleTarget and Startoar-- Accessed for force and max_velocityoceanfishingtackle-- Accessed for casting_data and lure_dataperiodicspawner-- Accessed for dependency calculationpickable-- Checked for scrapbook dataplanardefense-- Accessed for basedefenseprototyper-- Accessed for treessaddler-- Accessed for bonusdamagesanityaura-- Accessed for aurashadowthrall_mimics-- Accessed on TheWorldsnowmandecor-- Checked for scrapbook dataspawner-- Accessed for dependency calculationspellbook-- Used to SelectSpellstewer-- Checked for scrapbook datatool-- Accessed for actionstrader-- Used to AcceptGiftupgradeable-- Accessed for upgradetypeupgrader-- Accessed for upgradetypeunwrappable-- Used to WrapItemsvaultroom-- Used to LoadRoomwagpunk_arena_manager-- Used to DebugSkipStatewaterproofer-- Accessed for GetEffectivenesswaxable-- Checked for NeedsSpray
Tags:
cave-- checkboat-- check_inventoryitem-- checkFX-- checkNOCLICK-- checkDECOR-- checkINLIMBO-- check_combat-- checkplayer-- checkCLASSIFIED-- addshadow_aligned-- checklunar_aligned-- checkshadowthrall_centipede-- checkwall-- checksmallepic-- checkhaunted-- checkbird-- checkpig-- checkmerm-- checkhound-- checkchess-- checkoceanfish-- checkfarm_plant-- checkspider-- checktree-- checkstructure-- checkhat-- checkbook-- checkcampfire-- checklightbattery-- checkNPCcanaggro-- checkepic-- checkheavy-- checkshadow-- checkbrightmare-- check
Properties
| Property | Type | Default Value | Description |
|---|
Main functions
d_spawnlist(list, spacing, fn)
- Description: Spawns a grid of entities from a list at the console world position.
- Parameters:
list-- Table of prefab names or tables containing prefab, count, and init functionspacing-- Number, distance between spawned entities (default 2)fn-- Function, optional callback executed on each spawned instance
- Returns: Table of created entity instances
d_playeritems()
- Description: Spawns all craftable items associated with player builder tags in a grid.
- Parameters: None
- Returns: nil
d_allmutators()
- Description: Gives the player all mutator items (warrior, dropper, hider, etc.).
- Parameters: None
- Returns: nil
d_allcircuits()
- Description: Spawns all WX-78 module circuits in a grid at the console position.
- Parameters: None
- Returns: nil
d_allheavy()
- Description: Spawns a collection of heavy physics objects in a grid pattern.
- Parameters: None
- Returns: nil
d_spiders()
- Description: Spawns various spider types and sets them to follow the player.
- Parameters: None
- Returns: nil
d_particles()
- Description: Spawns emitting FX prefabs and attaches labels, orbiting them around a center point.
- Parameters: None
- Returns: nil
d_decodedata(path)
- Description: Loads a persistent string from the sim and saves it as a decoded version.
- Parameters:
path-- String, file path to decode persistent string data
- Returns: nil
- Error states: Prints error if load fails
d_riftspawns()
- Description: Announces rift opening, pushes world event, and spawns 200 rifts after 10 seconds.
- Parameters: None
- Returns: nil
d_lunarrift()
- Description: Enables lunar rifts and spawns one at the console position tile center.
- Parameters: None
- Returns: nil
d_shadowrift()
- Description: Enables shadow rifts and spawns one at the console position tile center.
- Parameters: None
- Returns: nil
d_oceanarena()
- Description: Triggers the sharkboimanager to find and place an ocean arena over time.
- Parameters: None
- Returns: nil
- Error states: Announces error if sharkboimanager is missing
d_exploreX(filterfn, precision)
- Description: Iterates map tiles and reveals areas for the player based on a filter function.
- Parameters:
filterfn-- Function, takes tile, tx, ty and returns booleanprecision-- Number, grid step size (default 5)
- Returns: nil
- Error states: Announces if not playing as a character
d_exploreland()
- Description: Reveals all land tiles on the map for the player.
- Parameters: None
- Returns: nil
d_exploreocean()
- Description: Reveals all ocean tiles on the map for the player.
- Parameters: None
- Returns: nil
d_explore_printunseentiles()
- Description: Prints coordinates of unseen land tiles to the console.
- Parameters: None
- Returns: nil
d_teleportboat(x, y, z)
- Description: Teleports the player's current boat to a position, handling physics and items.
- Parameters:
x-- Number, optional target x coordinatey-- Number, optional target y coordinatez-- Number, optional target z coordinate
- Returns: nil
- Error states: Returns if not on a boat or exit is blocked
d_breakropebridges(delaytime)
- Description: Destroys all rope bridges on the map, optionally with a delay sequence.
- Parameters:
delaytime-- Number, optional delay time for destruction
- Returns: nil
- Error states: Returns if ropebridgemanager is missing
d_rabbitking(kind)
- Description: Creates a Rabbit King entity for the player via the rabbitkingmanager.
- Parameters:
kind-- String, optional rabbit king variant kind
- Returns: nil
- Error states: Returns if not master sim or manager missing
d_fullmoon()
- Description: Sets the moon phase to full on the master simulation.
- Parameters: None
- Returns: nil
d_newmoon()
- Description: Sets the moon phase to new on the master simulation.
- Parameters: None
- Returns: nil
d_unlockaffinities()
- Description: Sets KV flags for Fuelweaver and Celestial Champion killed to unlock affinities.
- Parameters: None
- Returns: nil
d_resetskilltree()
- Description: Deactivates all player skills and adds max XP to the skill tree updater.
- Parameters: None
- Returns: nil
- Error states: Returns if not master sim or no player
d_reloadskilltreedefs()
- Description: Triggers a debug rebuild of skill tree definitions.
- Parameters: None
- Returns: nil
d_printskilltreestringsforcharacter(character)
- Description: Prints missing skill tree localization strings for a character to the console.
- Parameters:
character-- String, prefab name (default console player)
- Returns: nil
d_togglelunarhail()
- Description: Toggles lunar rifts and triggers weather long update for lunar hail event.
- Parameters: None
- Returns: nil
d_allsongs()
- Description: Gives the player all battlesong items.
- Parameters: None
- Returns: nil
d_allstscostumes()
- Description: Gives the player all STS costume masks and bodies.
- Parameters: None
- Returns: nil
d_domesticatedbeefalo(tendency, saddle)
- Description: Spawns a beefalo, maximizes domestication stats, and equips a saddle.
- Parameters:
tendency-- String, tendency key for domesticationsaddle-- String, prefab name for saddle (default saddle_basic)
- Returns: nil
d_domestication(domestication, obedience)
- Description: Sets the domestication and obedience of the selected entity to specific values.
- Parameters:
domestication-- Number, target domestication valueobedience-- Number, target obedience value
- Returns: nil
- Error states: Prints error if selected ent not domesticatable
d_testwalls()
- Description: Spawns walls of various materials with varying health percentages.
- Parameters: None
- Returns: nil
d_testruins()
- Description: Unlocks recipes for the player and gives a set of ruin exploration items.
- Parameters: None
- Returns: nil
d_combatgear()
- Description: Gives the player basic combat armor and weapons.
- Parameters: None
- Returns: nil
d_teststate(state)
- Description: Forces the selected entity's stategraph to go to a specific state.
- Parameters:
state-- String, state graph state name
- Returns: nil
d_anim(animname, loop)
- Description: Plays an animation on the debug entity.
- Parameters:
animname-- String, animation name to playloop-- Boolean, whether to loop the animation
- Returns: nil
- Error states: Prints error if no DebugEntity selected
d_light(c1, c2, c3)
- Description: Sets the ambient light colour in the simulation.
- Parameters:
c1-- Number, color componentc2-- Number, color component (default c1)c3-- Number, color component (default c1)
- Returns: nil
d_combatsimulator(prefab, count, force)
- Description: Spawns combat entities and optionally sets them to target nearby combatants.
- Parameters:
prefab-- String, prefab name to spawncount-- Number, number of entities to spawn (default 1)force-- Boolean, whether to force aggro on nearby combat entities
- Returns: nil
d_spawn_ds(prefab, scenario)
- Description: Spawns an entity, attaches a scenario runner, and executes a scenario script.
- Parameters:
prefab-- String, prefab to spawnscenario-- String, scenario script name
- Returns: nil
- Error states: Prints error if no entity selected
d_test_thank_you(param)
- Description: Pushes the ThankYouPopup screen with a skin gift item.
- Parameters:
param-- String, item name for the popup
- Returns: nil
d_test_skins_popup(param)
- Description: Pushes the SkinsItemPopUp screen for a specific item.
- Parameters:
param-- String, item name for the popup
- Returns: nil
d_test_skins_announce(param)
- Description: Triggers a networking skin announcement for an item.
- Parameters:
param-- String, item name for the announcement
- Returns: nil
d_test_skins_gift(param)
- Description: Pushes the GiftItemPopUp screen for the player.
- Parameters:
param-- String, item name for the gift popup
- Returns: nil
d_test_mystery_box(params)
- Description: Pushes the ItemBoxOpenerPopup screen for a mystery box.
- Parameters:
params-- Table, optional configuration for the box opener popup
- Returns: nil
d_print_skin_info()
- Description: Prints skin name and usability strings for a set of test items.
- Parameters: None
- Returns: nil
d_skin_mode(mode)
- Description: Sets the console player's skinner component to a specific skin mode.
- Parameters:
mode-- String, skin mode type
- Returns: nil
d_skin_name(name)
- Description: Sets the console player's skinner component to a specific skin name.
- Parameters:
name-- String, skin name to apply
- Returns: nil
d_clothing(name)
- Description: Sets the console player's clothing to a specific item.
- Parameters:
name-- String, clothing item name
- Returns: nil
d_clothing_clear(type)
- Description: Clears the console player's clothing for a specific type.
- Parameters:
type-- String, clothing type to clear
- Returns: nil
d_cycle_clothing()
- Description: Cycles through the player's inventory clothing items every 10 seconds.
- Parameters: None
- Returns: nil
d_sinkhole()
- Description: Spawns an antlion sinkhole and triggers its collapse event.
- Parameters: None
- Returns: nil
d_stalkersetup()
- Description: Spawns a fossil stalker mound, repairs it fully, and gives shadow heart and atrium key items.
- Parameters: None
- Returns: nil
d_resetruins()
- Description: Pushes the resetruins event to TheWorld.
- Parameters: None
- Returns: nil
d_getwidget()
- Description: Returns the currently selected debug widget target from TheFrontEnd.
- Parameters: None
- Returns: Widget
d_halloween()
- Description: Spawns all trinket and halloweencandy prefabs in a grid pattern.
- Parameters: None
- Returns: nil
d_potions()
- Description: Spawns all halloween potion prefabs in a grid pattern.
- Parameters: None
- Returns: nil
d_weirdfloaters()
- Description: Spawns a predefined list of floatable item prefabs in a grid pattern.
- Parameters: None
- Returns: nil
d_wintersfeast()
- Description: Spawns all winter ornament prefabs in a grid pattern.
- Parameters: None
- Returns: nil
d_wintersfood()
- Description: Spawns all winter food prefabs in a grid pattern.
- Parameters: None
- Returns: nil
d_madsciencemats()
- Description: Gives all halloween experiment materials to the player.
- Parameters: None
- Returns: nil
d_showalleventservers()
- Description: Toggles the _showalleventservers flag on TheFrontEnd.
- Parameters: None
- Returns: nil
d_lavaarena_skip()
- Description: Pushes the ms_lavaarena_endofstage event to skip the current stage.
- Parameters: None
- Returns: nil
d_lavaarena_speech(dialog, banter_line)
- Description: Makes the Boarlord entity speak specific dialog lines during the Lava Arena event.
- Parameters:
dialog-- String key for STRINGS table or table of linesbanter_line-- Index for banter line selection if dialog is a table
- Returns: nil
d_unlockallachievements()
- Description: Reports event progress to TheItems to unlock all active achievements.
- Parameters: None
- Returns: nil
d_unlockfoodachievements()
- Description: Reports event progress to TheItems to unlock all food-related achievements.
- Parameters: None
- Returns: nil
d_reportevent(other_ku)
- Description: Reports specific event progress data to TheItems for testing.
- Parameters:
other_ku-- Optional Klei User ID for secondary player stats
- Returns: nil
d_ground(ground, pt)
- Description: Sets the map tile at the specified coordinates to the specified ground type.
- Parameters:
ground-- Tile ID or string name of the ground tilept-- Vector3 position, defaults to ConsoleWorldPosition
- Returns: nil
d_portalfx()
- Description: Pushes the ms_newplayercharacterspawned event for ThePlayer.
- Parameters: None
- Returns: nil
d_walls(width, height)
- Description: Spawns wood walls in a rectangular formation around the player.
- Parameters:
width-- Width of the wall rectangle, defaults to 10height-- Height of the wall rectangle, defaults to width
- Returns: nil
d_hidekitcoon()
- Description: Spawns a kitcoon and forces it to hide in the entity under the mouse cursor.
- Parameters: None
- Returns: nil
d_hidekitcoons()
- Description: Initializes the Year of the Catcoon special event setup.
- Parameters: None
- Returns: nil
d_allkitcoons()
- Description: Spawns all kitcoon biome variants using d_spawnlist.
- Parameters: None
- Returns: nil
d_allcustomhidingspots()
- Description: Spawns custom hiding spots and associates kitcoons with them.
- Parameters: None
- Returns: nil
d_hunt()
- Description: Triggers the DebugForceHunt function on the world's hunter component.
- Parameters: None
- Returns: nil
d_islandstart()
- Description: Gives the player a set of starter survival items and randomizes sanity.
- Parameters: None
- Returns: nil
d_waxwellworker()
- Description: Spawns a shadow worker pet for the player and records spawn location.
- Parameters: None
- Returns: nil
d_waxwellprotector()
- Description: Spawns a shadow protector pet for the player and records spawn location.
- Parameters: None
- Returns: nil
d_boatitems()
- Description: Spawns all boat construction item prefabs.
- Parameters: None
- Returns: nil
d_giveturfs()
- Description: Gives the player all turf items defined in worldtiledefs.
- Parameters: None
- Returns: nil
d_turfs()
- Description: Spawns all turf items defined in worldtiledefs.
- Parameters: None
- Returns: nil
_SpawnLayout_AddFn(prefab, points_x, points_y, current_pos_idx, entitiesOut, width, height, prefab_list, prefab_data, rand_offset)
- Description: Local helper function to spawn entities for a layout definition.
- Parameters:
prefab-- Prefab name to spawnpoints_x-- Array of x coordinatespoints_y-- Array of y coordinatescurrent_pos_idx-- Current index in coordinate arraysentitiesOut-- Table to store spawned entitieswidth-- Layout widthheight-- Layout heightprefab_list-- List of prefabsprefab_data-- Data table for spawn recordrand_offset-- Boolean for random offset
- Returns: nil
AddTopologyData(topology, left, top, width, height, room_id, tags)
- Description: Adds a node to the topology data structure.
- Parameters:
topology-- Topology tableleft-- Left coordinatetop-- Top coordinatewidth-- Room widthheight-- Room heightroom_id-- Identifier for the roomtags-- Table of tags for the node
- Returns: index
AddTileNodeIdsForArea(world_map, node_index, left, top, width, height)
- Description: Sets the tile node ID for a rectangular area on the map.
- Parameters:
world_map-- World map componentnode_index-- Index of the topology nodeleft-- Left coordinatetop-- Top coordinatewidth-- Area widthheight-- Area height
- Returns: nil
d_spawnlayout(name, data)
- Description: Spawns a static layout at the player's position, optionally updating topology.
- Parameters:
name-- Name of the layout definitiondata-- Optional table containing id, tags, and density settings
- Returns: nil
d_allfish()
- Description: Spawns all fish prefabs defined in oceanfishdef.
- Parameters: None
- Returns: nil
d_fishing()
- Description: Spawns all ocean fishing related items (rods, lures, bobbers).
- Parameters: None
- Returns: nil
d_tables()
- Description: Spawns multiple winter feast tables in a grid.
- Parameters: None
- Returns: nil
d_gofishing()
- Description: Gives the player fishing rod and various bobbers and lures.
- Parameters: None
- Returns: nil
d_radius(radius, num, lifetime)
- Description: Spawns flint items in a circle that remove themselves after a delay.
- Parameters:
radius-- Radius of the circle, defaults to 4num-- Number of items, defaults to max(5, radius*2)lifetime-- Time in seconds before removal, defaults to 10
- Returns: nil
d_ratracer(speed, stamina, direction, reaction)
- Description: Spawns a carrat and sets its YOTC race stats to specified values.
- Parameters:
speed-- Speed stat valuestamina-- Stamina stat valuedirection-- Direction stat valuereaction-- Reaction stat value
- Returns: nil
d_ratracers()
- Description: Spawns multiple carrats with varying race stats and colors, giving them to the main character.
- Parameters: None
- Returns: nil
d_setup_placeholders(reuse, out_file_name)
- Description: Generates speech placeholder files by iterating through speech tables and writing to a file.
- Parameters:
reuse-- table, speech table to reuse or populateout_file_name-- string, path to the output file
- Returns: nil
d_allshells()
- Description: Spawns singing shells of different sizes in a grid pattern at the input position.
- Parameters: None
- Returns: nil
d_fish(swim, r, g, b)
- Description: Spawns ocean fish, optionally removes their brain, sets position, removes NOCLICK tag, and sets color.
- Parameters:
swim-- boolean, whether to keep brain (swim behavior)r-- number, red color componentg-- number, green color componentb-- number, blue color component
- Returns: nil
d_farmplants(grow_stage, oversized)
- Description: Spawns farm plants based on plant definitions, advancing growth stages and setting oversized flag.
- Parameters:
grow_stage-- number, growth stage to advanceoversized-- boolean, force oversized growth
- Returns: nil
d_plant(plant, num_wide, grow_stage, spacing)
- Description: Spawns a specific plant prefab in a grid pattern, optionally advancing growth stages.
- Parameters:
plant-- string, prefab namenum_wide-- number, grid sizegrow_stage-- number, growth stagespacing-- number, distance between plants
- Returns: nil
d_seeds()
- Description: Spawns all seed prefabs defined in farm plant definitions.
- Parameters: None
- Returns: nil
d_fertilizers()
- Description: Spawns all fertilizer prefabs defined in nutrient definitions.
- Parameters: None
- Returns: nil
d_oversized()
- Description: Spawns all oversized produce prefabs defined in farm plant definitions.
- Parameters: None
- Returns: nil
d_startmoonstorm()
- Description: Starts a moonstorm at the console world position node.
- Parameters: None
- Returns: nil
d_stopmoonstorm()
- Description: Stops the current moonstorm.
- Parameters: None
- Returns: nil
d_moonaltars()
- Description: Spawns various moon altars around the input position.
- Parameters: None
- Returns: nil
d_cookbook()
- Description: Iterates through cooking recipes and adds them to TheCookbook with dummy ingredients.
- Parameters: None
- Returns: nil
d_statues(material)
- Description: Spawns chess piece statues of various types with specified material.
- Parameters:
material-- string or number, material type for statues
- Returns: nil
d_craftingstations()
- Description: Spawns all prototyper crafting stations.
- Parameters: None
- Returns: nil
d_removeentitywithnetworkid(networkid, x, y, z)
- Description: Finds and removes an entity matching the given network ID within a radius.
- Parameters:
networkid-- number, network ID of entity to removex-- number, search center xy-- number, search center yz-- number, search center z
- Returns: nil
d_recipecards()
- Description: Spawns cooking recipe cards with names set via the named component.
- Parameters: None
- Returns: nil
d_spawnfilelist(filename, spacing)
- Description: Reads a file from persistent storage and spawns prefabs listed within it.
- Parameters:
filename-- string, name of file containing prefab listspacing-- number, spacing between spawned items
- Returns: nil
d_spawnallhats()
- Description: Spawns all hat prefabs defined in ALL_HAT_PREFAB_NAMES.
- Parameters: None
- Returns: nil
spawn_mannequin_and_equip_item(item)
- Description: Helper function to spawn a mannequin and equip a given item on it.
- Parameters:
item-- Entity, item to equip on mannequin
- Returns: nil
d_spawnallhats_onstands()
- Description: Spawns all hats on sewing mannequins.
- Parameters: None
- Returns: nil
d_spawnallarmor_onstands()
- Description: Spawns all armor and vest prefabs on sewing mannequins.
- Parameters: None
- Returns: nil
d_spawnallhandequipment_onstands()
- Description: Spawns all hand equipment prefabs on sewing mannequins.
- Parameters: None
- Returns: nil
d_allpillows()
- Description: Spawns all pillow prefabs defined in pillow_defs.
- Parameters: None
- Returns: nil
d_allpillows_onstands()
- Description: Spawns all pillow prefabs on sewing mannequins.
- Parameters: None
- Returns: nil
d_spawnequipment_onstand(...)
- Description: Spawns a mannequin at console position and equips provided items on it.
- Parameters:
...-- vararg, list of prefab names to spawn
- Returns: nil
d_daywalker(chain)
- Description: Spawns a daywalker and surrounding pillars, optionally setting prisoners.
- Parameters:
chain-- boolean, whether to chain pillars to daywalker
- Returns: nil
d_moonplant()
- Description: Spawns a moon plant on the currently selected entity.
- Parameters: None
- Returns: nil
d_punchingbags()
- Description: Spawns various punching bag prefabs.
- Parameters: None
- Returns: nil
d_skilltreestats()
- Description: Prints skill tree statistics for all characters to the console.
- Parameters: None
- Returns: nil
d_dumpCreatureTXT()
- Description: Iterates through prefabs, spawns them, and writes health and damage stats to creatures.txt.
- Parameters: None
- Returns: nil
d_dumpItemsTXT()
- Description: Iterates through prefabs, spawns them, and writes inventory item data to items.txt.
- Parameters: None
- Returns: nil
d_structuresTXT()
- Description: Writes structure prefab data to a text file named structures.txt.
- Parameters: None
- Returns: nil
Scrapbook_AddInfo(tbl, key, value)
- Description: Helper function to add formatted key-value info to the scrapbook data table.
- Parameters:
tbl-- table, the scrapbook data table to insert intokey-- string, the property namevalue-- string, number, boolean or table, the property value
- Returns: nil
- Error states: Returns early if value is nil
Scrapbook_WriteToFile(buffer)
- Description: Writes the generated scrapbook data to scripts/screens/redux/scrapbookdata.lua.
- Parameters:
buffer-- table, the scrapbook data buffer to write
- Returns: nil
Scrapbook_IsOnCraftingFilter(filter, entry)
- Description: Checks if a prefab entry belongs to a specific crafting filter.
- Parameters:
filter-- string, the crafting filter nameentry-- string, the prefab entry to check
- Returns: boolean
Scrapbook_DefineSubCategory(t)
- Description: Determines the scrapbook sub-category for a given entity based on tags and components.
- Parameters:
t-- Entity, the prefab instance to categorize
- Returns: string
Scrapbook_DefineName(t)
- Description: Determines the display name for a scrapbook entry.
- Parameters:
t-- Entity, the prefab instance
- Returns: string
Scrapbook_DefineType(t, entry)
- Description: Determines the scrapbook thing type (creature, food, item, etc.) for an entity.
- Parameters:
t-- Entity, the prefab instanceentry-- string, the prefab name
- Returns: string
Scrapbook_DefineAnimation(t)
- Description: Determines the animation name to use for the scrapbook icon.
- Parameters:
t-- Entity, the prefab instance
- Returns: string
Scrapbook_GetSanityAura(inst)
- Description: Retrieves the sanity aura value from an entity.
- Parameters:
inst-- Entity, the instance to check
- Returns: number or nil
Scrapbook_GetSkillOwner(skill)
- Description: Finds the character owner of a specific skill tree skill.
- Parameters:
skill-- string, the skill name
- Returns: string
d_printscrapbookrepairmaterialsdata()
- Description: Prints repair material data for scrapbook debugging.
- Parameters: None
- Returns: nil
d_createscrapbookdata(print_missing_icons)
- Description: Main function to generate scrapbook data for all prefabs, handling season/weather overrides.
- Parameters:
print_missing_icons-- boolean, optional flag to print missing icon warnings
- Returns: nil
- Error states: Aborts if prefab is invalid or missing AnimState
d_unlockscrapbook()
- Description: Unlocks all scrapbook entries via debug function.
- Parameters: None
- Returns: nil
d_erasescrapbookentrydata(entry)
- Description: Erases storage data for a specific scrapbook entry.
- Parameters:
entry-- string, the scrapbook entry name
- Returns: nil
- Error states: Returns early if entry is invalid
d_waxplant(plant)
- Description: Applies wax to a plant entity.
- Parameters:
plant-- Entity, optional plant instance, defaults to entity under mouse
- Returns: nil
d_checkmissingscrapbookentries()
- Description: Checks for prefabs that have names but missing scrapbook entries.
- Parameters: None
- Returns: nil
_testhash(word, results)
- Description: Helper to test hash collisions.
- Parameters:
word-- string, the word to hashresults-- table, table to store hash results
- Returns: boolean
_getbins(bitswanted, results)
- Description: Calculates hash distribution bins.
- Parameters:
bitswanted-- number, number of bits for bin maskresults-- table, hash results table
- Returns: table
_printbins(bins, total, collisions)
- Description: Prints hash bin statistics.
- Parameters:
bins-- table, bin countstotal-- number, total itemscollisions-- number, collision count
- Returns: nil
d_testhashes_random(bitswanted, tests)
- Description: Tests hash collisions on random strings.
- Parameters:
bitswanted-- number, bits for masktests-- number, number of random tests
- Returns: nil
d_testhashes_prefabs(bitswanted)
- Description: Tests hash collisions on existing prefabs.
- Parameters:
bitswanted-- number, bits for mask
- Returns: nil
d_testworldstatetags()
- Description: Tests world state tag decoding and printing.
- Parameters: None
- Returns: nil
worldtopology_createent(worldtopologyvisuals, x, z, icon, labelstr)
- Description: Creates a classified entity for visualizing world topology.
- Parameters:
worldtopologyvisuals-- table, list to store visual entitiesx-- number, x positionz-- number, z positionicon-- string, minimap iconlabelstr-- string, optional label text
- Returns: Entity
d_gotoworldtopologyindex(nodexindex)
- Description: Teleports the player to a specific world topology node.
- Parameters:
nodexindex-- number, the node index to teleport to
- Returns: nil
- Error states: Returns early if World or Player is missing
d_drawworldtopology()
- Description: Draws visual markers for world topology nodes and connections.
- Parameters: None
- Returns: nil
- Error states: Returns early if World is missing
d_drawworldroute(routename)
- Description: Draws visual markers for a specific world route.
- Parameters:
routename-- string, the name of the route to draw
- Returns: nil
- Error states: Returns early if World or route is missing
GetAvgCenterOfTask(task_name, manager)
- Description: Calculates the average center position of a migration task.
- Parameters:
task_name-- string, the task name to searchmanager-- Component, optional migration manager
- Returns: Vector3
- Error states: Returns Vector3(0,0,0) if no nodes found
d_drawworldbirdmigration()
- Description: Draws visual markers for bird migration paths.
- Parameters: None
- Returns: nil
- Error states: Returns early if World or migration map is missing
d_printworldroutetime(routename, speed, bonus)
- Description: Prints estimated travel time for a world route.
- Parameters:
routename-- string, the route namespeed-- number, travel speedbonus-- number, speed bonus
- Returns: nil
- Error states: Returns early if World or route is missing
d_wagpunkarena_nexttask()
- Description: Skips the current state in the Wagpunk arena manager.
- Parameters: None
- Returns: nil
d_require(file)
- Description: Reloads a Lua file by clearing package cache.
- Parameters:
file-- string, the file path to reload
- Returns: nil
d_mapstatistics(count_cutoff, item_cutoff, density_cutoff)
- Description: Prints statistics about prefab counts and tile density on the map.
- Parameters:
count_cutoff-- number, minimum count to print prefabsitem_cutoff-- number, minimum count to print itemsdensity_cutoff-- number, minimum density to print spots
- Returns: nil
_DamageListenerFn(inst, data)
- Description: Callback function to accumulate damage for DPS testing.
- Parameters:
inst-- Entity, the entity taking damagedata-- table, event data containing damage amount
- Returns: nil
d_testdps(time, target)
- Description: Tests damage per second on a target entity over a set time.
- Parameters:
time-- number, duration of the test in secondstarget-- Entity, optional target, defaults to entity under mouse
- Returns: nil
d_timeddebugprefab(x, y, z, lifetime, prefab)
- Description: Spawns a prefab that automatically removes itself after a lifetime.
- Parameters:
x-- number, x positiony-- number, y positionz-- number, z positionlifetime-- number, seconds before removalprefab-- string, prefab name to spawn
- Returns: Entity
d_prizepouch(prefab, nugget_count)
- Description: Spawns a prize pouch containing wrapped gold nuggets.
- Parameters:
prefab-- string, pouch prefab namenugget_count-- number, number of gold nuggets to wrap
- Returns: nil
d_boatracepointers()
- Description: Spawns boat race checkpoint indicators.
- Parameters: None
- Returns: nil
d_testsound(soundpath, loopname, volume)
- Description: Plays a test sound on the selected entity or player.
- Parameters:
soundpath-- string, path to the soundloopname-- string, sound loop namevolume-- number, volume level
- Returns: nil
d_stopsound(loopname)
- Description: Stops a playing sound loop.
- Parameters:
loopname-- string, sound loop name to stop
- Returns: nil
d_spell(spellnum, item)
- Description: Casts a spell from a spellbook item.
- Parameters:
spellnum-- number, spell indexitem-- Entity, optional spellbook item
- Returns: nil
d_itemwithshadowmimic(item_prefab)
- Description: Spawns an item and adds the itemmimic component.
- Parameters:
item_prefab-- string, prefab name of the item
- Returns: nil
- Error states: Returns early if shadowthrall_mimics component is missing
d_shadowparasite(host_prefab)
- Description: Spawns a host entity and equips it with a shadow parasite hat.
- Parameters:
host_prefab-- string, prefab name of the host
- Returns: nil
d_tweak_floater(size, offset, scale, swap_bank, float_index, swap_data)
- Description: Modifies the floater component of the selected entity.
- Parameters:
size-- string, floater sizeoffset-- number, vertical offsetscale-- number, scale factorswap_bank-- string, bank to swapfloat_index-- number, float indexswap_data-- table, swap data
- Returns: nil
d_startlunarhail()
- Description: Triggers the lunar hail event on the world.
- Parameters: None
- Returns: nil
d_testbirdattack()
- Description: Spawns a mutated bird to attack the player.
- Parameters: None
- Returns: nil
d_testbirdclearhail()
- Description: Spawns a mutated bird to clear lunar buildup from the selected entity.
- Parameters: None
- Returns: nil
- Error states: Returns early if no entity selected
d_spawncentipede(num)
- Description: Spawns a shadowthrall centipede with specified torso count.
- Parameters:
num-- number, number of torso segments
- Returns: nil
d_movementon()
- Description: Enables forward movement on the selected entity.
- Parameters: None
- Returns: nil
- Error states: Returns early if no entity selected
d_followplayer()
- Description: Makes the selected entity face and follow the player periodically.
- Parameters: None
- Returns: nil
- Error states: Returns early if no entity selected
d_stopcentipedemovement()
- Description: Stops movement for all shadowthrall centipedes.
- Parameters: None
- Returns: nil
d_lightworld()
- Description: Toggles world ambient lighting override.
- Parameters: None
- Returns: nil
d_activatearchives()
- Description: Activates archive switches by giving them an opal gem.
- Parameters: None
- Returns: nil
d_vaultroom(id)
- Description: Loads a specific vault room on the first found vaultroom entity.
- Parameters:
id-- string, the room ID to load
- Returns: nil
d_spawnvaultactors()
- Description: Spawns Wilson actors with ancient masks at the charlie stage.
- Parameters: None
- Returns: nil
d_debug_arc_attack_hitbox(arc_span, forward_offset, arc_radius, lifetime)
- Description: Debugs an arc attack hitbox on the selected entity.
- Parameters:
arc_span-- number, arc spanforward_offset-- number, forward offsetarc_radius-- number, arc radiuslifetime-- number, debug lifetime
- Returns: nil
d_lunarmutation(corpseprefab, buildid)
- Description: Spawns a non-gestalt lunar mutation corpse.
- Parameters:
corpseprefab-- string, corpse prefab namebuildid-- string, optional build ID
- Returns: nil
d_gestaltmutation(corpseprefab, buildid)
- Description: Spawns a gestalt mutation corpse.
- Parameters:
corpseprefab-- string, corpse prefab namebuildid-- string, optional build ID
- Returns: nil
d_mutatedbuzzardcircler()
- Description: Spawns a circling buzzard targeting the player.
- Parameters: None
- Returns: Entity
d_placegridgroupoutline()
- Description: Places a grid group outline at the input position.
- Parameters: None
- Returns: nil
d_removegridgroupoutline()
- Description: Removes a grid group outline at the input position.
- Parameters: None
- Returns: nil
d_tiles()
- Description: Sets map tiles around the input position to impassable and turf.
- Parameters: None
- Returns: nil
d_getmigrationpopulation(migrator_type)
- Description: Returns the population data for a specific migrator type.
- Parameters:
migrator_type-- string, the migrator type name
- Returns: table
- Error states: Returns nil if type not found
Events & listeners
Listens to:
onremove-- Listened in d_combatsimulator to respawn creaturedroppedtarget-- Listened in d_combatsimulator to re-acquire targetattacked-- Listened to in d_testdps to accumulate damage count
Pushes:
shadowrift_opened-- Pushed in d_riftspawns if world is cavelunarrift_opened-- Pushed in d_riftspawns if world is not cavems_setmoonphase-- Pushed in d_fullmoon and d_newmoon to set moon phasestartcollapse-- Pushed in d_sinkhole on spawned antlion_sinkholeresetruins-- Pushed by d_resetruins to reset ruins statems_lavaarena_endofstage-- Pushed by d_lavaarena_skip to end lava arena stagelavaarena_talk-- Pushed by d_lavaarena_speech to trigger Boarlord dialogms_newplayercharacterspawned-- Pushed by d_portalfx to trigger spawn effectsms_setseason-- Pushed in d_createscrapbookdata to force autumn seasonms_forceprecipitation-- Pushed in d_createscrapbookdata to stop rainoverrideambientlighting-- Pushed in d_lightworld to toggle lightingms_startlunarhail-- Pushed in d_startlunarhail to start event