upgrade animal mobs part to 20240101 version, fixed bugs and tune chicken
* added settings to disable specific animals * honey blocks and beehives aren't ground content closes https://codeberg.org/tenplus1/mobs_animal/pulls/1 closes https://github.com/pandorabox-io/pandorabox.io#836 * Many node definitions seem to have not set is_ground_content to false, means jumping a ship near mapblocks that haven't been generated yet, can lead to loss of ships or at least parts of it. * chickens eat seed on ground, so add farming dependency missing * backported the have chance of chicken dropping a feather * backported commit bf12043fdcab68acfef299e26b6896a918ce1512 frombf12043fdc
* way to detect newer engines, for the sound_play extra parameter cherry picked from commit e644a1b52343c5c7e821d53c8b2f6dc9751a16fc backported frome644a1b523
minetest.sound_play uses optional parameter only in 5.3+ so autodetectting for future uses * add nil check to sheepy, fix warning msg when dye'ing sheep
This commit is contained in:
parent
bc8892e022
commit
976a83012d
12
bee.lua
12
bee.lua
@ -91,6 +91,7 @@ minetest.register_node(":mobs:beehive", {
|
|||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = true,
|
walkable = true,
|
||||||
groups = {oddly_breakable_by_hand = 3, flammable = 1, disable_suffocation = 1},
|
groups = {oddly_breakable_by_hand = 3, flammable = 1, disable_suffocation = 1},
|
||||||
|
is_ground_content = false,
|
||||||
sounds = default and default.node_sound_defaults(),
|
sounds = default and default.node_sound_defaults(),
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
@ -123,7 +124,15 @@ minetest.register_node(":mobs:beehive", {
|
|||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, node, puncher)
|
||||||
|
|
||||||
-- yep, bee's don't like having their home punched by players
|
-- yep, bee's don't like having their home punched by players
|
||||||
puncher:set_hp(puncher:get_hp() - 4)
|
minetest.after(0.2, function()
|
||||||
|
|
||||||
|
if puncher then
|
||||||
|
|
||||||
|
local hp = puncher:get_hp()
|
||||||
|
|
||||||
|
if hp then puncher:set_hp(hp - 4) end
|
||||||
|
end
|
||||||
|
end)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
@ -157,6 +166,7 @@ minetest.register_node(":mobs:honey_block", {
|
|||||||
description = S("Honey Block"),
|
description = S("Honey Block"),
|
||||||
tiles = {"mobs_honey_block.png"},
|
tiles = {"mobs_honey_block.png"},
|
||||||
groups = {snappy = 3, flammable = 2},
|
groups = {snappy = 3, flammable = 2},
|
||||||
|
is_ground_content = false,
|
||||||
sounds = default and default.node_sound_dirt_defaults()
|
sounds = default and default.node_sound_dirt_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
50
chicken.lua
50
chicken.lua
@ -57,9 +57,23 @@ mobs:register_mob(":mobs_animal:chicken", {
|
|||||||
},
|
},
|
||||||
follow = {
|
follow = {
|
||||||
"farming:seed_wheat", "farming:seed_cotton", "farming:seed_barley",
|
"farming:seed_wheat", "farming:seed_cotton", "farming:seed_barley",
|
||||||
"farming:seed_oat", "farming:seed_rye"
|
"farming:seed_oat", "farming:seed_rye", "farming:seed_rice",
|
||||||
|
"farming:seed_hemp", "farming:seed_sunflower", "farming:seed_mint"
|
||||||
},
|
},
|
||||||
view_range = 5,
|
view_range = 5,
|
||||||
|
replace_rate = 5,
|
||||||
|
replace_what = {
|
||||||
|
{"farming:seed_wheat", "air", 0},
|
||||||
|
{"farming:seed_cotton", "air", 0},
|
||||||
|
{"farming:seed_barley", "air", 0},
|
||||||
|
{"farming:seed_oat", "air", 0},
|
||||||
|
{"farming:seed_rye", "air", 0},
|
||||||
|
{"farming:seed_rice", "air", 0},
|
||||||
|
{"farming:seed_hemp", "air", 0},
|
||||||
|
{"farming:seed_mint", "air", 0},
|
||||||
|
{"farming:seed_sunflower", "air", 0}
|
||||||
|
},
|
||||||
|
stay_near = {{"group:seed"}, 7},
|
||||||
|
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
|
|
||||||
@ -76,20 +90,25 @@ mobs:register_mob(":mobs_animal:chicken", {
|
|||||||
end
|
end
|
||||||
self.egg_timer = 0
|
self.egg_timer = 0
|
||||||
|
|
||||||
if self.child
|
if self.child then
|
||||||
or math.random(100) > 1 then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = self.object:get_pos() ; if not pos then return end
|
local pos = self.object:get_pos() ; if not pos then return end
|
||||||
|
|
||||||
minetest.add_item(pos, "mobs:egg")
|
if math.random(100) == 1 then
|
||||||
|
|
||||||
minetest.sound_play("default_place_node_hard", {
|
minetest.add_item(pos, "mobs:egg")
|
||||||
pos = pos,
|
|
||||||
gain = 1.0,
|
if mobs.is52a then
|
||||||
max_hear_distance = 5
|
minetest.sound_play("default_place_node_hard", { pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
||||||
})
|
else
|
||||||
|
minetest.sound_play("default_place_node_hard", { pos = pos, gain = 1.0, max_hear_distance = 5})
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif math.random(100) < 6 then
|
||||||
|
minetest.add_item(pos, "mobs:chicken_feather")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -161,10 +180,13 @@ mobs:register_arrow(":mobs_animal:egg_entity", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local staticdata = minetest.serialize(
|
mobs:add_mob(pos, {
|
||||||
{child = true, tamed = true, owner = self.playername})
|
name = "mobs_animal:chicken",
|
||||||
|
child = true,
|
||||||
minetest.add_entity(pos, "mobs_animal:chicken", staticdata)
|
owner = self.playername,
|
||||||
|
-- nametag = "Chicky",
|
||||||
|
ignore_count = true -- ignores mob count per map area
|
||||||
|
})
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -231,7 +253,7 @@ minetest.register_node(":mobs:egg", {
|
|||||||
wield_image = "mobs_chicken_egg.png",
|
wield_image = "mobs_chicken_egg.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
is_ground_content = true,
|
is_ground_content = false,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
mobs
|
mobs
|
||||||
default?
|
default?
|
||||||
|
farming?
|
||||||
lucky_block?
|
lucky_block?
|
||||||
intllib?
|
intllib?
|
||||||
tnt?
|
tnt?
|
||||||
fire?
|
fire?
|
||||||
|
35
init.lua
35
init.lua
@ -23,8 +23,11 @@ else
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mobs.intllib_animal = S
|
local is50 = minetest.has_feature("object_use_texture_alpha") or nil
|
||||||
|
local is54 = minetest.has_feature("use_texture_alpha_string_modes") or nil
|
||||||
|
|
||||||
|
mobs.intllib_animal = S
|
||||||
|
mobs.is54a = is54
|
||||||
|
|
||||||
-- Check for custom mob spawn file
|
-- Check for custom mob spawn file
|
||||||
local input = io.open(path .. "spawn.lua", "r")
|
local input = io.open(path .. "spawn.lua", "r")
|
||||||
@ -35,18 +38,28 @@ if input then
|
|||||||
input = nil
|
input = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- helper function
|
||||||
|
local function ddoo(mob)
|
||||||
|
|
||||||
|
if minetest.settings:get_bool("mobs_animal." .. mob) == false then
|
||||||
|
print("[Mobs_Animal] " .. mob .. " disabled!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
dofile(path .. mob .. ".lua")
|
||||||
|
end
|
||||||
|
|
||||||
if not minetest.get_modpath("mobs_animal") then
|
if not minetest.get_modpath("mobs_animal") then
|
||||||
dofile(path .. "chicken.lua") -- JKmurray
|
ddoo("chicken") -- JKmurray
|
||||||
dofile(path .. "cow.lua") -- KrupnoPavel
|
ddoo("cow") -- KrupnoPavel
|
||||||
dofile(path .. "rat.lua") -- PilzAdam
|
ddoo("rat") -- PilzAdam
|
||||||
dofile(path .. "sheep.lua") -- PilzAdam
|
ddoo("sheep") -- PilzAdam
|
||||||
dofile(path .. "warthog.lua") -- KrupnoPavel
|
ddoo("warthog") -- KrupnoPavel
|
||||||
dofile(path .. "bee.lua") -- KrupnoPavel
|
ddoo("bee") -- KrupnoPavel
|
||||||
dofile(path .. "bunny.lua") -- ExeterDad
|
ddoo("bunny") -- ExeterDad
|
||||||
dofile(path .. "kitten.lua") -- Jordach/BFD
|
ddoo("kitten") -- Jordach/BFD
|
||||||
dofile(path .. "penguin.lua") -- D00Med
|
ddoo("penguin") -- D00Med
|
||||||
dofile(path .. "panda.lua") -- AspireMint
|
ddoo("panda") -- AspireMint
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.get_modpath("mobs_doomed") or not minetest.get_modpath("dmobs") then
|
if not minetest.get_modpath("mobs_doomed") or not minetest.get_modpath("dmobs") then
|
||||||
|
25
kitten.lua
25
kitten.lua
@ -127,28 +127,30 @@ mobs:register_mob(":mobs_animal:kitten", {
|
|||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
minetest.add_item(pos, "mobs:hairball")
|
minetest.add_item(pos, "mobs:hairball")
|
||||||
|
if mobs.is54a then
|
||||||
minetest.sound_play("default_dig_snappy", {
|
minetest.sound_play("default_dig_snappy", { pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
||||||
pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
else
|
||||||
|
minetest.sound_play("default_dig_snappy", { pos = pos, gain = 1.0, max_hear_distance = 5})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
local spawn_on = {"default:dirt_with_grass"}
|
local spawn_on = "default:dirt_with_grass"
|
||||||
|
|
||||||
if minetest.get_modpath("ethereal") then
|
if minetest.get_modpath("ethereal") then
|
||||||
spawn_on = {"ethereal:grove_dirt","default:dirt_with_grass"}
|
spawn_on = "ethereal:grove_dirt"
|
||||||
end
|
end
|
||||||
|
|
||||||
if not mobs.custom_spawn_animal then
|
if not mobs.custom_spawn_animal then
|
||||||
|
|
||||||
mobs:spawn({
|
mobs:spawn({
|
||||||
name = ":mobs_animal:kitten",
|
name = ":mobs_animal:kitten",
|
||||||
nodes = spawn_on,
|
nodes = {spawn_on},
|
||||||
neighbors = {"group:grass"},
|
neighbors = {"group:grass"},
|
||||||
min_light = 14,
|
min_light = 14,
|
||||||
interval = 60,
|
interval = 60,
|
||||||
chance = 8000,
|
chance = 10000,
|
||||||
min_height = 5,
|
min_height = 5,
|
||||||
max_height = 50,
|
max_height = 50,
|
||||||
day_toggle = true
|
day_toggle = true
|
||||||
@ -187,10 +189,11 @@ minetest.register_craftitem(":mobs:hairball", {
|
|||||||
and minetest.registered_items[item] then
|
and minetest.registered_items[item] then
|
||||||
minetest.add_item(newpos, {name = item})
|
minetest.add_item(newpos, {name = item})
|
||||||
end
|
end
|
||||||
|
if mobs.is50a then
|
||||||
minetest.sound_play("default_place_node_hard", {
|
minetest.sound_play("default_place_node_hard", {pos = newpos, gain = 1.0, max_hear_distance = 5}, true)
|
||||||
pos = newpos, gain = 1.0, max_hear_distance = 5}, true)
|
else
|
||||||
|
minetest.sound_play("default_place_node_hard", {pos = newpos, gain = 1.0, max_hear_distance = 5})
|
||||||
|
end
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Convert '.po' file to '.txt' file.
|
# Convert '.po' file to '.txt' file.
|
||||||
|
|
||||||
|
This is only used for older engines.. newer ones uses the plain text files with tr extensions
|
||||||
|
|
||||||
### COMMAND SAMPLE
|
### COMMAND SAMPLE
|
||||||
''''
|
''''
|
||||||
$ lua po2tr.lua "Your Name (Your Site) <Your Email>" "pt_BR.po"
|
$ lua po2tr.lua "Your Name (Your Site) <Your Email>" "pt_BR.po"
|
||||||
|
@ -26,3 +26,9 @@ lucky_block:add_blocks({
|
|||||||
{name = "mobs:lava_orb", max = 1}}},
|
{name = "mobs:lava_orb", max = 1}}},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if minetest.registered_nodes["default:nyancat"] then
|
||||||
|
|
||||||
|
lucky_block:add_blocks({
|
||||||
|
{"tro", "default:nyancat", "mobs_kitten", true}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
3
mod.conf
3
mod.conf
@ -1,4 +1,5 @@
|
|||||||
name = mobs_jam
|
name = mobs_jam
|
||||||
depends = mobs
|
depends = mobs
|
||||||
optional_depends = default, lucky_block, intllib, tnt, fire
|
optional_depends = default, farming, lucky_block, tnt, fire
|
||||||
description = MOBS mod of animals, monters and extra, reduced version from tenplush1 and others mods
|
description = MOBS mod of animals, monters and extra, reduced version from tenplush1 and others mods
|
||||||
|
min_minetest_version = 0.4.16
|
||||||
|
@ -73,7 +73,8 @@ local spawn_on = {"default:dirt_with_grass"}
|
|||||||
|
|
||||||
if minetest.get_modpath("ethereal") then spawn_on = {"ethereal:bamboo_dirt", "default:dirt_with_grass"} end
|
if minetest.get_modpath("ethereal") then spawn_on = {"ethereal:bamboo_dirt", "default:dirt_with_grass"} end
|
||||||
|
|
||||||
if not mobs.custom_spawn_animal then
|
if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then
|
||||||
|
|
||||||
mobs:spawn({
|
mobs:spawn({
|
||||||
name = ":mobs_animal:panda",
|
name = ":mobs_animal:panda",
|
||||||
nodes = spawn_on,
|
nodes = spawn_on,
|
||||||
@ -85,7 +86,6 @@ if not mobs.custom_spawn_animal then
|
|||||||
max_height = 80,
|
max_height = 80,
|
||||||
day_toggle = true
|
day_toggle = true
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ if not mobs.custom_spawn_animal then
|
|||||||
min_light = 14,
|
min_light = 14,
|
||||||
interval = 60,
|
interval = 60,
|
||||||
chance = 10000,
|
chance = 10000,
|
||||||
min_height = 1000,
|
min_height = 0,
|
||||||
max_height = 200,
|
max_height = 200,
|
||||||
day_toggle = true
|
day_toggle = true
|
||||||
})
|
})
|
||||||
|
10
settingtypes.txt
Normal file
10
settingtypes.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
mobs_animal.bee (Enable Bee) bool true
|
||||||
|
mobs_animal.bunny (Enable Bunny) bool true
|
||||||
|
mobs_animal.chicken (Enable Chicken) bool true
|
||||||
|
mobs_animal.cow (Enable Cow) bool true
|
||||||
|
mobs_animal.kitten (Enable Kitten) bool true
|
||||||
|
mobs_animal.panda (Enable Panda) bool true
|
||||||
|
mobs_animal.penguin (Enable Penguin) bool true
|
||||||
|
mobs_animal.rat (Enable Rat) bool true
|
||||||
|
mobs_animal.sheep (Enable Sheep) bool true
|
||||||
|
mobs_animal.warthog (Enable Warthog) bool true
|
29
sheep.lua
29
sheep.lua
@ -34,6 +34,18 @@ for _, col in ipairs(all_colours) do
|
|||||||
|
|
||||||
local function horn_texture_sel(horns, gotten, colr)
|
local function horn_texture_sel(horns, gotten, colr)
|
||||||
|
|
||||||
|
-- get override colours hex value from table
|
||||||
|
if colr then
|
||||||
|
|
||||||
|
for _2, col2 in ipairs(all_colours) do
|
||||||
|
|
||||||
|
if col2[1] == colr then
|
||||||
|
colr = col2[3]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local base_text = "mobs_sheep_base.png"
|
local base_text = "mobs_sheep_base.png"
|
||||||
local wool_shave_text = "mobs_sheep_wool.png"
|
local wool_shave_text = "mobs_sheep_wool.png"
|
||||||
local shav_text = "mobs_sheep_shaved.png"
|
local shav_text = "mobs_sheep_shaved.png"
|
||||||
@ -370,9 +382,9 @@ end
|
|||||||
if not mobs.custom_spawn_animal then
|
if not mobs.custom_spawn_animal then
|
||||||
|
|
||||||
local max_ht = 400
|
local max_ht = 400
|
||||||
local spawn_on = {"default:dirt_with_grass"}
|
local spawn_on = {"default:dirt_with_grass", "ethereal:green_dirt"}
|
||||||
local mod_ethereal = minetest.get_modpath("ethereal")
|
local mod_ethereal = minetest.get_modpath("ethereal")
|
||||||
local spawn_chance = 4000
|
local spawn_chance = mod_ethereal and 9000 or 4000
|
||||||
|
|
||||||
if mod_ethereal then spawn_on = {"default:dirt_with_grass", "ethereal:green_dirt"} end
|
if mod_ethereal then spawn_on = {"default:dirt_with_grass", "ethereal:green_dirt"} end
|
||||||
|
|
||||||
@ -392,11 +404,11 @@ if not mobs.custom_spawn_animal then
|
|||||||
on_spawn = function(self, pos)
|
on_spawn = function(self, pos)
|
||||||
|
|
||||||
local nat_colors = {-- reference for all_colours table
|
local nat_colors = {-- reference for all_colours table
|
||||||
["white"] = 14,
|
["white"] = 14,
|
||||||
["grey"] = 8,
|
["grey"] = 8,
|
||||||
["dark_grey"] = 6,
|
["dark_grey"] = 6,
|
||||||
["black"] = 1,
|
["black"] = 1,
|
||||||
["brown"] = 3
|
["brown"] = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
local function random_sheep(pos, first)
|
local function random_sheep(pos, first)
|
||||||
@ -432,7 +444,10 @@ if not mobs.custom_spawn_animal then
|
|||||||
local entity = mobs:add_mob(pos,
|
local entity = mobs:add_mob(pos,
|
||||||
{name = "mobs_animal:sheep_" .. types, child = lamb})
|
{name = "mobs_animal:sheep_" .. types, child = lamb})
|
||||||
|
|
||||||
if entity and not lamb then
|
-- nil check
|
||||||
|
if not entity then return end
|
||||||
|
|
||||||
|
if not lamb then
|
||||||
-- Set horns attribute, lower height will be rarer.
|
-- Set horns attribute, lower height will be rarer.
|
||||||
-- This wont affect mobs spawned by egg those only spawn hornless sheep.
|
-- This wont affect mobs spawned by egg those only spawn hornless sheep.
|
||||||
local horns = random(max_ht) <= pos.y
|
local horns = random(max_ht) <= pos.y
|
||||||
|
Loading…
Reference in New Issue
Block a user