mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-07-08 10:50:23 +02:00
Update Farming, Mobs, 3d_armor
Farming : minors fixe, add the straw block Mobs : better api, swimming parameter for mobs, add eggs, code optimisation 3d_armor : change the model, many new textures, new shield, and new enchanted shield (which gain compared to normal shield +1 armor and x2 durability)
This commit is contained in:
32
mods/mobs/cow.lua
Normal file → Executable file
32
mods/mobs/cow.lua
Normal file → Executable file
@ -38,27 +38,23 @@ mobs:register_mob("mobs:cow", {
|
||||
on_rightclick = function(self, clicker)
|
||||
local tool = clicker:get_wielded_item()
|
||||
if tool:get_name() == "bucket:bucket_empty" then
|
||||
if self.milked then
|
||||
do return end
|
||||
end
|
||||
if self.gotten then return end
|
||||
clicker:get_inventory():remove_item("main", "bucket:bucket_empty")
|
||||
clicker:get_inventory():add_item("main", "mobs:bucket_milk")
|
||||
self.milked = true
|
||||
self.gotten = true -- milked
|
||||
end
|
||||
|
||||
if tool:get_name() == "farming:wheat" then
|
||||
if self.milked then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
tool:take_item(1)
|
||||
clicker:set_wielded_item(tool)
|
||||
end
|
||||
self.food = (self.food or 0) + 1
|
||||
if self.food >= 8 then
|
||||
self.food = 0
|
||||
self.milked = false
|
||||
self.tamed = true
|
||||
minetest.sound_play("mobs_cow", {object = self.object,gain = 1.0,max_hear_distance = 32,loop = false,})
|
||||
end
|
||||
if tool:get_name() == "farming:wheat" and self.gotten then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
tool:take_item(1)
|
||||
clicker:set_wielded_item(tool)
|
||||
end
|
||||
self.food = (self.food or 0) + 1
|
||||
if self.food >= 8 then
|
||||
self.food = 0
|
||||
self.gotten = false -- ready to be milked again
|
||||
self.tamed = true
|
||||
minetest.sound_play("mobs_cow", {object = self.object,gain = 1.0,max_hear_distance = 32,loop = false,})
|
||||
end
|
||||
return tool
|
||||
end
|
||||
@ -77,12 +73,14 @@ mobs:register_mob("mobs:cow", {
|
||||
punch_start = 70,
|
||||
punch_end = 100,
|
||||
},
|
||||
|
||||
jump = true,
|
||||
step = 1,
|
||||
blood_texture = "mobs_blood.png",
|
||||
passive = true,
|
||||
})
|
||||
mobs:register_spawn("mobs:cow", {"default:dirt_with_grass"}, 20, 0, 9000, 1, 31000)
|
||||
mobs:register_egg("mobs:cow", "Cow", "default_grass.png", 1)
|
||||
|
||||
-- Bucket of Milk
|
||||
|
||||
|
Reference in New Issue
Block a user