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

Mobd update second part

This commit is contained in:
Ombridride 2015-07-16 00:15:56 +02:00
parent c93567ef87
commit 744ccb7bee
23 changed files with 627 additions and 288 deletions

View File

@ -28,7 +28,7 @@ This mod contains the following additions:
Changelog:
1.13- Added capture function (thanks blert2112) chance of picking up mob with hand, net and magic lasso
1.13- Added capture function (thanks blert2112) chance of picking up mob with hand; net; magic lasso, replaced some .x models with newer .b3d one's
1.12- Added animal ownership so that players cannot steal your tamed animals
1.11- Added flying mobs (and swimming), fly=true and fly_in="air" or "deafult:water_source" for fishy
1,10- Footstep removed (use replace), explosion routine added for exploding mobs.

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@ mobs:register_mob("mobs:chicken", {
collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3},
visual = "mesh",
mesh = "mobs_chicken.x",
-- seems a lot of textures but this fixes the problem with the model
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"},
@ -84,7 +85,8 @@ mobs:register_mob("mobs:chicken", {
self.owner = name
end
minetest.sound_play("mobs_chicken", {
object = self.object,gain = 1.0,
object = self.object,
gain = 1.0,
max_hear_distance = 15,
loop = false,
})

View File

@ -21,7 +21,6 @@ mobs:register_mob("mobs:cow", {
--{"mobs_cow_brown.png"}, -- dé-commenter quand "mobs_cow_brown.png" sera compatible
},
blood_texture = "mobs_blood.png",
visual_size = {x=1,y=1},
-- sounds
makes_footstep_sound = true,
sounds = {
@ -107,7 +106,7 @@ mobs:register_mob("mobs:cow", {
minetest.sound_play("mobs_cow", {
object = self.object,
gain = 1.0,
max_hear_distance = 32,
max_hear_distance = 16,
loop = false,
})
end
@ -131,10 +130,10 @@ mobs:register_mob("mobs:cow", {
elseif self.owner ~= name then
minetest.chat_send_player(name, "Not owner!")
end
--]]
end
end,
})--]]
})
-- 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, 8, 10000, 1, 31000)
-- register spawn egg

View File

@ -1,12 +1,12 @@
-- Meat & Cooked Meat
-- raw meat
minetest.register_craftitem("mobs:meat_raw", {
description = "Raw Meat",
inventory_image = "mobs_meat_raw.png",
on_use = minetest.item_eat(3),
})
-- cooked meat
minetest.register_craftitem("mobs:meat", {
description = "Meat",
inventory_image = "mobs_meat.png",
@ -20,8 +20,7 @@ minetest.register_craft({
cooktime = 5,
})
-- Golden Lasso
-- golden lasso
minetest.register_tool("mobs:magic_lasso", {
description = "Magic Lasso (right-click animal to put in inventory)",
inventory_image = "mobs_magic_lasso.png",
@ -36,8 +35,7 @@ minetest.register_craft({
}
})
-- Net
-- net
minetest.register_tool("mobs:net", {
description = "Net (right-click animal to put in inventory)",
inventory_image = "mobs_net.png",

View File

@ -13,13 +13,12 @@ mobs:register_mob("mobs:dirt_monster", {
hp_max = 30,
armor = 90,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh",
mesh = "mobs_stone_monster.x",
mesh = "mobs_stone_monster.b3d",
textures = {
{"mobs_dirt_monster.png"},
},
visual_size = {x=3, y=2.6},
blood_texture = "default_dirt.png",
-- sounds
makes_footstep_sound = true,

View File

@ -13,13 +13,13 @@ mobs:register_mob("mobs:dungeon_master", {
attack_type = "shoot",
shoot_interval = 2.5,
arrow = "mobs:fireball",
shoot_offset = 0,
shoot_offset = 1,
-- health & armor
hp_min = 60,
hp_max = 80,
armor = 70,
-- textures and model
collisionbox = {-0.7, -0.01, -0.7, 0.7, 2.6, 0.7},
collisionbox = {-0.7, -1, -0.7, 0.7, 1.6, 0.7},
visual = "mesh",
mesh = "mobs_dungeon_master.b3d",
textures = {
@ -27,7 +27,6 @@ mobs:register_mob("mobs:dungeon_master", {
{"mobs_dungeon_master_cobblestone.png"},
{"mobs_dungeon_master_strangewhite.png"},
},
visual_size = {x=8, y=8},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = true,

View File

@ -20,7 +20,6 @@ mobs:register_mob("mobs:lava_flan", {
{"zmobs_lava_flan.png"},
},
blood_texture = "fire_basic_flame.png",
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = false,
sounds = {

View File

@ -69,7 +69,7 @@ mobs:register_egg("mobs:mese_monster", "Mese Monster", "default_mese_block.png",
-- mese arrow (weapon)
mobs:register_arrow("mobs:mese_arrow", {
visual = "sprite",
visual_size = {x=.5, y=.5},
visual_size = {x = 0.5, y = 0.5},
textures = {"default_mese_crystal_fragment.png"},
velocity = 6,

View File

@ -27,7 +27,6 @@ mobs:register_mob("mobs:npc", {
{"mobs_npc.png"},
{"mobs_npc2.png"}, -- female by nuttmeg20
},
visual_size = {x=1, y=1},
-- sounds
makes_footstep_sound = true,
sounds = {},
@ -69,7 +68,7 @@ mobs:register_mob("mobs:npc", {
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
if not name then return end
-- heal npc
-- feed toheal npc
if item:get_name() == "mobs:meat"
or item:get_name() == "farming:bread" then
-- feed and add health
@ -80,7 +79,6 @@ mobs:register_mob("mobs:npc", {
return
end
hp = hp + 4 -- add restorative value
-- new health shouldn't exceed self.hp_max
if hp > self.hp_max then hp = self.hp_max end
self.object:set_hp(hp)
-- take item

View File

@ -13,14 +13,13 @@ mobs:register_mob("mobs:oerkki", {
hp_max = 50,
armor = 90,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
collisionbox = {-0.4, -1, -0.4, 0.4, 0.9, 0.4},
visual = "mesh",
mesh = "mobs_oerkki.b3d",
textures = {
{"mobs_oerkki.png"},
{"mobs_oerkki2.png"},
},
visual_size = {x=5, y=5},
blood_texture = "mobs_blood.png",
-- sounds
makes_footstep_sound = false,

View File

@ -11,7 +11,7 @@ mobs:register_mob("mobs:rat", {
hp_max = 4,
armor = 200,
-- textures and model
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.2, 0.2},
collisionbox = {-0.2, -1, -0.2, 0.2, -0.8, 0.2},
visual = "mesh",
mesh = "mobs_rat.b3d",
textures = {

View File

@ -13,7 +13,7 @@ mobs:register_mob("mobs:sand_monster", {
hp_max = 20,
armor = 100,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh",
mesh = "mobs_sand_monster.b3d",
textures = {

View File

@ -1,4 +1,9 @@
local all_colours = {
"grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta",
"orange", "violet", "brown", "pink", "dark_grey", "dark_green"
}
-- Sheep by PilzAdam
mobs:register_mob("mobs:sheep", {
@ -11,7 +16,7 @@ mobs:register_mob("mobs:sheep", {
hp_max = 15,
armor = 200,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4},
visual = "mesh",
mesh = "mobs_sheep.b3d",
textures = {
@ -56,6 +61,7 @@ mobs:register_mob("mobs:sheep", {
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
replace_offset = -1,
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
@ -86,12 +92,12 @@ mobs:register_mob("mobs:sheep", {
end
self.object:set_properties({
textures = {"mobs_sheep.png"},
mesh = "mobs_sheep.x",
mesh = "mobs_sheep.b3d",
})
minetest.sound_play("mobs_sheep", {
object = self.object,
gain = 1.0,
max_hear_distance = 20,
max_hear_distance = 10,
loop = false,
})
end
@ -119,6 +125,29 @@ mobs:register_mob("mobs:sheep", {
return
end
for _, col in ipairs(all_colours) do
if item:get_name() == "dye:"..col
and self.gotten == false
and self.child == false
and self.tamed == true
and name == self.owner then
local pos = self.object:getpos()
self.object:remove()
local mob = minetest.add_entity(pos, "mobs:sheep_"..col)
local ent = mob:get_luaentity()
ent.owner = clicker:get_player_name()
ent.tamed = true
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
break
else
print ("not owner/tamed, cant dye sheep")
end
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end,
})
@ -148,3 +177,122 @@ minetest.register_craft({
{'', 'group:stick', 'default:steel_ingot'},
}
})
-- Coloured sheep
for _, col in ipairs(all_colours) do
mobs:register_mob("mobs:sheep_"..col, {
type = "animal",
passive = true,
hp_min = 8,
hp_max = 10,
armor = 200,
collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4},
visual = "mesh",
mesh = "mobs_sheep.b3d",
textures = {
{"mobs_sheep_"..col..".png"},
},
gotten_texture = {"mobs_sheep_shaved.png"},
gotten_mesh = "mobs_sheep_shaved.b3d",
makes_footstep_sound = true,
sounds = {
random = "mobs_sheep",
},
walk_velocity = 1,
jump = true,
drops = {
{name = "mobs:meat_raw",
chance = 1, min = 2, max = 3},
{name = "wool:"..col,
chance = 1, min = 1, max = 1},
},
water_damage = 1,
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 80,
walk_start = 81,
walk_end = 100,
},
follow = "farming:wheat",
view_range = 5,
replace_rate = 50,
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
replace_with = "air",
replace_offset = -1,
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
if item:get_name() == "farming:wheat" then
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
-- make child grow quicker
if self.child == true then
self.hornytimer = self.hornytimer + 10
return
end
-- feed and tame
self.food = (self.food or 0) + 1
if self.food > 7 then
self.food = 0
if self.hornytimer == 0 then
self.horny = true
end
self.gotten = false -- can be shaved again
self.tamed = true
-- make owner
if self.owner == "" then
self.owner = name
end
self.object:set_properties({
textures = {"mobs_sheep_"..col..".png"},
mesh = "mobs_sheep.b3d",
})
minetest.sound_play("mobs_sheep", {
object = self.object,
gain = 1.0,
max_hear_distance = 10,
loop = false,
})
end
return
end
if item:get_name() == "mobs:shears"
and self.gotten == false
and self.child == false then
self.gotten = true -- shaved
if minetest.registered_items["wool:"..col] then
local pos = self.object:getpos()
pos.y = pos.y + 0.5
local obj = minetest.add_item(pos, ItemStack("wool:"..col.." "..math.random(2,3)))
if obj then
obj:setvelocity({x = math.random(-1,1), y = 5, z = math.random(-1,1)})
end
item:add_wear(650) -- 100 uses
clicker:set_wielded_item(item)
end
self.object:set_properties({
textures = {"mobs_sheep_shaved.png"},
mesh = "mobs_sheep_shaved.b3d",
})
return
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end,
})
mobs:register_egg("mobs:sheep_"..col, "Sheep ("..col..")", "wool_"..col..".png", 1)
end

View File

@ -19,7 +19,6 @@ mobs:register_mob("mobs:stone_monster", {
textures = {
{"mobs_stone_monster.png"},
},
visual_size = {x=3, y=2.6},
blood_texture = "default_stone.png",
-- sounds
makes_footstep_sound = true,

View File

@ -13,13 +13,12 @@ mobs:register_mob("mobs:tree_monster", {
hp_max = 50,
armor = 80,
-- textures and model
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.9, 0.4},
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh",
mesh = "mobs_tree_monster.b3d",
textures = {
{"mobs_tree_monster.png"},
},
visual_size = {x=4.5,y=4.5},
blood_texture = "default_wood.png",
-- sounds
makes_footstep_sound = true,

View File

@ -105,6 +105,7 @@ minetest.register_craftitem("mobs:pork_raw", {
on_use = minetest.item_eat(4),
})
-- cooked porkchop
minetest.register_craftitem("mobs:pork_cooked", {
description = "Cooked Porkchop",
inventory_image = "mobs_pork_cooked.png",