[mini-mod] Cron Clear Objects [cron_clear_objects]
- 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]
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:
License: MITI like to make mods :D
I also made a patreon!
I also made a patreon!
- DS-minetest
- Member
- Posts: 1149
- 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]
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. ; ))
//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.
Feel free to call me DS.
-
- Member
- Posts: 321
- Joined: Sat Apr 06, 2013 11:58
- GitHub: MoNTE48
- In-game: MoNTE48
- Location: Internet
Re: [mini-mod] Cron Clear Objects [cron_clear_objects]
They should optimize the game, but not delete entities. It can be players mobs!!
Who is online
Users browsing this forum: Google [Bot] and 3 guests