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

Update in parts "mobs" mod

- Need to check NPC
- Need to check sheeps
- Need to merge the api.lua file (be carful to keep our modifs or merge it with the Tenplus1 modif for code unification BUT keep our specific config)
This commit is contained in:
Quentin BUISSON-DEBON 2015-08-18 17:09:53 +02:00
parent 2010c907d7
commit 4fe3fc8f25
20 changed files with 296 additions and 561 deletions

View File

@ -28,6 +28,9 @@ This mod contains the following additions:
Changelog:
1.16- Mobs follow multiple items now, Npc's can breed
1.15- Added Feeding/Taming/Breeding function, right-click to pick up any sheep with X mark on them and replace with new one to fix compatibility.
1.14- All .self variables saved in staticdata, Fixed self.health bug
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

View File

@ -28,7 +28,7 @@ mobs:register_mob("mobs:bee", {
-- drops honey when killed
drops = {
{name = "mobs:honey",
chance = 1, min = 1, max = 2,},
chance = 1, min = 1, max = 2},
},
-- damage
water_damage = 1,
@ -66,7 +66,7 @@ minetest.register_node("mobs:beehive", {
description = "Beehive",
drawtype = "plantlike",
visual_scale = 1.0,
tiles ={"mobs_beehive.png"},
tiles = {"mobs_beehive.png"},
inventory_image = "mobs_beehive.png",
paramtype = "light",
sunlight_propagates = true,
@ -76,11 +76,11 @@ minetest.register_node("mobs:beehive", {
sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
minetest.set_node(pos, {name="mobs:beehive", param2=1})
minetest.set_node(pos, {name = "mobs:beehive", param2 = 1})
minetest.add_entity(pos, "mobs:bee")
end
end,
})
minetest.register_craft({
@ -94,7 +94,7 @@ minetest.register_craft({
minetest.register_node("mobs:honey_block", {
description = "Honey Block",
tiles = {"mobs_honey_block.png"},
groups = {snappy=3,flammable=2},
groups = {snappy = 3, flammable = 2},
sounds = default.node_sound_dirt_defaults(),
})
@ -112,4 +112,4 @@ minetest.register_craft({
recipe = {
{"mobs:honey_block"},
}
})
})

View File

@ -28,7 +28,7 @@ mobs:register_mob("mobs:bunny", {
-- drops meat when dead
drops = {
{name = "mobs:meat_raw",
chance = 1, min = 1, max = 2,},
chance = 1, min = 1, max = 2},
},
-- damaged by
water_damage = 1,
@ -42,51 +42,30 @@ mobs:register_mob("mobs:bunny", {
punch_start = 16, punch_end = 24,
},
-- follows carrot from farming redo
follow = "farming:carrot",
view_range = 8,
follow = {"farming:carrot", "farming_plus:carrot_item"},
view_range = 10,
-- eat carrots
replace_rate = 80,
replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"},
replace_with = "air",
-- right click to pick up rabbit
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
if item:get_name() == "farming_plus:carrot_item"
or item:get_name() == "farming:carrot" then
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
-- feed and tame
self.food = (self.food or 0) + 1
if self.food > 3 then
self.food = 0
self.tamed = true
-- make owner
if self.owner == "" then
self.owner = name
if not mobs:feed_tame(self, clicker, 4, true) then
-- Monty Python tribute
local item = clicker:get_wielded_item()
if item:get_name() == "mobs:lava_orb" then
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_properties({
textures = {"mobs_bunny_evil.png"},
})
self.type = "monster"
self.state = "attack"
self.object:set_hp(20)
return
end
return
end
-- Monty Python tribute
if item:get_name() == "mobs:lava_orb" then
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_properties({
textures = {"mobs_bunny_evil.png"},
})
self.type = "monster"
self.state = "attack"
self.object:set_hp(20)
return
end
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
@ -95,4 +74,4 @@ mobs:register_mob("mobs:bunny", {
damage = 5,
})
mobs:spawn_specific("mobs:bunny", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
mobs:register_egg("mobs:bunny", "Bunny", "mobs_bunny_inv.png", 0)
mobs:register_egg("mobs:bunny", "Bunny", "mobs_bunny_inv.png", 0)

View File

@ -52,48 +52,13 @@ mobs:register_mob("mobs:chicken", {
walk_end = 40,
},
-- follows wheat
follow = "farming:seed_wheat",
follow = {"farming:seed_wheat", "farming:seed_cotton"},
view_range = 8,
replace_rate = 2000,
replace_rate = 2500,
replace_what = {"air"},
replace_with = "mobs:egg",
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
local name = clicker:get_player_name()
if tool:get_name() == "farming:seed_wheat" then
-- take item
if not minetest.setting_getbool("creative_mode") then
tool:take_item(1)
clicker:set_wielded_item(tool)
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.tamed = true
-- make owner
if self.owner == "" then
self.owner = name
end
minetest.sound_play("mobs_chicken", {
object = self.object,
gain = 1.0,
max_hear_distance = 15,
loop = false,
})
end
return
end
mobs:feed_tame(self, clicker, 8, true)
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end,
})
@ -121,7 +86,7 @@ minetest.register_node("mobs:egg", {
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})
minetest.set_node(pos, {name = "mobs:egg", param2 = 1})
end
end
})
@ -157,4 +122,4 @@ minetest.register_craft({
type = "cooking",
recipe = "mobs:chicken_raw",
output = "mobs:chicken_cooked",
})
})

View File

@ -14,7 +14,7 @@ mobs:register_mob("mobs:cow", {
hp_max = 30,
armor = 200,
-- textures and model
collisionbox = {-0.8, 0, -0.8, 0.8, 1.6, 0.8},
collisionbox = {-0.8, 0, -0.8, 0.8, 1.6, 0.8}, --Modif MFF (debug)
visual = "mesh",
mesh = "mobs_cow.x",
textures = {
@ -30,7 +30,7 @@ mobs:register_mob("mobs:cow", {
-- speed and jump
walk_velocity = 1,
run_velocity = 2,
jump = false,
jump = true,
-- drops raw meat when dead
drops = {
{name = "mobs:meat_raw",
@ -58,67 +58,32 @@ mobs:register_mob("mobs:cow", {
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
replace_with = "air",
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
local name = clicker:get_player_name()
if not mobs:feed_tame(self, clicker, 8, true) then
local tool = clicker:get_wielded_item()
if tool:get_name() == "bucket:bucket_empty" then
if self.gotten == true
or self.child == true then
-- milk cow with empty bucket
if tool:get_name() == "bucket:bucket_empty" then
if self.gotten == true
or self.child == true then
return
end
local inv = clicker:get_inventory()
inv:remove_item("main", "bucket:bucket_empty")
if inv:room_for_item("main", {name = "mobs:bucket_milk"}) then
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
else
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "mobs:bucket_milk"})
end
self.gotten = true -- milked
return
end
local inv = clicker:get_inventory()
inv:remove_item("main", "bucket:bucket_empty")
-- if room add bucket of milk to inventory, otherwise drop as item
if inv:room_for_item("main", {name="mobs:bucket_milk"}) then
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
else
local pos = self.object:getpos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = "mobs:bucket_milk"})
end
self.gotten = true -- milked
return
end
if tool:get_name() == "farming:wheat" then
-- take item
if not minetest.setting_getbool("creative_mode") then
tool:take_item(1)
clicker:set_wielded_item(tool)
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 -- ready to be milked again
self.tamed = true
-- make owner
if self.owner == "" then
self.owner = name
end
minetest.sound_play("mobs_cow", {
object = self.object,
gain = 1.0,
max_hear_distance = 16,
loop = false,
})
end
return
end
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
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:spawn_specific("mobs:cow", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
-- register spawn egg
@ -158,7 +123,7 @@ minetest.register_node("mobs:cheeseblock", {
description = "Cheese Block",
tiles = {"mobs_cheeseblock.png"},
is_ground_content = false,
groups = {crumbly=3},
groups = {crumbly = 3},
sounds = default.node_sound_dirt_defaults()
})

View File

@ -1,3 +1,8 @@
-- leather
minetest.register_craftitem("mobs:leather", {
description = "Leather",
inventory_image = "mobs_leather.png",
})
-- raw meat
minetest.register_craftitem("mobs:meat_raw", {
@ -48,4 +53,18 @@ minetest.register_craft({
{"default:stick", "", "default:stick"},
{"farming:string", "default:stick", "farming:string"},
}
})
-- shears (right click to shear animal)
minetest.register_tool("mobs:shears", {
description = "Steel Shears (right-click to shear)",
inventory_image = "mobs_shears.png",
})
minetest.register_craft({
output = 'mobs:shears',
recipe = {
{'', 'default:steel_ingot', ''},
{'', 'group:stick', 'default:steel_ingot'},
}
})

View File

@ -39,7 +39,7 @@ mobs:register_mob("mobs:dungeon_master", {
run_velocity = 2,
jump = false,
view_range = 16,
knock_back = 0.05, --this is a test
knock_back = 0.05, -- Very small knockback
-- drops mese or diamond when dead
drops = {
{name = "mobs:dungeon_master_blood",
@ -75,22 +75,22 @@ mobs:register_egg("mobs:dungeon_master", "Dungeon Master", "mobs_dongeon_master_
-- fireball (weapon)
mobs:register_arrow("mobs:fireball", {
visual = "sprite",
visual_size = {x=1, y=1},
visual_size = {x = 1, y = 1},
textures = {"mobs_fireball.png"},
velocity = 6,
-- direct hit, no fire... just plenty of pain
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=12},
full_punch_interval = 1.0,
damage_groups = {fleshy = 12},
}, 0)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=12},
full_punch_interval = 1.0,
damage_groups = {fleshy = 12},
}, 0)
end,

View File

@ -55,7 +55,7 @@ mobs:register_mob("mobs:goat", {
},
-- follows wheat
follow = "farming:wheat",
view_range = 8,
view_range = 10,
-- replace grass/wheat with air (eat)
replace_rate = 50,
replace_what = {"group:flora"},

View File

@ -49,7 +49,7 @@ if minetest.setting_get("log_mods") then minetest.log("action", "Slimes loaded")
-- NPC
dofile(path.."/npc.lua") -- TenPlus1
dofile(path.."/npc_female.lua") -- ???
dofile(path.."/npc_female.lua") -- nuttmeg20
-- Creeper (fast impl by davedevils)
dofile(path.."/creeper.lua")
@ -59,4 +59,4 @@ dofile(path.."/crafts.lua")
if minetest.setting_get("log_mods") then
minetest.log("action", "mobs loaded")
end
end

View File

@ -11,7 +11,7 @@ mobs:register_mob("mobs:kitten", {
-- textures and model
collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.1, 0.3},
visual = "mesh",
visual_size = {x=0.5, y=0.5},
visual_size = {x = 0.5, y = 0.5},
mesh = "mobs_kitten.b3d",
textures = {
{"mobs_kitten_striped.png"},
@ -42,42 +42,14 @@ mobs:register_mob("mobs:kitten", {
stand_start = 97, stand_end = 192,
walk_start = 0, walk_end = 96,
},
-- follows rat
follow = "mobs:rat",
view_range = 8,
-- follows Rat and Raw Fish
follow = {"mobs:rat", "ethereal:fish_raw"},
view_range = 10,
-- feed with raw fish to tame or right click to pick up
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
if item:get_name() == "fishing:fish_raw"
or item:get_name() == "ethereal:fish_raw" then
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
-- feed and tame
self.food = (self.food or 0) + 1
if self.food > 3 then
self.food = 0
self.tamed = true
-- make owner
if self.owner == "" then
self.owner = name
end
minetest.sound_play("mobs_kitten", {
object = self.object,
gain = 1.0,
max_hear_distance = 10,
loop = false,
})
end
return
end
mobs:feed_tame(self, clicker, 4, true)
mobs:capture_mob(self, clicker, 50, 50, 90, false, nil)
end
})
mobs:spawn_specific("mobs:kitten", {"default:dirt_with_grass"}, {"air"}, 0, 20, 30, 10000, 1, -31000, 31000, true)
mobs:register_egg("mobs:kitten", "Kitten", "mobs_kitten_inv.png", 0)
mobs:register_egg("mobs:kitten", "Kitten", "mobs_kitten_inv.png", 0)

View File

@ -36,7 +36,7 @@ mobs:register_mob("mobs:lava_flan", {
-- chance of dropping lava orb when dead
drops = {
{name = "mobs:lava_orb",
chance = 15, min = 1, max = 1,},
chance = 15, min = 1, max = 1},
},
-- damaged by
water_damage = 5,
@ -52,7 +52,7 @@ mobs:register_mob("mobs:lava_flan", {
},
-- do things when die
on_die = function(self, pos)
minetest.set_node(pos, {name="fire:basic_flame"})
minetest.set_node(pos, {name = "fire:basic_flame"})
end,
})
-- spawns in lava between -1 and 20 light, 1 in 2000 chance, 3 in area below 31000 in height
@ -66,4 +66,4 @@ minetest.register_craftitem("mobs:lava_orb", {
inventory_image = "zmobs_lava_orb.png",
})
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")
minetest.register_alias("zmobs:lava_orb", "mobs:lava_orb")

View File

@ -75,15 +75,15 @@ mobs:register_arrow("mobs:mese_arrow", {
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=8}, --Modif MFF
full_punch_interval = 1.0,
damage_groups = {fleshy = 8}, --Modif MFF
}, 0)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups = {fleshy=8}, --Modif MFF
full_punch_interval = 1.0,
damage_groups = {fleshy = 8}, --Modif MFF
}, 0)
end,
@ -99,4 +99,4 @@ minetest.register_craft({
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
{"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"},
}
})
})

View File

@ -29,6 +29,9 @@ mobs:register_mob("mobs:npc", {
textures = {
{"mobs_npc.png"},
},
child_texture = {
{"mobs_npc_baby.png"}, -- derpy baby by AmirDerAssassine
},
-- sounds
makes_footstep_sound = true,
sounds = {
@ -57,7 +60,7 @@ mobs:register_mob("mobs:npc", {
lava_damage = 6,
light_damage = 0,
-- follow diamond
follow = "default:diamond",
follow = {"farming:bread", "mobs:meat", "default:diamond"},
view_range = 16,
-- set owner and order
owner = "",
@ -72,37 +75,13 @@ mobs:register_mob("mobs:npc", {
},
-- right clicking with "cooked meat" or "bread" will give npc more health
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
if not name then return end
-- feed toheal npc
if item:get_name() == "mobs:meat"
or item:get_name() == "farming:bread" then
-- feed and add health
local hp = self.object:get_hp()
-- return if full health
if hp >= self.hp_max then
minetest.chat_send_player(name, "NPC at full health.")
return
end
hp = hp + 4 -- add restorative value
if hp > self.hp_max then hp = self.hp_max end
self.object:set_hp(hp)
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
-- 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)]})
-- feed to heal npc
if not mobs:feed_tame(self, clicker, 8, true) then
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
-- right clicking with gold lump drops random item from mobs.npc_drops
elseif item:get_name() == "default:diamond" then --/MFF (Crabman|07/14/2015) tamed with diamond
if (self.diamond_count or 0) < 4 then
self.diamond_count = (self.diamond_count or 0) + 1
@ -113,18 +92,21 @@ mobs:register_mob("mobs:npc", {
if self.diamond_count >= 4 then
self.damages = 3
self.owner = clicker:get_player_name()
end
end
else
-- if owner switch between follow and stand
if self.owner and self.owner == clicker:get_player_name() then
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
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)]
})
else
self.owner = clicker:get_player_name()
-- if owner switch between follow and stand
if self.owner and self.owner == clicker:get_player_name() then
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
end
end
end

View File

@ -37,11 +37,11 @@ mobs:register_mob("mobs:oerkki", {
{name = "default:obsidian",
chance = 3, min = 1, max = 2,},
{name = "maptools:silver_coin",
chance = 1, min = 1, max = 1,},
chance = 1, min = 1, max = 1},
},
-- damaged by
water_damage = 2,
lava_damage = 2,
lava_damage = 4,
light_damage = 1,
-- model animation
animation = {

View File

@ -61,4 +61,4 @@ minetest.register_craft({
output = "mobs:rat_cooked",
recipe = "mobs:rat",
cooktime = 5,
})
})

View File

@ -1,298 +1,183 @@
local all_colours = {
"grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta",
"orange", "violet", "brown", "pink", "dark_grey", "dark_green"
"white", "orange", "violet", "brown", "pink", "dark_grey", "dark_green"
}
-- Sheep by PilzAdam
mobs:register_mob("mobs:sheep", {
-- animal, monster, npc, barbarian
type = "animal",
-- not aggressive
passive = true,
-- health & armor
hp_min = 10,
hp_max = 15,
armor = 200,
-- textures and model
collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4},
visual = "mesh",
mesh = "mobs_sheep.b3d",
textures = {
{"mobs_sheep.png"},
},
blood_texture = "mobs_blood.png",
visual_size = {x=1,y=1},
-- specific texture and mesh for gotten
gotten_texture = {"mobs_sheep_shaved.png"},
gotten_mesh = "mobs_sheep_shaved.b3d",
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_sheep",
},
-- speed and jump
walk_velocity = 1,
run_velocity = 2,
jump = true,
-- drops raw meat when dead
drops = {
{name = "mobs:meat_raw",
chance = 1, min = 2, max = 3},
{name = "wool:white",
chance = 1, min = 1, max = 1},
},
-- 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
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.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:white"] then
local pos = self.object:getpos()
pos.y = pos.y + 0.5
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
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
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,
})
-- spawn on default;green grass between 20 and 8 light, 1 in 9000 chance, 1 sheep in area up to 31000 in height
mobs:spawn_specific("mobs:sheep", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
-- register spawn egg
mobs:register_egg("mobs:sheep", "Sheep", "wool_white.png", 1)
-- shears (right click sheep to shear wool)
minetest.register_tool("mobs:shears", {
description = "Steel Shears (right-click sheep to shear)",
inventory_image = "mobs_shears.png",
tool_capabilities = { -- Modif MFF /DEBUT
full_punch_interval = 1,
max_drop_level=1,
groupcaps={
snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2},
},
damage_groups = {fleshy=0},
}
}) -- Modif MFF /FIN
minetest.register_craft({
output = 'mobs:shears',
recipe = {
{'', 'default:steel_ingot', ''},
{'', '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)
mobs:register_mob("mobs:sheep_"..col, {
-- animal, monster, npc, barbarian
type = "animal",
-- not aggressive
passive = true,
-- health & armor
hp_min = 10,
hp_max = 15,
armor = 200,
-- textures and model
collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4},
visual = "mesh",
mesh = "mobs_sheep.b3d",
textures = {
{"mobs_sheep_"..col..".png"},
},
-- specific texture and mesh for gotten
gotten_texture = {"mobs_sheep_shaved.png"},
gotten_mesh = "mobs_sheep_shaved.b3d",
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_sheep",
},
-- speed and jump
walk_velocity = 1,
run_velocity = 2,
jump = true,
-- drops raw meat and woll of its color when dead
drops = {
{name = "mobs:meat_raw",
chance = 1, min = 2, max = 3},
{name = "wool:"..col,
chance = 1, min = 1, max = 1},
},
-- 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,
},
follow = {"farming:wheat", "default:grass_5"},
view_range = 10,
-- 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
replace_offset = -1,
on_rightclick = function(self, clicker)
local shpcolor = string.split(self.name,"_")[2]
if shpcolor =="dark" then
shpcolor = shpcolor.."_"..string.split(self.name,"_")[3]
end
-- make child grow quicker
if self.child == true then
self.hornytimer = self.hornytimer + 10
--are we feeding?
if mobs:feed_tame(self, clicker, 8, true) then
--if full grow fuzz
if self.gotten == false then
self.object:set_properties({
textures = {"mobs_sheep_"..shpcolor..".png"},
mesh = "mobs_sheep.b3d",
})
end
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
local item = clicker:get_wielded_item()
local itemname = item:get_name()
--are we giving a haircut>
if itemname == "mobs:shears" then
if self.gotten == false and self.child == false then
self.gotten = true -- shaved
if minetest.get_modpath("wool") then
local pos = self.object:getpos()
pos.y = pos.y + 0.5
local obj = minetest.add_item(pos, ItemStack("wool:"..shpcolor.." "..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",
})
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,
})
return
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)})
local name = clicker:get_player_name()
--are we coloring?
if itemname:find("dye:") then
if self.gotten == false and self.child == false and self.tamed == true and name == self.owner then
local col = string.split(itemname,":")[2]
for _,c in pairs(all_colours) do
if c == col 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 = name
ent.tamed = true
-- take item
if not minetest.setting_getbool("creative_mode") then
item:take_item()
clicker:set_wielded_item(item)
end
break
end
end
end
item:add_wear(650) -- 100 uses
clicker:set_wielded_item(item)
return
end
self.object:set_properties({
textures = {"mobs_sheep_shaved.png"},
mesh = "mobs_sheep_shaved.b3d",
})
return
--are we capturing?
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end
})
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end,
})
mobs:register_egg("mobs:sheep_"..col, "Sheep ("..col..")", "wool_"..col..".png", 1)
mobs:register_egg("mobs:sheep_"..col, "Sheep ("..col..")", "wool_"..col..".png", 1)
end
mobs:register_spawn("mobs:sheep_white", {"default:dirt_with_grass", "ethereal:green_dirt"}, 20, 10, 15000, 1, 31000)
-- compatibility (item and entity)
minetest.register_alias("mobs:sheep", "mobs:sheep_white")
minetest.register_entity("mobs:sheep", {
hp_max = 1,
physical = true,
collide_with_objects = true,
visual = "mesh",
mesh = "mobs_sheep.b3d",
visual_size = {x = 1, y = 1},
textures = {"mobs_sheep.png"},
velocity = {x = 0, y = 0, z = 0},
collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4},
is_visible = true,
speed = 0,
on_rightclick = function(self, clicker)
clicker:get_inventory():add_item("main", "mobs:sheep_white")
self.object:remove()
end,
})
-- -- shears (right click sheep to shear wool)
-- minetest.register_tool("mobs:shears", {
-- description = "Steel Shears (right-click sheep to shear)",
-- inventory_image = "mobs_shears.png",
-- tool_capabilities = { -- Modif MFF /DEBUT
-- full_punch_interval = 1,
-- max_drop_level=1,
-- groupcaps={
-- snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2},
-- },
-- damage_groups = {fleshy=0},
-- }
-- }) -- Modif MFF /FIN

View File

@ -36,7 +36,7 @@ mobs:register_mob("mobs:spider", {
view_range = 16,
floats = 0,
-- drops string with a chance of sandstone or crystal spike if Ethereal installed
drops = {
drops = {
{name = "farming:string",
chance = 2, min = 1, max = 3,},
{name = "mobs:meat_raw",
@ -58,7 +58,7 @@ mobs:register_mob("mobs:spider", {
},
})
-- spawn on jungleleaves/jungletree, between 0 and 5 light, 1 in 10000 chance, 1 in area up to 31000 in height
mobs:spawn_specific("mobs:spider", {"default:jungleleaves", "default:jungletree"}, {"air"}, -1, 20, 30, 7000, 1, -31000, 31000, false)
mobs:spawn_specific("mobs:spider", {"default:jungleleaves", "default:jungletree"}, {"air"}, -1, 20, 30, 7500, 1, -31000, 31000, false)
-- register spawn egg
mobs:register_egg("mobs:spider", "Spider", "mobs_cobweb.png", 1)
@ -83,7 +83,7 @@ minetest.register_node("mobs:spider_cobweb", {
liquid_renewable = false,
liquid_range = 0,
walkable = false,
groups = {snappy=1,liquid=3},
groups = {snappy = 1, liquid = 3},
drop = "farming:cotton",
sounds = default.node_sound_leaves_defaults(),
})
@ -96,4 +96,4 @@ minetest.register_craft( {
{ "farming:string", "", "" },
{ "", "", "farming:string"}
},
})
})

View File

@ -11,7 +11,7 @@ mobs:register_mob("mobs:stone_monster", {
-- health & armor
hp_min = 30,
hp_max = 35,
armor = 60,
armor = 70,
-- textures and model
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh",

View File

@ -66,4 +66,4 @@ mobs:register_egg("mobs:tree_monster", "Tree Monster", "mobs_tree_monster_inv.pn
if not minetest.get_modpath("ethereal") then
minetest.register_alias("ethereal:tree_sapling", "default:sapling")
minetest.register_alias("ethereal:jungle_tree_sapling", "default:junglesapling")
end
end

View File

@ -32,9 +32,9 @@ mobs:register_mob("mobs:pumba", {
walk_velocity = 2,
run_velocity = 3,
jump = true,
-- follows apple
follow = "default:apple",
view_range = 8,
-- follows apple and potato
follow = {"default:apple", "farming:potato"},
view_range = 10,
-- drops raw pork when dead
drops = {
{name = "mobs:pork_raw",
@ -55,42 +55,7 @@ mobs:register_mob("mobs:pumba", {
},
-- can be tamed by feeding 8 wheat (will not attack when tamed)
on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
if item:get_name() == "default:apple" 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.tamed = true
-- make owner
if self.owner == "" then
self.owner = name
end
minetest.sound_play("mobs_pig", {
object = self.object,
gain = 1.0,
max_hear_distance = 16,
loop = false,
})
end
return
end
mobs:feed_tame(self, clicker, 8, true)
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
end,
})
@ -118,4 +83,4 @@ minetest.register_craft({
output = "mobs:pork_cooked",
recipe = "mobs:pork_raw",
cooktime = 5,
})
})