[Mod] Mobs Redo [1.61] [mobs]
Update:
- Some more mob riding tweaks added (thanks for ideas auouymous)
- Better animation detection (flying mobs use 'walk' when on ground and 'fly' in the air, except for swimming mobs)
- 'fly' animation added to mobs_animal, mobs_sky and mobs_water
- Better animation detection (flying mobs use 'walk' when on ground and 'fly' in the air, except for swimming mobs)
- 'fly' animation added to mobs_animal, mobs_sky and mobs_water
Re: [Mod] Mobs Redo [1.56] [mobs]
hello TenPlus1 , I have a doubt ... if I put for example 3 or more mobs , in the same .lua file, could this weigh the mod?
...
In this modpack I made:
viewtopic.php?f=9&t=28089
a friend said that the skulls are heavier than the other monsters, and I believe it's because they are in the same file..
Can this happen?
Thanks, and sorry for the question, I'm learning XD
...
In this modpack I made:
viewtopic.php?f=9&t=28089
a friend said that the skulls are heavier than the other monsters, and I believe it's because they are in the same file..
Can this happen?
Thanks, and sorry for the question, I'm learning XD
Re: [Mod] Mobs Redo [1.56] [mobs]
It doesn't matter if your mob registrations are in separate files or one big file, it all works out the same way :) The only thing that makes a mob heavy would be the model size and media files used, or if it has custom functions that do a lot of computation, but your mobs look fine to me :P
Btw, you don't need to use the mobs:alias_mob() function for each mob, it's only used for a compatibility thing from the old mobs mod so that the new mobs_animal:cow for example appears instead of the older mobs:cow in players' old worlds.
Btw, you don't need to use the mobs:alias_mob() function for each mob, it's only used for a compatibility thing from the old mobs mod so that the new mobs_animal:cow for example appears instead of the older mobs:cow in players' old worlds.
Re: [Mod] Mobs Redo [1.56] [mobs]
I appreciate the attention and help, once again, thank you very much :)
Re: [Mod] Mobs Redo [1.56] [mobs]
Maybe not the best place to post this (noob here) but I'm playing single-user Minetest, pottering away in a virtual world and fixing tiny mod niggles if possible.
Two niggles with regard to mobs_animal: first, debug.txt gets flooded with warnings that Irrlicht can't load some animal models' textures; second, I have bucket_wooden (which I'm editing like mad to work with other mods) and one thing I can't do in bucket_wooden itself is make it possible to milk the cow with a wooden bucket.
First solution: the offending B3D models (bee, chicken, cow, rat), when opened with a hex editor (I used GHex) have "TEXS" at the top of the file. In the models that don't cause warnings, either there is no "TEXS", or it has been overwritten with "XXXX". I changed TEXS to XXXX in the four models' files, and nothing crashed, so I think that worked.
Second solution: cow.lua contains the milking code under "on rightclick". The changes I made might not be the best (I can't really use Lua except in a cut'n'paste sort of way; like I said, noob) so I'm just offering them here and the mod author can use, adapt or disregard them. The code is the whole on_rightclick with the changes between the comments "Change" and "End change".
Two niggles with regard to mobs_animal: first, debug.txt gets flooded with warnings that Irrlicht can't load some animal models' textures; second, I have bucket_wooden (which I'm editing like mad to work with other mods) and one thing I can't do in bucket_wooden itself is make it possible to milk the cow with a wooden bucket.
First solution: the offending B3D models (bee, chicken, cow, rat), when opened with a hex editor (I used GHex) have "TEXS" at the top of the file. In the models that don't cause warnings, either there is no "TEXS", or it has been overwritten with "XXXX". I changed TEXS to XXXX in the four models' files, and nothing crashed, so I think that worked.
Second solution: cow.lua contains the milking code under "on rightclick". The changes I made might not be the best (I can't really use Lua except in a cut'n'paste sort of way; like I said, noob) so I'm just offering them here and the mod author can use, adapt or disregard them. The code is the whole on_rightclick with the changes between the comments "Change" and "End change".
Code: Select all
on_rightclick = function(self, clicker)
-- feed or tame
if mobs:feed_tame(self, clicker, 8, true, true) then
-- if fed 7x wheat or grass then cow can be milked again
if self.food and self.food > 6 then
self.gotten = false
end
return
end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end
local tool = clicker:get_wielded_item()
local name = clicker:get_player_name()
local isbucket = 0 -- Change: new local for any bucket type.
-- milk cow with empty bucket
if tool:get_name() == "bucket:bucket_empty" then
-- Change: put bucket type in isbucket
-- No need to test if bucket_wooden is loaded; there wouldn't be a wooden bucket otherwise!
isbucket = 1
elseif tool:get_name() == "bucket_wooden:bucket_empty" then
isbucket = 2
end
if isbucket then -- any non-zero value
-- End change
--if self.gotten == true
if self.child == true then
return
end
if self.gotten == true then
minetest.chat_send_player(name,
S("Cow already milked!"))
return
end
local inv = clicker:get_inventory()
tool:take_item()
clicker:set_wielded_item(tool)
if isbucket == 1 then -- Change
if inv:room_for_item("main", {name = "mobs:bucket_milk"}) then
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
else
local pos = self.object:get_pos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "mobs:bucket_milk"})
end
-- Change
-- Instead of copying this for each bucket type, there should probaby be a function
-- with isbucket as input parameter.
elseif isbucket == 2 then
if inv:room_for_item("main", {name = "bucket_wooden:bucket_milk"}) then
clicker:get_inventory():add_item("main", "bucket_wooden:bucket_milk")
else
local pos = self.object:get_pos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "bucket_wooden:bucket_milk"})
end
end
-- End change
self.gotten = true -- milked
return
end
end,
on_replace = function(self, pos, oldnode, newnode)
self.food = (self.food or 0) + 1
-- if cow replaces 8x grass then it can be milked again
if self.food >= 8 then
self.food = 0
self.gotten = false
end
end,
Re: [Mod] Mobs Redo [1.56] [mobs]
A followup to last post: the on_rightclick code I posted, while harmless, will do nothing without corresponding code in bucket_wooden to get the milk in the bucket, and a tile for milk content (I took the standard milkbucket tile, edited out the bucket part and saved it as "bucket_content_milk.png"). I've been tinkering with bucket_wooden to make its bucket work with other mods, like mobs_animal, and had forgotten about the milkbucket code.
As the milkbucket code was added to init.lua in bucket_wooden, it tests if mobs_animal is loaded. The code could also be added to cow.lua in mobs_animal, but then it would have to test whether bucket_wooden is loaded. I should be posting it in the bucket_wooden thread, but that thread is two years old now. I really want to finish bucket_wooden and offer the changes to its author, but here is the bit of code to make milking work and use the milk, adapted from cow.lua:
As the milkbucket code was added to init.lua in bucket_wooden, it tests if mobs_animal is loaded. The code could also be added to cow.lua in mobs_animal, but then it would have to test whether bucket_wooden is loaded. I should be posting it in the bucket_wooden thread, but that thread is two years old now. I really want to finish bucket_wooden and offer the changes to its author, but here is the bit of code to make milking work and use the milk, adapted from cow.lua:
Code: Select all
local manim = minetest.get_modpath("mobs_animal")
local farm = minetest.get_modpath("farming") and farming and farming.mod
if manim then -- copied from mobs_animal: cow.lua
-- wooden bucket of milk
minetest.register_craftitem(":bucket_wooden:bucket_milk", {
description = S("Wooden Bucket of Milk"),
inventory_image = "bucket_wooden.png^bucket_content_milk.png",
stack_max = 1,
on_use = minetest.item_eat(8, "bucket_wooden:bucket_empty"),
groups = {food_milk = 1, flammable = 3, drink = 1},
})
--mobs recipes, unindented
minetest.register_craft({
output = "mobs:glass_milk 4",
recipe = {
{"vessels:drinking_glass", "vessels:drinking_glass"},
{"vessels:drinking_glass", "vessels:drinking_glass"},
{"bucket_wooden:bucket_milk", ""}
},
replacements = { {"bucket_wooden:bucket_milk", "bucket_wooden:bucket_empty"} }
})
minetest.register_craft({
output = "bucket_wooden:bucket_milk",
recipe = {
{"group:food_milk_glass", "group:food_milk_glass"},
{"group:food_milk_glass", "group:food_milk_glass"},
{"bucket_wooden:bucket_empty", ""}
},
replacements = { {"group:food_milk_glass", "vessels:drinking_glass 4"} }
})
if farm then
minetest.register_craft({
type = "shapeless",
output = "mobs:butter",
recipe = {"bucket_wooden:bucket_milk", "farming:salt"},
replacements = {{ "bucket_wooden:bucket_milk", "bucket_wooden:bucket_empty"}}
})
else -- some saplings are high in sodium so makes a good replacement item
minetest.register_craft({
type = "shapeless",
output = "mobs:butter",
recipe = {"bucket_wooden:bucket_milk", "default:sapling"},
replacements = {{ "bucket_wooden:bucket_milk", "bucket_wooden:bucket_empty"}}
})
end
minetest.register_craft({
type = "cooking",
output = "mobs:cheese",
recipe = "bucket_wooden:bucket_milk",
cooktime = 5,
replacements = {{ "bucket_wooden:bucket_milk", "bucket_wooden:bucket_empty"}}
})
end
Update:
- Added support for Wooden Bucket mod for milking cow
- Added recipes for wooden bucket of milk
Thanks for the idea Clickety :)
- Added recipes for wooden bucket of milk
Thanks for the idea Clickety :)
Re: [Mod] Mobs Redo [1.56] [mobs]
Whoops, I should have checked up on this thread before wrapping up version 0.1 of the wooden bucket compatibility mod. It's downloadable here:
viewtopic.php?p=410729#p410729
but has only been tested with the old Mobs Animal. The next version will be tested with the updated one! If nothing else, the download will contain the necessary tile "bucket_content_milk.png". Otherwise, since only handles milk buckets, version 0.1 is hereby obsolete.
The Wooden Bucket milking support is indispensable in any case, so I'm very happy with that. Many thanks!
viewtopic.php?p=410729#p410729
but has only been tested with the old Mobs Animal. The next version will be tested with the updated one! If nothing else, the download will contain the necessary tile "bucket_content_milk.png". Otherwise, since only handles milk buckets, version 0.1 is hereby obsolete.
The Wooden Bucket milking support is indispensable in any case, so I'm very happy with that. Many thanks!
Re: [Mod] Mobs Redo [1.56] [mobs]
How difficult is it to add internal variables to the mobs api?
Re: [Mod] Mobs Redo [1.56] [mobs]
@KCoombed - It's quite easy, you can either add custom variables using any of the mob functions (e.g. on_spawn, do_custom etc) or grab it as an object and use lua_entity() to add the variables seperately.
Re: [Mod] Mobs Redo [1.56] [mobs]
so adding a state to self.state ("sleeping") would require a bed location (self.bed) and adding that only requires the position of the bed?
Re: [Mod] Mobs Redo [1.56] [mobs]
@KCoombes - Exactly, once you have the lua_entity() for the mob using any function you can add and alter variables and they will be saved.
- j0j0n4th4n
- Member
- Posts: 250
- Joined: Tue Jan 26, 2021 06:45
Re: [Mod] Mobs Redo [1.56] [mobs]
I have a few suggestions and one critique.
Sometimes two mobs walk into each other but when they do in mobs_redo rather than block each other one of the mobs will 'teleport' above the other as if they walk over a node, this is particular troublesome with fish pools when one fish swim above the other and out of the pool. I actually like this behavior for some mobs, it allow foxes to walk over sheeps as they do in real life but I didn't see that behavior with mobkit mobs so I assume it is mobs_redo specific. As much as I like it, this is a deal break to me for any aquatic mobs who use mobs_redo API since they have a nack to beach themselves, quite often. Would it be possible to remove that feature or make it toggle-able?
Now the suggestions, I've been poking around with mobs_animal, I added a healing effect to the 'feeding' mechanic of cows and sheep, the idea is: if they are below full health, when they replaced enough nodes it would heal the animals a bit. Cows and sheep are easier to do that because they already use the same logic for milk and wool. But my suggestion goes a little further, I think it would be neat if animals had some self damage mechanic over time on top a healing mechanic, this would encourage farmer players to actually care for the animals rather than store them inside a pen. The way they are now, animals are more like a chest with a cool down for resources and that, in my opinion, is a shallow game mechanic as it doesn't encourage much interactivity.
Sometimes two mobs walk into each other but when they do in mobs_redo rather than block each other one of the mobs will 'teleport' above the other as if they walk over a node, this is particular troublesome with fish pools when one fish swim above the other and out of the pool. I actually like this behavior for some mobs, it allow foxes to walk over sheeps as they do in real life but I didn't see that behavior with mobkit mobs so I assume it is mobs_redo specific. As much as I like it, this is a deal break to me for any aquatic mobs who use mobs_redo API since they have a nack to beach themselves, quite often. Would it be possible to remove that feature or make it toggle-able?
Now the suggestions, I've been poking around with mobs_animal, I added a healing effect to the 'feeding' mechanic of cows and sheep, the idea is: if they are below full health, when they replaced enough nodes it would heal the animals a bit. Cows and sheep are easier to do that because they already use the same logic for milk and wool. But my suggestion goes a little further, I think it would be neat if animals had some self damage mechanic over time on top a healing mechanic, this would encourage farmer players to actually care for the animals rather than store them inside a pen. The way they are now, animals are more like a chest with a cool down for resources and that, in my opinion, is a shallow game mechanic as it doesn't encourage much interactivity.
cdb_894a100ddd76
Re: [Mod] Mobs Redo [1.56] [mobs]
@j0j0n4th4n - That isn't a feature as such, the stepheight for the mob is set too high so that it walks on top of other mobs or blocks, so setting a stepheight to 0 would stop that behaviour. mobkit uses pathfinding from what I know so would walk around each mob instead whereas mobs_redo uses both dumb movement and pathfinding both depending on mob definition.
You mean adding a hunger mechanic to tamed animals so the owner would need to feed them on occasion or store them away inside a spawn egg?
You mean adding a hunger mechanic to tamed animals so the owner would need to feed them on occasion or store them away inside a spawn egg?
- j0j0n4th4n
- Member
- Posts: 250
- Joined: Tue Jan 26, 2021 06:45
Re: [Mod] Mobs Redo [1.56] [mobs]
TenPlus1 wouldn't set the stepheight to 0 stop the mobs from climbing blocks as well?
They already have a hunger mechanic, herbivore mobs replace grass nodes with dirt it just that is more for aesthetic than function the mobs themselves don't gain anything from eating. Tweaking that made me realize tamed mobs aren't very... interactive, you sort of trap them in a tiny area and forgot they exist until you need their resources.
I think it would be more interesting to have some mechanic to encourage interacting with the mobs rather than storing them away. Losing health over time is one such mechanic but it was more of an example, as long as it encourage more interactivity with the mobs any other mechanic would be a great improvement imo.
They already have a hunger mechanic, herbivore mobs replace grass nodes with dirt it just that is more for aesthetic than function the mobs themselves don't gain anything from eating. Tweaking that made me realize tamed mobs aren't very... interactive, you sort of trap them in a tiny area and forgot they exist until you need their resources.
I think it would be more interesting to have some mechanic to encourage interacting with the mobs rather than storing them away. Losing health over time is one such mechanic but it was more of an example, as long as it encourage more interactivity with the mobs any other mechanic would be a great improvement imo.
cdb_894a100ddd76
Re: [Mod] Mobs Redo [1.56] [mobs]
Stepheight can be set per mob so 0 for swimming so they dont glitch out of the water and higher for ground mobs that need to step up blocks, plus they can still jump up if required.
I will look into a hunger mechanic as current eating of grass etc. only replenishes wool from sheep and milk from cows.
I will look into a hunger mechanic as current eating of grass etc. only replenishes wool from sheep and milk from cows.
- Blockhead
- Member
- Posts: 1681
- Joined: Wed Jul 17, 2019 10:14
- GitHub: Montandalar
- IRC: Blockhead256
- In-game: Blockhead Blockhead256
- Location: Land Down Under
- Contact:
Re: [Mod] Mobs Redo [1.56] [mobs]
I do like j0j0n4th4n's idea that mobs need a diet to maintain their health, as much as it could annoy a lot of farmers who already have a lot of stock. Well, those farmers should be maintaining their herd properly by having adequate pasture or intensive feeding with feedlot mod, or else they should be culling more often.
I can see two other potential ways to improve interactivity with mobs:
The first would revolve around genetics and breeding mobs that produce more of something, e.g. you breed cattle so that they produce more meat or more milk. The wild baseline cattle would produce an average amount of each, but when bred cattle can randomly have a +1 or -1 to milk and meat, up to a maximum modifier amount. That way you have to manage the animals to see which bloodlines produce the most. You can also involve cosmetic genetics, where cows randomly mutate into different looks and you breed the ones you like the look of. Minecraft has horse genetics in the base game but also a mod called 'Realistic Horse Genetics' might be worth looking at.
The second idea is to just RPGify the mobs as individuals. Mobs would have a bonus feeding cooldown (to prevent spam feeding for leveling up). The more times you feed a mob after it reaches its cooldown, the more XP it gets. The mob would level up and produce more items, up to a level cap.
I can see two other potential ways to improve interactivity with mobs:
The first would revolve around genetics and breeding mobs that produce more of something, e.g. you breed cattle so that they produce more meat or more milk. The wild baseline cattle would produce an average amount of each, but when bred cattle can randomly have a +1 or -1 to milk and meat, up to a maximum modifier amount. That way you have to manage the animals to see which bloodlines produce the most. You can also involve cosmetic genetics, where cows randomly mutate into different looks and you breed the ones you like the look of. Minecraft has horse genetics in the base game but also a mod called 'Realistic Horse Genetics' might be worth looking at.
The second idea is to just RPGify the mobs as individuals. Mobs would have a bonus feeding cooldown (to prevent spam feeding for leveling up). The more times you feed a mob after it reaches its cooldown, the more XP it gets. The mob would level up and produce more items, up to a level cap.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: [Mod] Mobs Redo [1.56] [mobs]
I've come across an interesting issue (seems I'm having a bug day) and I've part tracked at least were the mob gets stuck but no fix as it may actually be buried in pathfinding?
I noticed that mobs(monsters mostly) if your standing 1 node below them will jump on your head and then doesn't attack you - fairly amusing for me not so much for the monster as I can just stab them from below and kill them pretty easily.
To see the behaviour grab a tree monster egg stand near a ledge 1 block high and spawn him onto the ledge he will run and then jump on your head every time.
I tracked through the code and he appears to be getting stuck in mob_class:do_jump() after that as it will continually loop into there and then fail at "if minetest.registered_nodes[self.standing_on].walkable == false" as it is basically standing on air- log output (I just dumped node description as I figured it was probably air):
I suspect there's probably multiple fixes but the best would seem to be have it/monsters stop next to the player? I don't fully follow the pathfinding code but I did see this little bit which seems to have the actual pos the palyer is in as the end point:
I can't see any offsetting in the code for allowing or trying to find the node beside the player along the direction the monster is coming from but I could be missing it and then it's something with jumping maybe? Anyways I'm happy to dig further or if someone with more mobs experience (maybe Tenplus1 if you have time :) ) can see a quick fix that might be faster.
I noticed that mobs(monsters mostly) if your standing 1 node below them will jump on your head and then doesn't attack you - fairly amusing for me not so much for the monster as I can just stab them from below and kill them pretty easily.
To see the behaviour grab a tree monster egg stand near a ledge 1 block high and spawn him onto the ledge he will run and then jump on your head every time.
I tracked through the code and he appears to be getting stuck in mob_class:do_jump() after that as it will continually loop into there and then fail at "if minetest.registered_nodes[self.standing_on].walkable == false" as it is basically standing on air- log output (I just dumped node description as I figured it was probably air):
Code: Select all
2022-06-28 12:39:40: [Server]: 2.7026197667267 << just me dumping range to target
2022-06-28 12:39:40: [Server]: attack << dogfight
2022-06-28 12:39:40: [Server]: jump << loops until either me or the sunlight kills it\/
2022-06-28 12:39:40: [Server]: is_walkable
2022-06-28 12:39:40: [Server]: "\27(T@__builtin)Air\27E"
2022-06-28 12:39:40: [Server]: jump
2022-06-28 12:39:40: [Server]: is_walkable
2022-06-28 12:39:40: [Server]: "\27(T@__builtin)Air\27E"
Code: Select all
function mob_class:smart_mobs(s, p, dist, dtime)
local s1 = self.path.lastpos
local target_pos = p
I can't see any offsetting in the code for allowing or trying to find the node beside the player along the direction the monster is coming from but I could be missing it and then it's something with jumping maybe? Anyways I'm happy to dig further or if someone with more mobs experience (maybe Tenplus1 if you have time :) ) can see a quick fix that might be faster.
Re: [Mod] Mobs Redo [1.56] [mobs]
It turns out that the mob stepheight may be the issue here, when it's 1 block above the player and moving towards you it accidentally steps up on your head from the higher level, and since the reach (usually 1.5) is now too long since it's on your head then it cannot attack. To remedy this I can either reduce stepheight so it doesnt step up (meaning they jump up onto blocks) or increase reach (meaning they can attack from farther away).
Update:
- API updated, when a mob is on top of the player they have an extended reach to attack.
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
- sirrobzeroone
- Member
- Posts: 593
- Joined: Mon Jul 16, 2018 07:56
- GitHub: sirrobzeroone
- Contact:
Re: [Mod] Mobs Redo [1.56] [mobs]
Hi TenPlus1,
A few questions - hopefully easy:
I've tried to keep the spirit of the monster but sort of cross between a shark/bat/worm. I've so far got 3 animations sequences complete, Fly(walk), Stand(Hover), Attack-Shoot (already usable in game). I want to add a Jump, Death and Attack-Hand to Hand. I've also added 4 texture options - purple and yellow for default and then a red/green/blue for possible use in combination with Ethereal mushroom levels, you get the idea :). Also want try and fix the mese shoot arrow.
I think I've got about a week of work left to finish him off in between everything else but I've had him working in game so complete enough I'm comfortable asking the above and he dosen't become monster-vapor ware :).
Quick Blender previews (slightly over-saturated) - Mid-Fly and Mid- Shoot Attack
A few questions - hopefully easy:
- Any plans to add a jump animation? or hard to add/big job?
I've tried to keep the spirit of the monster but sort of cross between a shark/bat/worm. I've so far got 3 animations sequences complete, Fly(walk), Stand(Hover), Attack-Shoot (already usable in game). I want to add a Jump, Death and Attack-Hand to Hand. I've also added 4 texture options - purple and yellow for default and then a red/green/blue for possible use in combination with Ethereal mushroom levels, you get the idea :). Also want try and fix the mese shoot arrow.
I think I've got about a week of work left to finish him off in between everything else but I've had him working in game so complete enough I'm comfortable asking the above and he dosen't become monster-vapor ware :).
Quick Blender previews (slightly over-saturated) - Mid-Fly and Mid- Shoot Attack
- Attachments
-
- mese_monster_preview.png (110.15 KiB) Viewed 2987 times
-
- Member
- Posts: 62
- Joined: Mon May 02, 2022 11:03
- GitHub: alerikaisattera
Re: [Mod] Mobs Redo [1.56] [mobs]
Suggestion: add /clearmobs command for admins to remove all mobs
Re: [Mod] Mobs Redo [1.56] [mobs]
@sirrobzeroone - if jump_start and jump_end and the optional jump_speed and jump_loop are defined in the animation settings then they will be used when the mob jumps instead of the default stand animation.
@alerikaisattera - if admin want to clear mobs then using '/clearobjects quick' will do the trick.
@alerikaisattera - if admin want to clear mobs then using '/clearobjects quick' will do the trick.
-
- Member
- Posts: 62
- Joined: Mon May 02, 2022 11:03
- GitHub: alerikaisattera
Who is online
Users browsing this forum: No registered users and 33 guests