mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-03-31 09:40:43 +02: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:
parent
2010c907d7
commit
4fe3fc8f25
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,40 +42,18 @@ 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
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
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
|
||||
-- take item
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
@ -88,6 +66,7 @@ mobs:register_mob("mobs:bunny", {
|
||||
self.object:set_hp(20)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
|
||||
end,
|
||||
|
@ -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,
|
||||
})
|
||||
|
@ -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,9 +58,10 @@ 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)
|
||||
if not mobs:feed_tame(self, clicker, 8, true) then
|
||||
local tool = clicker:get_wielded_item()
|
||||
local name = clicker:get_player_name()
|
||||
|
||||
-- milk cow with empty bucket
|
||||
if tool:get_name() == "bucket:bucket_empty" then
|
||||
if self.gotten == true
|
||||
or self.child == true then
|
||||
@ -68,7 +69,6 @@ mobs:register_mob("mobs:cow", {
|
||||
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
|
||||
@ -79,46 +79,11 @@ mobs:register_mob("mobs:cow", {
|
||||
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
|
||||
|
||||
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
|
||||
|
@ -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", {
|
||||
@ -49,3 +54,17 @@ minetest.register_craft({
|
||||
{"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'},
|
||||
}
|
||||
})
|
@ -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",
|
||||
|
@ -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"},
|
||||
|
@ -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")
|
||||
|
@ -42,40 +42,12 @@ 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
|
||||
})
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
||||
-- 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()
|
||||
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)]})
|
||||
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,8 +92,12 @@ mobs:register_mob("mobs:npc", {
|
||||
if self.diamond_count >= 4 then
|
||||
self.damages = 3
|
||||
self.owner = clicker:get_player_name()
|
||||
end
|
||||
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
|
||||
-- if owner switch between follow and stand
|
||||
if self.owner and self.owner == clicker:get_player_name() then
|
||||
@ -123,8 +106,7 @@ mobs:register_mob("mobs:npc", {
|
||||
else
|
||||
self.order = "follow"
|
||||
end
|
||||
else
|
||||
self.owner = clicker:get_player_name()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -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 = {
|
||||
|
@ -1,12 +1,14 @@
|
||||
|
||||
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", {
|
||||
for _, col in ipairs(all_colours) do
|
||||
|
||||
mobs:register_mob("mobs:sheep_"..col, {
|
||||
-- animal, monster, npc, barbarian
|
||||
type = "animal",
|
||||
-- not aggressive
|
||||
@ -20,10 +22,8 @@ mobs:register_mob("mobs:sheep", {
|
||||
visual = "mesh",
|
||||
mesh = "mobs_sheep.b3d",
|
||||
textures = {
|
||||
{"mobs_sheep.png"},
|
||||
{"mobs_sheep_"..col..".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",
|
||||
@ -36,11 +36,11 @@ mobs:register_mob("mobs:sheep", {
|
||||
walk_velocity = 1,
|
||||
run_velocity = 2,
|
||||
jump = true,
|
||||
-- drops raw meat when dead
|
||||
-- drops raw meat and woll of its color when dead
|
||||
drops = {
|
||||
{name = "mobs:meat_raw",
|
||||
chance = 1, min = 2, max = 3},
|
||||
{name = "wool:white",
|
||||
{name = "wool:"..col,
|
||||
chance = 1, min = 1, max = 1},
|
||||
},
|
||||
-- damaged by
|
||||
@ -53,9 +53,8 @@ mobs:register_mob("mobs:sheep", {
|
||||
stand_start = 0, stand_end = 80,
|
||||
walk_start = 81, walk_end = 100,
|
||||
},
|
||||
-- follows wheat
|
||||
follow = "farming:wheat",
|
||||
view_range = 8,
|
||||
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"},
|
||||
@ -63,57 +62,40 @@ mobs:register_mob("mobs:sheep", {
|
||||
-- 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()
|
||||
local shpcolor = string.split(self.name,"_")[2]
|
||||
if shpcolor =="dark" then
|
||||
shpcolor = shpcolor.."_"..string.split(self.name,"_")[3]
|
||||
end
|
||||
|
||||
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
|
||||
--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.png"},
|
||||
textures = {"mobs_sheep_"..shpcolor..".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
|
||||
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.registered_items["wool:white"] then
|
||||
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:white "..math.random(2,3)))
|
||||
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)})
|
||||
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)
|
||||
@ -122,20 +104,23 @@ mobs:register_mob("mobs:sheep", {
|
||||
textures = {"mobs_sheep_shaved.png"},
|
||||
mesh = "mobs_sheep_shaved.b3d",
|
||||
})
|
||||
end
|
||||
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 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 = clicker:get_player_name()
|
||||
ent.owner = name
|
||||
ent.tamed = true
|
||||
-- take item
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
@ -143,156 +128,56 @@ mobs:register_mob("mobs:sheep", {
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
break
|
||||
else
|
||||
print ("not owner/tamed, cant dye sheep")
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
--are we capturing?
|
||||
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)
|
||||
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
|
||||
|
||||
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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user