[mini-mod] Cron Clear Objects [cron_clear_objects]

Post Reply
User avatar
Oil_boi
Member
Posts: 139
Joined: Mon Jan 28, 2019 13:12
GitHub: oilboi
IRC: oilboi
In-game: oilboi
Contact:

[mini-mod] Cron Clear Objects [cron_clear_objects]

by Oil_boi » Post

Someone in the IRC asked if there was a cron equivalent for minetest. Specifically to clear objects every 24 hours, so I wrote a mini mod to do it:
cron_clear_objects.zip
(334 Bytes) Downloaded 23 times
License: MIT
I like to make mods :D
I also made a patreon!

User avatar
DS-minetest
Member
Posts: 1150
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [mini-mod] Cron Clear Objects [cron_clear_objects]

by DS-minetest » Post

This could also be done with minetest.after:
//lua local function foo() minetest.chat_send_all("The server is currently clearing all objects, please be patient.") minetest.clear_objects({mode="quick"}) minetest.after(60*60*24, foo) end minetest.after(60*60*24, foo)
If you have many such jobs running, having .after handling this is faster. Also, this can be done after server start with worldedit. (Edit: Remove the //lua if you are not doing this with worldedit.)

Edit: I didn't test this particular code, but yes, this should be true. (And do !help for MinetestBot btw. ; ))
Last edited by DS-minetest on Thu Apr 02, 2020 16:48, edited 1 time in total.
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

MoNTE48
Member
Posts: 323
Joined: Sat Apr 06, 2013 11:58
GitHub: MoNTE48
In-game: MoNTE48
Location: Internet

Re: [mini-mod] Cron Clear Objects [cron_clear_objects]

by MoNTE48 » Post

They should optimize the game, but not delete entities. It can be players mobs!!

Post Reply

Who is online

Users browsing this forum: GreenXenith and 4 guests