mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-07-13 21:30:23 +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:
@ -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()
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user