Remove old luaentries?

Post Reply
User avatar
fstltna
Member
Posts: 128
Joined: Sat Aug 05, 2017 23:22
GitHub: fstltna
IRC: MarisaG
In-game: MarisaG
Location: South San Francisco, CA
Contact:

Remove old luaentries?

by fstltna » Post

This has been bugging me for a while - when mods that add terrain types or other lua entities are then removed the server starts displaying error messages in the log about the luaentry not being defined. Is there a way to remove these ghost entities?
---- https://MineCity.online - Fan site for Minetest - get Minetest Hosting with first month FREE & $14/month after that
---- https://discord.gg/Bd4Xw9c - Minecity Discord Server - Join today!
---- http://MineCity.online:2000 - Get a free @minecity.online email address

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: Remove old luaentries?

by Festus1965 » Post

lua entities:
I think there I used command : /clearobjects [full|quick]
and I don't remember I have seen one of the monsters terminal complain as mod mobs_monster is still also off

nodes:
I use on my server : mod minetest-remover
You have to put the node names into the version you choose (fast or slow) and it works here since years.
Last edited by Festus1965 on Sun Jun 26, 2022 11:50, edited 1 time in total.
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: Remove old luaentries?

by LMD » Post

This is about entities though. I'd try the following code:

Code: Select all

setmetatable(minetest.registered_entities, {__index = function() return {on_activate = function(self) self.object:remove() end} end})
Explanation: If an entity isn't found in the registered entities table, default to an entity definition that instantly removes the entity as soon as it's activated.
My stuff: Projects - Mods - Website

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Remove old luaentries?

by Blockhead » Post

LMD wrote:
Sun Jun 26, 2022 11:06
This is about entities though. I'd try the following code:

Code: Select all

setmetatable(minetest.registered_entities, {__index = function() return {on_activate = function(self) self.object:remove() end} end})
Explanation: If an entity isn't found in the registered entities table, default to an entity definition that instantly removes the entity as soon as it's activated.
I think this bears further explanation, as to me it's unclear whether it does what you say. In fact if I had to guess what it did, it would remove all entities or at least all entities without an already-defined on_activate.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: Remove old luaentries?

by LMD » Post

Blockhead wrote:
Mon Jun 27, 2022 06:06
LMD wrote:
Sun Jun 26, 2022 11:06
This is about entities though. I'd try the following code:

Code: Select all

setmetatable(minetest.registered_entities, {__index = function() return {on_activate = function(self) self.object:remove() end} end})
Explanation: If an entity isn't found in the registered entities table, default to an entity definition that instantly removes the entity as soon as it's activated.
I think this bears further explanation, as to me it's unclear whether it does what you say. In fact if I had to guess what it did, it would remove all entities or at least all entities without an already-defined on_activate.
Indeed the crammed one-linter didn't even work as I didn't set the __index on the table which is used as a metatable for the entity (there was no risk of it deleting any known entities though). Here's a cleaned-up, indented, commented & fixed version with logging: Small, hacky Minetest utility to get rid of "unknown entities" as they are activated
My stuff: Projects - Mods - Website

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests