update mobs mod

This commit is contained in:
crabman77 2016-02-18 13:39:47 +01:00
parent 1f68c2729e
commit f8e7c9557d
44 changed files with 113 additions and 16 deletions

View File

@ -28,7 +28,7 @@ This mod contains the following additions:
Changelog:
1.26- Pathfinding feature added thanks to rnd, when monsters attack they become scary smart in finding you :)
1.26- Pathfinding feature added thanks to rnd, when monsters attack they become scary smart in finding you :) also, beehive produces honey now :)
1.25- Mobs no longer spawn within 12 blocks of player or despawn within same range, spawners now have player detection, Code tidy and tweak.
1.24- Added feature where certain animals run away when punched (runaway = true in mob definition)
1.23- Added mob spawner block for admin to setup spawners in-game (place and right click to enter settings)

View File

@ -1,4 +1,4 @@
-- Mobs Api (16th February 2016)
-- Mobs Api (17th February 2016)
mobs = {}
mobs.mod = "redo"
@ -917,6 +917,7 @@ minetest.register_entity(name, {
fear_height = def.fear_height or 0,
runaway = def.runaway,
runaway_timer = 0,
pathfinding = def.pathfinding,
on_step = function(self, dtime)
@ -1669,7 +1670,9 @@ minetest.register_entity(name, {
if dist > self.reach then
-- path finding by rnd
if enable_pathfinding then
if self.pathfinding -- only if mob has pathfinding enabled
and enable_pathfinding then
smart_mobs(self, s, p, dist, dtime)
end

View File

@ -73,6 +73,20 @@ minetest.register_node("mobs:beehive", {
on_use = minetest.item_eat(4),
sounds = default.node_sound_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,6]"
..default.gui_bg..default.gui_bg_img..default.gui_slots
.. "image[3,0.8;0.8,0.8;mobs_bee_inv.png]"
.. "list[current_name;beehive;4,0.5;1,1;]"
.. "list[current_player;main;0,2.35;8,4;]"
.. "listring[]")
meta:get_inventory():set_size("beehive", 1)
end,
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
@ -84,7 +98,30 @@ minetest.register_node("mobs:beehive", {
end
end
end,
on_punch = function(pos, node, puncher)
-- yep, bee's don't like having their home punched by players
puncher:set_hp(puncher:get_hp() - 4)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "beehive" then
return 0
end
return stack:get_count()
end,
can_dig = function(pos,player)
local meta = minetest.get_meta(pos)
-- only dig beehive if no honey inside
return meta:get_inventory():is_empty("beehive")
end,
})
minetest.register_craft({
@ -117,3 +154,37 @@ minetest.register_craft({
{"mobs:honey_block"},
}
})
-- beehive workings
minetest.register_abm({
nodenames = {"mobs:beehive"},
interval = 6,
chance = 5,
catch_up = false,
action = function(pos, node)
-- bee's only make honey during the day
local tod = (minetest.get_timeofday() or 0) * 24000
if tod < 4500 or tod > 19500 then
return
end
-- find flowers in area around hive
local flowers = minetest.find_nodes_in_area_under_air(
{x = pos.x - 10, y = pos.y - 5, z = pos.z - 10},
{x = pos.x + 10, y = pos.y + 5, z = pos.z + 10},
"group:flower")
-- no flowers no honey, nuff said!
if #flowers > 3 then
local meta = minetest.get_meta(pos)
-- error check just incase it's an old beehive
if meta then
meta:get_inventory():add_item("beehive", "mobs:honey")
end
end
end
})

View File

@ -7,6 +7,7 @@ mobs:register_mob("mobs:dirt_monster", {
-- aggressive, deals 6 damage to player when hit
passive = false,
attack_type = "dogfight",
pathfinding = true,
reach = 2,
damage = 5,
-- health & armor

View File

@ -18,6 +18,7 @@ mobs:register_mob("mobs:npc", {
damage = 5, -- 3 damages if tamed
attack_type = "dogfight",
attacks_monsters = true,
pathfinding = true,
-- health & armor
hp_min = 20,
hp_max = 20,

View File

@ -18,6 +18,7 @@ mobs:register_mob("mobs:npc_female", {
damage = 5, -- 3 damages if tamed
attack_type = "dogfight",
attacks_monsters = true,
pathfinding = true,
-- health & armor
hp_min = 20,
hp_max = 20,

View File

@ -7,6 +7,7 @@ mobs:register_mob("mobs:oerkki", {
-- aggressive, deals 7 damage when player hit
passive = false,
attack_type = "dogfight",
pathfinding = true,
reach = 2,
damage = 6,
-- health & armor

View File

@ -7,6 +7,7 @@ mobs:register_mob("mobs:sand_monster", {
-- aggressive, deals 5 damage to player when hit
passive = false,
attack_type = "dogfight",
pathfinding = true,
reach = 2,
damage = 4,
-- health & armor

View File

@ -1,14 +1,28 @@
local all_colours = {
"grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta",
"white", "orange", "violet", "brown", "pink", "dark_grey", "dark_green"
{"black", "Black", "#000000b0"},
{"blue", "Blue", "#015dbb70"},
{"brown", "Brown", "#663300a0"},
{"cyan", "Cyan", "#01ffd870"},
{"dark_green", "Dark Green", "#005b0770"},
{"dark_grey", "Dark Grey", "#303030b0"},
{"green", "Green", "#61ff0170"},
{"grey", "Grey", "#5b5b5bb0"},
{"magenta", "Magenta", "#ff05bb70"},
{"orange", "Orange", "#ff840170"},
{"pink", "Pink", "#ff65b570"},
{"red", "Red", "#ff0000a0"},
{"violet", "Violet", "#2000c970"},
{"white", "White", "#abababc0"},
{"yellow", "Yellow", "#e3ff0070"},
}
-- Sheep by PilzAdam
-- Sheep by PilzAdam, texture converted to minetest by AMMOnym from Summerfield pack
for _, col in pairs(all_colours) do
mobs:register_mob("mobs:sheep_"..col, {
mobs:register_mob("mobs:sheep_"..col[1], {
-- animal, monster, npc, barbarian
type = "animal",
-- not aggressive
@ -22,7 +36,7 @@ for _, col in pairs(all_colours) do
visual = "mesh",
mesh = "mobs_sheep.b3d",
textures = {
{"mobs_sheep_"..col..".png"},
{"mobs_sheep_wool.png^[colorize:" .. col[3] .. "^mobs_sheep_base.png"},
},
-- specific texture and mesh for gotten
gotten_texture = {"mobs_sheep_shaved.png"},
@ -40,7 +54,7 @@ for _, col in pairs(all_colours) do
-- drops raw meat and woll of its color when dead
drops = {
{name = "mobs:meat_raw", chance = 1, min = 2, max = 3},
{name = "wool:"..col, chance = 1, min = 1, max = 1},
{name = "wool:"..col[1], chance = 1, min = 1, max = 1},
},
-- damaged by
water_damage = 1,
@ -65,7 +79,9 @@ for _, col in pairs(all_colours) do
replace_offset = -1,
fear_height = 3,
on_rightclick = function(self, clicker)
local shpcolor = string.split(self.name,"_")[2]
if shpcolor =="dark" then
shpcolor = shpcolor.."_"..string.split(self.name,"_")[3]
end
@ -76,7 +92,7 @@ for _, col in pairs(all_colours) do
--if full grow fuzz
if self.gotten == false then
self.object:set_properties({
textures = {"mobs_sheep_"..shpcolor..".png"},
textures = {"mobs_sheep_wool.png^[colorize:" .. col[3] .. "^mobs_sheep_base.png"},
mesh = "mobs_sheep.b3d",
})
end
@ -133,17 +149,17 @@ for _, col in pairs(all_colours) do
and self.tamed == true
and name == self.owner then
local col = string.split(itemname,":")[2]
local colr = string.split(itemname,":")[2]
for _,c in pairs(all_colours) do
if c == col then
if c[1] == colr then
local pos = self.object:getpos()
self.object:remove()
local mob = minetest.add_entity(pos, "mobs:sheep_"..col)
local mob = minetest.add_entity(pos, "mobs:sheep_"..colr)
local ent = mob:get_luaentity()
ent.owner = name
@ -168,7 +184,7 @@ for _, col in pairs(all_colours) do
end
})
mobs:register_egg("mobs:sheep_"..col, "Sheep ("..col..")", "mobs_sheep_"..col.."_inv.png", 1)
mobs:register_egg("mobs:sheep_"..col[1], col[2] .. "Sheep", "mobs_sheep_white_inv.png^[colorize:" .. col[3], 1)
end

View File

@ -7,6 +7,7 @@ mobs:register_mob("mobs:stone_monster", {
-- aggressive, deals 8 damage to player when hit
passive = false,
attack_type = "dogfight",
pathfinding = true,
reach = 2,
damage = 6,
-- health & armor
@ -19,6 +20,7 @@ mobs:register_mob("mobs:stone_monster", {
mesh = "mobs_stone_monster.b3d",
textures = {
{"mobs_stone_monster.png"},
{"mobs_stone_monster2.png"}, -- by AMMOnym
},
blood_texture = "default_stone.png",
-- sounds
@ -61,7 +63,7 @@ mobs:register_mob("mobs:stone_monster", {
})
-- spawns on stone between -1 and 5 light, 1 in 7000 chance, 1 in area below -25
mobs:spawn_specific("mobs:stone_monster", {"default:stone", "default:sandstone"}, {"air"}, -1, 5, 30, 7000, 1, -31000, -25, false)
mobs:spawn_specific("mobs:stone_monster", {"default:stone", "default:desert_stone"}, {"air"}, -1, 5, 30, 7000, 1, -31000, -25, false)
-- register spawn egg
mobs:register_egg("mobs:stone_monster", "Stone Monster", "mobs_stone_monster_inv.png", 1)

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB