1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-01-11 18:40:25 +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: 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.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.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.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 honey when killed
drops = { drops = {
{name = "mobs:honey", {name = "mobs:honey",
chance = 1, min = 1, max = 2,}, chance = 1, min = 1, max = 2},
}, },
-- damage -- damage
water_damage = 1, water_damage = 1,
@ -66,7 +66,7 @@ minetest.register_node("mobs:beehive", {
description = "Beehive", description = "Beehive",
drawtype = "plantlike", drawtype = "plantlike",
visual_scale = 1.0, visual_scale = 1.0,
tiles ={"mobs_beehive.png"}, tiles = {"mobs_beehive.png"},
inventory_image = "mobs_beehive.png", inventory_image = "mobs_beehive.png",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
@ -76,11 +76,11 @@ minetest.register_node("mobs:beehive", {
sounds = default.node_sound_defaults(), sounds = default.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
if placer:is_player() then 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") minetest.add_entity(pos, "mobs:bee")
end end
end, end,
}) })
minetest.register_craft({ minetest.register_craft({
@ -94,7 +94,7 @@ minetest.register_craft({
minetest.register_node("mobs:honey_block", { minetest.register_node("mobs:honey_block", {
description = "Honey Block", description = "Honey Block",
tiles = {"mobs_honey_block.png"}, tiles = {"mobs_honey_block.png"},
groups = {snappy=3,flammable=2}, groups = {snappy = 3, flammable = 2},
sounds = default.node_sound_dirt_defaults(), sounds = default.node_sound_dirt_defaults(),
}) })
@ -112,4 +112,4 @@ minetest.register_craft({
recipe = { recipe = {
{"mobs:honey_block"}, {"mobs:honey_block"},
} }
}) })

View File

@ -28,7 +28,7 @@ mobs:register_mob("mobs:bunny", {
-- drops meat when dead -- drops meat when dead
drops = { drops = {
{name = "mobs:meat_raw", {name = "mobs:meat_raw",
chance = 1, min = 1, max = 2,}, chance = 1, min = 1, max = 2},
}, },
-- damaged by -- damaged by
water_damage = 1, water_damage = 1,
@ -42,51 +42,30 @@ mobs:register_mob("mobs:bunny", {
punch_start = 16, punch_end = 24, punch_start = 16, punch_end = 24,
}, },
-- follows carrot from farming redo -- follows carrot from farming redo
follow = "farming:carrot", follow = {"farming:carrot", "farming_plus:carrot_item"},
view_range = 8, view_range = 10,
-- eat carrots -- eat carrots
replace_rate = 80, replace_rate = 80,
replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"}, replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"},
replace_with = "air", replace_with = "air",
-- right click to pick up rabbit -- right click to pick up rabbit
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item() if not mobs:feed_tame(self, clicker, 4, true) then
local name = clicker:get_player_name() -- Monty Python tribute
local item = clicker:get_wielded_item()
if item:get_name() == "farming_plus:carrot_item" if item:get_name() == "mobs:lava_orb" then
or item:get_name() == "farming:carrot" then if not minetest.setting_getbool("creative_mode") then
-- take item item:take_item()
if not minetest.setting_getbool("creative_mode") then clicker:set_wielded_item(item)
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
self.object:set_properties({
textures = {"mobs_bunny_evil.png"},
})
self.type = "monster"
self.state = "attack"
self.object:set_hp(20)
return
end 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 end
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
@ -95,4 +74,4 @@ mobs:register_mob("mobs:bunny", {
damage = 5, damage = 5,
}) })
mobs:spawn_specific("mobs:bunny", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true) 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, walk_end = 40,
}, },
-- follows wheat -- follows wheat
follow = "farming:seed_wheat", follow = {"farming:seed_wheat", "farming:seed_cotton"},
view_range = 8, view_range = 8,
replace_rate = 2000, replace_rate = 2500,
replace_what = {"air"}, replace_what = {"air"},
replace_with = "mobs:egg", replace_with = "mobs:egg",
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item() mobs:feed_tame(self, clicker, 8, true)
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:capture_mob(self, clicker, 30, 50, 80, false, nil) mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end, end,
}) })
@ -121,7 +86,7 @@ minetest.register_node("mobs:egg", {
groups = {snappy=2, dig_immediate=3}, groups = {snappy=2, dig_immediate=3},
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
if placer:is_player() then 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
end end
}) })
@ -157,4 +122,4 @@ minetest.register_craft({
type = "cooking", type = "cooking",
recipe = "mobs:chicken_raw", recipe = "mobs:chicken_raw",
output = "mobs:chicken_cooked", output = "mobs:chicken_cooked",
}) })

View File

@ -14,7 +14,7 @@ mobs:register_mob("mobs:cow", {
hp_max = 30, hp_max = 30,
armor = 200, armor = 200,
-- textures and model -- 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", visual = "mesh",
mesh = "mobs_cow.x", mesh = "mobs_cow.x",
textures = { textures = {
@ -30,7 +30,7 @@ mobs:register_mob("mobs:cow", {
-- speed and jump -- speed and jump
walk_velocity = 1, walk_velocity = 1,
run_velocity = 2, run_velocity = 2,
jump = false, jump = true,
-- drops raw meat when dead -- drops raw meat when dead
drops = { drops = {
{name = "mobs:meat_raw", {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_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
replace_with = "air", replace_with = "air",
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item() if not mobs:feed_tame(self, clicker, 8, true) then
local name = clicker:get_player_name() local tool = clicker:get_wielded_item()
if tool:get_name() == "bucket:bucket_empty" then -- milk cow with empty bucket
if self.gotten == true if tool:get_name() == "bucket:bucket_empty" then
or self.child == true 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 return
end end
local inv = clicker:get_inventory() end
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
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
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 -- 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) mobs:spawn_specific("mobs:cow", {"default:dirt_with_grass"}, {"air"}, 8, 20, 30, 10000, 1, -31000, 31000, true)
-- register spawn egg -- register spawn egg
@ -158,7 +123,7 @@ minetest.register_node("mobs:cheeseblock", {
description = "Cheese Block", description = "Cheese Block",
tiles = {"mobs_cheeseblock.png"}, tiles = {"mobs_cheeseblock.png"},
is_ground_content = false, is_ground_content = false,
groups = {crumbly=3}, groups = {crumbly = 3},
sounds = default.node_sound_dirt_defaults() 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 -- raw meat
minetest.register_craftitem("mobs:meat_raw", { minetest.register_craftitem("mobs:meat_raw", {
@ -48,4 +53,18 @@ minetest.register_craft({
{"default:stick", "", "default:stick"}, {"default:stick", "", "default:stick"},
{"farming:string", "default:stick", "farming:string"}, {"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, run_velocity = 2,
jump = false, jump = false,
view_range = 16, 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 mese or diamond when dead
drops = { drops = {
{name = "mobs:dungeon_master_blood", {name = "mobs:dungeon_master_blood",
@ -75,22 +75,22 @@ mobs:register_egg("mobs:dungeon_master", "Dungeon Master", "mobs_dongeon_master_
-- fireball (weapon) -- fireball (weapon)
mobs:register_arrow("mobs:fireball", { mobs:register_arrow("mobs:fireball", {
visual = "sprite", visual = "sprite",
visual_size = {x=1, y=1}, visual_size = {x = 1, y = 1},
textures = {"mobs_fireball.png"}, textures = {"mobs_fireball.png"},
velocity = 6, velocity = 6,
-- direct hit, no fire... just plenty of pain -- direct hit, no fire... just plenty of pain
hit_player = function(self, player) hit_player = function(self, player)
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval = 1.0,
damage_groups = {fleshy=12}, damage_groups = {fleshy = 12},
}, 0) }, 0)
end, end,
hit_mob = function(self, player) hit_mob = function(self, player)
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval = 1.0,
damage_groups = {fleshy=12}, damage_groups = {fleshy = 12},
}, 0) }, 0)
end, end,

View File

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

View File

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

View File

@ -11,7 +11,7 @@ mobs:register_mob("mobs:kitten", {
-- textures and model -- textures and model
collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.1, 0.3}, collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.1, 0.3},
visual = "mesh", visual = "mesh",
visual_size = {x=0.5, y=0.5}, visual_size = {x = 0.5, y = 0.5},
mesh = "mobs_kitten.b3d", mesh = "mobs_kitten.b3d",
textures = { textures = {
{"mobs_kitten_striped.png"}, {"mobs_kitten_striped.png"},
@ -42,42 +42,14 @@ mobs:register_mob("mobs:kitten", {
stand_start = 97, stand_end = 192, stand_start = 97, stand_end = 192,
walk_start = 0, walk_end = 96, walk_start = 0, walk_end = 96,
}, },
-- follows rat -- follows Rat and Raw Fish
follow = "mobs:rat", follow = {"mobs:rat", "ethereal:fish_raw"},
view_range = 8, view_range = 10,
-- feed with raw fish to tame or right click to pick up -- feed with raw fish to tame or right click to pick up
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item() mobs:feed_tame(self, clicker, 4, true)
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:capture_mob(self, clicker, 50, 50, 90, false, nil) mobs:capture_mob(self, clicker, 50, 50, 90, false, nil)
end end
}) })
mobs:spawn_specific("mobs:kitten", {"default:dirt_with_grass"}, {"air"}, 0, 20, 30, 10000, 1, -31000, 31000, true) 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 -- chance of dropping lava orb when dead
drops = { drops = {
{name = "mobs:lava_orb", {name = "mobs:lava_orb",
chance = 15, min = 1, max = 1,}, chance = 15, min = 1, max = 1},
}, },
-- damaged by -- damaged by
water_damage = 5, water_damage = 5,
@ -52,7 +52,7 @@ mobs:register_mob("mobs:lava_flan", {
}, },
-- do things when die -- do things when die
on_die = function(self, pos) on_die = function(self, pos)
minetest.set_node(pos, {name="fire:basic_flame"}) minetest.set_node(pos, {name = "fire:basic_flame"})
end, end,
}) })
-- spawns in lava between -1 and 20 light, 1 in 2000 chance, 3 in area below 31000 in height -- 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", 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) hit_player = function(self, player)
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval = 1.0,
damage_groups = {fleshy=8}, --Modif MFF damage_groups = {fleshy = 8}, --Modif MFF
}, 0) }, 0)
end, end,
hit_mob = function(self, player) hit_mob = function(self, player)
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval=1.0, full_punch_interval = 1.0,
damage_groups = {fleshy=8}, --Modif MFF damage_groups = {fleshy = 8}, --Modif MFF
}, 0) }, 0)
end, 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"},
{"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 = { textures = {
{"mobs_npc.png"}, {"mobs_npc.png"},
}, },
child_texture = {
{"mobs_npc_baby.png"}, -- derpy baby by AmirDerAssassine
},
-- sounds -- sounds
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { sounds = {
@ -57,7 +60,7 @@ mobs:register_mob("mobs:npc", {
lava_damage = 6, lava_damage = 6,
light_damage = 0, light_damage = 0,
-- follow diamond -- follow diamond
follow = "default:diamond", follow = {"farming:bread", "mobs:meat", "default:diamond"},
view_range = 16, view_range = 16,
-- set owner and order -- set owner and order
owner = "", owner = "",
@ -72,37 +75,13 @@ mobs:register_mob("mobs:npc", {
}, },
-- right clicking with "cooked meat" or "bread" will give npc more health -- right clicking with "cooked meat" or "bread" will give npc more health
on_rightclick = function(self, clicker) 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 -- feed to heal npc
elseif item:get_name() == "default:gold_lump" then if not mobs:feed_tame(self, clicker, 8, true) then
if not minetest.setting_getbool("creative_mode") then local item = clicker:get_wielded_item()
item:take_item() local name = clicker:get_player_name()
clicker:set_wielded_item(item)
end -- right clicking with gold lump drops random item from mobs.npc_drops
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 elseif item:get_name() == "default:diamond" then --/MFF (Crabman|07/14/2015) tamed with diamond
if (self.diamond_count or 0) < 4 then if (self.diamond_count or 0) < 4 then
self.diamond_count = (self.diamond_count or 0) + 1 self.diamond_count = (self.diamond_count or 0) + 1
@ -113,18 +92,21 @@ mobs:register_mob("mobs:npc", {
if self.diamond_count >= 4 then if self.diamond_count >= 4 then
self.damages = 3 self.damages = 3
self.owner = clicker:get_player_name() self.owner = clicker:get_player_name()
end local pos = self.object:getpos()
end pos.y = pos.y + 0.5
else minetest.add_item(pos, {
-- if owner switch between follow and stand name = mobs.npc_drops[math.random(1, #mobs.npc_drops)]
if self.owner and self.owner == clicker:get_player_name() then })
if self.order == "follow" then
self.order = "stand"
else
self.order = "follow"
end
else 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
end end

View File

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

View File

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

View File

@ -1,298 +1,183 @@
local all_colours = { local all_colours = {
"grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta", "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 -- 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 for _, col in ipairs(all_colours) do
mobs:register_mob("mobs:sheep_"..col, { mobs:register_mob("mobs:sheep_"..col, {
type = "animal", -- animal, monster, npc, barbarian
passive = true, type = "animal",
hp_min = 8, -- not aggressive
hp_max = 10, passive = true,
armor = 200, -- health & armor
collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4}, hp_min = 10,
visual = "mesh", hp_max = 15,
mesh = "mobs_sheep.b3d", armor = 200,
textures = { -- textures and model
{"mobs_sheep_"..col..".png"}, collisionbox = {-0.4, -1, -0.4, 0.4, 0.3, 0.4},
}, visual = "mesh",
gotten_texture = {"mobs_sheep_shaved.png"}, mesh = "mobs_sheep.b3d",
gotten_mesh = "mobs_sheep_shaved.b3d", textures = {
makes_footstep_sound = true, {"mobs_sheep_"..col..".png"},
sounds = { },
random = "mobs_sheep", -- specific texture and mesh for gotten
}, gotten_texture = {"mobs_sheep_shaved.png"},
walk_velocity = 1, gotten_mesh = "mobs_sheep_shaved.b3d",
jump = true, -- sounds
drops = { makes_footstep_sound = true,
{name = "mobs:meat_raw", sounds = {
chance = 1, min = 2, max = 3}, random = "mobs_sheep",
{name = "wool:"..col, },
chance = 1, min = 1, max = 1}, -- speed and jump
}, walk_velocity = 1,
water_damage = 1, run_velocity = 2,
lava_damage = 5, jump = true,
light_damage = 0, -- drops raw meat and woll of its color when dead
animation = { drops = {
speed_normal = 15, {name = "mobs:meat_raw",
speed_run = 15, chance = 1, min = 2, max = 3},
stand_start = 0, {name = "wool:"..col,
stand_end = 80, chance = 1, min = 1, max = 1},
walk_start = 81, },
walk_end = 100, -- damaged by
}, water_damage = 1,
follow = "farming:wheat", lava_damage = 5,
view_range = 5, light_damage = 0,
replace_rate = 50, -- model animation
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"}, animation = {
replace_with = "air", speed_normal = 15, speed_run = 15,
replace_offset = -1, stand_start = 0, stand_end = 80,
on_rightclick = function(self, clicker) walk_start = 81, walk_end = 100,
local item = clicker:get_wielded_item() },
local name = clicker:get_player_name() follow = {"farming:wheat", "default:grass_5"},
view_range = 10,
if item:get_name() == "farming:wheat" then -- replace grass/wheat with air (eat)
-- take item replace_rate = 50,
if not minetest.setting_getbool("creative_mode") then replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
item:take_item() replace_with = "air",
clicker:set_wielded_item(item) -- 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 end
-- make child grow quicker
if self.child == true then --are we feeding?
self.hornytimer = self.hornytimer + 10 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 return
end end
-- feed and tame
self.food = (self.food or 0) + 1 local item = clicker:get_wielded_item()
if self.food > 7 then local itemname = item:get_name()
self.food = 0
if self.hornytimer == 0 then --are we giving a haircut>
self.horny = true 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 end
self.gotten = false -- can be shaved again return
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 end
return
end
if item:get_name() == "mobs:shears" local name = clicker:get_player_name()
and self.gotten == false
and self.child == false then --are we coloring?
self.gotten = true -- shaved if itemname:find("dye:") then
if minetest.registered_items["wool:"..col] then if self.gotten == false and self.child == false and self.tamed == true and name == self.owner then
local pos = self.object:getpos() local col = string.split(itemname,":")[2]
pos.y = pos.y + 0.5 for _,c in pairs(all_colours) do
local obj = minetest.add_item(pos, ItemStack("wool:"..col.." "..math.random(2,3))) if c == col then
if obj then local pos = self.object:getpos()
obj:setvelocity({x = math.random(-1,1), y = 5, z = math.random(-1,1)}) 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 end
item:add_wear(650) -- 100 uses return
clicker:set_wielded_item(item)
end end
self.object:set_properties({
textures = {"mobs_sheep_shaved.png"}, --are we capturing?
mesh = "mobs_sheep_shaved.b3d", mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
})
return
end end
})
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) mobs:register_egg("mobs:sheep_"..col, "Sheep ("..col..")", "wool_"..col..".png", 1)
end,
})
mobs:register_egg("mobs:sheep_"..col, "Sheep ("..col..")", "wool_"..col..".png", 1)
end 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, view_range = 16,
floats = 0, floats = 0,
-- drops string with a chance of sandstone or crystal spike if Ethereal installed -- drops string with a chance of sandstone or crystal spike if Ethereal installed
drops = { drops = {
{name = "farming:string", {name = "farming:string",
chance = 2, min = 1, max = 3,}, chance = 2, min = 1, max = 3,},
{name = "mobs:meat_raw", {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 -- 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 -- register spawn egg
mobs:register_egg("mobs:spider", "Spider", "mobs_cobweb.png", 1) mobs:register_egg("mobs:spider", "Spider", "mobs_cobweb.png", 1)
@ -83,7 +83,7 @@ minetest.register_node("mobs:spider_cobweb", {
liquid_renewable = false, liquid_renewable = false,
liquid_range = 0, liquid_range = 0,
walkable = false, walkable = false,
groups = {snappy=1,liquid=3}, groups = {snappy = 1, liquid = 3},
drop = "farming:cotton", drop = "farming:cotton",
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })
@ -96,4 +96,4 @@ minetest.register_craft( {
{ "farming:string", "", "" }, { "farming:string", "", "" },
{ "", "", "farming:string"} { "", "", "farming:string"}
}, },
}) })

View File

@ -11,7 +11,7 @@ mobs:register_mob("mobs:stone_monster", {
-- health & armor -- health & armor
hp_min = 30, hp_min = 30,
hp_max = 35, hp_max = 35,
armor = 60, armor = 70,
-- textures and model -- textures and model
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4}, collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh", 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 if not minetest.get_modpath("ethereal") then
minetest.register_alias("ethereal:tree_sapling", "default:sapling") minetest.register_alias("ethereal:tree_sapling", "default:sapling")
minetest.register_alias("ethereal:jungle_tree_sapling", "default:junglesapling") 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, walk_velocity = 2,
run_velocity = 3, run_velocity = 3,
jump = true, jump = true,
-- follows apple -- follows apple and potato
follow = "default:apple", follow = {"default:apple", "farming:potato"},
view_range = 8, view_range = 10,
-- drops raw pork when dead -- drops raw pork when dead
drops = { drops = {
{name = "mobs:pork_raw", {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) -- can be tamed by feeding 8 wheat (will not attack when tamed)
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item() mobs:feed_tame(self, clicker, 8, true)
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:capture_mob(self, clicker, 0, 5, 50, false, nil) mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
end, end,
}) })
@ -118,4 +83,4 @@ minetest.register_craft({
output = "mobs:pork_cooked", output = "mobs:pork_cooked",
recipe = "mobs:pork_raw", recipe = "mobs:pork_raw",
cooktime = 5, cooktime = 5,
}) })