update mobs 02/02

stats mobs,

    oerkki peut détruire/enlever torchs,

    vache/sheep mangent l'herbe,

    bébé phacochère/mouton qui suivent leur "maman",

    npc => suit les diamonds, il peut etre soigné avec meat ou bread,
clique droit avec "default:gold_lump" en main et il droppera un objet
au hasard en échange,

    pumba => follow maintenant "default:apple"

    kittens => follow maintenant "fishing:fish_raw"
This commit is contained in:
Ombridride 2015-03-18 21:28:40 +01:00
parent ec9c96562f
commit d72ff66ad2
36 changed files with 915 additions and 712 deletions

View File

@ -28,6 +28,10 @@ This mod contains the following additions:
Changelog:
beta- Npc mob added, kills monsters, attacks player when punched, right click with food to heal or gold lump for drop
1.04- Added mating for sheep, cows and hogs... feed animals to make horny and hope for a baby which is half size, will grow up quick though :)
1.03- Added mob drop/replace feature so that chickens can drop eggs, cow/sheep can eat grass/wheat etc.
1.02- Sheared sheep are remembered and spawn shaven, Warthogs will attack when threatened, Api additions
1.01- Mobs that suffer fall damage or die in water/lava/sunlight will now drop items
1.0 - more work on Api so that certain mobs can float in water while some sink like a brick :)
0.9 - Spawn eggs added for all mobs (admin only, cannot be placed in protected areas)... Api tweaked

View File

@ -1,29 +1,24 @@
-- Mobs Api (1st March 2015)
-- Mobs Api (15th March 2015)
mobs = {}
-- Set global for other mod checks (e.g. Better HUD uses this)
mobs.mod = "redo"
-- Do mobs spawn in protected areas (0=yes, 1=no)
mobs.protected = 0
-- Initial check to see if damage is enabled
-- Initial check to see if damage is enabled and peaceful mode active
local damage_enabled = minetest.setting_getbool("enable_damage")
-- Check to see if in peaceful mode
local peaceful_only = minetest.setting_getbool("only_peaceful_mobs")
function mobs:register_mob(name, def)
minetest.register_entity(name, {
name = name,
hp_min = def.hp_min or 5,
hp_max = def.hp_max,
hp_max = def.hp_max or 10,
physical = true,
collisionbox = def.collisionbox,
visual = def.visual,
visual_size = def.visual_size,
visual_size = def.visual_size or {x=1, y=1},
mesh = def.mesh,
--textures = def.textures,
makes_footstep_sound = def.makes_footstep_sound,
view_range = def.view_range,
walk_velocity = def.walk_velocity,
@ -32,7 +27,8 @@ function mobs:register_mob(name, def)
light_damage = def.light_damage,
water_damage = def.water_damage,
lava_damage = def.lava_damage,
fall_damage = def.fall_damage or true,
fall_damage = def.fall_damage or 1,
fall_speed = def.fall_speed or -10, -- must be lower than -2
drops = def.drops,
armor = def.armor,
drawtype = def.drawtype,
@ -43,7 +39,7 @@ function mobs:register_mob(name, def)
shoot_interval = def.shoot_interval,
sounds = def.sounds or {},
animation = def.animation,
follow = def.follow,
follow = def.follow or "",
jump = def.jump or true,
exp_min = def.exp_min or 0,
exp_max = def.exp_max or 0,
@ -53,12 +49,16 @@ function mobs:register_mob(name, def)
--fov = def.fov or 120,
passive = def.passive or false,
recovery_time = def.recovery_time or 0.5,
knock_back = def.knock_back or 1, --knock_back = def.knock_back or 3,
knock_back = def.knock_back or 1, --default value is "or 3",
blood_offset = def.blood_offset or 0,
blood_amount = def.blood_amount or 5,
blood_texture = def.blood_texture or "mobs_blood.png",
shoot_offset = def.shoot_offset or 0,
floats = def.floats or 1, -- floats in water by default
replace_rate = def.replace_rate,
replace_what = def.replace_what,
replace_with = def.replace_with,
replace_offset = def.replace_offset or 0,
stimer = 0,
timer = 0,
@ -71,6 +71,9 @@ function mobs:register_mob(name, def)
tamed = false,
last_state = nil,
pause_timer = 0,
horny = false,
hornytimer = 0,
child = false,
do_attack = function(self, player, dist)
if self.state ~= "attack" then
@ -130,33 +133,25 @@ function mobs:register_mob(name, def)
self.animation.current = ""
end
if type == "stand" and self.animation.current ~= "stand" then
if self.animation.stand_start
and self.animation.stand_end
and self.animation.speed_normal then
if self.animation.stand_start and self.animation.stand_end and self.animation.speed_normal then
self.object:set_animation({x=self.animation.stand_start,
y=self.animation.stand_end},self.animation.speed_normal, 0)
self.animation.current = "stand"
end
elseif type == "walk" and self.animation.current ~= "walk" then
if self.animation.walk_start
and self.animation.walk_end
and self.animation.speed_normal then
if self.animation.walk_start and self.animation.walk_end and self.animation.speed_normal then
self.object:set_animation({x=self.animation.walk_start,y=self.animation.walk_end},
self.animation.speed_normal, 0)
self.animation.current = "walk"
end
elseif type == "run" and self.animation.current ~= "run" then
if self.animation.run_start
and self.animation.run_end
and self.animation.speed_run then
if self.animation.run_start and self.animation.run_end and self.animation.speed_run then
self.object:set_animation({x=self.animation.run_start,y=self.animation.run_end},
self.animation.speed_run, 0)
self.animation.current = "run"
end
elseif type == "punch" and self.animation.current ~= "punch" then
if self.animation.punch_start
and self.animation.punch_end
and self.animation.speed_normal then
if self.animation.punch_start and self.animation.punch_end and self.animation.speed_normal then
self.object:set_animation({x=self.animation.punch_start,y=self.animation.punch_end},
self.animation.speed_normal, 0)
self.animation.current = "punch"
@ -177,7 +172,7 @@ function mobs:register_mob(name, def)
local player_count = 0
for _,obj in ipairs(minetest.get_objects_inside_radius(self.object:getpos(), 10)) do
if obj:is_player() then
player_count = player_count+1
player_count = player_count + 1
break -- only really need 1 player to be found
end
end
@ -188,12 +183,12 @@ function mobs:register_mob(name, def)
end
end
-- drop egg
if name == "mobs:chicken" then
if math.random(1, 3000) <= 1
and minetest.get_node(self.object:getpos()).name == "air"
and self.state == "stand" then
minetest.set_node(self.object:getpos(), {name="mobs:egg"})
-- check for mob drop/replace (used for chicken egg and sheep eating grass/wheat)
if self.replace_rate and math.random(1,self.replace_rate) == 1 then
local pos = self.object:getpos() ; pos.y = pos.y + self.replace_offset
if #minetest.find_nodes_in_area(pos,pos,self.replace_what) > 0
and self.object:getvelocity().y == 0 and self.state == "stand" then
minetest.set_node(pos, {name = self.replace_with})
end
end
@ -202,25 +197,21 @@ function mobs:register_mob(name, def)
if minetest.get_item_group(minetest.get_node(self.object:getpos()).name, "water") ~= 0 then
self.object:setacceleration({x = 0, y = 1.5, z = 0})
else
self.object:setacceleration({x = 0, y = -10, z = 0}) -- 14.5
self.object:setacceleration({x = 0, y = self.fall_speed, z = 0})
end
else
self.object:setacceleration({x=0, y=-10, z=0})
self.object:setacceleration({x = 0, y = self.fall_speed, z = 0})
end
-- fall damage
if self.fall_damage and self.object:getvelocity().y == 0 then
if not self.old_y then
self.old_y = self.object:getpos().y
else
local d = self.old_y - self.object:getpos().y
if d > 5 then
local damage = d-5
self.object:set_hp(self.object:get_hp()-damage)
check_for_death(self)
end
self.old_y = self.object:getpos().y
if self.fall_damage == 1 and self.object:getvelocity().y == 0 then
local d = self.old_y - self.object:getpos().y
if d > 5 then
local damage = math.floor(d - 5)
self.object:set_hp(self.object:get_hp()-damage)
check_for_death(self)
end
self.old_y = self.object:getpos().y
end
-- if pause state then this is where the loop ends
@ -254,19 +245,22 @@ function mobs:register_mob(name, def)
if self.light_damage and self.light_damage ~= 0
and pos.y > 0
and lit > 4
and lit > 10 -- direct sunlight (was 4)
and tod > 0.2 and tod < 0.8 then
self.object:set_hp(self.object:get_hp()-self.light_damage) ; --print ("light damage")
self.object:set_hp(self.object:get_hp()-self.light_damage)
effect(pos, 5, "tnt_smoke.png")
end
if self.water_damage and self.water_damage ~= 0
and minetest.get_item_group(n.name, "water") ~= 0 then
self.object:set_hp(self.object:get_hp()-self.water_damage) ; --print ("water damage")
self.object:set_hp(self.object:get_hp()-self.water_damage)
effect(pos, 5, "bubble.png")
end
if self.lava_damage and self.lava_damage ~= 0
and minetest.get_item_group(n.name, "lava") ~= 0 then
self.object:set_hp(self.object:get_hp()-self.lava_damage) ; --print ("lava damage")
self.object:set_hp(self.object:get_hp()-self.lava_damage)
effect(pos, 5, "fire_basic_flame.png")
end
check_for_death(self)
@ -281,7 +275,7 @@ function mobs:register_mob(name, def)
end
-- FIND SOMEONE TO ATTACK
if ( self.type == "monster" or self.type == "barbarian" ) and damage_enabled and self.state ~= "attack" then
if self.type == "monster" and damage_enabled and self.state ~= "attack" then
local s = self.object:getpos()
local inradius = minetest.get_objects_inside_radius(s,self.view_range)
@ -319,22 +313,20 @@ function mobs:register_mob(name, def)
end
-- NPC FIND A MONSTER TO ATTACK
-- if self.type == "npc" and self.attacks_monsters and self.state ~= "attack" then
-- local s = self.object:getpos()
-- local inradius = minetest.get_objects_inside_radius(s,self.view_range)
-- for _, oir in pairs(inradius) do
-- local obj = oir:get_luaentity()
-- if obj then
-- if obj.type == "monster" or obj.type == "barbarian" then
-- -- attack monster
-- local p = obj.object:getpos()
-- local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
-- self.do_attack(self,obj.object,dist)
-- break
-- end
-- end
-- end
-- end
if self.type == "npc" and self.attacks_monsters and self.state ~= "attack" then
local s = self.object:getpos()
local inradius = minetest.get_objects_inside_radius(s,self.view_range)
for _, oir in pairs(inradius) do
local obj = oir:get_luaentity()
if obj and obj.type == "monster" then
-- attack monster
local p = obj.object:getpos()
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
self.do_attack(self,obj.object,dist)
break
end
end
end
if self.follow ~= "" and not self.following then
for _,player in pairs(minetest.get_connected_players()) do
@ -342,19 +334,29 @@ function mobs:register_mob(name, def)
local p = player:getpos()
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if self.view_range and dist < self.view_range then
self.following = player
self.following = player ; self.following_player = true
break
else self.following_player = nil
end
end
end
if self.following and self.following:is_player() then
if self.following and self.following:is_player() and self.following:get_wielded_item():get_name() ~= self.follow then
self.following = nil
self.v_start = false
end
if self.following:get_wielded_item():get_name() ~= self.follow then
self.following = nil
else
local s = self.object:getpos()
local p = self.following:getpos()
if self.following then
local s = self.object:getpos()
local p
if self.following.is_player and self.following:is_player() then
p = self.following:getpos()
elseif self.following.object then
p = self.following.object:getpos()
end
if p then
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
if dist > self.view_range then
self.following = nil
@ -392,6 +394,68 @@ function mobs:register_mob(name, def)
end
end
-- horny animal can mate for 40 seconds, afterwards horny animal cannot mate again for 60 seconds
if self.horny == true and self.hornytimer < 100 and self.child == false then
self.hornytimer = self.hornytimer + 1
if self.hornytimer <= 40 then
effect(self.object:getpos(), 4, "heart.png")
end
if self.hornytimer >= 100 then
self.hornytimer = 0
self.horny = false
end
end
-- if animal is child take 120 seconds before growing into adult
if self.child == true then
self.hornytimer = self.hornytimer + 1
if self.hornytimer > 120 then
self.child = false
self.hornytimer = 0
self.object:set_properties({
visual_size = {x=self.visual_size.x,y=self.visual_size.y},
})
end
end
-- if animal is horny, find another same animal who is horny and mate
if self.horny == true and self.hornytimer <= 40 then
local pos = self.object:getpos()
local ents = minetest.get_objects_inside_radius(pos, self.view_range)
local num = 0
for i,obj in ipairs(ents) do
local ent = obj:get_luaentity()
if ent and ent.name == self.name and ent.horny == true and ent.hornytimer <= 40 then num = num + 1 end
if num > 1 then
--print("2 horny "..name)
self.following = ent
ent.following = self
self.horny = false
self.hornytimer = 0
self.following = nil
ent.horny = false
ent.following = nil
ent.hornytimer = 0
minetest.after(7, function(dtime)
--print ("spawned baby:",self.name)
local mob = minetest.add_entity(pos, self.name)
local ent2 = mob:get_luaentity()
mob:set_properties({
visual_size = {x=self.visual_size.x/2,y=self.visual_size.y/2},
})
ent2.child = true
ent2.tamed = true
end)
num = 0
break
end
end
end
if self.state == "stand" then
-- randomly turn
if math.random(1, 4) == 1 then
@ -687,11 +751,11 @@ function mobs:register_mob(name, def)
on_activate = function(self, staticdata, dtime_s)
local pos = self.object:getpos()
self.object:set_hp( math.random(self.hp_min, self.hp_max) ) -- reset HP
self.object:set_hp( math.random(self.hp_min, self.hp_max) ) -- set HP
self.object:set_armor_groups({fleshy=self.armor})
self.object:setacceleration({x=0, y=-10, z=0})
self.object:setacceleration({x=0, y= self.fall_speed, z=0})
self.state = "stand"
self.object:setvelocity({x=0, y=self.object:getvelocity().y, z=0})
self.object:setvelocity({x=0, y=self.object:getvelocity().y, z=0}) ; self.old_y = self.object:getpos().y
self.object:setyaw(math.random(1, 360)/180*math.pi)
if self.type == "monster" and peaceful_only then
self.object:remove()
@ -711,8 +775,18 @@ function mobs:register_mob(name, def)
if tmp.gotten then -- using this variable for obtaining something from mob (milk/wool)
self.gotten = tmp.gotten
end
if tmp.child then
self.child = tmp.child
end
if tmp.horny then
self.horny = tmp.horny
end
if tmp.hornytimer then
self.hornytimer = tmp.hornytimer
end
end
end
if self.lifetimer <= 0 and not self.tamed and self.type ~= "npc" then
self.object:remove()
end
@ -723,11 +797,30 @@ function mobs:register_mob(name, def)
end,
get_staticdata = function(self)
-- set mob texture and model
local textures = def.available_textures["texture_"..math.random(1,def.available_textures["total"])]
local mesh = self.mesh
local vis_size = self.visual_size
-- if object is a sheared sheep then set texture and model
if self.name == "mobs:sheep" and self.gotten == true then
textures = {"mobs_sheep_shaved.png"}
mesh = "mobs_sheep_shaved.x"
end
-- if object is child then set half size
if self.child == true then
vis_size = {x=self.visual_size.x/2,y=self.visual_size.y/2}
end
local tmp = {
lifetimer = self.lifetimer,
tamed = self.tamed,
gotten = self.gotten,
textures = def.available_textures["texture_"..math.random(1,def.available_textures["total"])],
child = self.child,
horny = self.horny,
hornytimer = self.hornytimer,
mesh = mesh,
textures = textures,
visual_size = vis_size,
}
self.object:set_properties(tmp)
return minetest.serialize(tmp)
@ -743,21 +836,7 @@ function mobs:register_mob(name, def)
if self.blood_amount > 0 and pos then
local p = pos
p.y = p.y + self.blood_offset
minetest.add_particlespawner({
amount = self.blood_amount,
time = 0.25,
minpos = {x=p.x-0.2, y=p.y-0.2, z=p.z-0.2},
maxpos = {x=p.x+0.2, y=p.y+0.2, z=p.z+0.2},
minvel = {x=-0, y=-2, z=-0},
maxvel = {x=2, y=2, z=2},
minacc = {x=-4, y=-4, z=-4},
maxacc = {x=4, y=4, z=4},
minexptime = 0.1,
maxexptime = 1,
minsize = 0.5,
maxsize = 1,
texture = self.blood_texture,
})
effect(p, self.blood_amount, self.blood_texture)
end
-- knock back effect, adapted from blockmen's pyramids mod
@ -778,9 +857,9 @@ function mobs:register_mob(name, def)
self.object:setvelocity({x=dir.x*kb,y=ykb,z=dir.z*kb})
self.pause_timer = r
--[[
-- attack puncher and call other mobs for help
if self.passive == false then
if self.passive == false and not self.tamed then
if self.state ~= "attack" then
self.do_attack(self,hitter,1)
end
@ -795,7 +874,7 @@ function mobs:register_mob(name, def)
end
end
end
]]--
end,
})
@ -811,7 +890,7 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o
chance = chance,
action = function(pos, node, _, active_object_count_wider)
-- do not spawn if too many in one active area
-- do not spawn if too many active in area
if active_object_count_wider > active_object_count
or not mobs.spawning_mobs[name]
or not pos then
@ -821,27 +900,24 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o
-- spawn above node
pos.y = pos.y + 1
-- Check if protected area, if so mobs will not spawn
-- mobs cannot spawn inside protected areas if enabled
if mobs.protected == 1 and minetest.is_protected(pos, "") then
return
end
-- check if light and height levels are ok to spawn
if not minetest.get_node_light(pos)
or minetest.get_node_light(pos) > max_light
or minetest.get_node_light(pos) < min_light
local light = minetest.get_node_light(pos)
if not light or light > max_light or light < min_light
or pos.y > max_height then
return
end
-- are we spawning inside a node?
-- are we spawning inside a solid node?
local nod = minetest.get_node_or_nil(pos)
if not nod then return end
if minetest.registered_nodes[nod.name].walkable == true then return end
if not nod or minetest.registered_nodes[nod.name].walkable == true then return end
pos.y = pos.y + 1
nod = minetest.get_node_or_nil(pos)
if not nod then return end
if minetest.registered_nodes[nod.name].walkable == true then return end
if not nod or minetest.registered_nodes[nod.name].walkable == true then return end
if minetest.setting_getbool("display_mob_spawn") then
minetest.chat_send_all("[mobs] Add "..name.." at "..minetest.pos_to_string(pos))
@ -849,7 +925,7 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o
-- spawn mob half block higher
pos.y = pos.y - 0.5
local mob = minetest.add_entity(pos, name)
minetest.add_entity(pos, name)
-- set mob health (randomly between min and max)
if mob then
@ -860,26 +936,42 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o
})
end
-- particle effects
function effect(pos, amount, texture)
minetest.add_particlespawner({
amount = amount,
time = 0.25,
minpos = {x=pos.x-0.2, y=pos.y-0.2, z=pos.z-0.2},
maxpos = {x=pos.x+0.2, y=pos.y+0.2, z=pos.z+0.2},
minvel = {x=-0, y=-2, z=-0},
maxvel = {x=2, y=2, z=2},
minacc = {x=-4, y=-4, z=-4},
maxacc = {x=4, y=4, z=4},
minexptime = 0.1,
maxexptime = 1,
minsize = 0.5,
maxsize = 1,
texture = texture,
})
end
-- on mob death drop items
function check_for_death(self)
if self.object:get_hp() < 1 then
local pos = self.object:getpos()
pos.y = pos.y + 0.5 -- drop items half a block higher
self.object:remove()
for _,drop in ipairs(self.drops) do
if math.random(1, drop.chance) == 1 then
local d = ItemStack(drop.name.." "..math.random(drop.min, drop.max))
local obj = minetest.add_item(pos, d)
if obj then
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
end
if self.object:get_hp() > 0 then return end
local pos = self.object:getpos()
pos.y = pos.y + 0.5 -- drop items half a block higher
self.object:remove()
for _,drop in ipairs(self.drops) do
if math.random(1, drop.chance) == 1 then
local d = ItemStack(drop.name.." "..math.random(drop.min, drop.max))
local obj = minetest.add_item(pos, d)
if obj then
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
end
end
if self.sounds.death ~= nil then
minetest.sound_play(self.sounds.death,{object = self.object,})
end
end
if self.sounds.death ~= nil then
minetest.sound_play(self.sounds.death,{object = self.object,})
end
end

View File

@ -1,32 +1,43 @@
-- Bee
-- Bee by KrupnoPavel
mobs:register_mob("mobs:bee", {
-- animal, monster, npc, barbarian
type = "animal",
hp_min = 1,
hp_max = 2,
-- it is aggressive
passive = true,
-- health & armor
hp_min = 1, hp_max = 2, armor = 200,
-- textures and model
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.2, 0.2},
visual = "mesh",
mesh = "mobs_bee.x",
--textures = {"mobs_bee.png"},
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_bee.png"},
},
-- sounds
makes_footstep_sound = false,
sounds = {
random = "mobs_bee",
},
-- speed and jump
walk_velocity = 1,
armor = 200,
jump = true,
step = 1,
-- drops honey when killed
drops = {
{name = "mobs:med_cooked",
chance = 1,
min = 1,
max = 2,},
{name = "mobs:honey",
chance = 1, min = 1, max = 2,},
},
drawtype = "front",
-- damage
water_damage = 1,
lava_damage = 1,
light_damage = 0,
fall_damage = 0,
fall_speed = -3,
-- model animation
animation = {
speed_normal = 15,
stand_start = 0,
@ -37,36 +48,29 @@ mobs:register_mob("mobs:bee", {
sounds = {
random = "mobs_bee",
},
-- right click to pick up bee
on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_inventory() then
clicker:get_inventory():add_item("main", "mobs:bee")
self.object:remove()
end
end,
jump = true,
step = 1,
passive = true,
})
-- spawn on group:flowers between 4 and 20 light, 1 in 5000 chance, 1 bee in area up to 31000 in height
mobs:register_spawn("mobs:bee", {"default:dirt_with_grass"}, 20, 4, 7500, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:bee", "Bee", "mobs_bee_inv.png", 0)
-- Honey
minetest.register_craftitem("mobs:honey", {
description = "Honey",
inventory_image = "mobs_honey_inv.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
type = "cooking",
output = "mobs:med_cooked",
recipe = "mobs:bee",
cooktime = 5,
})
-- Beehive
-- Beehive (when placed, bee appears)
minetest.register_node("mobs:beehive", {
description = "Beehive",
drawtype = "plantlike",

View File

@ -1,15 +1,18 @@
--= Chicken (thanks to JK Murray for his chicken model)
-- Chicken by JK Murray
mobs:register_mob("mobs:chicken", {
-- animal, monster, npc, barbarian
type = "animal",
hp_min = 5,
hp_max = 10,
animaltype = "clucky",
-- is it aggressive
passive = true,
-- health & armor
hp_min = 5, hp_max = 10, armor = 200,
-- textures and model
collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3},
visual = "mesh",
mesh = "chicken.x",
-- textures look repetative but they fix the wrapping bug
drawtype = "front",
available_textures = {
total = 2,
texture_1 = {"mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png",
@ -19,19 +22,28 @@ mobs:register_mob("mobs:chicken", {
"mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png",
"mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png"},
},
--textures = {"mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png",
-- "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png", "mobs_chicken.png"},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mobs:chicken_raw", chance = 1, min = 2, max = 2,},
sounds = {
random = "mobs_chicken",
},
drawtype = "front",
-- speed and jump
walk_velocity = 1,
jump = true,
step = 1,
-- drops raw chicken when dead
drops = {
{name = "mobs:chicken_raw",
chance = 1, min = 2, max = 2},
},
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 0,
jump = false,
fall_damage = 0,
fall_speed = -8,
-- model animation
animation = {
speed_normal = 15,
stand_start = 0,
@ -39,12 +51,13 @@ mobs:register_mob("mobs:chicken", {
walk_start = 20,
walk_end = 40,
},
follow = "farming:wheat",
view_range = 8,
sounds = {
random = "mobs_chicken",
},
-- follows wheat
follow = "farming:wheat", view_range = 8,
-- replace air with egg (lay)
replace_rate = 1000,
replace_what = {"air"},
replace_with = "mobs:egg",
-- right click to pick up chicken
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
if tool:get_name() == "farming:wheat" then
@ -66,44 +79,39 @@ mobs:register_mob("mobs:chicken", {
self.object:remove()
end
end
end,
jump = true,
step = 1,
blood_texture = "mobs_blood.png",
passive = true,
})
})
-- spawn on default or bamboo grass between 8 and 20 light, 1 in 9000 change, 1 chicken in area up to 31000 in height
mobs:register_spawn("mobs:chicken", {"default:dirt_with_grass"}, 20, 0, 9000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:chicken", "Chicken", "mobs_chicken_inv.png", 0)
-- Egg (can be fried in furnace)
minetest.register_node("mobs:egg",
{
description = "Chicken Egg",
tiles = {"mobs_chicken_egg.png"},
inventory_image = "mobs_chicken_egg.png",
on_use = minetest.item_eat(1),
visual_scale = 0.7,
drawtype = "plantlike",
wield_image = "mobs_chicken_egg.png",
paramtype = "light",
walkable = false,
is_ground_content = true,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
},
groups = {snappy=2, dig_immediate=3},
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
minetest.set_node(pos, {name="mobs:egg", param2=1})
end
-- Egg
minetest.register_node("mobs:egg", {
description = "Chicken Egg",
tiles = {"mobs_chicken_egg.png"},
inventory_image = "mobs_chicken_egg.png",
visual_scale = 0.7,
drawtype = "plantlike",
wield_image = "mobs_chicken_egg.png",
paramtype = "light",
walkable = false,
is_ground_content = true,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
},
groups = {snappy=2, dig_immediate=3},
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
minetest.set_node(pos, {name="mobs:egg", param2=1})
end
end
})
-- Fried egg
minetest.register_craftitem("mobs:chicken_egg_fried", {
description = "Fried Egg",
inventory_image = "mobs_chicken_egg_fried.png",
@ -117,7 +125,6 @@ minetest.register_craft({
})
-- Chicken (raw and cooked)
minetest.register_craftitem("mobs:chicken_raw", {
description = "Raw Chicken",
inventory_image = "mobs_chicken_raw.png",

View File

@ -2,49 +2,69 @@
-- Cow by Krupnovpavel
mobs:register_mob("mobs:cow", {
-- animal, monster, npc, barbarian
type = "animal",
hp_min = 10,
hp_max = 15,
-- aggressive, does 6 damage to player when threatened
passive = false,
attack_type = "dogfight",
damage = 6,
-- health & armor
hp_min = 20, hp_max = 30, armor = 200,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
--textures = {"mobs_cow.png"},
visual = "mesh",
mesh = "mobs_cow.x",
drawtype = "front",
available_textures = {
total = 1, -- à mettre à 2 quand "mobs_cow_brown.png" sera compatible
texture_1 = {"mobs_cow.png"},
--texture_2 = {"mobs_cow_brown.png"}, -- dé-commenter quand "mobs_cow_brown.png" sera compatible
},
visual = "mesh",
mesh = "mobs_cow.x",
blood_texture = "mobs_blood.png",
visual_size = {x=1,y=1},
-- sounds
makes_footstep_sound = true,
view_range = 7,
walk_velocity = 1,
run_velocity = 2,
damage = 10,
armor = 200,
drops = {
{name = "mobs:meat_raw",
chance = 1,
min = 5,
max = 10,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
follow = "farming:wheat",
sounds = {
random = "mobs_cow",
},
-- speed and jump
walk_velocity = 1,
run_velocity = 2,
jump = true,
step = 0.5,
-- drops raw meat when dead
drops = {
{name = "mobs:meat_raw",
chance = 1, min = 5, max = 10},
},
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 30,
walk_start = 35, walk_end = 65,
run_start = 105, run_end = 135,
punch_start = 70, punch_end = 100,
},
-- follows wheat
follow = "farming:wheat", view_range = 8,
-- replace grass/wheat with air (eat)
replace_rate = 50,
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
replace_with = "air",
-- right-click cow with empty bucket to get milk, then feed 8 wheat to replenish milk
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
if tool:get_name() == "bucket:bucket_empty" then
if tool:get_name() == "bucket:bucket_empty" and self.child == false then
if self.gotten then return end
clicker:get_inventory():remove_item("main", "bucket:bucket_empty")
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
self.gotten = true -- milked
end
if tool:get_name() == "farming:wheat" and self.gotten then
if tool:get_name() == "farming:wheat" then -- and self.gotten then
if not minetest.setting_getbool("creative_mode") then
tool:take_item(1)
clicker:set_wielded_item(tool)
@ -52,6 +72,7 @@ mobs:register_mob("mobs:cow", {
self.food = (self.food or 0) + 1
if self.food >= 8 then
self.food = 0
if self.child == false then self.horny = true end
self.gotten = false -- ready to be milked again
self.tamed = true
minetest.sound_play("mobs_cow", {object = self.object,gain = 1.0,max_hear_distance = 32,loop = false,})
@ -60,21 +81,10 @@ mobs:register_mob("mobs:cow", {
end
end,
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 30,
walk_start = 35, walk_end = 65,
run_start = 105, run_end = 135,
punch_start = 70, punch_end = 100,
},
jump = true,
step = 1,
blood_texture = "mobs_blood.png",
passive = true,
})
mobs:register_spawn("mobs:cow", {"default:dirt_with_grass"}, 20, 0, 9000, 1, 31000)
-- spawn on default;green;prairie grass between 0 and 20 light, 1 in 11000 chance, 1 cow in area up to 31000 in height
mobs:register_spawn("mobs:cow", {"default:dirt_with_grass"}, 20, 0, 10000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:cow", "Cow", "default_grass.png", 1)
-- Bucket of Milk

0
mods/mobs/creeper.lua Executable file → Normal file
View File

View File

@ -1,23 +1,38 @@
-- Dirt Monster
-- Dirt Monster by PilzAdam
mobs:register_mob("mobs:dirt_monster", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 25,
hp_max = 30,
-- aggressive, deals 4 damage to player when hit
passive = false,
attack_type = "dogfight",
damage = 4,
-- health & armor
hp_min = 25, hp_max = 30, armor = 90,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_stone_monster.x",
--textures = {"mobs_dirt_monster.png"},
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_dirt_monster.png"},
},
visual_size = {x=3, y=2.6},
blood_texture = "default_dirt.png",
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_dirtmonster",
},
-- speed and jump
view_range = 16,
walk_velocity = 3,
run_velocity = 5,
damage = 4,
jump = true,
step = 1,
-- drops dirt and coins when dead
drops = {
{name = "default:dirt",
chance = 1,
@ -28,32 +43,21 @@ mobs:register_mob("mobs:dirt_monster", {
min = 2,
max = 8,},
},
-- damaged by
light_resistant = false,
armor = 90,
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 2,
on_rightclick = nil,
attack_type = "dogfight",
-- model animation
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 14,
walk_start = 15, walk_end = 38,
run_start = 40, run_end = 63,
punch_start = 40, punch_end = 63,
},
sounds = {
random = "mobs_dirtmonster",
},
jump = true,
step = 1,
blood_texture = "default_dirt.png",
})
-- spawn on normal;grey dirt between 0 and 5 light, 1 in 7000 change, 1 dirt monster in area up to 31000 in height
mobs:register_spawn("mobs:dirt_monster", {"default:dirt_with_grass"}, 3, -1, 9000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:dirt_monster", "Dirt Monster", "default_dirt.png", 1)

View File

@ -1,5 +1,5 @@
-- Dungeon Master (This one spits out fireballs at you)
-- Dungeon Master by PilzAdam
-- Node which cannot be destroyed by DungeonMasters' fireballs
local excluded = {"nether:netherrack","default:obsidian_glass","maptools:cobble",
@ -7,13 +7,22 @@ local excluded = {"nether:netherrack","default:obsidian_glass","maptools:cobble"
}
mobs:register_mob("mobs:dungeon_master", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 50,
hp_max = 60,
-- aggressive, shoots fireballs at player
passive = false,
damage = 13,
attack_type = "shoot",
shoot_interval = 2.5,
arrow = "mobs:fireball",
shoot_offset = 0,
-- health & armor
hp_min = 50, hp_max = 60, armor = 60,
-- textures and model
collisionbox = {-0.7, -0.01, -0.7, 0.7, 2.6, 0.7},
visual = "mesh",
mesh = "mobs_dungeon_master.x",
--textures = {"mobs_dungeon_master.png"},
drawtype = "front",
available_textures = {
total = 3,
texture_1 = {"mobs_dungeon_master.png"},
@ -21,72 +30,52 @@ mobs:register_mob("mobs:dungeon_master", {
texture_3 = {"mobs_dungeon_master_strangewhite.png"},
},
visual_size = {x=8, y=8},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
view_range = 16,
sounds = {
random = "mobs_dungeonmaster",
attack = "mobs_fireball",
},
-- speed and jump
walk_velocity = 1,
run_velocity = 3,
damage = 13,
run_velocity = 2,
jump = true,
step = 0.5,
view_range = 16,
-- drops mese or diamond when dead
drops = {
{name = "default:mese_crystal_fragment",
chance = 1,
min = 1,
max = 3,},
chance = 1, min = 1, max = 3,},
{name = "default:diamond",
chance = 5,
min = 1,
max = 3,},
chance = 5, min = 1, max = 3,},
{name = "default:mese_crystal",
chance = 2,
min = 1,
max = 3,},
chance = 2, min = 1, max = 3,},
{name = "default:diamond_block",
chance = 30,
min = 1,
max = 1,},
chance = 30, min = 1, max = 1,},
{name = "maptools:gold_coin",
chance = 15,
min = 1,
max = 2,},
chance = 15, min = 1, max = 2,},
{name = "maptools:silver_coin",
chance = 1,
min = 2,
max = 10,},
chance = 1, min = 2, max = 10,},
},
armor = 60,
drawtype = "front",
-- damaged by
water_damage = 1,
lava_damage = 1,
light_damage = 0,
on_rightclick = nil,
attack_type = "shoot",
arrow = "mobs:fireball",
shoot_interval = 2.5,
sounds = {
attack = "mobs_fireball",
},
-- model animation
animation = {
stand_start = 0,
stand_end = 19,
walk_start = 20,
walk_end = 35,
punch_start = 36,
punch_end = 48,
speed_normal = 15,
speed_run = 15,
stand_start = 0, stand_end = 19,
walk_start = 20, walk_end = 35,
punch_start = 36, punch_end = 48,
speed_normal = 15, speed_run = 15,
},
sounds = {
random = "mobs_dungeonmaster",
},
jump = true,
step = 0.5,
shoot_offset = 0,
blood_texture = "mobs_blood.png",
})
-- spawn on stone between 20 and -1 light, 1 in 7000 chance, 1 dungeon master in area starting at -100 and below
mobs:register_spawn("mobs:dungeon_master", {"default:stone, nether:netherrack"}, 20, -1, 7000, 1, -100)
-- register spawn egg
mobs:register_egg("mobs:dungeon_master", "Dungeon Master", "fire_basic_flame.png", 1)
-- Fireball (weapon)
-- Fireball (dungeon masters weapon)
mobs:register_arrow("mobs:fireball", {
visual = "sprite",
visual_size = {x=1, y=1},
@ -100,12 +89,11 @@ mobs:register_arrow("mobs:fireball", {
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=13},
}, 0) -- {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z})
}, 0)
end,
-- node hit, bursts into flame (cannot blast through obsidian)
-- node hit, bursts into flame (cannot blast through obsidian or protection redo mod items)
hit_node = function(self, pos, node)
for dx=-1,1 do
for dy=-1,1 do
for dz=-1,1 do
@ -123,7 +111,7 @@ mobs:register_arrow("mobs:fireball", {
end
if n ~= "default:obsidian"
and n ~= "default:obsidianbrick"
and not n:find("protector:") then
and not n:find("protector:") then
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <= 30 then
minetest.set_node(p, {name="fire:basic_flame"})
else

View File

@ -33,6 +33,9 @@ dofile(minetest.get_modpath("mobs").."/mese_monster.lua")
dofile(minetest.get_modpath("mobs").."/spider.lua")
-- NPC
dofile(minetest.get_modpath("mobs").."/npc.lua")
-- Creeper (fast impl by davedevils)
dofile(minetest.get_modpath("mobs").."/creeper.lua")

View File

@ -104,7 +104,7 @@ mobs:register_mob("mobs:kitten", {
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:rat" then
if item:get_name() == "fishing:fish_raw" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)

View File

@ -1,67 +1,67 @@
--= Lava Flan by Zeg9
minetest.register_craftitem("mobs:lava_orb", {
description = "Lava orb",
inventory_image = "zmobs_lava_orb.png",
on_place = function(itemstack, placer, pointed_thing)
end,
})
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")
-- Lava Flan by Zeg9
mobs:register_mob("mobs:lava_flan", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 20,
hp_max = 35,
-- aggressive, deals 3 damage to player when hit
passive = false,
attack_type = "dogfight",
damage = 3,
-- health and armor
hp_min = 20, hp_max = 35, armor = 80,
-- textures and model
collisionbox = {-0.5, -0.5, -0.5, 0.5, 1.5, 0.5},
visual = "mesh",
mesh = "zmobs_lava_flan.x",
--textures = {"zmobs_lava_flan.png"},
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"zmobs_lava_flan.png"},
},
blood_texture = "fire_basic_flame.png",
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = true,
view_range = 10,
walk_velocity = 0.5,
run_velocity = 2,
damage = 3,
drops = {
{name = "mobs:lava_orb",
chance = 10,
min = 1,
max = 1,},
},
light_resistant = true,
armor = 80,
drawtype = "front",
water_damage = 5,
lava_damage = 0,
light_damage = 0,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 8,
walk_start = 10,
walk_end = 18,
run_start = 20,
run_end = 28,
punch_start = 20,
punch_end = 28,
},
sounds = {
random = "mobs_lavaflan",
war_cry = "mobs_lavaflan",
death = nil,
},
-- speed and jump, sinks in water
walk_velocity = 0.5,
run_velocity = 2,
jump = true,
step = 2,
view_range = 16,
floats = 0,
blood_texture = "fire_basic_flame.png",
-- chance of dropping lava orb when dead
drops = {
{name = "mobs:lava_orb",
chance = 15, min = 1, max = 1,},
},
-- damaged by
light_resistant = true,
water_damage = 5,
lava_damage = 0,
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 8,
walk_start = 10, walk_end = 18,
run_start = 20, run_end = 28,
punch_start = 20, punch_end = 28,
},
})
-- spawns in lava between -1 and 20 light, 1 in 2000 chance, 2 in area below 31000 in height
mobs:register_spawn("mobs:lava_flan", {"default:lava_source"}, 20, -1, 2000, 2, 31000)
-- register spawn egg
mobs:register_egg("mobs:lava_flan", "Lava Flan", "default_lava.png", 1)
-- Lava Orb
minetest.register_craftitem("mobs:lava_orb", {
description = "Lava orb",
inventory_image = "zmobs_lava_orb.png",
})
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")

View File

@ -1,83 +1,70 @@
--= Mese Monster by Zeg9
-- Mese Monster by Zeg9
-- 9 mese crystal fragments = 1 mese crystal
minetest.register_craft({
output = "default:mese_crystal",
recipe = {
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
}
})
-- Mese Monster
mobs:register_mob("mobs:mese_monster", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 30,
hp_max = 40,
-- agressive, deals 3 damage to player when hit
passive = false,
damage = 7,
attack_type = "shoot",
shoot_interval = .5,
arrow = "mobs:mese_arrow",
shoot_offset = 2,
-- health & armor
hp_min = 30, hp_max = 40, armor = 80,
-- textures and model
collisionbox = {-0.5, -1.5, -0.5, 0.5, 0.5, 0.5},
visual = "mesh",
mesh = "zmobs_mese_monster.x",
--textures = {"zmobs_mese_monster.png"},
available_textures = {
total = 1,
texture_1 = {"zmobs_mese_monster.png"},
},
visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 16,
walk_velocity = 1,
run_velocity = 3,
damage = 6,
drops = {
{name = "default:mese_crystal",
chance = 9,
min = 1,
max = 3,},
{name = "default:mese_crystal_fragment",
chance = 1,
min = 1,
max = 9,},
{name = "maptools:silver_coin",
chance = 2,
min = 2,
max = 5,},
{name = "returnmirror:mirror_inactive",
chance = 50,
min = 1,
max = 1,},
},
light_resistant = true,
armor = 80,
drawtype = "front",
water_damage = 0,
lava_damage = 0,
light_damage = 0,
attack_type = "shoot",
arrow = "mobs:mese_arrow",
shoot_interval = .5,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 15, -- 40
punch_end = 38, -- 63
},
blood_texture = "default_mese_crystal_fragment.png",
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_mesemonster",
},
-- speed and jump
view_range = 16,
walk_velocity = 0.5,
run_velocity = 2,
jump = true,
step = 1,
shoot_offset = 2,
blood_texture = "default_mese_crystal_fragment.png",
fall_damage = 0,
fall_speed = -6,
-- drops mese when dead
drops = {
{name = "default:mese_crystal",
chance = 9, min = 1, max = 3,},
{name = "default:mese_crystal_fragment",
chance = 1, min = 1, max = 9,},
{name = "maptools:silver_coin",
chance = 2, min = 2, max = 5,},
{name = "returnmirror:mirror_inactive",
chance = 50, min = 1, max = 1,},
},
-- damaged by
light_resistant = true,
water_damage = 0,
lava_damage = 0,
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 14,
walk_start = 15, walk_end = 38,
run_start = 40, run_end = 63,
punch_start = 15, punch_end = 38, -- was 40 & 63
},
})
-- spawn on stone between 20 and -1 light, 1 in 6000 chance, 1 in area below -25
mobs:register_spawn("mobs:mese_monster", {"default:stone", }, 20, -1, 6000, 1, -25)
-- register spawn egg
mobs:register_egg("mobs:mese_monster", "Mese Monster", "default_mese_block.png", 1)
-- Mese Monster Crystal Shards (weapon)
@ -95,9 +82,19 @@ mobs:register_arrow("mobs:mese_arrow", {
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=7},
}, 0) -- {x=s.x-p.x, y=s.y-p.y, z=s.z-p.z})
}, 0)
end,
hit_node = function(self, pos, node)
end
})
-- 9 mese crystal fragments = 1 mese crystal
minetest.register_craft({
output = "default:mese_crystal",
recipe = {
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
}
})

BIN
mods/mobs/models/character.b3d Executable file

Binary file not shown.

BIN
mods/mobs/models/mobs_npc.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

83
mods/mobs/npc.lua Executable file
View File

@ -0,0 +1,83 @@
-- Npc by TenPlus1
mobs.npc_drops = { "default:pick_steel", "mobs:meat", "default:sword_steel", "default:shovel_steel", "farming:bread", "bucket:bucket_water" }
mobs:register_mob("mobs:npc", {
-- animal, monster, npc
type = "npc",
-- aggressive, deals 3 damage to player/monster when hit
passive = false,
damage = 3,
attack_type = "dogfight",
attacks_monsters = true,
-- health & armor
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",
mesh = "character.b3d",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_npc.png"},
},
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = true,
sounds = {},
-- speed and jump
walk_velocity = 1,
run_velocity = 2,
jump = true,
-- drops wood and chance of apples when dead
drops = {
{name = "default:wood",
chance = 1, min = 1, max = 3},
{name = "default:apple",
chance = 2, min = 1, max = 2},
{name = "default:axe_stone",
chance = 3, min = 1, max = 1},
},
-- damaged by
water_damage = 0,
lava_damage = 2,
light_damage = 0,
-- follow diamond
follow = "default:diamond",
view_range = 16,
-- model animation
animation = {
speed_normal = 30, speed_run = 30,
stand_start = 0, stand_end = 79,
walk_start = 168, walk_end = 187,
run_start = 168, run_end = 187,
punch_start = 200, punch_end = 219,
},
-- right clicking with cooked meat will give npc more health
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:meat" or item:get_name() == "farming:bread" then
local hp = self.object:get_hp()
if hp + 4 > self.hp_max then return end
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_hp(hp+4)
-- right clicking with gold lump drops random item from mobs.npc_drops
elseif item:get_name() == "default:gold_lump" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = mobs.npc_drops[math.random(1,#mobs.npc_drops)]})
end
end,
})
-- spawning disabled for now
--mobs:register_spawn("mobs:npc", {"default:dirt_with_grass"}, 20, 0, 7000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:npc", "Npc", "default_brick.png", 1)

View File

@ -1,61 +1,66 @@
-- Oerkki
-- Oerkki by PilzAdam
mobs:register_mob("mobs:oerkki", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 40,
hp_max = 50,
-- aggressive, deals 5 damage when player hit
passive = false,
attack_type = "dogfight",
damage = 5,
-- health & armor
hp_min = 40, hp_max = 50, armor = 90,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_oerkki.x",
--textures = {"mobs_oerkki.png"},
drawtype = "front",
available_textures = {
total = 2,
texture_1 = {"mobs_oerkki.png"},
texture_2 = {"mobs_oerkki2.png"},
},
visual_size = {x=5, y=5},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = false,
view_range = 16,
walk_velocity = 2,
run_velocity = 4,
damage = 5,
drops = {
{name = "default:obsidian",
chance = 3,
min = 1,
max = 2,},
{name = "maptools:silver_coin",
chance = 2,
min = 2,
max = 3,},
},
armor = 90,
drawtype = "front",
light_resistant = true,
water_damage = 1,
lava_damage = 1,
light_damage = 0,
attack_type = "dogfight",
animation = {
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 36,
run_start = 37,
run_end = 49,
punch_start = 37,
punch_end = 49,
speed_normal = 15,
speed_run = 15,
},
sounds = {
random = "mobs_oerkki",
attack = "mobs_oerkki_attack",
},
-- speed and jump
walk_velocity = 2,
run_velocity = 4,
view_range = 16,
jump = true,
step = 1,
blood_texture = "mobs_blood.png",
-- chance of dropping obsidian and coins
drops = {
{name = "default:obsidian",
chance = 3, min = 1, max = 2,},
{name = "maptools:silver_coin",
chance = 2, min = 2, max = 3,},
},
-- damaged by
light_resistant = true,
water_damage = 1,
lava_damage = 1,
light_damage = 0,
-- model animation
animation = {
stand_start = 0, stand_end = 23,
walk_start = 24, walk_end = 36,
run_start = 37, run_end = 49,
punch_start = 37, punch_end = 49,
speed_normal = 15, speed_run = 15,
},
-- replace torch with air (remove)
replace_rate = 50,
replace_what = {"default:torch"},
replace_with = "air",
replace_offset = -1,
})
mobs:register_spawn("mobs:oerkki", {"default:stone"}, 2, -1, 6000, 1, -10)
-- spawns on stone between 5 and -1 light, 1 in 7000 chance, 1 in area starting at -10 and below
mobs:register_spawn("mobs:oerkki", {"default:stone"}, 5, -1, 7000, 1, -10)
-- register spawn egg
mobs:register_egg("mobs:oerkki", "Oerkki", "default_obsidian.png", 1)

View File

@ -1,34 +1,39 @@
-- Rat
-- Rat by PilzAdam
mobs:register_mob("mobs:rat", {
-- animal, monster, npc, barbarian
type = "animal",
hp_min = 1,
hp_max = 4, -- 1
-- not aggressive
passive = true,
-- health & armor
hp_min = 1, hp_max = 4, armor = 200,
-- textures and model
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.2, 0.2},
visual = "mesh",
mesh = "mobs_rat.x",
--textures = {"mobs_rat.png"},
drawtype = "front",
available_textures = {
total = 2,
texture_1 = {"mobs_rat.png"},
texture_2 = {"mobs_rat_brown.png"},
},
-- sounds
makes_footstep_sound = false,
walk_velocity = 1,
armor = 200,
drops = {},
drawtype = "front",
water_damage = 0,
lava_damage = 1,
light_damage = 0,
jump = true,
step = 1,
passive = true,
sounds = {
random = "mobs_rat",
},
-- speed and jump
walk_velocity = 1,
jump = true,
step = 1,
-- no drops
drops = {},
-- damaged by
water_damage = 0,
lava_damage = 1,
light_damage = 0,
-- right click to pick up rat
on_rightclick = function(self, clicker)
if clicker:is_player() and clicker:get_inventory() then
clicker:get_inventory():add_item("main", "mobs:rat")
@ -36,15 +41,15 @@ passive = true,
end
end,
})
mobs:register_spawn("mobs:rat", {"default:stone"}, 20, -1, 9000, 1, 31000)
-- spawn on stone between 1 and 20 light, 1 in 7000 chance, 1 per area up to 31000 in height
mobs:register_spawn("mobs:rat", {"default:stone"}, 20, 0, 9000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:rat", "Rat", "mobs_rat_inventory.png", 0)
-- Cooked Rat, yummy!
minetest.register_craftitem("mobs:rat_cooked", {
description = "Cooked Rat",
inventory_image = "mobs_cooked_rat.png",
on_use = minetest.item_eat(3),
})

View File

@ -1,61 +1,59 @@
-- Sand Monster
-- Sand Monster by PilzAdam
mobs:register_mob("mobs:sand_monster", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 15,
hp_max = 20,
-- aggressive, deals 3 damage to player when hit
passive = false,
attack_type = "dogfight",
damage = 3,
-- health & armor
hp_min = 15, hp_max = 20, armor = 90,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_sand_monster.x",
--textures = {"mobs_sand_monster.png"},
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_sand_monster.png"},
},
visual_size = {x=8,y=8},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
view_range = 16,
walk_velocity = 3,
run_velocity = 5,
damage = 3,
drops = {
{name = "default:desert_sand",
chance = 1,
min = 3,
max = 5,},
{name = "maptools:copper_coin",
chance = 2,
min = 2,
max = 4,},
},
light_resistant = true,
armor = 90,
drawtype = "front",
water_damage = 3,
lava_damage = 1,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 39,
walk_start = 41,
walk_end = 72,
run_start = 74,
run_end = 105,
punch_start = 74,
punch_end = 105,
},
sounds = {
random = "mobs_sandmonster",
},
-- speed and jump, sinks in water
walk_velocity = 3,
run_velocity = 5,
view_range = 16,
jump = true,
step = 1,
blood_texture = "mobs_blood.png",
floats = 0,
-- drops desert sand when dead
drops = {
{name = "default:desert_sand",
chance = 1, min = 3, max = 5,},
{name = "maptools:copper_coin",
chance = 2, min = 2, max = 4,},
},
-- damaged by
water_damage = 3,
lava_damage = 1,
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 39,
walk_start = 41, walk_end = 72,
run_start = 74, run_end = 105,
punch_start = 74, punch_end = 105,
},
})
-- spawns on desert sand between -1 and 20 light, 1 in 5000 chance, 1 sand monster in area up to 31000 in height
mobs:register_spawn("mobs:sand_monster", {"default:desert_sand", "default:sand"}, 20, -1, 5000, 1, 31000)
mobs:register_egg("mobs:sand_monster", "Sand Monster", "default_desert_sand.png", 1)
-- register spawn egg
mobs:register_egg("mobs:sand_monster", "Sand Monster", "default_desert_sand.png", 1)

View File

@ -1,47 +1,56 @@
-- Sheep
-- Sheep by PilzAdam
mobs:register_mob("mobs:sheep", {
-- animal, monster, npc, barbarian
type = "animal",
hp_min = 10,
hp_max = 15,
-- not aggressive
passive = true,
-- health & armor
hp_min = 10, hp_max = 15, armor = 200,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
--textures = {"mobs_sheep.png"},
visual = "mesh",
mesh = "mobs_sheep.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_sheep.png"},
},
visual = "mesh",
mesh = "mobs_sheep.x",
blood_texture = "mobs_blood.png",
visual_size = {x=1,y=1},
-- sounds
makes_footstep_sound = true,
walk_velocity = 1,
armor = 200,
drops = {
{name = "mobs:meat_raw",
chance = 1,
min = 2,
max = 3,},
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
sounds = {
random = "mobs_sheep",
},
animation = {
speed_normal = 15,
stand_start = 0,
stand_end = 80,
walk_start = 81,
walk_end = 100,
},
-- speed and jump
walk_velocity = 1,
jump = true,
step = 1,
blood_texture = "mobs_blood.png",
passive = true,
-- drops raw meat when dead
drops = {
{name = "mobs:meat_raw",
chance = 1, min = 2, max = 3,},
},
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 80,
walk_start = 81, walk_end = 100,
},
-- follows wheat
follow = "farming:wheat",
view_range = 8,
-- replace grass/wheat with air (eat)
replace_rate = 50,
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
replace_with = "air",
-- right click sheep to shear sheep and get wood, feed 8 wheat for wool to grow back
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "farming:wheat" then
@ -52,6 +61,7 @@ mobs:register_mob("mobs:sheep", {
self.food = (self.food or 0) + 1
if self.food >= 8 then
self.food = 0
if self.child == false then self.horny = true end
self.gotten = false -- can be shaved again
self.tamed = true
self.object:set_properties({
@ -62,7 +72,7 @@ mobs:register_mob("mobs:sheep", {
end
return
end
if clicker:get_inventory() and not self.gotten then
if clicker:get_inventory() and not self.gotten and self.child == false then
self.gotten = true -- shaved
if minetest.registered_items["wool:white"] then
clicker:get_inventory():add_item("main", ItemStack("wool:white "..math.random(1,3)))
@ -75,5 +85,7 @@ mobs:register_mob("mobs:sheep", {
end
end,
})
-- spawn on default;green grass between 20 and 8 light, 1 in 9000 chance, 1 sheep in area up to 31000 in height
mobs:register_spawn("mobs:sheep", {"default:dirt_with_grass"}, 20, 8, 9000, 1, 31000)
mobs:register_egg("mobs:sheep", "Sheep", "wool_white.png", 1)
-- register spawn egg
mobs:register_egg("mobs:sheep", "Sheep", "wool_white.png", 1)

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

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

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

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

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

Binary file not shown.

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

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

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

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

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

View File

@ -1,85 +1,74 @@
-- Glowtest Spider
-- Spider by fishyWET (borrowed from Lord of the Test [game])
mobs:register_mob("mobs:spider", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 30,
hp_max = 35,
-- agressive, does 4 damage to player when hit
passive = false,
attack_type = "dogfight",
damage = 4,
-- health & armor
hp_min = 30, hp_max = 40, armor = 100,
-- textures and model
collisionbox = {-0.9, -0.01, -0.7, 0.7, 0.6, 0.7},
--textures = {"mobs_spider.png"},
visual = "mesh",
mesh = "mobs_spider.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_spider.png"},
},
visual_size = {x=7,y=7},
visual = "mesh",
mesh = "mobs_spider.x",
-- sounds
makes_footstep_sound = true,
view_range = 15,
walk_velocity = 1,
run_velocity = 3,
armor = 100,
damage = 4,
drops = {
{name = "farming:string",
chance = 2,
min = 2,
max = 3,},
{name = "mobs:meat_raw",
chance = 4,
min = 1,
max = 2,},
{name = "ethereal:crystal_spike",
chance = 15,
min = 1,
max = 2,},
{name = "maptools:copper_coin",
chance = 2,
min = 2,
max = 6,},
},
light_resistant = true,
drawtype = "front",
water_damage = 5,
lava_damage = 5,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 1,
stand_end = 1,
walk_start = 20,
walk_end = 40,
run_start = 20,
run_end = 40,
punch_start = 50,
punch_end = 90,
},
sounds = {
random = "mobs_spider",
war_cry = "mobs_eerie",
death = "mobs_howl",
attack = "mobs_oerkki_attack",
attack = "mobs_spider",
},
-- speed and jump, sinks in water
walk_velocity = 1,
run_velocity = 3,
jump = true,
sounds = {},
step = 1,
blood_texture = "mobs_blood.png",
view_range = 16,
floats = 0,
-- drops string with a chance of sandstone or crystal spike if Ethereal installed
drops = {
{name = "farming:string",
chance = 2, min = 2, max = 3,},
{name = "mobs:meat_raw",
chance = 4, min = 1, max = 2,},
{name = "maptools:copper_coin",
chance = 2, min = 2, max = 6,},
},
-- damaged by
water_damage = 5,
lava_damage = 5,
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 1, stand_end = 1,
walk_start = 20, walk_end = 40,
run_start = 20, run_end = 40,
punch_start = 50, punch_end = 90,
},
blood_texture = "mobs_blood.png",
})
mobs:register_spawn("mobs:spider", {"default:junglegrass", "default:jungleleaves", "default:jungletree"}, 20, -1, 8000, 1, 31000)
-- spawn on desert stone/crystal dirt, between 0 and 5 light, 1 in 7000 chance, 1 in area up to 71 in height
mobs:register_spawn("mobs:spider", {"default:jungleleaves", "default:jungletree"}, 20, -1, 8000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:spider", "Spider", "mobs_cobweb.png", 1)
-- Ethereal crystal spike compatibility
if not minetest.get_modpath("ethereal") then
minetest.register_alias("ethereal:crystal_spike", "default:sandstone")
end
-- Spider Cobweb
minetest.register_node("mobs:spider_cobweb", {
description = "Spider Cobweb", --Description changé pour éviter conflit avec homedecor_modpack
drawtype = "plantlike",

View File

@ -1,68 +1,63 @@
-- Stone Monster
-- Stone Monster by PilzAdam
mobs:register_mob("mobs:stone_monster", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 30,
hp_max = 35,
-- aggressive, deals 5 damage to player when hit
passive = false,
attack_type = "dogfight",
damage = 5,
-- health & armor
hp_min = 30, hp_max = 35, armor = 60,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_stone_monster.x",
--textures = {"mobs_stone_monster.png"},
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_stone_monster.png"},
},
visual_size = {x=3, y=2.6},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
view_range = 16,
walk_velocity = 2,
run_velocity = 4,
damage = 5,
drops = {
{name = "default:torch",
chance = 10,
min = 3,
max = 5,},
{name = "default:iron_lump",
chance = 5,
min = 1,
max = 2,},
{name = "default:coal_lump",
chance = 3,
min = 1,
max = 3,},
{name = "maptools:silver_coin",
chance = 2,
min = 2,
max = 3,},
},
light_resistant = true,
armor = 60,
drawtype = "front",
water_damage = 0,
lava_damage = 0,
light_damage = 0,
attack_type = "dogfight",
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
},
sounds = {
random = "mobs_stonemonster",
},
-- speed and jump, sinks in water
walk_velocity = 2,
run_velocity = 4,
jump = true,
step = 1,
blood_texture = "mobs_blood.png",
floats = 0,
view_range = 16,
-- chance of dropping torch, iron, lump and coins
drops = {
{name = "default:torch",
chance = 10, min = 3, max = 5,},
{name = "default:iron_lump",
chance = 5, min = 1, max = 2,},
{name = "default:coal_lump",
chance = 3, min = 1, max = 3,},
{name = "maptools:silver_coin",
chance = 2, min = 2, max = 3,},
},
-- damaged by
water_damage = 0,
lava_damage = 0,
light_damage = 0,
-- model animation
animation = {
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 14,
walk_start = 15, walk_end = 38,
run_start = 40, run_end = 63,
punch_start = 40, punch_end = 63,
},
})
mobs:register_spawn("mobs:stone_monster", {"default:stone", "nether:dirt_top"}, 3, -1, 5250, 1, -5)
-- spawns on stone between -1 and 5 light, 1 in 5500 chance, 1 in area below -5
mobs:register_spawn("mobs:stone_monster", {"default:stone", "nether:dirt_top"}, 5, -1, 5500, 1, -5)
-- register spawn egg
mobs:register_egg("mobs:stone_monster", "Stone Monster", "default_stone.png", 1)

BIN
mods/mobs/textures/tnt_smoke.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

View File

@ -1,75 +1,70 @@
-- Tree Monster (or Tree Gollum as I like to call it)
-- Tree Monster (or Tree Gollum) by PilzAdam
mobs:register_mob("mobs:tree_monster", {
-- animal, monster, npc, barbarian
type = "monster",
hp_min = 40,
hp_max = 50,
-- aggressive, deals 6 damage to player when hit
passive = false,
attack_type = "dogfight",
damage = 6,
-- health & armor
hp_min = 40, hp_max = 50, armor = 80,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
visual = "mesh",
mesh = "mobs_tree_monster.x",
--textures = {"mobs_tree_monster.png"},
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_tree_monster.png"},
},
visual_size = {x=4.5,y=4.5},
blood_texture = "default_wood.png",
-- sounds
makes_footstep_sound = true,
view_range = 16,
sounds = {
random = "mobs_treemonster",
},
-- speed and jumop
walk_velocity = 0.5,
run_velocity = 2.5,
damage = 6,
jump = true,
step = 0.5,
view_range = 16,
-- drops saplings or apple
drops = {
{name = "ethereal:tree_sapling",
chance = 3,
min = 1,
max = 2,},
chance = 3, min = 1, max = 2},
{name = "ethereal:jungle_tree_sapling",
chance = 3,
min = 1,
max = 2,},
chance = 3, min = 1, max = 2},
{name = "default:apple",
chance = 2,
min = 1,
max = 5,},
chance = 2, min = 1, max = 3,},
{name = "maptools:silver_coin",
chance = 2,
min = 1,
max = 1,},
},
light_resistant = true,
armor = 80,
drawtype = "front",
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 2,
disable_fall_damage = true,
attack_type = "dogfight",
fall_damage = 0,
-- model animation
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 24,
walk_start = 25,
walk_end = 47,
run_start = 48,
run_end = 62,
punch_start = 48,
punch_end = 62,
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 24,
walk_start = 25, walk_end = 47,
run_start = 48, run_end = 62,
punch_start = 48, punch_end = 62,
},
sounds = {
random = "mobs_treemonster",
},
step = 0.5,
jump = true,
step = 1,
blood_texture = "default_wood.png",
})
-- spawn on leaves and beech_leaves, between 0 and 5 light, 1 in 7000 chance, 1 in area up to 31000 in height
mobs:register_spawn("mobs:tree_monster", {"default:leaves", "moretrees:beech_leaves"}, 3, -1, 8000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:tree_monster", "Tree Monster", "default_tree_top.png", 1)
-- Ethereal sapling compatibility
if not minetest.get_modpath("ethereal") then
minetest.register_alias("ethereal:tree_sapling", "default:sapling")
minetest.register_alias("ethereal:jungle_tree_sapling", "default:junglesapling")

View File

@ -1,56 +1,67 @@
-- Warthog
-- Warthog by KrupnoPavel
mobs:register_mob("mobs:pumba", {
-- animal, monster, npc, barbarian
type = "animal",
hp_min = 10,
hp_max = 15,
-- aggressive, deals 2 damage to player when threatened
passive = false,
attack_type = "dogfight",
damage = 4,
-- health & armor
hp_min = 15, hp_max = 20, armor = 200,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
--textures = {"mobs_pumba.png"},
visual = "mesh",
mesh = "mobs_pumba.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_pumba.png"},
},
visual = "mesh",
mesh = "mobs_pumba.x",
visual_size = {x=1,y=1},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_pig",
attack = "mobs_pig_angry",
},
-- speed and jump
walk_velocity = 2,
armor = 200,
run_velocity = 3,
jump = true,
step = 1,
-- follows apple
follow = "default:apple",
view_range = 8,
-- drops raw pork when dead
drops = {
{name = "mobs:pork_raw",
chance = 1,
min = 2,
max = 3,},
chance = 1, min = 2, max = 3,},
},
drawtype = "front",
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 0,
sounds = {
random = "mobs_pig",
},
-- model animation
animation = {
speed_normal = 15,
stand_start = 25,
stand_end = 55,
walk_start = 70,
walk_end = 100,
stand_start = 25, stand_end = 55,
walk_start = 70, walk_end = 100,
punch_start = 70, punch_end = 100,
},
follow = "farming:wheat",
view_range = 8,
jump = true,
step = 1,
passive = true,
blood_texture = "mobs_blood.png",
-- can be tamed by feeding 8 wheat (will not attack when tamed)
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if item:get_name() == "farming:wheat" then
if item:get_name() == "default:apple" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.food = (self.food or 0) + 1
if self.food >= 8 then
if self.child == false then self.horny = true end
self.food = 0
self.tamed = true
minetest.sound_play("mobs_pig", {object = self.object,gain = 1.0,max_hear_distance = 32,loop = false,})
@ -60,11 +71,12 @@ mobs:register_mob("mobs:pumba", {
end,
})
-- spawns on normal or shroom dirt, between 8 and 20 light, 1 in 10000 chance, 1 in area up to 31000 in height
mobs:register_spawn("mobs:pumba", {"default:dirt_with_grass", "default:dirt"}, 20, 8, 10000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:pumba", "Warthog", "wool_pink.png", 1)
-- Porkchops
-- Porkchops (raw and cooked)
minetest.register_craftitem("mobs:pork_raw", {
description = "Raw Porkchop",
inventory_image = "mobs_pork_raw.png",

View File

@ -14,7 +14,7 @@ mobs:register_mob("mobs:wolf", {
},
--visual_size = {x=1, y=1},
makes_footstep_sound = true,
view_range = 20,
view_range = 16,
walk_velocity = 3,
run_velocity = 5,
damage = 4,