Delete/reset to default a specific chunk

  • Hi


    I want to delete a specific chunk (x,y,z) and reset it's data as a fresh new one generated by game as chunk never was saved in db. Any hint how can i do that? I tried to find a specific method in API but i can't find one. Only idea i have is to delete data from Chunks/ChunkPart tables from chunks.db but this look ugly and i am not sure if i mess something if delete data of row of specific x,y,z. And how can delete these data with game running on MP server, how can players see new chunk, etc.

    Ultimate goal is to have a tool who can reset a chunk to default state and delete large data of constructions element ,large terrain terraforming, etc from that chunk and reclaim chunk to pool of untouched chunk where npc/animals can spawn again.


    Thx in advance.

  • are you looking for something in the api to use?

    to visualize chunk border's use the chunkborders command.

  • Yes. Or something that work on live server. One alternative is a command like deletesector but limited to only a chunk, not all sector. And after this command to can be used in plugin to reset a chunk.


    PS

    Trust me, is not funny to delete in a chunk thousands of construction elements with a hammer. After some number of construction elements in same chunk (more than 10-15k i see in my case) you have a huge lag when want to delete a individual element in that chunk.

  • yeah, i think that would be a tough one to make. i guess someone could simply delete the chunk from the world db/directory. tho i think that would cause some issues for storage's and stuff to as the objects they use are tied to chunk data.

  • Hey, sorry for my late response! But deleting chunks is a bit tricky unfortunately... basically you can delete chunks manually from the database (this only works properly while the server isn't running), but if there had been terrain modifications in that chunk, there might be seams between the newly generated chunk and the surrounding chunks :/


    But I can add a deletechunk console command which could be used to delete/reset a chunk (i.e restore the original state) :)

  • A command deletechunk i think will be god, If this command can be called from a plugin for a regular user (plugin will check if user can do that) i can achieve scope (reset chunk as a new one generated where animals/npc can spawn again, and delete all construction/modification of terrain done to that chunk). And of course this command must be working in MP running server. I think will not be a problem with old legacy world pre cave update, where some sectors have generated with another algorithm (because seed of chunks are saved in metadata of sector?)? I wait to have very soon that command (maybe red surprise us with next update? ;) )!


    Thx

  • If this command can be called from a plugin for a regular user

    Yes, but this command will be bound to a permission, so if you want to invoke it for a user (via player.executeCommand()), you have to make sure that the user has the permission for that. The new permission will probably be called deletechunks (under "commands"). If a user has this permission, he will be able to execute the deletechunk console command ;)


    But it probably makes sense to have a separate method in the API for that, e.g. something like "World.resetChunk()" or "World.deleteChunk()"... I will put this on my list :)


    I think will not be a problem with old legacy world pre cave update, where some sectors have generated with another algorithm (because seed of chunks are saved in metadata of sector?)?

    The game will update the transition between the deleted chunks and neighbouring chunks automatically in this case ^^


    maybe red surprise us with next update?

    I can't guarantee that, but I will try to add this command with the next update :saint: