Jump to content

Console command


Recommended Posts

hi, i wanted to ask if there is a console command to delete for example all twigs which are lying on the ground. but not the ones in inventory and chests. 

after a while my world is full with twiggy trees and rot  and... Im always trying to keep it clean but its hard (still on very slow regrow)

i have always to delete all twiggy trees (c_removeall("twiggytree") and then bundle all my twigs and rot which we have in chests and then i can delete twigs and rot in the world. it would make it so easier if there is a way just to delete the ones lying on the ground.

there is a mod "no twiggy tree" but if i used it then i get twigssaplings growing evrywhere. like in the ruins and evrywhere where they shoudnt grow. its maybe cause  ive the worldsettings for twigs on "less". its kinda a bug maybe. cause if you make your worldsettings for trees on less (without using mods) you get trees growing evrywhere. decidious trees growing in savannah, swamp, caves ruins....

anyway xxD hope someone can help me. thx for reading

Link to comment
Share on other sites

I have this code in my customcommands.lua on my dedicated server and use it to remove some stuff: Hope this helps.

function c_cleanup()
	local prefabs = {
		"twigs", "spoiled_food"
	}
	local count = 0
    for k,v in pairs(Ents) do
		if (hasValue(prefabs, v.prefab)) then
			local owner = nil
			if not (v.components.inventoryitem ~= nil and v.components.inventoryitem.owner~= nil) then 
        	   v:Remove()
			   count = count + 1
            end
        end
    end
end

local function hasValue(tab, item)
    local match = false
	for key, value in pairs(tab) do
        if (value == item) then
			match = true
			break
		end
	end
	return match
end


Added "spoiled_food" so you can understand how to add more stuff if you want.

Link to comment
Share on other sites

thank you a lot for responding. i have also a deticated server which i made with a guide. but im a total noob. do i have to add this in my worldgen.lua

or do i have to make a customcommands.lua and add this. :(((( im so sorry for not knowing

Link to comment
Share on other sites

It would be interesting if a mod would run a cleanup like this once a year, dissapearing all twigs, rot, poop, guano, bee stingers, silk and hound teeth lying on the ground (but not in chests or other containers). There probably is and I dont know about it though.

it would be even better if these things would have each its own timer and dissapear if left on the ground for a year or so. Maybe Klei's QOL updates in the future should adress this.

Link to comment
Share on other sites

3 hours ago, fimmatek said:

I used this mod once to clean up my server: https://steamcommunity.com/sharedfiles/filedetails/?id=597417408

I edited both the settings and then the mods files, adding and removing some items from the to-be-deleted list. It worked ou t pretty well.

yes ik this mod but it delets to much. and becasue of that mod can clean things from ground i was asking for a command

Link to comment
Share on other sites

5 hours ago, BeliarBAD said:

yes ik this mod but it delets to much. and becasue of that mod can clean things from ground i was asking for a command

I'm not sure what are you asking then... didn't you want to delete all twigs from the ground? Because you can do that with this mod.

Link to comment
Share on other sites

1 hour ago, fimmatek said:

I'm not sure what are you asking then... didn't you want to delete all twigs from the ground? Because you can do that with this mod.

but this mod does much more then just the twigs. how i remember you cant disable the most features of the mod. for example spiders you can make setting to a max amount but if you want that none spiders get deleted then you cant have that with that mod

Link to comment
Share on other sites

1 hour ago, BeliarBAD said:

but this mod does much more then just the twigs. how i remember you cant disable the most features of the mod. for example spiders you can make setting to a max amount but if you want that none spiders get deleted then you cant have that with that mod

You can do that if you edit the modoverrides.lua file. I did so and could fully customise what I wanted to delete and what not. Take a look at this subforum of the mod: https://steamcommunity.com/workshop/filedetails/discussion/597417408/451850468367189203/

I hope it helps!

Link to comment
Share on other sites

,["workshop-597417408"] = {
enabled = true,
configuration_options =
{
Clean_Period = 6000, --100 min
eat_things = "no",
Custom_prefabs = "guano:0,twigs:0,spoiled_food:0",
Cleaning_text = "Cleaning server",
                Cleaning_warning_text = "Server cleaning will start in 120 sec",
Cleaning_delay = 3
}
}

 

so if i want twigs, rot and guano deleted then i make it like this? and i made eat things on NO. is that correct?

thank you for your help


 

Link to comment
Share on other sites

8 hours ago, BeliarBAD said:

so if i want twigs, rot and guano deleted then i make it like this? and i made eat things on NO. is that correct?

thank you for your help

I think so. If you want to go for sure, you could test it in a new world where you spawn in different items, just to see if it works correctly, but it definitely should. Also, don't forget to use the special command to manually run the cleaner. Good luck!

Link to comment
Share on other sites

Just now, BeliarBAD said:

Made it possible to run cleaning immediately using console: TheWorld.Clean()
is that the special command you mean?

thank you and all others for your help. ill try it

I think so. It's been a bit long since I last did it, so I don't remember exactely, but I'm pretty sure it is. In any case, try it in a new world, so you don't lose anything even if something goes wrong. (And make a backup if you didn't already... it's always good to have a backup of the DST folder, just in case)

Link to comment
Share on other sites

somehow it didnt worked.

ive a deticated server. so i hosted a normal server and added the mods i want and changed the settings how i like. for the less lags mod i left them on default. then i created the world and disconnected. then i went here Documents\Klei\DoNotStarveTogether\Cluster_1\master and copied the mod.lua to my desktop. there i opened it with editor and edited it to this:

["workshop-597417408"]={
    configuration_options={
      Clean_Period="12000",
      Cleaning_delay="10",
      Cleaning_text="Cleaning server...",
      Cleaning_warning_text="",
      Custom_prefabs="",
      wetgoop_Amount="0",
      charocal_Amount="0",
      pinecone_Amount="0",
      guano_Amount="0",
      poop_Amount="0",
      twigs_Amount="0",
      stinger_Amount="0",
      bee_Amount="0",
      eat_things="no",
      killerbee_Amount="0",
      spoiled_food_Amount="0"
    },
    enabled=true
  },

then i copied this edited mod.lua in both master folder of my caves and overworld deticated server.

after this i started my deticated server with steam tools and all looked fine. i went to my bee boxes and dropped some wetgoop, charocal .... near them and in my inventory. then i used the console command to clean my world. what happeend was that all my flowers near my bee boxes got deleted. the things i dropped didnt get deleted. so somehow the mod still has his default settings.

 

so im not sure what i did wrong.

when i opened the mod.lua with editor it didnt looked like it looks in the mod description.

,["workshop-597417408"] = {
enabled = true,
configuration_options =
{
Clean_Period = 6000, --100 min
eat_things = "yes",
Custom_prefabs = "carrot:100,flower:3,spider:20,beefalo:30,spoiled_food:0",
Cleaning_text = "Cleaning server",
                Cleaning_warning_text = "Server cleaning will start in 120 sec",
Cleaning_delay = 3
}
}

 

 

it looked like this:

 

return {
  ["workshop-597417408"]={
    configuration_options={
      Clean_Period="12000",
      Cleaning_delay="10",
      Cleaning_text="Cleaning server...",
      Cleaning_warning_text="",
      Custom_prefabs="",
      babybeefalo_Amount="5",
      bee_Amount="0",
      beefalo_Amount="30",
      beefaloherd_Amount="2",
      carrot_planted_Amount="30",
      eat_things="no",
      flower_Amount="100",
      killerbee_Amount="0",
      krampus_Amount="1",
      lavae_Amount="0",
      skeleton_player_Amount="100",
      slurper_Amount="0",
      spider_Amount="0",
      spider_warrior_Amount="0",
      spiderden_Amount="5",
      spoiled_food_Amount="0"
    },
    enabled=true
  }
}

 

and i edited to this:

 

["workshop-597417408"]={
    configuration_options={
      Clean_Period="12000",
      Cleaning_delay="10",
      Cleaning_text="Cleaning server...",
      Cleaning_warning_text="",
      Custom_prefabs="",
      wetgoop_Amount="0",
      charocal_Amount="0",
      pinecone_Amount="0",
      guano_Amount="0",
      poop_Amount="0",
      twigs_Amount="0",
      stinger_Amount="0",
      bee_Amount="0",
      eat_things="no",
      killerbee_Amount="0",
      spoiled_food_Amount="0"
    },
    enabled=true
  },

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...