Grizzly Adam
Member
Posts: 252 Joined: Sat Aug 05, 2017 01:28
GitHub:
Grizzly-Adam
Location: Lost in America
Contact:
by Grizzly Adam » Sat Jan 06, 2018 01:08
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.
jas
Member
Posts: 593 Joined: Mon Jul 24, 2017 18:15
IRC: Freenode
Location: IRC
by jas » Sat Jan 06, 2018 01:19
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.
Grizzly Adam
Member
Posts: 252 Joined: Sat Aug 05, 2017 01:28
GitHub:
Grizzly-Adam
Location: Lost in America
Contact:
by Grizzly Adam » Sat Jan 06, 2018 02:07
Post
Can you think of any other way I can attempt to affect this?
jas
Member
Posts: 593 Joined: Mon Jul 24, 2017 18:15
IRC: Freenode
Location: IRC
by jas » Sat Jan 06, 2018 06:24
Post
Iterate over the list of registered entities, checking for `drops' property and overriding it manually may work.
Krock
Developer
Posts: 4650 Joined: Thu Oct 03, 2013 07:48
GitHub:
SmallJoker
Location: Switzerland
Contact:
by Krock » Sat Jan 06, 2018 13:51
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.
Grizzly Adam
Member
Posts: 252 Joined: Sat Aug 05, 2017 01:28
GitHub:
Grizzly-Adam
Location: Lost in America
Contact:
by Grizzly Adam » Sat Jan 06, 2018 14:14
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.
Users browsing this forum: No registered users and 9 guests