*SOLVED* Overriding "Drops" in Mobs_redo

Post Reply
User avatar
Grizzly Adam
Member
Posts: 252
Joined: Sat Aug 05, 2017 01:28
GitHub: Grizzly-Adam
Location: Lost in America
Contact:

*SOLVED* Overriding "Drops" in Mobs_redo

by Grizzly Adam » Post

I am trying to do an override of the sheep in mobs_redo to make them drop mutton. However, the override is having no effect. I am able to override "groups" on this item, but not the "drops". Any ideas?

Code: Select all

minetest.override_item("mobs:sheep", {
		drops = {
			{name = "bbq:mutton_raw", chance = 1, min = 1, max = 2},
		},
})
Last edited by Grizzly Adam on Sat Jan 06, 2018 14:15, edited 1 time in total.
Check out my Mods: BBQ Mod Crops Plus

User avatar
jas
Member
Posts: 593
Joined: Mon Jul 24, 2017 18:15
IRC: Freenode
Location: IRC

Re: Overriding "Drops"

by jas » Post

minetest.override is for items registered through minetest.register_*

drops, in the sheep definition, is specific to mobs_redo mob registration, and will not work with minetest.override_item, AFAIK.

User avatar
Grizzly Adam
Member
Posts: 252
Joined: Sat Aug 05, 2017 01:28
GitHub: Grizzly-Adam
Location: Lost in America
Contact:

Re: Overriding "Drops"

by Grizzly Adam » Post

Can you think of any other way I can attempt to affect this?
Check out my Mods: BBQ Mod Crops Plus

User avatar
jas
Member
Posts: 593
Joined: Mon Jul 24, 2017 18:15
IRC: Freenode
Location: IRC

Re: Overriding "Drops"

by jas » Post

Iterate over the list of registered entities, checking for `drops' property and overriding it manually may work.

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Overriding "Drops"

by Krock » Post

1) Add the line "mobs" to your depends.txt file to ensure that mobs_redo is loaded before your mod.
2) There's no override_entity function (yet?), but you can modify the entity table (and only the entity table) directly like this:

Code: Select all

local def = minetest.registered_entities["mobs:sheep"]
assert(def, "mobs:sheep not found")
def.drops = {
	{ name = "bbq:mutton_raw", chance = 1, min = 1, max = 2 },
}
3) Add the [Solved] tag to your main post (= the topic title) if this solved your problem.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Grizzly Adam
Member
Posts: 252
Joined: Sat Aug 05, 2017 01:28
GitHub: Grizzly-Adam
Location: Lost in America
Contact:

Re: Overriding "Drops"

by Grizzly Adam » Post

Krock wrote:1) Add the line "mobs" to your depends.txt file to ensure that mobs_redo is loaded before your mod.
2) There's no override_entity function (yet?), but you can modify the entity table (and only the entity table) directly like this:

Code: Select all

local def = minetest.registered_entities["mobs:sheep"]
assert(def, "mobs:sheep not found")
def.drops = {
	{ name = "bbq:mutton_raw", chance = 1, min = 1, max = 2 },
}
3) Add the [Solved] tag to your main post (= the topic title) if this solved your problem.
Thanks! It didn't work with the mobs:sheep alias, but it did with the mobs_animal:sheep_white entity.

Code: Select all

local def = minetest.registered_entities["mobs_animal:sheep_white"]
assert(def, "mobs:sheep not found")
def.drops = {
   { name = "bbq:mutton_raw", chance = 1, min = 1, max = 2 },
}
All in all, you have me sorted in about three minutes! I will mark this as solved. Again, thank you.
Check out my Mods: BBQ Mod Crops Plus

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests