Debugcommands
Based on game build 722832 | Last updated: 2026-04-22
Overview
debugcommands.lua provides an extensive collection of console command functions (prefixed with d_) that serve as development and debugging tools for Don't Starve Together. These commands cover entity spawning, world state manipulation, event testing, skin and clothing validation, scrapbook data generation, topology visualization, and system-specific debugging for features like fishing, farming, combat, and seasonal events. The file requires multiple external modules including prefab definitions, skill tree configurations, and screen interfaces to support its diverse functionality. These commands are primarily intended for development and testing purposes, allowing developers to quickly instantiate entities, modify world conditions, and verify game systems without manual gameplay.
Usage example
-- Debug functions are global console commands, available directly in debug context
-- No module import required - these are built-in debug utilities
-- Spawn a list of entities at console position
d_spawnlist({"spider", "beefalo"}, 5)
-- Test skin functionality on current player
d_skin_mode("ghost_skin")
d_clothing("hat_winterhat")
-- Generate scrapbook data for debugging
d_createscrapbookdata()
-- Visualize world topology and migration routes
d_drawworldtopology()
d_drawworldbirdmigration()
-- Manipulate world events
d_startmoonstorm()
d_halloween()
Dependencies & tags
External dependencies:
scrapbook_prefabs-- scrapbook prefab definitions for data generationwx78_moduledefs-- WX-78 circuit module definitionsworldtiledefs-- ground tile and turf definitionsmap/object_layout-- layout spawning and topology utilitiesprefabs/oceanfishdef-- ocean fish prefab definitionsprefabs/farm_plant_defs-- farm plant and growth definitionsprefabs/fertilizer_nutrient_defs-- fertilizer nutrient definitionsprefabs/pillow_defs-- pillow prefab definitionsprefabs/skilltree_defs-- skill tree definitions and metadatacooking-- cookbook and recipe card datatechtree-- technology tree definitionsprefabs/waxed_plant_common-- waxed plant utilitiesscreens/thankyoupopup-- thank you popup screen for skin testingscreens/skinsitempopup-- skins item popup screenscreens/giftitempopup-- gift item popup screenscreens/redux/itemboxopenerpopup-- mystery box opener popupskin_gifts-- skin gift type definitions
Components used:
riftspawner-- spawn and highlight rifts via TheWorld.components.riftspawnersharkboimanager-- access shark boy manager via TheWorld.components.sharkboimanagerropebridgemanager-- access rope bridge manager via TheWorld.components.ropebridgemanagerrabbitkingmanager-- access rabbit king manager via TheWorld.components.rabbitkingmanagerskilltreeupdater-- update skill tree via player.components.skilltreeupdaterweather-- access weather events via TheWorld.net.components.weather (network layer)moonstormmanager-- start/stop moonstorms via TheWorld.components.moonstormmanagerlunarthrall_plantspawner-- spawn lunar thrall plants via TheWorld.components.lunarthrall_plantspawnerworldroutes-- access world routes via TheWorld.components.worldroutesmigrationmanager-- access migration populations via TheWorld.components.migrationmanagerwagpunk_arena_manager-- debug skip state via TheWorld.components.wagpunk_arena_managershadowthrall_mimics-- access shadow thrall mimics via TheWorld.components.shadowthrall_mimicshunter-- access hunter component via TheWorld.components.hunterspecialeventsetup-- setup special events via TheWorld.components.specialeventsetupskinner-- set skin mode, name, and clothing via player.components.skinnerpetleash-- spawn pets via player.components.petleashinventory-- give items via player.components.inventorysanity-- set sanity percent via player.components.sanitybuilder-- unlock recipes via player.components.builderdomesticatable-- set domestication values via beefalo.components.domesticatablerideable-- set saddle via beefalo.components.rideablehealth-- set health percent via wall.components.healthcombat-- set combat target via creature.components.combatknownlocations-- remember locations via creature.components.knownlocationsscenariorunner-- run scenario scripts via inst.components.scenariorunnerfollower-- set leader via spider.components.followerstackable-- set stack size via inst.components.stackablewalkableplatform-- get players on platform via boat.components.walkableplatforminventoryitem-- set landed state via ent.components.inventoryitemhideandseekhider-- hide kitcoons via kitcoon.components.hideandseekhidergrowable-- advance growth stages via plant.components.growablecyclable-- set step via shell.components.cyclableyotc_racestats-- set race stats via carrat.components.yotc_racestatslocomotor-- walk/stop via centipede.components.locomotortalker-- ignore talking via player.components.talkerfloater-- tweak floater via inst.components.floaterspellbook-- select spell via item.components.spellbookcentipedebody-- set torso segments via controller.components.centipedebodyvaultroom-- load/unload rooms via inst.components.vaultroomtrader-- accept gifts via archive_switch.components.tradermutatedbuzzardcircler-- set circle target via buzzard.components.mutatedbuzzardcircler
Tags:
boat-- check if player is on boatcave-- check world tag for rift spawningNOCLICK-- remove from fish entitiesCLASSIFIED-- add to topology visual entitiesFX-- check/exclude from scrapbook and teleportsmallcreature-- check for creature classificationmonster-- check for creature classificationanimal-- check for creature classificationsmallepic-- check for scrapbook subcategoryhaunted-- check for scrapbook subcategorysingingshell-- check for scrapbook subcategorypig-- check for scrapbook subcategorymerm-- check for scrapbook subcategorychess-- check for scrapbook subcategoryoceanfish-- check for scrapbook subcategorywagstafftool-- check for scrapbook subcategorypocketwatch-- check for scrapbook subcategorygroundtile-- check for scrapbook subcategorybackpack-- check for scrapbook subcategorychest-- check for scrapbook subcategorybattlesong-- check for scrapbook subcategoryghostlyelixir-- check for scrapbook subcategoryfarm_plant-- check for scrapbook subcategoryspidermutator-- check for scrapbook subcategoryslingshotammo-- check for scrapbook subcategoryheavy-- check for scrapbook subcategoryhat-- check for scrapbook subcategorybook-- check for scrapbook subcategorywinter_ornament-- check for scrapbook subcategoryhalloween_ornament-- check for scrapbook subcategoryspider-- check for scrapbook subcategoryinsect-- check for scrapbook subcategorytree-- check for scrapbook subcategorystructure-- check for scrapbook subcategorycampfire-- check for scrapbook subcategoryblueflame-- check for campfire variantlightbattery-- check for scrapbook subcategoryNPCcanaggro-- check for creature typeshadow_aligned-- add to notes in scrapbooklunar_aligned-- add to notes in scrapbookshadowthrall_centipede-- check for stop movementINLIMBO-- exclude from scrapbook and teleportDECOR-- exclude from teleport_inventoryitem-- filter for teleport itemsplayer-- exclude from entity findwall-- check for scrapbook subcategorywallbuilder-- check for scrapbook subcategorybird-- check for scrapbook subcategorybuzzard-- check for scrapbook subcategorytallbird-- check for scrapbook subcategoryhound-- check for scrapbook subcategorywarg-- check for scrapbook subcategorybrightmare-- check for scrapbook subcategoryshadow-- check for scrapbook subcategorystalker-- check for scrapbook subcategoryshadowthrall-- check for scrapbook subcategoryshadowhand-- check for scrapbook subcategoryepic-- check for giant typecrabking-- check for giant typeboatbumper-- exclude from creature typefence-- exclude from creature typeancienttree-- exclude from tree subcategoryrock_tree-- exclude from tree subcategoryleif-- exclude from tree subcategorymanrabbit-- exclude from pig subcategory
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
| TELEPORTBOAT_ITEM_MUST_TAGS | table | {"_inventoryitem"} | Tags that items must have to be teleported by boat |
| TELEPORTBOAT_ITEM_CANT_TAGS | table | {"FX", "NOCLICK", "DECOR", "INLIMBO"} | Tags that prevent items from being teleported by boat |
| TELEPORTBOAT_BLOCKER_CANT_TAGS | table | {"FX", "NOCLICK", "DECOR", "INLIMBO", "_inventoryitem"} | Tags that prevent entities from blocking boat teleportation |
| COMBAT_TAGS | table | {"_combat"} | Tags used for combat-related entity filtering |
| TEST_ITEM_NAME | string | "birdcage_pirate" | Test prefab name for debugging |
| WAXED_PLANTS | table | (from require) | Waxed plant prefab data from waxed_plant_common |
| DARK | boolean | true | Flag for dark mode/state in d_lightworld |
| CREATING_SCRAPBOOK_DATA | boolean | nil | Flag indicating scrapbook data generation is in progress |
| IGNORE_PATTERN_checkmissingscrapbookentries | table | (pattern list) | Patterns to ignore when checking for missing scrapbook entries |
| SCRAPBOOK_IGNORE_UNLOCKABILITY | table | (prefab list) | Prefabs to ignore when checking scrapbook unlockability |
| SKIP_SPECIALINFO_CHECK | table | (info list) | Special info entries to skip validation checks |
| SCRAPBOOK_NAME_LOOKUP | table | (name mappings) | Maps prefabs to alternate scrapbook names |
| RECIPE_BUILDER_TAG_LOOKUP | table | (builder mappings) | Maps recipe builder tags to character names |
| scrapbook_finiteuses_useamount_modifiers | table | (modifier list) | Component names that modify finiteuses consumption rate |
| skiplist | table | (prefab skip list) | Prefab names to skip during dump operations (creatures, items, structures) |
| REPAIR_MATERIAL_DATA | table | (repair material mappings) | Maps repair materials to their corresponding repair item prefabs for scrapbook data |
Main functions
d_spawnlist(list, spacing, fn)
- Description: Spawns a grid of prefabs at console world position, arranging them in a square pattern with configurable spacing.
- Parameters:
list-- table, array of prefab names or tables with{prefab, count, item_fn}structurespacing-- number, distance between spawned entities (default 2)fn-- function, optional callback function called on each spawned instance
- Returns: table -- array of created entity instances
d_playeritems()
- Description: Spawns all craftable items organized by builder tag at console position.
- Parameters: None
- Returns: nil
d_allmutators()
- Description: Gives the player all mutator items (warrior, dropper, hider, spitter, moon, water).
- Parameters: None
- Returns: nil
d_allcircuits()
- Description: Spawns all WX-78 module circuit prefabs in a grid pattern at console position.
- Parameters: None
- Returns: nil
d_allheavy()
- Description: Spawns all heavy physics objects (boulders, sculptures, oversized items) in rows at console position.
- Parameters: None
- Returns: nil
d_spiders()
- Description: Spawns all spider variants and sets them to follow the local player.
- Parameters: None
- Returns: nil
d_particles()
- Description: Spawns particle effect prefabs in a grid pattern with labels, then rotates them in a circular pattern periodically.
- Parameters: None
- Returns: nil
d_decodedata(path)
- Description: Loads a persistent string from sim storage and saves it as a decoded version.
- Parameters:
path-- string, file path to decode from persistent storage
- Returns: nil
d_riftspawns()
- Description: Opens lunar or shadow rifts based on world type, then spawns 200 rifts after 10 seconds.
- Parameters: None
- Returns: nil
d_lunarrift()
- Description: Enables lunar rifts and spawns one at console world position.
- Parameters: None
- Returns: nil
d_shadowrift()
- Description: Enables shadow rifts and spawns one at console world position.
- Parameters: None
- Returns: nil
d_oceanarena()
- Description: Triggers the Sharkboi ocean arena placement via sharkboimanager component.
- Parameters: None
- Returns: nil
- Error states: Returns early if sharkboimanager component is missing from TheWorld
d_exploreland()
- Description: Reveals all land tiles on the map for the current player.
- Parameters: None
- Returns: nil
d_exploreocean()
- Description: Reveals all ocean tiles on the map for the current player.
- Parameters: None
- Returns: nil
d_explore_printunseentiles()
- Description: Prints coordinates of unseen land tiles that the player cannot see on minimap.
- Parameters: None
- Returns: nil
d_teleportboat(x, y, z)
- Description: Teleports the player's current boat to specified coordinates, handling item collision and platform entities.
- Parameters:
x-- number, optional target x position (uses console position if nil)y-- number, optional target y positionz-- number, optional target z position
- Returns: nil
- Error states: Returns early if no player found or player is not on a boat; returns if exit position is blocked
d_breakropebridges(delaytime)
- Description: Destroys all rope bridges on the map, optionally with delayed destruction animation.
- Parameters:
delaytime-- number, optional delay time for destruction animation
- Returns: nil
- Error states: Returns early if ropebridgemanager component is missing from TheWorld
d_rabbitking(kind)
- Description: Spawns a Rabbit King boss for the current player via rabbitkingmanager.
- Parameters:
kind-- string, optional rabbit king variant kind (e.g., 'warrior', 'dropper')
- Returns: nil
- Error states: Returns early if no player, not on master sim, or rabbitkingmanager is missing
d_fullmoon()
- Description: Sets the moon phase to full on master sim.
- Parameters: None
- Returns: nil
d_newmoon()
- Description: Sets the moon phase to new on master sim.
- Parameters: None
- Returns: nil
d_unlockaffinities()
- Description: Sets GenericKV flags to mark Fuelweaver and Celestial Champion as killed.
- Parameters: None
- Returns: nil
d_resetskilltree()
- Description: Deactivates all skills for the current player and adds maximum skill XP.
- Parameters: None
- Returns: nil
- Error states: Returns early if no player or not on master sim
d_reloadskilltreedefs()
- Description: Triggers debug rebuild of skill tree definitions.
- Parameters: None
- Returns: nil
d_printskilltreestringsforcharacter(character)
- Description: Prints missing skill tree localization strings for a character to console.
- Parameters:
character-- string, optional character prefab name (defaults to current player)
- Returns: nil
d_togglelunarhail()
- Description: Enables lunar rifts and triggers lunar hail event via weather component.
- Parameters: None
- Returns: nil
d_allsongs()
- Description: Gives the player all battlesong items.
- Parameters: None
- Returns: nil
d_allstscostumes()
- Description: Gives the player all masquerade costumes (masks and bodies).
- Parameters: None
- Returns: nil
d_domesticatedbeefalo(tendency, saddle)
- Description: Spawns a fully domesticated beefalo with specified tendency and saddle.
- Parameters:
tendency-- string, tendency type (ORANGE, DEFAULT, etc.)saddle-- string, optional saddle prefab name (default 'saddle_basic')
- Returns: nil
d_domestication(domestication, obedience)
- Description: Sets domestication and obedience values on the selected entity.
- Parameters:
domestication-- number, optional domestication value to setobedience-- number, optional obedience value to set
- Returns: nil
- Error states: Prints warning if selected entity has no domesticatable component
d_testwalls()
- Description: Spawns test walls of various materials at different health percentages near player.
- Parameters: None
- Returns: nil
d_testruins()
- Description: Unlocks ruins tech recipes and gives player essential ruins exploration items.
- Parameters: None
- Returns: nil
d_combatgear()
- Description: Gives the player basic combat gear (armor, hat, spear).
- Parameters: None
- Returns: nil
d_teststate(state)
- Description: Forces the selected entity's stategraph to go to specified state.
- Parameters:
state-- string, stategraph state name to transition to
- 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 (default false)
- Returns: nil
- Error states: Prints message if no DebugEntity is selected
d_light(c1, c2, c3)
- Description: Sets the ambient light color in the simulation.
- Parameters:
c1-- number, red color component (0-1)c2-- number, green color component (defaults to c1)c3-- number, blue color component (defaults to c1)
- Returns: nil
d_combatsimulator(prefab, count, force)
- Description: Spawns creatures for combat testing with automatic target reassignment on drop.
- Parameters:
prefab-- string, prefab name to spawn for combat testingcount-- number, number of instances to spawn (default 1)force-- boolean, whether to force combat targeting
- Returns: nil
d_spawn_ds(prefab, scenario)
- Description: Spawns an entity and applies a scenario script via scenariorunner component.
- Parameters:
prefab-- string, prefab name to spawnscenario-- string, scenario script name to apply
- Returns: nil
- Error states: Returns early if spawn fails
d_test_thank_you(param)
- Description: Opens the ThankYouPopup screen for testing skin DLC entitlements.
- Parameters:
param-- string, optional item name for thank you popup (defaults to TEST_ITEM_NAME constant if not provided)
- Returns: nil
d_test_skins_popup(param)
- Description: Opens the SkinsItemPopUp screen for testing.
- Parameters:
param-- string, optional item name for skins popup
- Returns: nil
d_test_skins_announce(param)
- Description: Triggers a networking skin announcement for testing.
- Parameters:
param-- string, optional item name for skin announcement
- Returns: nil
d_test_skins_gift(param)
- Description: Opens the GiftItemPopUp screen for testing.
- Parameters:
param-- string, optional item name for gift popup
- Returns: nil
d_test_mystery_box(params)
- Description: Opens the ItemBoxOpenerPopup for testing mystery box opening.
- Parameters:
params-- table, optional params table with allow_cancel, box_build, skin_pack keys
- Returns: nil
d_print_skin_info()
- Description: Prints skin name and usability info for test items to console.
- Parameters: None
- Returns: nil
d_skin_mode(mode)
- Description: Sets the player's skin mode via skinner component.
- Parameters:
mode-- string, skin mode to set on player
- Returns: nil
d_skin_name(name)
- Description: Sets the player's skin name via skinner component.
- Parameters:
name-- string, skin name to set on player
- Returns: nil
d_clothing(name)
- Description: Sets clothing on the player via skinner component.
- Parameters:
name-- string, clothing item name to equip
- Returns: nil
d_clothing_clear(type)
- Description: Clears clothing of specified type on the player via skinner component.
- Parameters:
type-- string, clothing type to clear
- Returns: nil
d_cycle_clothing()
- Description: Cycles through all inventory items as clothing on the player 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 prefab and simulates repair completion by calling onrepaired for each work unit, then gives shadowheart and atrium_key items.
- Parameters: None
- Returns: nil
- Error states: Errors if spawned mound has no workable or repairable component
d_resetruins()
- Description: Pushes the resetruins event to TheWorld to reset ruins state.
- Parameters: None
- Returns: nil
d_getwidget()
- Description: Returns the widget currently selected by the debug widget editor (WidgetDebug).
- Parameters: None
- Returns: Widget instance or nil if no widget selected
d_halloween()
- Description: Spawns all trinket and halloweencandy prefabs in a grid pattern around console world position.
- Parameters: None
- Returns: nil
d_potions()
- Description: Spawns all Halloween potion prefabs and livingtree_root in a grid pattern around console world position.
- Parameters: None
- Returns: nil
d_weirdfloaters()
- Description: Spawns a large list of weapon and tool prefabs in a grid pattern around console world position.
- Parameters: None
- Returns: nil
d_wintersfeast()
- Description: Spawns all Winter's Feast ornament prefabs in a grid pattern using GetAllWinterOrnamentPrefabs().
- Parameters: None
- Returns: nil
d_wintersfood()
- Description: Spawns all winter_food prefabs in a grid pattern around console world position.
- Parameters: None
- Returns: nil
d_madsciencemats()
- Description: Gives all Halloween experiment materials via c_mat command.
- Parameters: None
- Returns: nil
d_showalleventservers()
- Description: Toggles TheFrontEnd._showalleventservers boolean to show or hide all event servers.
- Parameters: None
- Returns: nil
d_lavaarena_skip()
- Description: Pushes ms_lavaarena_endofstage event to TheWorld to skip to end of Lava Arena stage.
- Parameters: None
- Returns: nil
d_lavaarena_speech(dialog, banter_line)
- Description: Makes the Boarlord speak dialog lines from STRINGS table, supporting banter line selection.
- Parameters:
dialog-- string, dialog key from STRINGS table, may contain BANTER keywordbanter_line-- number, optional index for banter dialog array selection
- Returns: nil
- Error states: None if dialog key not found in STRINGS or Boarlord not present
d_unlockallachievements()
- Description: Reports event progress to unlock all active achievements via TheItems:ReportEventProgress.
- Parameters: None
- Returns: nil
d_unlockfoodachievements()
- Description: Reports event progress to unlock all food-related achievements (food_001 through food_069 and food_syrup).
- Parameters: None
- Returns: nil
d_reportevent(other_ku)
- Description: Reports event progress with test achievements scotttestdaily_d1 and wintime_30.
- Parameters:
other_ku-- string, optional other player KU ID for multi-team report
- Returns: nil
d_ground(ground, pt)
- Description: Sets ground tile type at specified position using TheWorld.Map:SetTile.
- Parameters:
ground-- string or number, tile type name or WORLD_TILES constant, defaults to QUAGMIRE_SOILpt-- Vector3, position to set tile at, defaults to ConsoleWorldPosition()
- Returns: nil
d_portalfx()
- Description: Pushes ms_newplayercharacterspawned event to TheWorld with ThePlayer to trigger portal spawn effects.
- Parameters: None
- Returns: nil
- Error states: None
d_walls(width, height)
- Description: Spawns wood walls in a rectangular pattern around console world position.
- Parameters:
width-- number, wall rectangle width, defaults to 10height-- number, wall rectangle height, defaults to width
- Returns: nil
d_hidekitcoon()
- Description: Spawns a kitcoon_deciduous and makes it hide at the entity under mouse cursor using hideandseekhider:GoHide.
- Parameters: None
- Returns: nil
d_hidekitcoons()
- Description: Calls specialeventsetup:_SetupYearOfTheCatcoon to initialize Year of the Catcoon event.
- Parameters: None
- Returns: nil
d_allkitcoons()
- Description: Spawns all kitcoon biome variants using d_spawnlist helper.
- Parameters: None
- Returns: nil
d_allcustomhidingspots()
- Description: Spawns hiding spots from TUNING.KITCOON_HIDING_OFFSET keys with kitcoons attempting to hide at each.
- Parameters: None
- Returns: nil
d_hunt()
- Description: Calls hunter:DebugForceHunt on TheWorld.components.hunter to force hunting mechanics.
- Parameters: None
- Returns: nil
- Error states: None
d_islandstart()
- Description: Gives starting island survival items and sets player sanity to random 20-60%.
- Parameters: None
- Returns: nil
- Error states: None
d_waxwellworker()
- Description: Spawns shadowworker pet at player position using petleash:SpawnPetAt and records spawn location.
- Parameters: None
- Returns: nil
- Error states: Errors if ConsoleCommandPlayer() returns nil (nil dereference on player.Transform) or player lacks petleash component (nil dereference on player.components.petleash — no guard present in source)
d_waxwellprotector()
- Description: Spawns shadowprotector pet at player position using petleash:SpawnPetAt and records spawn location.
- Parameters: None
- Returns: nil
- Error states: Errors if ConsoleCommandPlayer() returns nil (nil dereference on player.Transform — no guard present) or if player has no petleash component (nil dereference on player.components.petleash)
d_boatitems()
- Description: Spawns boat crafting items including boat_item, mast_item, anchor_item, steeringwheel_item, and oar.
- Parameters: None
- Returns: nil
d_giveturfs()
- Description: Gives all turf items by iterating through worldtiledefs.turf table.
- Parameters: None
- Returns: nil
d_turfs()
- Description: Spawns all turf items in a list using d_spawnlist helper with quantity 10 each.
- Parameters: None
- Returns: nil
d_spawnlayout(name, data)
- Description: Spawns a predefined layout at console position, optionally creating topology nodes and populating prefab densities.
- Parameters:
name-- string, layout definition namedata-- table, optional layout data with id, tags, populate_prefab_densities
- Returns: nil
- Error states: Errors if layout definition not found (nil dereference on layout.ground — no guard present in source)
d_allfish()
- Description: Spawns all fish prefabs from oceanfishdef plus fish meat variants in a grid pattern.
- Parameters: None
- Returns: nil
d_fishing()
- Description: Spawns all ocean fishing items including bobbers, lures, and oceanfishingrod in a grid pattern.
- Parameters: None
- Returns: nil
d_tables()
- Description: Spawns 28 table_winters_feast prefabs in a grid pattern.
- Parameters: None
- Returns: nil
d_gofishing()
- Description: Gives ocean fishing rod and various bobbers and lures via c_give.
- Parameters: None
- Returns: nil
d_radius(radius, num, lifetime)
- Description: Spawns flint items in a circle pattern that auto-remove after lifetime seconds.
- Parameters:
radius-- number, circle radius, defaults to 4num-- number, number of items in circle, defaults to max(5, radius*2)lifetime-- number, seconds before items auto-remove, defaults to 10
- Returns: nil
d_ratracer(speed, stamina, direction, reaction)
- Description: Spawns a carrat with custom YOTC race stats and gives it to player inventory.
- Parameters:
speed-- number, rat speed stat, defaults to randomstamina-- number, rat stamina stat, defaults to randomdirection-- number, rat direction stat, defaults to randomreaction-- number, rat reaction stat, defaults to random
- Returns: nil
- Error states: Errors if DebugSpawn("carrat") returns nil (nil dereference on rat._spread_stats_task — no guard present in source); errors if ConsoleCommandPlayer() returns nil (nil dereference on .components.inventory — no guard present in source)
d_ratracers()
- Description: Spawns 8 carrats with varying YOTC race stats (speed, stamina, direction, reaction) set to max or 0, each with different colors, and gives them to the player.
- Parameters: None
- Returns: nil
- Error states: Errors if ConsoleCommandPlayer() returns nil and components.inventory is accessed
d_setup_placeholders(reuse, out_file_name)
- Description: Defines a local helper function use_table that recursively processes speech table structures, filling missing string values with 'TODO'. The helper is defined and immediately invoked to process STRINGS.CHARACTERS.GENERIC.
- Parameters:
reuse-- table, speech table to populate with placeholdersout_file_name-- string, output file path for the generated Lua file
- Returns: nil
- Error states: None
d_allshells()
- Description: Spawns 12 large, medium, and small singing shells in rows at the console world position, setting each cyclable component to steps 1-12.
- Parameters: None
- Returns: nil
d_fish(swim, r, g, b)
- Description: Spawns 4 ocean fish at console position, optionally removes their brain, removes NOCLICK tag, and applies color tint to the last fish.
- Parameters:
swim-- boolean, if false, removes brain from fishr-- number, red color component (0-255), defaults to 0g-- number, green color component (0-255), defaults to 5b-- number, blue color component (0-255), defaults to 5
- Returns: nil
d_farmplants(grow_stage, oversized)
- Description: Spawns all farm plants that have oversized products, optionally advancing growth stages and forcing oversized state.
- Parameters:
grow_stage-- number, number of growth stages to applyoversized-- boolean, if true, forces oversized growth
- Returns: nil
d_plant(plant, num_wide, grow_stage, spacing)
- Description: Spawns plants in a square grid centered at console world position, optionally advancing growth stages over time.
- Parameters:
plant-- string, prefab name of the plant to spawnnum_wide-- number, number of plants per row/column in the gridgrow_stage-- number, number of growth stages to applyspacing-- number, distance between plants, defaults to 1.25
- Returns: nil
d_seeds()
- Description: Spawns all seed prefabs from farm plant definitions that have oversized products.
- Parameters: None
- Returns: nil
d_fertilizers()
- Description: Spawns all sorted fertilizer prefabs from fertilizer nutrient definitions.
- Parameters: None
- Returns: nil
d_oversized()
- Description: Spawns all oversized product prefabs from farm plant definitions.
- Parameters: None
- Returns: nil
d_startmoonstorm()
- Description: Starts a moonstorm at the console world position's map node.
- Parameters: None
- Returns: nil
- Error states: Errors if TheWorld.components.moonstormmanager is nil
d_stopmoonstorm()
- Description: Stops the current moonstorm.
- Parameters: None
- Returns: nil
- Error states: Errors if TheWorld.components.moonstormmanager is nil
d_moonaltars()
- Description: Spawns moon altar, moon altar idol, moon altar astral, and moon altar cosmic at positions offset from console world position.
- Parameters: None
- Returns: nil
d_cookbook()
- Description: Disables cookbook saving, then learns all food stats and adds sample recipes for all cookbook recipes.
- Parameters: None
- Returns: nil
- Error states: Errors if TheCookbook is nil
d_statues(material)
- Description: Spawns all chess piece and boss statues with the specified material.
- Parameters:
material-- string or number, material type (marble, stone, moonglass) or index, defaults to marble
- Returns: nil
d_craftingstations()
- Description: Spawns all prototyper/crafting station prefabs from PROTOTYPER_DEFS.
- Parameters: None
- Returns: nil
- Error states: Errors if PROTOTYPER_DEFS is nil
d_removeentitywithnetworkid(networkid, x, y, z)
- Description: Finds and removes the entity with the matching network ID within a radius of 1 from the given position.
- Parameters:
networkid-- number, network ID of entity to removex-- number, search center X positiony-- number, search center Y positionz-- number, search center Z position
- Returns: nil
d_recipecards()
- Description: Spawns cooking recipe cards with names set from the cooking module's recipe_cards data.
- Parameters: None
- Returns: nil
d_spawnfilelist(filename, spacing)
- Description: Reads a persistent string file asynchronously and spawns prefabs listed in the file (one prefab name per line) via d_spawnlist callback after file loads.
- Parameters:
filename-- string, name of file to read (located in client_save directory)spacing-- number, passed to d_spawnlist but has no effect on file contents due to asynchronous loading
- Returns: nil
d_spawnallhats()
- Description: Spawns all hat prefabs from ALL_HAT_PREFAB_NAMES.
- Parameters: None
- Returns: table -- array of created entity instances
- Error states: Errors if ALL_HAT_PREFAB_NAMES is nil
d_spawnallhats_onstands()
- Description: Spawns all hats on sewing mannequins, including the slurper.
- Parameters: None
- Returns: table -- array of created entity instances
- Error states: Errors if ALL_HAT_PREFAB_NAMES is 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 (weapons, tools, staffs, etc.) on sewing mannequins.
- Parameters: None
- Returns: nil
d_allpillows()
- Description: Spawns all hand and body pillow prefabs from pillow_defs.
- Parameters: None
- Returns: nil
d_allpillows_onstands()
- Description: Spawns all pillows on sewing mannequins.
- Parameters: None
- Returns: nil
d_spawnequipment_onstand(...)
- Description: Spawns a sewing mannequin at console position and equips all provided item prefabs on it. Returns early if no arguments provided.
- Parameters:
...-- vararg, prefab names of items to equip on the mannequin
- Returns: nil
- Error states: None
d_daywalker(chain)
- Description: Spawns a daywalker boss with 3 daywalker pillars arranged in a circle around it, optionally chaining them.
- Parameters:
chain-- boolean, if true, chains pillars to the daywalker as prisoners
- Returns: nil
- Error states: Crashes if c_spawn("daywalker") returns nil (nil dereference on daywalker.Transform with no guard)
d_moonplant()
- Description: Spawns a lunarthrall plant on the currently selected entity.
- Parameters: None
- Returns: nil
- Error states: Does nothing if no entity is selected
d_punchingbags()
- Description: Spawns all three punching bag variants (normal, lunar, shadow).
- Parameters: None
- Returns: nil
d_skilltreestats()
- Description: Prints skill tree statistics (skill count and lock count) for all characters to the console, sorted by skill count.
- Parameters: None
- Returns: nil
d_dumpCreatureTXT()
- Description: Iterates through all prefabs, spawns each one, and writes prefab name, entity name, max health, and default damage to creatures.txt.
- Parameters: None
- Returns: nil
- Error states: Errors if SpawnPrefab returns nil (t:Remove() nil dereference) or Prefabs table is nil
d_dumpItemsTXT()
- Description: Iterates through all prefabs with inventoryitem component and writes their prefab names to items.txt.
- Parameters: None
- Returns: nil
- Error states: None
d_structuresTXT()
- Description: Exports a list of valid structure prefabs to a text file named 'structures.txt', filtering out skins, inventory items, and locomotor entities.
- Parameters: None
- Returns: nil
d_printscrapbookrepairmaterialsdata()
- Description: Scans all prefabs to categorize repair materials, forge repair materials, and upgrader types, printing the data for manual inclusion.
- Parameters: None
- Returns: nil
d_createscrapbookdata(print_missing_icons)
- Description: Generates the complete scrapbook dataset by spawning prefabs, analyzing components, and writing data files. Forces season and weather state during execution.
- Parameters:
print_missing_icons-- boolean, Optional flag to list missing icon atlases
- Returns: nil
- Error states: Aborts if prefab is invalid or lacks AnimState
d_unlockscrapbook()
- Description: Debug command to unlock all scrapbook partitions for testing.
- Parameters: None
- Returns: nil
d_erasescrapbookentrydata(entry)
- Description: Removes storage data for a specific scrapbook entry.
- Parameters:
entry-- string, The scrapbook entry name to erase
- Returns: nil
- Error states: Prints error if entry is invalid
d_waxplant(plant)
- Description: Applies wax to a plant entity using the waxed plant common module.
- Parameters:
plant-- Entity, The plant entity to wax. Defaults to entity under mouse
- Returns: nil
d_checkmissingscrapbookentries()
- Description: Checks STRINGS.NAMES against scrapbook prefabs to find named entries missing from the scrapbook.
- Parameters: None
- Returns: nil
d_testhashes_random(bitswanted, tests)
- Description: Tests hash collision rates using randomly generated strings.
- Parameters:
bitswanted-- number, Bits for mask (default 4)tests-- number, Number of random tests (default 10000)
- Returns: nil
d_testhashes_prefabs(bitswanted)
- Description: Tests hash collision rates using all registered prefab names.
- Parameters:
bitswanted-- number, Bits for mask (default 4)
- Returns: nil
d_testworldstatetags()
- Description: Tests WORLDSTATETAGS encoding and decoding with various tag sets.
- Parameters: None
- Returns: nil
d_gotoworldtopologyindex(nodexindex)
- Description: Teleports the player to the center of a specific world topology node.
- Parameters:
nodexindex-- number, Index of the topology node
- Returns: nil
d_drawworldtopology()
- Description: Toggles visualization of world topology nodes and connections on the minimap.
- Parameters: None
- Returns: nil
d_drawworldroute(routename)
- Description: Toggles visualization of a specific world route path on the minimap.
- Parameters:
routename-- string, Name of the route to visualize
- Returns: nil
d_drawworldbirdmigration()
- Description: Toggles visualization of bird migration paths and populations on the minimap.
- Parameters: None
- Returns: nil
d_printworldroutetime(routename, speed, bonus)
- Description: Calculates and prints the time required to traverse a world route.
- Parameters:
routename-- string, Name of the routespeed-- number, Movement speedbonus-- number, Speed bonus multiplier
- Returns: nil
d_wagpunkarena_nexttask()
- Description: Forces the Wagpunk arena manager to skip to the next state.
- Parameters: None
- Returns: nil
d_require(file)
- Description: Clears the package cache and requires a file, effectively reloading the module.
- Parameters:
file-- string, Module path to reload
- Returns: nil
d_mapstatistics(count_cutoff, item_cutoff, density_cutoff)
- Description: Analyzes and prints statistics about entity counts, item distribution, and tile density on the map.
- Parameters:
count_cutoff-- number, Minimum count to print prefab statsitem_cutoff-- number, Minimum count to print item statsdensity_cutoff-- number, Minimum density to print high density spots
- Returns: nil
d_testdps(time, target)
- Description: Measures and prints the damage per second dealt to a target over a specified time.
- Parameters:
time-- number, Duration of the test in secondstarget-- Entity, Target entity. Defaults to entity under mouse
- Returns: nil
d_timeddebugprefab(x, y, z, lifetime, prefab)
- Description: Spawns a prefab at a location that automatically removes itself after a lifetime.
- Parameters:
x-- number, X positiony-- number, Y positionz-- number, Z positionlifetime-- number, Time before removalprefab-- string, Prefab name
- Returns: Entity
d_prizepouch(prefab, nugget_count)
- Description: Spawns a prize pouch and wraps specified gold nuggets inside it using the unwrappable component.
- Parameters:
prefab-- string, Pouch prefab namenugget_count-- number, Number of gold nuggets to wrap
- Returns: nil
d_boatracepointers()
- Description: Spawns a list of boat race checkpoint indicators with animated symbols.
- Parameters: None
- Returns: nil
d_testsound(soundpath, loopname, volume)
- Description: Plays a sound on the selected entity or player.
- Parameters:
soundpath-- string, Path to the sound fileloopname-- string, Name for the sound loopvolume-- number, Volume level
- Returns: nil
d_stopsound(loopname)
- Description: Stops a playing sound loop on the selected entity or player.
- Parameters:
loopname-- string, Name of the sound loop to kill
- Returns: nil
d_spell(spellnum, item)
- Description: Executes a specific spell from a spellbook item.
- Parameters:
spellnum-- number, Spell indexitem-- Entity, Spellbook item. Defaults to selected
- Returns: nil
d_itemwithshadowmimic(item_prefab)
- Description: Spawns an item and adds the itemmimic component to it.
- Parameters:
item_prefab-- string, Prefab of the item to mimic
- Returns: nil
d_shadowparasite(host_prefab)
- Description: Spawns a host and equips it with a shadow thrall parasite hat.
- Parameters:
host_prefab-- string, Prefab of the host entity
- Returns: nil
d_tweak_floater(size, offset, scale, swap_bank, float_index, swap_data)
- Description: Modifies the floater component of the selected entity and prints the MakeInventoryFloatable call.
- Parameters:
size-- string, Float 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 and forces it to swoop attack the player.
- Parameters: None
- Returns: nil
d_testbirdclearhail()
- Description: Spawns a mutated bird and commands it to remove lunar buildup from the selected entity.
- Parameters: None
- Returns: nil
d_spawncentipede(num)
- Description: Spawns a shadow thrall centipede controller with a specified number of torso segments.
- Parameters:
num-- number, Number of torso segments
- Returns: nil
d_movementon()
- Description: Forces the selected entity to walk forward using its locomotor component.
- Parameters: None
- Returns: nil
d_followplayer()
- Description: Makes the selected entity periodically face the player's position.
- Parameters: None
- Returns: nil
d_stopcentipedemovement()
- Description: Stops the locomotor component of all shadow thrall centipede entities.
- Parameters: None
- Returns: nil
d_lightworld()
- Description: Toggles ambient lighting override on the world between dark and normal.
- Parameters: None
- Returns: nil
d_activatearchives()
- Description: Finds an archive switch and gives it an opal gem to activate it.
- Parameters: None
- Returns: nil
d_vaultroom(id)
- Description: Unloads the current vault room and loads a specified room ID.
- Parameters:
id-- string, Room ID to load
- Returns: nil
d_spawnvaultactors()
- Description: Spawns Wilson actors equipped with ancient masks at the charlie stage.
- Parameters: None
- Returns: nil
d_debug_arc_attack_hitbox(arc_span, forward_offset, arc_radius, lifetime)
- Description: Visualizes an arc attack hitbox for 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 corpse and sets it to non-gestalt mode with optional build overrides.
- Parameters:
corpseprefab-- string, Corpse prefab namebuildid-- string, Alternate build ID
- Returns: nil
d_gestaltmutation(corpseprefab, buildid)
- Description: Spawns a corpse and sets it to gestalt mode with optional build overrides.
- Parameters:
corpseprefab-- string, Corpse prefab namebuildid-- string, Alternate build ID
- Returns: nil
d_mutatedbuzzardcircler()
- Description: Spawns a circling buzzard and sets it to circle the player.
- Parameters: None
- Returns: nil
d_placegridgroupoutline()
- Description: Places a grid placer group outline at the input world position.
- Parameters: None
- Returns: nil
d_removegridgroupoutline()
- Description: Removes a grid placer group outline at the input world position.
- Parameters: None
- Returns: nil
d_tiles()
- Description: Fills a grid of tiles around the input position with impassable and turf tiles for testing.
- Parameters: None
- Returns: nil
d_getmigrationpopulation(migrator_type)
- Description: Returns the population data for a specific migrator type from the migration manager.
- Parameters:
migrator_type-- string, Type of migrator
- Returns: table or nil
d_hidehovertext()
- Description: Forces the player HUD hover text and action hints to hide.
- Parameters: None
- Returns: nil
d_notalking()
- Description: Makes all players ignore talking events from the 'd_notalking' source.
- Parameters: None
- Returns: nil
Events & listeners
Listens to:
onremove— Listened on spawned creatures in d_combatsimulator to respawn themdroppedtarget— Listened in d_combatsimulator to reassign combat target when droppedattacked— Listened to in d_testdps to accumulate damage count
Pushes:
shadowrift_opened— Pushed on TheWorld in d_riftspawns when in cavelunarrift_opened— Pushed on TheWorld in d_riftspawns when not in cavems_setmoonphase— Pushed on TheWorld in d_fullmoon and d_newmoon to set moon phasestartcollapse— Pushed on antlion_sinkhole in d_sinkholeresetruins— Pushed to TheWorld by d_resetruins to reset ruins statems_lavaarena_endofstage— Pushed to TheWorld by d_lavaarena_skip with reason=debug triggeredms_newplayercharacterspawned— Pushed to TheWorld by d_portalfx with player=ThePlayerlavaarena_talk— Pushed to Boarlord by d_lavaarena_speech with text linesms_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 trigger eventdomesticated— Pushed by domesticatable component when beefalo becomes domesticatedsaddlechanged— Pushed when saddle is equipped or removed from rideable entityleaderchanged— Pushed when follower's leader changesstacksizechange— Pushed when stackable item stack size changestrade— Pushed when trader accepts a giftwrappeditem— Pushed when item is wrapped in unwrappable bundleon_landed/on_no_longer_landed— Pushed by inventoryitem when landing state changes