Subgame: Update textures and small bugfix

This commit is contained in:
Maksim Gamarnik 2016-12-06 07:25:04 +03:00
parent 827084f5fb
commit 6d60a2d71b
84 changed files with 439 additions and 212 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 639 B

View File

@ -89,13 +89,6 @@ minetest.register_craftitem("default:clay_brick", {
groups = {materials = 1}, groups = {materials = 1},
}) })
minetest.register_craftitem("default:flint", {
description = "Flint",
inventory_image = "default_flint.png",
stack_max = 64,
groups = {materials = 1},
})
minetest.register_craftitem("default:gunpowder", { minetest.register_craftitem("default:gunpowder", {
description = "Gunpowder", description = "Gunpowder",
inventory_image = "default_gunpowder.png", inventory_image = "default_gunpowder.png",

View File

@ -306,25 +306,6 @@ minetest.register_node("default:dirt", {
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
minetest.register_node("default:gravel", {
description = "Gravel",
tiles = {"default_gravel.png"},
is_ground_content = true,
stack_max = 64,
groups = {crumbly=2, falling_node=1, building = 1},
drop = {
max_items = 1,
items = {
{items = {'default:flint'},rarity = 7},
{items = {'default:gravel'}}
}
},
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_gravel_footstep", gain=0.45},
}),
})
-- sandstone -- -- sandstone --
minetest.register_node("default:sand", { minetest.register_node("default:sand", {
description = "Sand", description = "Sand",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1015 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 B

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 B

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 946 B

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 772 B

After

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 718 B

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 993 B

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

After

Width:  |  Height:  |  Size: 695 B

View File

@ -321,22 +321,3 @@ minetest.register_tool("default:pole", {
return nil return nil
end, end,
}) })
--Shears
minetest.register_tool("default:shears", {
description = "Shears",
inventory_image = "default_tool_shears.png",
wield_image = "default_tool_shears.png",
stack_max = 1,
max_drop_level=3,
tool_capabilities = {
full_punch_interval = 0.5,
max_drop_level=1,
groupcaps={
leaves={times={[1]=0,[2]=0,[3]=0}, uses=283, maxlevel=1},
wool={times={[1]=0.2,[2]=0.2,[3]=0.2}, uses=283, maxlevel=1},
snappy={times={[1]=0.2,[2]=0.2,[3]=0.2}, uses=283, maxlevel=1},
}
},
groups = {tools=1},
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 574 B

View File

@ -44,8 +44,12 @@
fall_damage = 5, fall_damage = 5,
makes_footstep_sound = true, makes_footstep_sound = true,
drops = { drops = {
{name = "mobs:meat_raw", chance = 1, min = 2, max = 4}, {name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
{name = "mobs:leather", chance = 1, min = 1, max = 2} {name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
{name = "mobs:meat_raw", chance = 2, min = 1, max = 1},
{name = "mobs:meat_raw", chance = 2, min = 1, max = 1},
{name = "mobs:leather", chance = 1, min = 1, max = 1},
{name = "mobs:leather", chance = 2, min = 1, max = 1}
}, },
replace_what = { replace_what = {
"farming:blueberry_4", "farming:raspberry_4" "farming:blueberry_4", "farming:raspberry_4"
@ -78,9 +82,15 @@
end end
}) })
mobs:spawn({
mobs:register_spawn("mobs_animal:bear", name = "mobs_animal:bear",
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 4000, 1, 31000, true) nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 0,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mobs_animal:bear", "Bear", "wool_brown.png", 1) mobs:register_egg("mobs_animal:bear", "Bear", "wool_brown.png", 1)

View File

@ -71,6 +71,7 @@ mobs:register_mob("mobs_animal:bunny", {
return return
end end
mobs:protect(self, clicker)
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end, end,
@ -78,8 +79,14 @@ mobs:register_mob("mobs_animal:bunny", {
damage = 5, damage = 5,
}) })
mobs:register_spawn("mobs_animal:bunny", mobs:spawn({
{"default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 0, 3000, 2, 31000, true) name = "mobs_animal:bunny",
nodes = {"default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 10,
chance = 15000,
min_height = 0,
day_toggle = true,
})
mobs:register_egg("mobs_animal:bunny", "Bunny", "mobs_bunny_inv.png", 0) mobs:register_egg("mobs_animal:bunny", "Bunny", "mobs_bunny_inv.png", 0)

View File

@ -52,6 +52,7 @@ mobs:register_mob("mobs_animal:chicken", {
return return
end end
mobs:protect(self, clicker)
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end, end,
@ -74,8 +75,15 @@ mobs:register_mob("mobs_animal:chicken", {
end, end,
}) })
mobs:register_spawn("mobs_animal:chicken", mobs:spawn({
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 3000, 1, 31000, true) name = "mobs_animal:chicken",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 5,
chance = 15000,
active_object_count = 2,
min_height = 0,
day_toggle = true,
})
mobs:register_egg("mobs_animal:chicken", "Chicken", "mobs_chicken_inv.png", 0) mobs:register_egg("mobs_animal:chicken", "Chicken", "mobs_chicken_inv.png", 0)

View File

@ -1,5 +1,5 @@
-- Cow by Krupnopavel (additional texture by JurajVajda) -- Cow by Krupnovpavel (additional texture by JurajVajda)
mobs:register_mob("mobs_animal:cow", { mobs:register_mob("mobs_animal:cow", {
type = "animal", type = "animal",
@ -25,8 +25,11 @@ mobs:register_mob("mobs_animal:cow", {
run_velocity = 2, run_velocity = 2,
jump = true, jump = true,
drops = { drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 3}, {name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
{name = "mobs:leather", chance = 1, min = 0, max = 2}, {name = "mobs:meat_raw", chance = 2, min = 1, max = 1},
{name = "mobs:meat_raw", chance = 2, min = 1, max = 1},
{name = "mobs:leather", chance = 2, min = 1, max = 1},
{name = "mobs:leather", chance = 2, min = 1, max = 1}
}, },
water_damage = 1, water_damage = 1,
lava_damage = 5, lava_damage = 5,
@ -57,6 +60,7 @@ mobs:register_mob("mobs_animal:cow", {
end end
local tool = clicker:get_wielded_item() local tool = clicker:get_wielded_item()
local name = clicker:get_player_name()
-- milk cow with empty bucket -- milk cow with empty bucket
if tool:get_name() == "bucket:bucket_empty" then if tool:get_name() == "bucket:bucket_empty" then
@ -67,7 +71,7 @@ mobs:register_mob("mobs_animal:cow", {
end end
if self.gotten == true then if self.gotten == true then
minetest.chat_send_player(clicker:get_player_name(), minetest.chat_send_player(name,
"Cow already milked!") "Cow already milked!")
return return
end end
@ -89,12 +93,20 @@ mobs:register_mob("mobs_animal:cow", {
return return
end end
mobs:protect(self, clicker)
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end, end,
}) })
mobs:register_spawn("mobs_animal:cow", mobs:spawn({
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 4000, 1, 31000, true) name = "mobs_animal:cow",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 5,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mobs_animal:cow", "Cow", "default_grass.png", 1) mobs:register_egg("mobs_animal:cow", "Cow", "default_grass.png", 1)

View File

@ -40,13 +40,13 @@
fall_damage = 4, fall_damage = 4,
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { sounds = {
war_cry = "mobs_wolf_attack" war_cry = "mobs_wolf_attack",
death = "mobs_wolf_attack"
}, },
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 2, false, true) then if mobs:feed_tame(self, clicker, 2, false, true) then
if self.food == 0 then if self.food == 0 then
local mob = minetest.add_entity(self.object:getpos(), "mobs_wolf:dog") local mob = minetest.add_entity(self.object:getpos(), "mobs_animal:dog")
local ent = mob:get_luaentity() local ent = mob:get_luaentity()
ent.owner = clicker:get_player_name() ent.owner = clicker:get_player_name()
ent.following = clicker ent.following = clicker
@ -59,9 +59,15 @@
end end
}) })
mobs:spawn({
mobs:register_spawn("mobs_animal:wolf", name = "mobs_animal:wolf",
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 0, 4000, 1, 31000, true) nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 0,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mobs_animal:wolf", "Wolf", "wool_grey.png", 1) mobs:register_egg("mobs_animal:wolf", "Wolf", "wool_grey.png", 1)
@ -106,9 +112,9 @@ mobs:register_egg("mobs_animal:wolf", "Wolf", "wool_grey.png", 1)
fall_damage = 5, fall_damage = 5,
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { sounds = {
war_cry = "mobs_wolf_attack" war_cry = "mobs_wolf_attack",
death = "mobs_wolf_attack"
}, },
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 6, true, true) then if mobs:feed_tame(self, clicker, 6, true, true) then
return return

View File

@ -13,5 +13,11 @@ dofile(path .. "/pig.lua") -- KrupnoPavel
dofile(path .. "/bear.lua") -- KrupnoPavel dofile(path .. "/bear.lua") -- KrupnoPavel
-- Removed -- Removed
dofile(path .. "/rat.lua") -- Jordach/BFD mobs:register_mob("mobs_animal:rat", {
lifetimer = 1,
})
-- compatibility
mobs:alias_mob("mobs:rat", "mobs_animal:rat")
mobs:alias_mob("mobs:rat_meat", "mobs:meat_raw")
mobs:alias_mob("mobs:rat_cooked", "mobs:meat")

View File

@ -46,12 +46,20 @@ mobs:register_mob("mobs_animal:kitten", {
return return
end end
mobs:protect(self, clicker)
mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) mobs:capture_mob(self, clicker, 50, 50, 90, false, nil)
end end
}) })
mobs:register_spawn("mobs_animal:kitten", mobs:spawn({
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 5000, 1, 31000, true) name = "mobs_animal:kitten",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 12,
chance = 22000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mobs_animal:kitten", "Kitten", "mobs_kitten_inv.png", 0) mobs:register_egg("mobs_animal:kitten", "Kitten", "mobs_kitten_inv.png", 0)

View File

@ -32,7 +32,7 @@ mobs:register_mob("mobs_animal:pig", {
{name = "mobs:pork_raw", {name = "mobs:pork_raw",
chance = 2, min = 1, max = 1}, chance = 2, min = 1, max = 1},
{name = "mobs:pork_raw", {name = "mobs:pork_raw",
chance = 2, min = 1, max = 1}, chance = 2, min = 1, max = 1}
}, },
water_damage = 1, water_damage = 1,
lava_damage = 5, lava_damage = 5,
@ -53,9 +53,15 @@ mobs:register_mob("mobs_animal:pig", {
end, end,
}) })
mobs:register_spawn("mobs_animal:pig", mobs:spawn({
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 4000, 1, 31000, true) name = "mobs_animal:pig",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 5,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:register_egg("mobs_animal:pig", "Pig", "wool_pink.png", 1) mobs:register_egg("mobs_animal:pig", "Pig", "wool_pink.png", 1)

View File

@ -1,8 +0,0 @@
mobs:register_mob("mobs_animal:rat", {
lifetimer = 1,
})
-- compatibility
mobs:alias_mob("mobs:rat", "mobs_animal:rat")
mobs:alias_mob("mobs:rat_meat", "mobs:meat_raw")
mobs:alias_mob("mobs:rat_cooked", "mobs:meat")

View File

@ -27,7 +27,7 @@ Rat
Sheep Sheep
- Green grass and wheat munchers that can be clipped using shears to give 1-3 wool. Feed sheep 8x wheat to regrow wool, tame and breed. Will drop 1-3 meat when killed. - Green grass and wheat munchers that can be clipped using shears to give 1-3 wool. Feed sheep 8x wheat to regrow wool, tame and breed. Right-click a tamed sheep with dye to change it's colour. Will drop 1-3 meat when killed.
Warthog Warthog

View File

@ -45,8 +45,9 @@ for _, col in pairs(all_colours) do
runaway = true, runaway = true,
jump = true, jump = true,
drops = { drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 2}, {name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
{name = "wool:"..col[1], chance = 1, min = 1, max = 1}, {name = "mobs:meat_raw", chance = 2, min = 1, max = 1},
{name = "wool:"..col[1], chance = 1, min = 1, max = 1}
}, },
water_damage = 1, water_damage = 1,
lava_damage = 5, lava_damage = 5,
@ -176,21 +177,55 @@ for _, col in pairs(all_colours) do
end end
mobs:register_spawn("mobs_animal:sheep_white", mobs:spawn({
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true) name = "mobs_animal:sheep_white",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
mobs:register_spawn("mobs_animal:sheep_grey", min_light = 5,
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true) chance = 15000,
min_height = 0,
mobs:register_spawn("mobs_animal:sheep_dark_grey", max_height = 31000,
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true) day_toggle = true,
})
mobs:register_spawn("mobs_animal:sheep_black",
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true)
mobs:register_spawn("mobs_animal:sheep_brown",
{"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"}, 20, 5, 12000, 1, 31000, true)
mobs:spawn({
name = "mobs_animal:sheep_grey",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 5,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:spawn({
name = "mobs_animal:sheep_dark_grey",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 5,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:spawn({
name = "mobs_animal:sheep_black",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 5,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
mobs:spawn({
name = "mobs_animal:sheep_brown",
nodes = {"default:dirt", "default:sand", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass"},
min_light = 5,
chance = 15000,
min_height = 0,
max_height = 31000,
day_toggle = true,
})
-- compatibility -- compatibility
mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white") mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white")

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View File

@ -4,5 +4,5 @@ local path = minetest.get_modpath("mobs_monster")
-- Monsters -- Monsters
dofile(path .. "/spider.lua") -- AspireMint dofile(path .. "/spider.lua") -- AspireMint
dofile(path.."/zombie.lua") -- Blockmen dofile(path .. "/zombie.lua") -- Blockmen
dofile(path.."/skeleton.lua") -- Blockmen dofile(path .. "/skeleton.lua") -- Blockmen

View File

@ -35,4 +35,4 @@ Stone Monster
Tree Monster Tree Monster
- Found atop tree's at night time they drop down and look for food in the form of players. Can drop saplings and sometimes an apple or three. - Found atop tree's at night time they drop down and look for food in the form of players and animals. Can drop saplings and sometimes an apple or three.

View File

@ -36,12 +36,21 @@ mobs:register_mob("mobs_monster:skeleton", {
run_velocity = 0.5, run_velocity = 0.5,
jump = false, jump = false,
drops = { drops = {
{name = "default:bone", chance = 1, min = 0, max = 2,} {name = "default:bone", chance = 2, min = 1, max = 1},
{name = "default:bone", chance = 2, min = 1, max = 1}
}, },
}) })
mobs:register_spawn("mobs_monster:skeleton", mobs:spawn({
{"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, 10, 0, 5000, 1, 31000, false) name = "mobs_monster:skeleton",
nodes = {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"},
min_light = 0,
max_light = 10,
chance = 7000,
active_object_count = 1,
min_height = -50,
max_height = 31000,
})
-- compatibility -- compatibility
mobs:alias_mob("mobs:skeleton", "mobs_monster:skeleton") mobs:alias_mob("mobs:skeleton", "mobs_monster:skeleton")

View File

@ -3,6 +3,7 @@
mobs:register_mob("mobs_monster:spider", { mobs:register_mob("mobs_monster:spider", {
docile_by_day = true, docile_by_day = true,
group_attack = true,
type = "monster", type = "monster",
passive = false, passive = false,
attack_type = "dogfight", attack_type = "dogfight",
@ -32,7 +33,7 @@ mobs:register_mob("mobs_monster:spider", {
-- {name = "farming:string", -- {name = "farming:string",
-- chance = 1, min = 1, max = 2}, }, -- chance = 1, min = 1, max = 2}, },
water_damage = 5, water_damage = 5,
lava_damage = 5, lava_damage = 5,
light_damage = 0, light_damage = 0,
animation = { animation = {
speed_normal = 15, speed_normal = 15,
@ -48,8 +49,16 @@ mobs:register_mob("mobs_monster:spider", {
}, },
}) })
mobs:register_spawn("mobs_monster:spider", mobs:spawn({
{"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, 13, 0, 6000, 1, 31000) name = "mobs_monster:spider",
nodes = {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"},
min_light = 0,
max_light = 12,
chance = 7000,
active_object_count = 1,
min_height = -50,
max_height = 31000,
})
mobs:register_egg("mobs_monster:spider", "Spider", "mobs_cobweb.png", 1) mobs:register_egg("mobs_monster:spider", "Spider", "mobs_cobweb.png", 1)

View File

@ -36,19 +36,28 @@ mobs:register_mob("mobs_monster:zombie", {
run_velocity = 0.5, run_velocity = 0.5,
jump = false, jump = false,
drops = { drops = {
{name = "mobs_monster:rotten_flesh", chance = 1, min = 1, max = 3,} {name = "mobs_monster:rotten_flesh", chance = 1, min = 1, max = 1},
{name = "mobs_monster:rotten_flesh", chance = 2, min = 1, max = 1},
{name = "mobs_monster:rotten_flesh", chance = 2, min = 1, max = 1}
}, },
}) })
mobs:register_spawn("mobs_monster:zombie", mobs:spawn({
{"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"}, 10, 0, 5000, 1, 31000, false) name = "mobs_monster:zombie",
nodes = {"default:dirt", "default:sandstone", "default:sand", "default:stone", "default:snowblock", "default:dirt_with_snow", "default:dirt_with_grass", "default:cobble", "default:mossycobble"},
min_light = 0,
max_light = 10,
chance = 7000,
active_object_count = 1,
min_height = -50,
max_height = 31000,
})
mobs:register_egg("mobs_monster:zombie", "Zombie", "zombie_head.png", 0) mobs:register_egg("mobs_monster:zombie", "Zombie", "zombie_head.png", 0)
-- compatibility -- compatibility
mobs:alias_mob("mobs:zombie", "mobs_monster:zombie") mobs:alias_mob("mobs:zombie", "mobs_monster:zombie")
mobs:alias_mob("mobs:rotten_flesh", "mobs_monster:rotten_flesh") mobs:alias_mob("mobs:rotten_flesh", "mobs_monster:rotten_flesh")
mobs:alias_mob("mobs:zombie_spawner", "mobs_monster:zombie_spawner")
-- rotten flesh -- rotten flesh
minetest.register_craftitem("mobs_monster:rotten_flesh", { minetest.register_craftitem("mobs_monster:rotten_flesh", {
@ -56,6 +65,3 @@ minetest.register_craftitem("mobs_monster:rotten_flesh", {
inventory_image = "mobs_rotten_flesh.png", inventory_image = "mobs_rotten_flesh.png",
on_use = minetest.item_eat(1), on_use = minetest.item_eat(1),
}) })
-- compatibility
mobs:alias_mob("mobs:zombie", "mobs_monster:zombie")

View File

@ -1,23 +1,23 @@
-- Mobs Api (5th September 2016) -- Mobs Api (22nd November 2016)
mobs = {} mobs = {}
mobs.mod = "redo" mobs.mod = "redo"
-- Invisibility mod check -- Invisibility mod check
local invis = {} mobs.invis = {}
if rawget(_G, "invisibility") then if rawget(_G, "invisibility") then
invis = invisibility mobs.invis = invisibility
end end
-- Load settings -- Load settings
local damage_enabled = minetest.setting_getbool("enable_damage") local damage_enabled = minetest.setting_getbool("enable_damage")
local peaceful_only = minetest.setting_getbool("only_peaceful_mobs") local peaceful_only = minetest.setting_getbool("only_peaceful_mobs")
--local disable_blood = minetest.setting_getbool("mobs_disable_blood")
local disable_blood = true local disable_blood = true
local creative = minetest.setting_getbool("creative_mode") local creative = minetest.setting_getbool("creative_mode")
local spawn_protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 1 local spawn_protected = tonumber(minetest.setting_get("mobs_spawn_protected")) or 1
local remove_far = minetest.setting_getbool("remove_far_mobs") local remove_far = minetest.setting_getbool("remove_far_mobs")
local difficulty = tonumber(minetest.setting_get("mob_difficulty")) or 1.0
-- pathfinding settings -- pathfinding settings
local enable_pathfinding = true local enable_pathfinding = true
@ -216,9 +216,12 @@ function line_of_sight_water(self, pos1, pos2, stepsize)
end end
-- particle effects -- particle effects
function effect(pos, amount, texture, max_size, radius) function effect(pos, amount, texture, min_size, max_size, radius, gravity)
radius = radius or 2 radius = radius or 2
min_size = min_size or 0.5
max_size = max_size or 1
gravity = gravity or -10
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = amount, amount = amount,
@ -227,12 +230,12 @@ function effect(pos, amount, texture, max_size, radius)
maxpos = pos, maxpos = pos,
minvel = {x = -radius, y = -radius, z = -radius}, minvel = {x = -radius, y = -radius, z = -radius},
maxvel = {x = radius, y = radius, z = radius}, maxvel = {x = radius, y = radius, z = radius},
minacc = {x = -radius, y = -radius, z = -radius}, minacc = {x = 0, y = gravity, z = 0},
maxacc = {x = radius, y = radius, z = radius}, maxacc = {x = 0, y = gravity, z = 0},
minexptime = 0.1, minexptime = 0.1,
maxexptime = 1, maxexptime = 1,
minsize = 0.5, minsize = min_size,
maxsize = (max_size or 1), maxsize = max_size,
texture = texture, texture = texture,
}) })
end end
@ -318,9 +321,9 @@ function check_for_death(self)
if obj then if obj then
obj:setvelocity({ obj:setvelocity({
x = random(-10, 10) / 9, x = random(-10, 10) / 7,
y = 5, y = 5,
z = random(-10, 10) / 9, z = random(-10, 10) / 7,
}) })
end end
end end
@ -340,6 +343,7 @@ function check_for_death(self)
if self.on_die then if self.on_die then
self.on_die(self, pos) self.on_die(self, pos)
self.object:remove()
return true return true
end end
@ -445,7 +449,7 @@ do_env_damage = function(self)
self.health = self.health - self.light_damage self.health = self.health - self.light_damage
effect(pos, 5, "hud_heart_fg.png") effect(pos, 5, "heart.png")
end end
-- what is mob standing in? -- what is mob standing in?
@ -466,7 +470,7 @@ do_env_damage = function(self)
self.health = self.health - self.water_damage self.health = self.health - self.water_damage
effect(pos, 5, "hud_air_fg.png") effect(pos, 5, "bubble.png")
end end
-- lava or fire -- lava or fire
@ -543,11 +547,6 @@ do_jump = function(self)
max_hear_distance = self.sounds.distance max_hear_distance = self.sounds.distance
}) })
end end
else
if self.state ~= "attack" then
self.state = "stand"
set_animation(self, "stand")
end
end end
end end
@ -594,7 +593,7 @@ end
-- should mob follow what I'm holding ? -- should mob follow what I'm holding ?
function follow_holding(self, clicker) function follow_holding(self, clicker)
if invis[clicker:get_player_name()] then if mobs.invis[clicker:get_player_name()] then
return false return false
end end
@ -670,7 +669,7 @@ local function breed(self)
local pos = self.object:getpos() local pos = self.object:getpos()
effect({x = pos.x, y = pos.y + 1, z = pos.z}, 4, "heart.png") effect({x = pos.x, y = pos.y + 1, z = pos.z}, 8, "heart.png", 3, 4, 1, 0.1)
local objs = minetest.get_objects_inside_radius(pos, 3) local objs = minetest.get_objects_inside_radius(pos, 3)
local num = 0 local num = 0
@ -954,6 +953,25 @@ function smart_mobs(self, s, p, dist, dtime)
end end
end end
-- specific attacks
local specific_attack = function(list, what)
-- no list so attack default (player, animals etc.)
if list == nil then
return true
end
-- is found entity on list to attack?
for no = 1, #list do
if list[no] == what then
return true
end
end
return false
end
-- monster find someone to attack -- monster find someone to attack
local monster_attack = function(self) local monster_attack = function(self)
@ -966,7 +984,8 @@ local monster_attack = function(self)
local s = self.object:getpos() local s = self.object:getpos()
local p, sp, dist local p, sp, dist
local player, type, obj, min_player local player, obj, min_player
local type, name = "", ""
local min_dist = self.view_range + 1 local min_dist = self.view_range + 1
local objs = minetest.get_objects_inside_radius(s, self.view_range) local objs = minetest.get_objects_inside_radius(s, self.view_range)
@ -974,12 +993,13 @@ local monster_attack = function(self)
if objs[n]:is_player() then if objs[n]:is_player() then
if invis[ objs[n]:get_player_name() ] then if mobs.invis[ objs[n]:get_player_name() ] then
type = "" type = ""
else else
player = objs[n] player = objs[n]
type = "player" type = "player"
name = "player"
end end
else else
obj = objs[n]:get_luaentity() obj = objs[n]:get_luaentity()
@ -987,11 +1007,14 @@ local monster_attack = function(self)
if obj then if obj then
player = obj.object player = obj.object
type = obj.type type = obj.type
name = obj.name or ""
end end
end end
if type == "player" -- find specific mob to attack, failing that attack player/npc/animal
or type == "npc" then if specific_attack(self.specific_attack, name)
and (type == "player" or type == "npc"
or (type == "animal" and self.attack_animals == true)) then
s = self.object:getpos() s = self.object:getpos()
p = player:getpos() p = player:getpos()
@ -1075,7 +1098,7 @@ local follow_flop = function(self)
for n = 1, #players do for n = 1, #players do
if get_distance(players[n]:getpos(), s) < self.view_range if get_distance(players[n]:getpos(), s) < self.view_range
and not invis[ players[n]:get_player_name() ] then and not mobs.invis[ players[n]:get_player_name() ] then
self.following = players[n] self.following = players[n]
@ -1345,8 +1368,8 @@ local do_states = function(self, dtime)
self.runaway_timer = self.runaway_timer + 1 self.runaway_timer = self.runaway_timer + 1
-- stop after 3 seconds or when at cliff -- stop after 5 seconds or when at cliff
if self.runaway_timer > 3 if self.runaway_timer > 5
or is_at_cliff(self) then or is_at_cliff(self) then
self.runaway_timer = 0 self.runaway_timer = 0
set_velocity(self, 0) set_velocity(self, 0)
@ -1378,7 +1401,7 @@ local do_states = function(self, dtime)
or not self.attack or not self.attack
or not self.attack:getpos() or not self.attack:getpos()
or self.attack:get_hp() <= 0 or self.attack:get_hp() <= 0
or (self.attack:is_player() and invis[ self.attack:get_player_name() ]) then or (self.attack:is_player() and mobs.invis[ self.attack:get_player_name() ]) then
--print(" ** stop attacking **", dist, self.view_range) --print(" ** stop attacking **", dist, self.view_range)
self.state = "stand" self.state = "stand"
@ -1423,9 +1446,7 @@ local do_states = function(self, dtime)
if get_velocity(self) <= 0.5 if get_velocity(self) <= 0.5
and self.object:getvelocity().y == 0 then and self.object:getvelocity().y == 0 then
local v = self.object:getvelocity() do_jump(self)
v.y = 5
self.object:setvelocity(v)
end end
set_velocity(self, self.run_velocity) set_velocity(self, self.run_velocity)
@ -1475,7 +1496,7 @@ local do_states = function(self, dtime)
self.object:remove() self.object:remove()
effect(pos, 15, "hud_air_fg.png", 5) effect(pos, 15, "bubble.png", 5)
return return
end end
@ -1725,6 +1746,7 @@ local do_states = function(self, dtime)
local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5 local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5
local v = ent.velocity or 1 -- or set to default local v = ent.velocity or 1 -- or set to default
ent.switch = 1 ent.switch = 1
ent.owner_id = tostring(self.object) -- add unique owner id to arrow
-- offset makes shoot aim accurate -- offset makes shoot aim accurate
vec.y = vec.y + self.shoot_offset vec.y = vec.y + self.shoot_offset
@ -1807,8 +1829,13 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
return return
end end
-- direction error check -- is mob protected?
dir = dir or {x = 0, y = 0, z = 0} if self.protected and hitter:is_player()
and minetest.is_protected(self.object:getpos(), hitter:get_player_name()) then
minetest.chat_send_player(hitter:get_player_name(), "Mob has been protected!")
return
end
-- weapon wear -- weapon wear
local weapon = hitter:get_wielded_item() local weapon = hitter:get_wielded_item()
@ -1848,7 +1875,13 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
end end
end end
-- print ("Mob Damage is", damage) -- healing
if damage <= -1 then
self.health = self.health - floor(damage)
return
end
-- print ("Mob Damage is", damage)
-- add weapon wear -- add weapon wear
if tool_capabilities then if tool_capabilities then
@ -1862,6 +1895,9 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
hitter:set_wielded_item(weapon) hitter:set_wielded_item(weapon)
end end
-- only play hit sound and show blood effects if damage is 1 or over
if damage >= 1 then
-- weapon sounds -- weapon sounds
if weapon:get_definition().sounds ~= nil then if weapon:get_definition().sounds ~= nil then
@ -1895,17 +1931,6 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
end) end)
end) end)
-- blood_particles
if self.blood_amount > 0
and not disable_blood then
local pos = self.object:getpos()
pos.y = pos.y + (-self.collisionbox[2] + self.collisionbox[5]) * .5
effect(pos, self.blood_amount, self.blood_texture)
end
-- knock back effect (only on full punch) -- knock back effect (only on full punch)
if self.knock_back > 0 if self.knock_back > 0
and tflp > punch_interval then and tflp > punch_interval then
@ -1921,6 +1946,9 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
up = 0 up = 0
end end
-- direction error check
dir = dir or {x = 0, y = 0, z = 0}
self.object:setvelocity({ self.object:setvelocity({
x = dir.x * kb, x = dir.x * kb,
y = up, y = up,
@ -1930,6 +1958,8 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
self.pause_timer = r self.pause_timer = r
end end
end -- END if damage
-- if skittish then run away -- if skittish then run away
if self.runaway == true then if self.runaway == true then
@ -1959,7 +1989,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
and self.state ~= "flop" and self.state ~= "flop"
and self.child == false and self.child == false
and hitter:get_player_name() ~= self.owner and hitter:get_player_name() ~= self.owner
and not invis[ hitter:get_player_name() ] then and not mobs.invis[ hitter:get_player_name() ] then
-- attack whoever punched mob -- attack whoever punched mob
self.state = "" self.state = ""
@ -2236,8 +2266,8 @@ minetest.register_entity(name, {
drawtype = def.drawtype, -- DEPRECATED, use rotate instead drawtype = def.drawtype, -- DEPRECATED, use rotate instead
rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2 rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2
lifetimer = def.lifetimer or 180, -- 3 minutes lifetimer = def.lifetimer or 180, -- 3 minutes
hp_min = def.hp_min or 5, hp_min = max(1, (def.hp_min or 5) * difficulty),
hp_max = def.hp_max or 10, hp_max = max(1, (def.hp_max or 10) * difficulty),
physical = true, physical = true,
collisionbox = def.collisionbox, collisionbox = def.collisionbox,
visual = def.visual, visual = def.visual,
@ -2247,7 +2277,7 @@ minetest.register_entity(name, {
view_range = def.view_range or 5, view_range = def.view_range or 5,
walk_velocity = def.walk_velocity or 1, walk_velocity = def.walk_velocity or 1,
run_velocity = def.run_velocity or 2, run_velocity = def.run_velocity or 2,
damage = def.damage or 0, damage = max(1, (def.damage or 0) * difficulty),
light_damage = def.light_damage or 0, light_damage = def.light_damage or 0,
water_damage = def.water_damage or 0, water_damage = def.water_damage or 0,
lava_damage = def.lava_damage or 0, lava_damage = def.lava_damage or 0,
@ -2288,6 +2318,7 @@ minetest.register_entity(name, {
health = 0, health = 0,
reach = def.reach or 3, reach = def.reach or 3,
htimer = 0, htimer = 0,
texture_list = def.textures,
child_texture = def.child_texture, child_texture = def.child_texture,
docile_by_day = def.docile_by_day or false, docile_by_day = def.docile_by_day or false,
time_of_day = 0.5, time_of_day = 0.5,
@ -2302,6 +2333,8 @@ minetest.register_entity(name, {
dogshoot_switch = def.dogshoot_switch, dogshoot_switch = def.dogshoot_switch,
dogshoot_count = 0, dogshoot_count = 0,
dogshoot_count_max = def.dogshoot_count_max or 5, dogshoot_count_max = def.dogshoot_count_max or 5,
attack_animals = def.attack_animals or false,
specific_attack = def.specific_attack,
on_blast = def.on_blast or do_tnt, on_blast = def.on_blast or do_tnt,
@ -2359,29 +2392,53 @@ minetest.register_entity(name, {
end -- END mobs:register_mob function end -- END mobs:register_mob function
-- count how many mobs of one type are inside an area
local count_mobs = function(pos, type)
local num = 0
local objs = minetest.get_objects_inside_radius(pos, 32)
for n = 1, #objs do
if not objs[n]:is_player() then
local obj = objs[n]:get_luaentity()
if obj and obj.name and obj.name == type then
num = num + 1
end
end
end
return num
end
-- global functions -- global functions
function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
interval, chance, aoc, min_height, max_height, day_toggle) interval, chance, aoc, min_height, max_height, day_toggle, on_spawn)
-- chance override in minetest.conf for registered mob -- chance/spawn number override in minetest.conf for registered mob
local new_chance = tonumber(minetest.setting_get(name .. "_chance")) local numbers = minetest.setting_get(name)
if new_chance ~= nil then if numbers then
numbers = numbers:split(",")
chance = tonumber(numbers[1]) or chance
aoc = tonumber(numbers[2]) or aoc
if new_chance == 0 then if chance == 0 then
print("[Mobs Redo] " .. name .. " has spawning disabled") print("[Mobs Redo] @1 has spawning disabled", name)
return return
end end
chance = new_chance print ("[Mobs Redo] Chance setting for @1 changed to @2", name, chance
.. " (total: " .. aoc .. ")")
print ("[Mobs Redo] Chance setting for " .. name .. " changed to " .. chance)
end end
minetest.register_abm({ minetest.register_abm({
label = name .. " spawning",
nodenames = nodes, nodenames = nodes,
neighbors = neighbors, neighbors = neighbors,
interval = interval, interval = interval,
@ -2390,10 +2447,16 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
-- do not spawn if too many active entities in area -- is mob actually registered?
if active_object_count_wider >= aoc if not mobs.spawning_mobs[name] then
or not mobs.spawning_mobs[name] then --print ("--- mob doesn't exist", name)
return
end
-- do not spawn if too many of same mob in area
if active_object_count_wider >= aoc
and count_mobs(pos, name) >= aoc then
--print ("--- too many entities", name, aoc)
return return
end end
@ -2405,11 +2468,13 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
if tod > 4500 and tod < 19500 then if tod > 4500 and tod < 19500 then
-- daylight, but mob wants night -- daylight, but mob wants night
if day_toggle == false then if day_toggle == false then
--print ("--- mob needs night", name)
return return
end end
else else
-- night time but mob wants day -- night time but mob wants day
if day_toggle == true then if day_toggle == true then
--print ("--- mob needs day", name)
return return
end end
end end
@ -2424,6 +2489,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
for n = 1, #objs do for n = 1, #objs do
if objs[n]:is_player() then if objs[n]:is_player() then
--print ("--- player too close", name)
return return
end end
end end
@ -2431,27 +2497,36 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
-- mobs cannot spawn in protected areas when enabled -- mobs cannot spawn in protected areas when enabled
if spawn_protected == 1 if spawn_protected == 1
and minetest.is_protected(pos, "") then and minetest.is_protected(pos, "") then
--print ("--- inside protected area", name)
return return
end end
-- check if light and height levels are ok to spawn -- are light levels ok?
local light = minetest.get_node_light(pos) local light = minetest.get_node_light(pos)
if not light if not light
or light > max_light or light > max_light
or light < min_light or light < min_light then
or pos.y > max_height --print ("--- light limits not met", name, light)
return
end
-- are we spawning within height limits?
if pos.y > max_height
or pos.y < min_height then or pos.y < min_height then
--print ("--- height limits not met", name, pos.y)
return return
end end
-- are we spawning inside solid nodes? -- are we spawning inside solid nodes?
if minetest.registered_nodes[node_ok(pos).name].walkable == true then if minetest.registered_nodes[node_ok(pos).name].walkable == true then
--print ("--- feet in block", name, node_ok(pos).name)
return return
end end
pos.y = pos.y + 1 pos.y = pos.y + 1
if minetest.registered_nodes[node_ok(pos).name].walkable == true then if minetest.registered_nodes[node_ok(pos).name].walkable == true then
--print ("--- head in block", name, node_ok(pos).name)
return return
end end
@ -2464,9 +2539,12 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
-- print ("[mobs] Spawned " .. name .. " at " -- print ("[mobs] Spawned " .. name .. " at "
-- .. minetest.pos_to_string(pos) .. " on " -- .. minetest.pos_to_string(pos) .. " on "
-- .. node.name .. " near " .. neighbors[1]) -- .. node.name .. " near " .. neighbors[1])
if on_spawn and not on_spawn(mob, pos) then
return
end
else else
print ("[mobs]" .. name .. " failed to spawn at " print ("[mobs] @1 failed to spawn at @2",
.. minetest.pos_to_string(pos)) name, minetest.pos_to_string(pos))
end end
end end
@ -2488,15 +2566,16 @@ function mobs:spawn(def)
local neighbors = def.neighbors or {"air"} local neighbors = def.neighbors or {"air"}
local min_light = def.min_light or 0 local min_light = def.min_light or 0
local max_light = def.max_light or 15 local max_light = def.max_light or 15
local interval = def.interval or 30 local interval = def.interval or 10
local chance = def.chance or 5000 local chance = def.chance or 5000
local active_object_count = def.active_object_count or 1 local active_object_count = def.active_object_count or 1
local min_height = def.min_height or -31000 local min_height = def.min_height or -31000
local max_height = def.max_height or 31000 local max_height = def.max_height or 31000
local day_toggle = def.day_toggle or nil local day_toggle = def.day_toggle
local on_spawn = def.on_spawn
mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval,
chance, active_object_count, min_height, max_height, day_toggle) chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
end end
-- set content id's -- set content id's
@ -2505,6 +2584,7 @@ local c_ignore = minetest.get_content_id("ignore")
local c_obsidian = minetest.get_content_id("default:obsidian") local c_obsidian = minetest.get_content_id("default:obsidian")
local c_brick = minetest.get_content_id("default:obsidianbrick") local c_brick = minetest.get_content_id("default:obsidianbrick")
local c_chest = minetest.get_content_id("default:chest_locked") local c_chest = minetest.get_content_id("default:chest_locked")
local c_fire = minetest.get_content_id("fire:basic_flame")
-- explosion (cannot break protected or unbreakable nodes) -- explosion (cannot break protected or unbreakable nodes)
function mobs:explosion(pos, radius, fire, smoke, sound) function mobs:explosion(pos, radius, fire, smoke, sound)
@ -2553,14 +2633,21 @@ function mobs:explosion(pos, radius, fire, smoke, sound)
and data[vi] ~= c_ignore and data[vi] ~= c_ignore
and data[vi] ~= c_obsidian and data[vi] ~= c_obsidian
and data[vi] ~= c_brick and data[vi] ~= c_brick
and data[vi] ~= c_chest then and data[vi] ~= c_chest
and data[vi] ~= c_fire then
local n = node_ok(p).name local n = node_ok(p).name
local on_blast = minetest.registered_nodes[n].on_blast local on_blast = minetest.registered_nodes[n].on_blast
if on_blast then if on_blast then
return on_blast(p) return on_blast(p)
elseif minetest.registered_nodes[n].groups.unbreakable == 1 then
-- do nothing
else else
-- after effects -- after effects
if fire > 0 if fire > 0
and (minetest.registered_nodes[n].groups.flammable and (minetest.registered_nodes[n].groups.flammable
@ -2603,6 +2690,7 @@ function mobs:register_arrow(name, def)
collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows
timer = 0, timer = 0,
switch = 0, switch = 0,
owner_id = def.owner_id,
on_step = def.on_step or function(self, dtime) on_step = def.on_step or function(self, dtime)
@ -2623,15 +2711,35 @@ function mobs:register_arrow(name, def)
if def.tail if def.tail
and def.tail == 1 and def.tail == 1
and def.tail_texture then and def.tail_texture then
effect(pos, 1, def.tail_texture, 10, 0)
-- effect(pos, 1, def.tail_texture,
-- def.tail_size or 5,
-- def.tail_size or 10,
-- 0, 0) -- 0 radius and 0 gravity to just hover
minetest.add_particlespawner({
amount = 1,
time = 0.25,
minpos = pos,
maxpos = pos,
minvel = {x = 0, y = 0, z = 0},
maxvel = {x = 0, y = 0, z = 0},
minacc = {x = 0, y = 0, z = 0},
maxacc = {x = 0, y = 0, z = 0},
minexptime = 0.1,
maxexptime = 1,
minsize = def.tail_size or 5,
maxsize = def.tail_size or 10,
texture = def.tail_texture,
})
end end
if self.hit_node then if self.hit_node then
local node = node_ok(pos).name local node = node_ok(pos).name
--if minetest.registered_nodes[node].walkable then if minetest.registered_nodes[node].walkable then
if node ~= "air" then --if node ~= "air" then
self.hit_node(self, pos, node) self.hit_node(self, pos, node)
@ -2650,9 +2758,7 @@ function mobs:register_arrow(name, def)
end end
end end
if (self.hit_player or self.hit_mob) if self.hit_player or self.hit_mob then
-- clear mob entity before arrow becomes active
and self.timer > (10 - (self.velocity / 2)) then
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do
@ -2664,17 +2770,21 @@ function mobs:register_arrow(name, def)
return return
end end
local entity = player:get_luaentity()
and player:get_luaentity().name or ""
if self.hit_mob if self.hit_mob
and player:get_luaentity() and tostring(player) ~= self.owner_id
and player:get_luaentity().name ~= self.object:get_luaentity().name and entity ~= self.object:get_luaentity().name
and player:get_luaentity().name ~= "__builtin:item" and entity ~= "__builtin:item"
and player:get_luaentity().name ~= "gauges:hp_bar" and entity ~= "__builtin:falling_node"
and player:get_luaentity().name ~= "signs:text" and entity ~= "gauges:hp_bar"
and player:get_luaentity().name ~= "itemframes:item" then and entity ~= "signs:text"
and entity ~= "itemframes:item" then
self.hit_mob(self, player) self.hit_mob(self, player)
self.object:remove() ; -- print ("hit mob") self.object:remove() ; --print ("hit mob")
return return
end end
@ -2774,7 +2884,7 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso,
if self.owner ~= name if self.owner ~= name
and force_take == false then and force_take == false then
minetest.chat_send_player(name, self.owner.." is owner!") minetest.chat_send_player(name, "@1 is owner!", self.owner)
return return
end end
@ -2821,6 +2931,32 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso,
end end
end end
-- protect tamed mob with rune iten
function mobs:protect(self, clicker)
local name = clicker:get_player_name()
if self.tamed == false then
minetest.chat_send_player(name, "Not tamed!")
return false
end
local tool = clicker:get_wielded_item()
if tool:get_name() == "mobs:protector" then
tool:take_item() -- take 1 protection rune
clicker:set_wielded_item(tool)
self.protected = true
minetest.chat_send_player(name, S("Protected!"))
return true
end
return false
end
local mob_obj = {} local mob_obj = {}
local mob_sta = {} local mob_sta = {}
@ -2854,8 +2990,8 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
if self.htimer < 1 then if self.htimer < 1 then
minetest.chat_send_player(clicker:get_player_name(), minetest.chat_send_player(clicker:get_player_name(),
self.name:split(":")[2] "@1 at full health (@2)",
.. " at full health (" .. tostring(self.health) .. ")") self.name:split(":")[2], tostring(self.health))
self.htimer = 5 self.htimer = 5
end end
@ -2889,8 +3025,8 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
if self.tamed == false then if self.tamed == false then
minetest.chat_send_player(clicker:get_player_name(), minetest.chat_send_player(clicker:get_player_name(),
self.name:split(":")[2] "@1 has been tamed!",
.. " has been tamed!") self.name:split(":")[2])
end end
self.tamed = true self.tamed = true
@ -2928,8 +3064,6 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
local tag = self.nametag or "" local tag = self.nametag or ""
minetest.show_formspec(name, "mobs_nametag", "size[8,4]" minetest.show_formspec(name, "mobs_nametag", "size[8,4]"
.. default.gui_bg
.. default.gui_bg_img
.. "field[0.5,1;7.5,0;name;Enter name:;" .. tag .. "]" .. "field[0.5,1;7.5,0;name;Enter name:;" .. tag .. "]"
.. "button_exit[2.5,3.5;3,1;mob_rename;Rename]") .. "button_exit[2.5,3.5;3,1;mob_rename;Rename]")

View File

@ -87,3 +87,18 @@ minetest.register_craft({
{'', 'group:stick', 'default:steel_ingot'}, {'', 'group:stick', 'default:steel_ingot'},
} }
}) })
-- protection rune
minetest.register_craftitem("mobs:protector", {
description = "Mob Protection Rune",
inventory_image = "mobs_protector.png",
})
minetest.register_craft({
output = "mobs:protector",
recipe = {
{"default:stone", "default:stone", "default:stone"},
{"default:stone", "default:goldblock", "default:stone"},
{"default:stone", "default:stone", "default:stone"},
}
})

View File

@ -9,14 +9,23 @@ https://github.com/tenplus1/mobs
Built from PilzAdam's original Simple Mobs with additional mobs by KrupnovPavel, Zeg9, ExeterDad, AspireMint, TenPlus1, kaadmy, blert2112 and MoNTE48. Built from PilzAdam's original Simple Mobs with additional mobs by KrupnovPavel, Zeg9, ExeterDad, AspireMint, TenPlus1, kaadmy, blert2112 and MoNTE48.
This mod contains the API only for adding your own mobs into the world, so please use the additional modpacks to add animals, monsters etc.
https://forum.minetest.net/viewtopic.php?f=11&t=9917 https://forum.minetest.net/viewtopic.php?f=11&t=9917
Crafts:
- Nametag (paper, black dye, string) can be used right-click on a tamed mob to give them a name.
- Nets can be used to right-click tamed mobs to pick them up and place inside inventory as a spawn egg.
- Magic Lasso is similar to nets but with a better chance of picking up larger mobs.
- Shears are used to right-click sheep and return 1-3 wool.
- Protection Rune lets you protect tamed mobs from harm by other players
Changelog: Changelog:
- 1.32- Added new spawn check to count specific mobs AND new minetest.conf setting to chance spawn chance and numbers, added ability to protect tamed mobs
- 1.31- Added 'attack_animals' and 'specific_attack' flags for custom monster attacks, also 'mob_difficulty' .conf setting to make mobs harder.
- 1.30- Added support for invisibility mod (mobs cant attack what they cant see), tweaked and tidied code
- 1.29- Split original Mobs Redo into a modpack to make it easier to disable mob sets (animal, monster, npc) or simply use the Api itself for your own mod - 1.29- Split original Mobs Redo into a modpack to make it easier to disable mob sets (animal, monster, npc) or simply use the Api itself for your own mod
- 1.28- New damage system added with ability for mob to be immune to weapons or healed by them :) - 1.28- New damage system added with ability for mob to be immune to weapons or healed by them :)
- 1.27- Added new sheep, lava flan and spawn egg textures. New Lava Pick tool smelts what you dig. New atan checking function. - 1.27- Added new sheep, lava flan and spawn egg textures. New Lava Pick tool smelts what you dig. New atan checking function.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 509 B

View File

@ -134,7 +134,7 @@ railcart:register_entity("railcart:cart_entity", {
minetest.register_craftitem("railcart:cart", { minetest.register_craftitem("railcart:cart", {
description = "Railcart", description = "Railcart",
inventory_image = minetest.inventorycube("railcart_top.png", "railcart_side.png", "railcart_side.png"), inventory_image = "railcart_side.png",
wield_image = "railcart_side.png", wield_image = "railcart_side.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local name = placer:get_player_name() local name = placer:get_player_name()

View File

@ -83,7 +83,7 @@ minetest.register_entity("throwing:arrow_entity", THROWING_ARROW_ENTITY)
minetest.register_craft({ minetest.register_craft({
output = 'throwing:arrow 4', output = 'throwing:arrow 4',
recipe = { recipe = {
{'default:flint'}, {'fire:flint_and_steel'},
{'default:stick'}, {'default:stick'},
{'default:paper'} {'default:paper'}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 B

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 B

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB