update mobs mod

This commit is contained in:
crabman77 2016-02-01 12:45:12 +01:00
parent 6a0f7a70f9
commit 46004d9bf2
26 changed files with 606 additions and 271 deletions

View File

@ -28,6 +28,9 @@ This mod contains the following additions:
Changelog:
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)
1.22- Added ability to name tamed animals and npc using nametags, also npc will attack anyone who punches them apart from owner
1.21- Added some more error checking to reduce serialize.h error and added height checks for falling off cliffs (thanks cmdskp)
1.20- Error checking added to remove bad mobs, out of map limit mobs and stop serialize.h error
1.19- Chickens now drop egg items instead of placing the egg, also throwing eggs result in 1/8 chance of spawning chick

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,9 @@ mobs:register_mob("mobs:bunny", {
passive = true,
reach = 1,
-- health & armor
hp_min = 3, hp_max = 6, armor = 200,
hp_min = 3,
hp_max = 6,
armor = 200,
-- textures and model
collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268},
visual = "mesh",
@ -18,13 +20,14 @@ mobs:register_mob("mobs:bunny", {
{"mobs_bunny_grey.png"},
{"mobs_bunny_brown.png"},
{"mobs_bunny_white.png"},
{"mobs_bunny_evil.png"},
},
-- sounds
sounds = {},
makes_footstep_sound = false,
-- speed and jump
walk_velocity = 1, run_velocity = 2,
walk_velocity = 1,
run_velocity = 2,
runaway = true,
jump = true,
-- drops meat when dead
drops = {
@ -55,25 +58,35 @@ mobs:register_mob("mobs:bunny", {
replace_with = "air",
-- right click to pick up rabbit
on_rightclick = function(self, clicker)
if not mobs:feed_tame(self, clicker, 4, true, true) then
-- Monty Python tribute
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:lava_orb" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_properties({
textures = {"mobs_bunny_evil.png"},
})
self.type = "monster"
self.object:set_hp(20)
return
-- feed or tame
if mobs:feed_tame(self, clicker, 4, true, true) then
return
end
-- Monty Python tribute
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:lava_orb" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_properties({
textures = {"mobs_bunny_evil.png"},
})
self.type = "monster"
self.object:set_hp(20)
return
end
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end,
attack_type = "dogfight",
damage = 5,
})

View File

@ -33,6 +33,8 @@ mobs:register_mob("mobs:chicken", {
},
-- speed and jump
walk_velocity = 1,
run_velocity = 3,
runaway = true,
jump = true,
-- drops raw chicken when dead
drops = {
@ -59,7 +61,9 @@ mobs:register_mob("mobs:chicken", {
view_range = 5,
on_rightclick = function(self, clicker)
mobs:feed_tame(self, clicker, 8, true, true)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end,
@ -137,12 +141,12 @@ mobs:register_arrow("mobs:egg_entity", {
end
})
-- snowball throwing item
-- egg throwing item
local egg_GRAVITY = 9
local egg_VELOCITY = 19
-- shoot snowball
-- shoot egg
local mobs_shoot_egg = function (item, player, pointed_thing)
local playerpos = player:getpos()
minetest.sound_play("default_place_node_hard", {

View File

@ -66,28 +66,45 @@ mobs:register_mob("mobs:cow", {
replace_with = "air",
fear_height = 2,
on_rightclick = function(self, clicker)
if not mobs:feed_tame(self, clicker, 8, true, true) then
local tool = clicker:get_wielded_item()
-- milk cow with empty bucket
if tool:get_name() == "bucket:bucket_empty" then
if self.gotten == true
or self.child == true then
return
end
local inv = clicker:get_inventory()
inv:remove_item("main", "bucket:bucket_empty")
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:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "mobs:bucket_milk"})
end
self.gotten = true -- milked
-- feed or tame
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
local tool = clicker:get_wielded_item()
-- milk cow with empty bucket
if tool:get_name() == "bucket:bucket_empty" then
--if self.gotten == true
if self.child == true then
return
end
if self.gotten == true then
minetest.chat_send_player(clicker:get_player_name(),
"Cow already milked!")
return
end
local inv = clicker:get_inventory()
inv:remove_item("main", "bucket:bucket_empty")
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:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "mobs:bucket_milk"})
end
self.gotten = true -- milked
return
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end,
})

View File

@ -1,3 +1,15 @@
-- nametag
minetest.register_craftitem("mobs:nametag", {
description = "Nametag",
inventory_image = "mobs_nametag.png",
})
core.register_craft({
type = "shapeless",
output = "mobs:nametag",
recipe = {"default:paper", "dye:black", "farming:string"},
})
-- leather
minetest.register_craftitem("mobs:leather", {
description = "Leather",

View File

@ -1,9 +1,6 @@
-- Dungeon Master by PilzAdam
-- Node which cannot be destroyed by DungeonMasters' fireballs
local excluded = {"nether:netherrack","default:obsidian_glass","default:obsidian", "default:obsidian_cooled", "default:bedrock", "doors:door_steel_b_1", "doors:door_steel_t_1", "doors:door_steel_b_2", "doors:door_steel_t_2","default:chest_locked"}
mobs:register_mob("mobs:dungeon_master", {
-- animal, monster, npc, barbarian
type = "monster",
@ -100,7 +97,7 @@ mobs:register_arrow("mobs:fireball", {
}, nil)
end,
-- node hit, bursts into flame (cannot blast through obsidian or protection redo mod items)
-- node hit, bursts into flame
hit_node = function(self, pos, node)
mobs:explosion(pos, 1, 1, 0)
end

View File

@ -8,6 +8,7 @@ mobs:register_mob("mobs:goat", {
passive = false,
group_attack = true,
attack_type = "dogfight",
reach = 2,
damage = 4,
-- health & armor
hp_min = 15,

View File

@ -62,6 +62,9 @@ dofile(path.."/creeper.lua")
-- Mob Items
dofile(path.."/crafts.lua")
-- Spawner
dofile(path.."/spawner.lua")
-- Mob menu spawner special MFF
dofile(path.."/mff_menu.lua")

View File

@ -7,7 +7,9 @@ mobs:register_mob("mobs:kitten", {
-- is it aggressive
passive = true,
-- health & armor
hp_min = 4, hp_max = 8, armor = 200,
hp_min = 4,
hp_max = 8,
armor = 200,
-- textures and model
collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.1, 0.3},
visual = "mesh",
@ -27,6 +29,8 @@ mobs:register_mob("mobs:kitten", {
},
-- speed and jump
walk_velocity = 0.6,
run_velocity = 2,
runaway = true,
jump = false,
-- drops string
drops = {
@ -50,7 +54,9 @@ mobs:register_mob("mobs:kitten", {
view_range = 10,
-- feed with raw fish to tame or right click to pick up
on_rightclick = function(self, clicker)
mobs:feed_tame(self, clicker, 4, true, true)
if mobs:feed_tame(self, clicker, 4, true, true) then
return
end
mobs:capture_mob(self, clicker, 50, 50, 90, false, nil)
end
})

0
mods/mobs/models/mobs_ent.x Normal file → Executable file
View File

0
mods/mobs/models/mobs_pig.b3d Normal file → Executable file
View File

View File

@ -8,7 +8,6 @@ mobs.npc_drops = { "farming:meat", "farming:donut", "farming:bread", "default:a
"default:cobble", "default:gravel", "default:clay_lump", "default:sand", "default:dirt_with_grass",
"default:dirt", "default:chest", "default:torch"}
mobs.npc_max_hp = 20
mobs:register_mob("mobs:npc", {
-- animal, monster, npc
@ -20,7 +19,9 @@ mobs:register_mob("mobs:npc", {
attack_type = "dogfight",
attacks_monsters = true,
-- health & armor
hp_min = 20, hp_max = 20, armor = 100,
hp_min = 20,
hp_max = 20,
armor = 100,
-- textures and model
collisionbox = {-0.35,-1.0,-0.35, 0.35,0.8,0.35},
visual = "mesh",
@ -106,6 +107,7 @@ mobs:register_mob("mobs:npc", {
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {
@ -122,6 +124,7 @@ mobs:register_mob("mobs:npc", {
end
mobs:capture_mob(self, clicker, 0, 5, 80, false, nil)
end
end,
})

View File

@ -44,6 +44,7 @@ mobs:register_mob("mobs:oerkki", {
water_damage = 2,
lava_damage = 4,
light_damage = 1,
fear_height = 3,
-- model animation
animation = {
stand_start = 0,

View File

@ -26,6 +26,8 @@ mobs:register_mob("mobs:rat", {
},
-- speed and jump
walk_velocity = 1,
run_velocity = 2,
runaway = true,
jump = true,
-- no drops
drops = {},

View File

@ -6,7 +6,7 @@ local all_colours = {
-- Sheep by PilzAdam
for _, col in ipairs(all_colours) do
for _, col in pairs(all_colours) do
mobs:register_mob("mobs:sheep_"..col, {
-- animal, monster, npc, barbarian
@ -36,6 +36,7 @@ for _, col in ipairs(all_colours) do
-- speed and jump
walk_velocity = 1,
run_velocity = 2,
runaway = true,
jump = true,
-- drops raw meat and woll of its color when dead
drops = {
@ -117,7 +118,10 @@ for _, col in ipairs(all_colours) do
--are we coloring?
if itemname:find("dye:") then
if self.gotten == false and self.child == false and self.tamed == true and name == self.owner then
if self.gotten == false
and self.child == false
and self.tamed == true
and name == self.owner then
local col = string.split(itemname,":")[2]
for _,c in pairs(all_colours) do
if c == col then
@ -185,4 +189,4 @@ minetest.register_entity("mobs:sheep", {
end
end,
})
})

0
mods/mobs/sounds/default_punch2.ogg Normal file → Executable file
View File

0
mods/mobs/sounds/mobs_die_yell.ogg Normal file → Executable file
View File

0
mods/mobs/sounds/mobs_yeti_death.ogg Normal file → Executable file
View File

127
mods/mobs/spawner.lua Executable file
View File

@ -0,0 +1,127 @@
-- mob spawner
local spawner_default = "mobs:pig 10 15 0"
minetest.register_node("mobs:spawner", {
tiles = {"mob_spawner.png"},
drawtype = "glasslike",
paramtype = "light",
walkable = true,
description = "Mob Spawner",
groups = {cracky = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
-- text entry formspec
meta:set_string("formspec", "field[text;mob_name min_light max_light amount;${command}]")
meta:set_string("infotext", "Spawner Not Active (enter settings)")
meta:set_string("command", spawner_default)
end,
on_right_click = function(pos, placer)
local meta = minetest.get_meta(pos)
end,
on_receive_fields = function(pos, formname, fields, sender)
if not fields.text or fields.text == "" then
return
end
local meta = minetest.get_meta(pos)
local comm = fields.text:split(" ")
local name = sender:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
local mob = comm[1]
local mlig = tonumber(comm[2])
local xlig = tonumber(comm[3])
local num = tonumber(comm[4])
if mob and mob ~= ""
and num and num >= 0 and num <= 10
and mlig and mlig >= 0 and mlig <= 15
and xlig and xlig >= 0 and xlig <= 15 then
meta:set_string("command", fields.text)
meta:set_string("infotext", "Spawner Active (" .. mob .. ")")
else
minetest.chat_send_player(name, "Mob Spawner settings failed!")
end
end,
})
-- spawner abm
minetest.register_abm({
nodenames = {"mobs:spawner"},
interval = 10,
chance = 4,
catch_up = false,
action = function(pos, node, active_object_count, active_object_count_wider)
-- check objects inside 9x9 area around spawner
local objs = minetest.get_objects_inside_radius(pos, 9)
-- get meta and command
local meta = minetest.get_meta(pos)
local comm = meta:get_string("command"):split(" ")
-- get settings from command
local mob = comm[1]
local mlig = tonumber(comm[2])
local xlig = tonumber(comm[3])
local num = tonumber(comm[4])
-- if amount is 0 then do nothing
if num == 0 then
return
end
local count = 0
local ent = nil
-- count objects of same type in area
for k, obj in pairs(objs) do
ent = obj:get_luaentity()
if ent and ent.name == mob then
count = count + 1
end
end
-- is there too many of same type?
if count >= num then
return
end
-- find air blocks within 5 nodes of spawner
local air = minetest.find_nodes_in_area(
{x = pos.x - 5, y = pos.y, z = pos.z - 5},
{x = pos.x + 5, y = pos.y, z = pos.z + 5},
{"air"})
-- spawn in random air block
if air and #air > 0 then
local pos2 = air[math.random(#air)]
local lig = minetest.get_node_light(pos2)
pos2.y = pos2.y + 0.5
-- only if light levels are within range
if lig and lig >= mlig and lig <= xlig then
minetest.add_entity(pos2, mob)
end
end
end
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

0
mods/mobs/textures/mobs_ent.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

0
mods/mobs/textures/mobs_pig_inv.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 892 B

After

Width:  |  Height:  |  Size: 892 B

0
mods/mobs/textures/mobs_pig_pink.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB