Skip to content

Instantly share code, notes, and snippets.

@eniraa
Last active October 13, 2021 03:08
Show Gist options
  • Save eniraa/bda1e0d1701f14b3181f46f3cfe6a95e to your computer and use it in GitHub Desktop.
Save eniraa/bda1e0d1701f14b3181f46f3cfe6a95e to your computer and use it in GitHub Desktop.
Change the turf in Don't Starve!
function change_ground(ground)
--[[
paste this code into the console and then use the change_ground(`ground`) command
options for `ground` can be a number or a string
use `worldtiledefs.lua` or `terrain.lua` as a reference
--]]
ground =
ground == nil and GROUND.QUAGMIRE_SOIL or type(ground) == "string" and GROUND[string.upper(ground)] or ground
local pt = ConsoleWorldPosition()
local x, y = TheWorld.Map:GetTileCoordsAtPoint(pt:Get())
local original_tile_type = TheWorld.Map:GetTileAtPoint(pt:Get())
TheWorld.Map:SetTile(x, y, ground)
TheWorld.Map:RebuildLayer(original_tile_type, x, y)
TheWorld.Map:RebuildLayer(ground, x, y)
TheWorld.minimap.MiniMap:RebuildLayer(original_tile_type, x, y)
TheWorld.minimap.MiniMap:RebuildLayer(ground, x, y)
end
@eniraa
Copy link
Author

eniraa commented Oct 13, 2021

This has only been tested in DST.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment