Jump to content

[Mod Request] World Cleaner


Recommended Posts

Hello, i tried to find out if this mod does exist, one mod who will check item unlooted and would delete it to ease the server.

would be could if it had a configurable (after how many days the item gonna get deleted)

Link to comment
Share on other sites

@Ayuros, I don't know if there's a mod on the workshop that does it, but I did write something like this for my Director Maxwell mod (I'm still working on it):

local deleteless = {	spider = true,	spider_warrior = true,	hound = true,	icehound = true,	firehound = true,	crawlinghorror = true,	terrorbeak = true,}local deletemore = {	spider = true,	spider_warrior = true,	hound = true,	icehound = true,	firehound = true,	crawlinghorror = true,	terrorbeak = true,	silk = true,	spidergland = true,	monstermeat = true,	houndstooth = true,	redgem = true,	bluegem = true,}local function CheckTurfRemove(object)	local turf = GLOBAL.TheWorld.Map:GetTileAtPoint(object:GetPosition():Get())	if turf == 1 or turf > 12 then		object:Remove()	endendlocal function ClearMaze(more)	local delete = more and deletemore or deleteless	local ents = GLOBAL.TheSim:FindEntities(0, 0, 0, 9001)	for k,v in pairs(ents) do		if delete[v.prefab] and not v.inlimbo then			CheckTurfRemove(v)		elseif more and (v.prefab == 'nightmarefuel' and (not v.inlimbo) and math.random() < 0.05) then			CheckTurfRemove(v)		end	endend

 

This actually clears monsters and stuff too (whatever's in the delete list). You probably want something a little more like this, though:

local dontdelete = {	lighter = true,	abigail_flower = true,	cane = true,	walrushat = true,}local function CleanGround()	local ents = GLOBAL.TheSim:FindEntities(0, 0, 0, 9001)	for k,v in pairs(ents) do		if not dontdelete[v.prefab] and not v.inlimbo then			v:Remove()		end	endendAddPrefabPostInit("world", function(inst) inst:DoPeriodicTask(30*16, CleanGround) end) 

You probably want to add more items to the dontdelete list, though (which prevents it from deleting certain valuable items like walking canes). 30*16 is one in-game day.

 

Although I realized in retrospect that maybe what you want is more along the lines of deleting any item that's been on the ground for a certain amount of time? That's a more difficult task... Probably something you'd do by doing AddComponentPostInit("inventoryitem", fn), with a function that modifies the topocket and toground to start a cleanup task with the configured time-to-delete.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...