1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 01:30:38 +01:00

Update mobs mod

- api.lua (many improves, chicken egg more frequent, NPC attack nearly
mobs, textures code, etc…)
- Bee (spawn on group:flower now, textures code updated)
- Bunny (textures code updated)
- Chicken (two times more eggs, textures code updated)
- Cow (textures code updated)
- Creeper (finish reorganize the code, textures code updated, new eggs
inventory texture)
- Dirt Monster (textures code updated)
- Dungeon Master (textures code updated)
- init.lua (small credits tweaks)
- Kitten (textures code updated, now drop sometimes farming:string)
- Lava Flan (textures code updated, now 3 can spawn per chunck)
- Mese Monster (textures code updated)
- NPC (textures code updated, revert give raw meat versus health code
for tests)
- Oerkki (textures code updated, now 1 light damage)
- Rat (textures code updated)
- Sand Monster (textures code updated)
- Sheep (textures code updated, now give 2 to 3 wool when sheared)
- Spider (textures code updated, change credits, comments our
modifications)
- Stone Monster (textures code updated)
- Tree Monster (textures code updated)
- Warthog (textures code updated)
- Wolf (finish reorganize the code, textures code updated, add spawner
egg and an inventory texture)
- Tweaks some sounds
This commit is contained in:
Ombridride 2015-03-31 19:32:46 +02:00
parent a6bfdd377c
commit 4645ef3cb5
38 changed files with 176 additions and 206 deletions

View File

@ -1,4 +1,4 @@
-- Mobs Api (24th March 2015)
-- Mobs Api (29th March 2015)
mobs = {}
mobs.mod = "redo"
@ -41,16 +41,13 @@ function mobs:register_mob(name, def)
animation = def.animation,
follow = def.follow or "",
jump = def.jump or true,
exp_min = def.exp_min or 0,
exp_max = def.exp_max or 0,
walk_chance = def.walk_chance or 50,
attacks_monsters = def.attacks_monsters or false,
group_attack = def.group_attack or false,
--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, --default value is "or 3",
blood_offset = def.blood_offset or 0,
knock_back = def.knock_back or 1, --Modif MFF, default value is "or 3",
blood_amount = def.blood_amount or 5,
blood_texture = def.blood_texture or "mobs_blood.png",
shoot_offset = def.shoot_offset or 0,
@ -88,6 +85,7 @@ function mobs:register_mob(name, def)
end,
set_velocity = function(self, v)
if not v then v = 0 end -- added
local yaw = self.object:getyaw()
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
@ -208,8 +206,7 @@ function mobs:register_mob(name, def)
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)
self.object:set_hp(self.object:get_hp() - math.floor(d - 5))
check_for_death(self)
end
self.old_y = self.object:getpos().y
@ -241,12 +238,12 @@ function mobs:register_mob(name, def)
local pos = self.object:getpos()
local n = minetest.get_node(pos)
local lit = minetest.get_node_light(pos) or 0
local tod = minetest.get_timeofday()
pos.y = pos.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
if self.light_damage and self.light_damage ~= 0
and pos.y > 0
and lit > 10 -- direct sunlight (was 4)
and (minetest.get_node_light(pos) or 0) > 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)
effect(pos, 5, "tnt_smoke.png")
@ -279,17 +276,17 @@ function mobs:register_mob(name, def)
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)
local player = nil
local type = nil
local obj = nil
for _,oir in ipairs(inradius) do
for _,oir in ipairs(minetest.get_objects_inside_radius(s,self.view_range)) do
if oir:is_player() then
player = oir
type = "player"
else
local obj = oir:get_luaentity()
obj = oir:get_luaentity()
if obj then
player = obj.object
type = obj.type
@ -316,38 +313,23 @@ function mobs:register_mob(name, def)
-- 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()
local obj = nil
local p, dist
for _, oir in pairs(minetest.get_objects_inside_radius(s,self.view_range)) do
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
p = obj.object:getpos()
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
local s = self.object:getpos()
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 = true
break
else self.following_player = nil
end
end
end
-- horny animal can mate for 40 seconds, afterwards horny animal cannot mate again for 200 seconds
if self.horny == true and self.hornytimer < 240 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 >= 240 then
self.hornytimer = 0
self.horny = false
@ -364,6 +346,7 @@ function mobs:register_mob(name, def)
textures = self.base_texture,
mesh = self.base_mesh,
visual_size = {x=self.visual_size.x,y=self.visual_size.y},
collisionbox = self.collisionbox,
})
end
end
@ -371,15 +354,16 @@ function mobs:register_mob(name, def)
-- 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()
effect(pos, 4, "heart.png")
local ents = minetest.get_objects_inside_radius(pos, self.view_range)
local num = 0
local ent = nil
for i,obj in ipairs(ents) do
local ent = obj:get_luaentity()
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
@ -388,22 +372,22 @@ function mobs:register_mob(name, def)
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()
local textures = self.base_texture
if def.child_texture then
print ("child texture detected")
textures = def.child_texture[1]
end
mob:set_properties({
textures = textures,
visual_size = {x=self.visual_size.x/2,y=self.visual_size.y/2},
collisionbox = {self.collisionbox[1]/2, self.collisionbox[2]/2, self.collisionbox[3]/2,
self.collisionbox[4]/2, self.collisionbox[5]/2, self.collisionbox[6]/2},
})
ent2.child = true
ent2.tamed = true
ent2.following = ent -- follow mother
end)
num = 0
break
@ -411,7 +395,21 @@ function mobs:register_mob(name, def)
end
end
if self.following and self.following:is_player() and self.following:get_wielded_item():get_name() ~= self.follow then
if self.follow ~= "" and not self.following then
local s, p, dist
for _,player in pairs(minetest.get_connected_players()) do
s = self.object:getpos()
p = player:getpos()
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
break
end
end
end
--if self.following and self.following:is_player() and self.following:get_wielded_item():get_name() ~= self.follow 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
@ -446,9 +444,9 @@ function mobs:register_mob(name, def)
self.v_start = true
self.set_velocity(self, self.walk_velocity)
else
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then -- 0.5 was 1.5
if self.jump and self.get_velocity(self) <= 0.5 and self.object:getvelocity().y == 0 then
local v = self.object:getvelocity()
v.y = 6
v.y = 6.5 -- 6 (in older api.lua version)
self.object:setvelocity(v)
end
self.set_velocity(self, self.walk_velocity)
@ -837,13 +835,14 @@ function mobs:register_mob(name, def)
get_staticdata = function(self)
-- select random texture, set model
if not self.base_texture then
self.base_texture = def.available_textures["texture_"..math.random(1,def.available_textures["total"])]
self.base_texture = def.textures[math.random(1,#def.textures)]
self.base_mesh = def.mesh
end
-- set texture, model and size
local textures = self.base_texture
local mesh = self.base_mesh
local vis_size = self.visual_size
local colbox = self.collisionbox
-- specific texture if gotten
if self.gotten == true and def.gotten_texture then
textures = def.gotten_texture
@ -858,6 +857,8 @@ function mobs:register_mob(name, def)
if def.child_texture then
textures = def.child_texture[1]
end
colbox = {self.collisionbox[1]/2, self.collisionbox[2]/2, self.collisionbox[3]/2,
self.collisionbox[4]/2, self.collisionbox[5]/2, self.collisionbox[6]/2}
end
-- remember settings
local tmp = {
@ -871,6 +872,7 @@ function mobs:register_mob(name, def)
textures = textures,
visual_size = vis_size,
base_texture = self.base_texture,
collisionbox = colbox,
}
self.object:set_properties(tmp)
return minetest.serialize(tmp)
@ -879,14 +881,13 @@ function mobs:register_mob(name, def)
on_punch = function(self, hitter, tflp, tool_capabilities, dir)
process_weapon(hitter,tflp,tool_capabilities)
local pos = self.object:getpos()
check_for_death(self)
--blood_particles
local pos = self.object:getpos()
pos.y = pos.y + (self.collisionbox[2] + self.collisionbox[5]) / 2
if self.blood_amount > 0 and pos then
local p = pos
p.y = p.y + self.blood_offset
effect(p, self.blood_amount, self.blood_texture)
effect(pos, self.blood_amount, self.blood_texture)
end
-- knock back effect, adapted from blockmen's pyramids mod
@ -913,10 +914,10 @@ function mobs:register_mob(name, def)
if self.state ~= "attack" then
self.do_attack(self,hitter,1)
end
-- alert other NPCs to the attack
local inradius = minetest.get_objects_inside_radius(hitter:getpos(),5)
for _, oir in pairs(inradius) do
local obj = oir:get_luaentity()
-- alert others to the attack
local obj = nil
for _, oir in pairs(minetest.get_objects_inside_radius(hitter:getpos(),5)) do
obj = oir:get_luaentity()
if obj then
if obj.group_attack == true and obj.state ~= "attack" then
obj.do_attack(obj,hitter,1)
@ -1006,10 +1007,10 @@ function check_for_death(self)
local pos = self.object:getpos()
pos.y = pos.y + 0.5 -- drop items half a block higher
self.object:remove()
local obj = nil
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)
obj = minetest.add_item(pos, ItemStack(drop.name.." "..math.random(drop.min, drop.max)))
if obj then
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
end
@ -1079,13 +1080,6 @@ local weapon = player:get_wielded_item()
weapon:add_wear(wear)
player:set_wielded_item(weapon)
end
-- if weapon:get_definition().sounds ~= nil then
-- local s = math.random(0,#weapon:get_definition().sounds)
-- minetest.sound_play(weapon:get_definition().sounds[s], {object=player,})
-- else
-- minetest.sound_play("default_sword_wood", {object = player,})
-- end
end
-- Spawn Egg

View File

@ -13,9 +13,8 @@ mobs:register_mob("mobs:bee", {
visual = "mesh",
mesh = "mobs_bee.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_bee.png"},
textures = {
{"mobs_bee.png"},
},
-- sounds
makes_footstep_sound = false,
@ -52,8 +51,8 @@ mobs:register_mob("mobs:bee", {
end
end,
})
-- spawn on group:flowers between 4 and 20 light, 1 in 10000 chance, 1 bee in area up to 31000 in height
mobs:register_spawn("mobs:bee", {"default:dirt_with_grass"}, 20, 4, 10000, 1, 31000)
-- 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", {"group:flower"}, 20, 4, 5000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:bee", "Bee", "mobs_bee_inv.png", 0)

View File

@ -13,11 +13,10 @@ mobs:register_mob("mobs:bunny", {
visual = "mesh",
mesh = "mobs_bunny.b3d",
drawtype = "front",
available_textures = {
total = 3,
texture_1 = {"mobs_bunny_grey.png"},
texture_2 = {"mobs_bunny_brown.png"},
texture_3 = {"mobs_bunny_white.png"},
textures = {
{"mobs_bunny_grey.png"},
{"mobs_bunny_brown.png"},
{"mobs_bunny_white.png"},
},
-- sounds
sounds = {},

View File

@ -13,14 +13,11 @@ mobs:register_mob("mobs:chicken", {
visual = "mesh",
mesh = "mobs_chicken.x",
drawtype = "front",
available_textures = {
total = 2,
texture_1 = {"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"},
texture_2 = {"mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png",
"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"},
{"mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png",
"mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png", "mobs_chicken_black.png"},
},
child_texture = {
{"mobs_chick.png", "mobs_chick.png", "mobs_chick.png", "mobs_chick.png",
@ -57,7 +54,7 @@ mobs:register_mob("mobs:chicken", {
-- follows wheat
follow = "farming:seed_wheat", view_range = 8,
-- replace air with egg (lay)
replace_rate = 1000,
replace_rate = 2000,
replace_what = {"air"},
replace_with = "mobs:egg",
-- right click to pick up chicken
@ -70,7 +67,10 @@ mobs:register_mob("mobs:chicken", {
clicker:set_wielded_item(tool)
end
self.food = (self.food or 0) + 1
if self.food >= 4 then
if self.child == true then
self.hornytimer = self.hornytimer + 10
end
if self.food >= 8 then
self.food = 0
if self.child == false then self.horny = true end
self.gotten = false -- reset
@ -86,6 +86,12 @@ mobs:register_mob("mobs:chicken", {
end
end,
if clicker:is_player() and clicker:get_inventory() and self.child == false
and clicker:get_inventory():room_for_item("main", "mobs:chicken") then
clicker:get_inventory():add_item("main", "mobs:chicken")
self.object:remove()
end
end,
})
-- 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, 10000, 1, 31000)

View File

@ -15,10 +15,9 @@ mobs:register_mob("mobs:cow", {
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
textures = {
{"mobs_cow.png"},
{"mobs_cow_brown.png"}, -- dé-commenter quand "mobs_cow_brown.png" sera compatible
},
blood_texture = "mobs_blood.png",
visual_size = {x=1,y=1},

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

@ -15,19 +15,22 @@ mobs:register_mob("mobs:creeper", {
visual = "mesh",
mesh = "mobs_tree_monster.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_creeper.png"},
textures = {
{"mobs_creeper.png"},
},
visual_size = {x=4.5,y=4.5},
blood_texture = "mobs_creeper_inv.png",
-- Continuer d'organiser le code à partir d'ici --
-- sounds
makes_footstep_sound = true,
view_range = 16,
sounds = {
random = "mobs_treemonster",
},
-- speed and jump
walk_velocity = 2,
run_velocity = 4,
jump = true,
view_range = 16,
-- drops mese or diamond when dead
drops = {
{name = "default:torch",
chance = 10,
@ -46,27 +49,18 @@ mobs:register_mob("mobs:creeper", {
min = 2,
max = 3,},
},
light_resistant = true,
water_damage = 0,
-- damaged by
water_damage = 2,
lava_damage = 15,
light_damage = 0,
disable_fall_damage = false,
-- 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,
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,
},
sounds = {
random = "mobs_treemonster",
},
jump = true,
})
mobs:register_spawn("mobs:creeper", {"default:dirt_with_grass"}, 20, 8, 12000, 1, 31000)
mobs:register_egg("mobs:creeper", "Creeper", "mobs_creeper_inv.png", 1)

View File

@ -15,9 +15,8 @@ mobs:register_mob("mobs:dirt_monster", {
visual = "mesh",
mesh = "mobs_stone_monster.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_dirt_monster.png"},
textures = {
{"mobs_dirt_monster.png"},
},
visual_size = {x=3, y=2.6},
blood_texture = "default_dirt.png",

View File

@ -21,11 +21,10 @@ mobs:register_mob("mobs:dungeon_master", {
visual = "mesh",
mesh = "mobs_dungeon_master.x",
drawtype = "front",
available_textures = {
total = 3,
texture_1 = {"mobs_dungeon_master.png"},
texture_2 = {"mobs_dungeon_master_cobblestone.png"},
texture_3 = {"mobs_dungeon_master_strangewhite.png"},
textures = {
{"mobs_dungeon_master.png"},
{"mobs_dungeon_master_cobblestone.png"},
{"mobs_dungeon_master_strangewhite.png"},
},
visual_size = {x=8, y=8},
blood_texture = "mobs_blood.png",

View File

@ -24,10 +24,10 @@ dofile(minetest.get_modpath("mobs").."/treemonster.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/wolf.lua") -- PilzAdam
dofile(minetest.get_modpath("mobs").."/lava_flan.lua") -- Zeg9
dofile(minetest.get_modpath("mobs").."/mese_monster.lua") -- Zeg9
dofile(minetest.get_modpath("mobs").."/spider.lua") -- https://forum.minetest.net/viewtopic.php?pid=127538
dofile(minetest.get_modpath("mobs").."/spider.lua") -- AspireMint
-- NPC
dofile(minetest.get_modpath("mobs").."/npc.lua")
dofile(minetest.get_modpath("mobs").."/npc.lua") -- TenPlus1
-- Creeper (fast impl by davedevils)
dofile(minetest.get_modpath("mobs").."/creeper.lua")

View File

@ -13,12 +13,11 @@ mobs:register_mob("mobs:kitten", {
visual = "mesh",
visual_size = {x=0.5, y=0.5},
mesh = "mobs_kitten.b3d",
available_textures = {
total = 4,
texture_1 = {"mobs_kitten_striped.png"},
texture_2 = {"mobs_kitten_splotchy.png"},
texture_3 = {"mobs_kitten_ginger.png"},
texture_4 = {"mobs_kitten_sandy.png"},
textures = {
{"mobs_kitten_striped.png"},
{"mobs_kitten_splotchy.png"},
{"mobs_kitten_ginger.png"},
{"mobs_kitten_sandy.png"},
},
blood_texture = "mobs_blood.png",
-- sounds
@ -29,12 +28,12 @@ mobs:register_mob("mobs:kitten", {
-- speed and jump
walk_velocity = 0.6,
jump = false,
-- drops sometimes coins
-- drops string and coins
drops = {
{name = "maptools:copper_coin",
chance = 10,
min = 1,
max = 1,},
chance = 10, min = 1, max = 1,},
{name = "farming:string",
chance = 2, min = 1, max = 1},
},
-- damaged by
water_damage = 1,

View File

@ -15,9 +15,8 @@ mobs:register_mob("mobs:lava_flan", {
visual = "mesh",
mesh = "zmobs_lava_flan.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"zmobs_lava_flan.png"},
textures = {
{"zmobs_lava_flan.png"},
},
blood_texture = "fire_basic_flame.png",
visual_size = {x=1, y=1},
@ -53,8 +52,8 @@ mobs:register_mob("mobs:lava_flan", {
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, 2500, 2, 31000)
-- spawns in lava between -1 and 20 light, 1 in 2000 chance, 3 in area below 31000 in height
mobs:register_spawn("mobs:lava_flan", {"default:lava_source"}, 20, -1, 2500, 3, 31000)
-- register spawn egg
mobs:register_egg("mobs:lava_flan", "Lava Flan", "default_lava.png", 1)

View File

@ -17,9 +17,8 @@ mobs:register_mob("mobs:mese_monster", {
collisionbox = {-0.5, -1.5, -0.5, 0.5, 0.5, 0.5},
visual = "mesh",
mesh = "zmobs_mese_monster.x",
available_textures = {
total = 1,
texture_1 = {"zmobs_mese_monster.png"},
textures = {
{"zmobs_mese_monster.png"},
},
visual_size = {x=1, y=1},
drawtype = "front",
@ -60,7 +59,7 @@ mobs:register_mob("mobs:mese_monster", {
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
-- spawn on stone between 20 and -1 light, 1 in 7000 chance, 1 in area below -25
mobs:register_spawn("mobs:mese_monster", {"default:stone", }, 20, -1, 7000, 1, -25)
-- register spawn egg
mobs:register_egg("mobs:mese_monster", "Mese Monster", "default_mese_block.png", 1)

View File

@ -21,9 +21,8 @@ mobs:register_mob("mobs:npc", {
visual = "mesh",
mesh = "character.b3d",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_npc.png"},
textures = {
{"mobs_npc.png"},
},
visual_size = {x=1, y=1},
-- sounds
@ -33,7 +32,6 @@ mobs:register_mob("mobs:npc", {
walk_velocity = 1.5,
run_velocity = 2.5,
jump = true,
step = 1,
-- drops wood and chance of apples when dead
drops = {
{name = "default:wood",
@ -65,14 +63,12 @@ mobs:register_mob("mobs:npc", {
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 >= self.hp_max then return end
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
local n = hp + 4
if n > self.hp_max then n = self.hp_max end
self.object:set_hp(n)
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

View File

@ -15,10 +15,9 @@ mobs:register_mob("mobs:oerkki", {
visual = "mesh",
mesh = "mobs_oerkki.x",
drawtype = "front",
available_textures = {
total = 2,
texture_1 = {"mobs_oerkki.png"},
texture_2 = {"mobs_oerkki2.png"},
textures = {
{"mobs_oerkki.png"},
{"mobs_oerkki2.png"},
},
visual_size = {x=5, y=5},
blood_texture = "mobs_blood.png",
@ -43,7 +42,7 @@ mobs:register_mob("mobs:oerkki", {
-- damaged by
water_damage = 1,
lava_damage = 1,
light_damage = 0,
light_damage = 1,
-- model animation
animation = {
stand_start = 0, stand_end = 23,

View File

@ -13,10 +13,9 @@ mobs:register_mob("mobs:rat", {
visual = "mesh",
mesh = "mobs_rat.x",
drawtype = "front",
available_textures = {
total = 2,
texture_1 = {"mobs_rat.png"},
texture_2 = {"mobs_rat_brown.png"},
textures = {
{"mobs_rat.png"},
{"mobs_rat_brown.png"},
},
blood_texture = "mobs_blood.png",
-- sounds

View File

@ -15,9 +15,8 @@ mobs:register_mob("mobs:sand_monster", {
visual = "mesh",
mesh = "mobs_sand_monster.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_sand_monster.png"},
textures = {
{"mobs_sand_monster.png"},
},
visual_size = {x=8,y=8},
blood_texture = "default_sand.png",
@ -52,7 +51,7 @@ mobs:register_mob("mobs:sand_monster", {
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
-- spawns on desert sand between -1 and 20 light, 1 in 7500 chance, 1 sand monster in area up to 31000 in height
mobs:register_spawn("mobs:sand_monster", {"default:desert_sand", "default:sand"}, 20, -1, 7500, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:sand_monster", "Sand Monster", "default_desert_sand.png", 1)

View File

@ -13,9 +13,8 @@ mobs:register_mob("mobs:sheep", {
visual = "mesh",
mesh = "mobs_sheep.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_sheep.png"},
textures = {
{"mobs_sheep.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=1,y=1},
@ -86,7 +85,7 @@ mobs:register_mob("mobs:sheep", {
if minetest.registered_items["wool:white"] then
local pos = self.object:getpos()
pos.y = pos.y + 0.5
local obj = minetest.add_item(pos, ItemStack("wool:white "..math.random(1,3)))
local obj = minetest.add_item(pos, ItemStack("wool:white "..math.random(2,3)))
if obj then
obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)})
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

View File

@ -1,5 +1,5 @@
-- Spider by fishyWET (borrowed from Lord of the Test [game])
-- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
mobs:register_mob("mobs:spider", {
-- animal, monster, npc, barbarian
@ -15,9 +15,8 @@ mobs:register_mob("mobs:spider", {
visual = "mesh",
mesh = "mobs_spider.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_spider.png"},
textures = {
{"mobs_spider.png"},
},
visual_size = {x=7,y=7},
blood_texture = "mobs_blood.png",
@ -27,7 +26,7 @@ mobs:register_mob("mobs:spider", {
random = "mobs_spider",
war_cry = "mobs_eerie",
death = "mobs_howl",
attack = "mobs_spider",
attack = "mobs_spider_attack",
},
-- speed and jump, sinks in water
walk_velocity = 1,
@ -57,7 +56,7 @@ mobs:register_mob("mobs:spider", {
punch_start = 50, punch_end = 90,
},
})
-- spawn on desert stone/crystal dirt, between 0 and 5 light, 1 in 7000 chance, 1 in area up to 71 in height
-- spawn on desert stone/crystal dirt, between 0 and 5 light, 1 in 9000 chance, 1 in area up to 31000 in height
mobs:register_spawn("mobs:spider", {"default:jungleleaves", "default:jungletree"}, 20, -1, 9000, 1, 31000)
-- register spawn egg
mobs:register_egg("mobs:spider", "Spider", "mobs_cobweb.png", 1)
@ -78,8 +77,8 @@ minetest.register_node("mobs:spider_cobweb", {
sunlight_propagates = true,
liquid_viscosity = 11,
liquidtype = "source",
liquid_alternative_flowing = "mobs:spider_cobweb",
liquid_alternative_source = "mobs:spider_cobweb",
liquid_alternative_flowing = "mobs:spider_cobweb", --Modif MFF
liquid_alternative_source = "mobs:spider_cobweb", --Modif MFF
liquid_renewable = false,
liquid_range = 0,
walkable = false,

View File

@ -15,9 +15,8 @@ mobs:register_mob("mobs:stone_monster", {
visual = "mesh",
mesh = "mobs_stone_monster.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_stone_monster.png"},
textures = {
{"mobs_stone_monster.png"},
},
visual_size = {x=3, y=2.6},
blood_texture = "mobs_blood.png",
@ -25,6 +24,7 @@ mobs:register_mob("mobs:stone_monster", {
makes_footstep_sound = true,
sounds = {
random = "mobs_stonemonster",
attack = "mobs_stonemonster_attack",
},
-- speed and jump, sinks in water
walk_velocity = 2,
@ -32,7 +32,7 @@ mobs:register_mob("mobs:stone_monster", {
jump = true,
floats = 0,
view_range = 16,
-- chance of dropping torch, iron, lump and coins
-- chance of dropping torch, iron lump, coal lump and/or silver coins
drops = {
{name = "default:torch",
chance = 10, min = 3, max = 5,},
@ -56,7 +56,7 @@ mobs:register_mob("mobs:stone_monster", {
punch_start = 40, punch_end = 63,
},
})
-- spawns on stone between -1 and 5 light, 1 in 5500 chance, 1 in area below -5
-- spawns on stone between -1 and 5 light, 1 in 7000 chance, 1 in area below -5
mobs:register_spawn("mobs:stone_monster", {"default:stone", "nether:dirt_top"}, 5, -1, 7000, 1, -5)
-- register spawn egg
mobs:register_egg("mobs:stone_monster", "Stone Monster", "default_stone.png", 1)

BIN
mods/mobs/textures/mobs_creeper_inv.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

After

Width:  |  Height:  |  Size: 883 B

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

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -15,9 +15,8 @@ mobs:register_mob("mobs:tree_monster", {
visual = "mesh",
mesh = "mobs_tree_monster.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_tree_monster.png"},
textures = {
{"mobs_tree_monster.png"},
},
visual_size = {x=4.5,y=4.5},
blood_texture = "default_wood.png",
@ -31,7 +30,7 @@ mobs:register_mob("mobs:tree_monster", {
run_velocity = 2.5,
jump = true,
view_range = 16,
-- drops saplings or apple
-- drops saplings, junglesapling, apple and/or silver coins
drops = {
{name = "default:sapling",
chance = 3, min = 1, max = 2},
@ -56,7 +55,7 @@ mobs:register_mob("mobs:tree_monster", {
punch_start = 48, punch_end = 62,
},
})
-- spawn on leaves and beech_leaves, between 0 and 5 light, 1 in 7000 chance, 1 in area up to 31000 in height
-- spawn on leaves and beech_leaves, between 0 and 5 light, 1 in 8000 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)

View File

@ -15,9 +15,8 @@ mobs:register_mob("mobs:pumba", {
visual = "mesh",
mesh = "mobs_pumba.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_pumba.png"},
textures = {
{"mobs_pumba.png"},
},
visual_size = {x=1,y=1},
blood_texture = "mobs_blood.png",

View File

@ -15,20 +15,22 @@ mobs:register_mob("mobs:wolf", {
visual = "mesh",
mesh = "mobs_wolf.x",
drawtype = "front",
available_textures = {
total = 1,
texture_1 = {"mobs_wolf.png"},
textures = {
{"mobs_wolf.png"},
},
--visual_size = {x=1,y=1}, --Quel valeur lui mettre ?
blood_texture = "mobs_blood.png",
-- Continuer d'organiser le code à partir d'ici --
-- sounds
makes_footstep_sound = true,
view_range = 16,
sounds = {
random = "mobs_wolf",
},
-- speed and jump
walk_velocity = 3,
run_velocity = 5,
damage = 4,
jump = true,
view_range = 16,
-- drops mese or diamond when dead
drops = {
{name = "mobs:meat_raw",
chance = 1,
@ -39,26 +41,19 @@ mobs:register_mob("mobs:wolf", {
min = 1,
max = 4,},
},
light_resistant = false,
-- damaged by
water_damage = 1,
lava_damage = 5,
light_damage = 2,
on_rightclick = nil,
-- 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,
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,
},
sounds = {
random = "mobs_wolf",
},
jump = true,
})
mobs:register_spawn("mobs:wolf", {"default:dirt_with_grass"}, 3, -1, 9500, 1, 31000)
mobs:register_egg("mobs:wolf", "Wolf", "mobs_wolf_inv.png", 1)