mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-18 16:20:38 +01:00
add mobs:dog (dog.lua) and fixed wolf tamed
This commit is contained in:
parent
9eaff838e5
commit
0ba98ba2f6
76
mods/mobs/dog.lua
Normal file
76
mods/mobs/dog.lua
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
|
||||||
|
-- Dog
|
||||||
|
|
||||||
|
mobs:register_mob("mobs:dog", {
|
||||||
|
type = "npc",
|
||||||
|
passive = true,
|
||||||
|
hp_max = 5,
|
||||||
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "mobs_wolf.x",
|
||||||
|
textures = {
|
||||||
|
{"mobs_dog.png"},
|
||||||
|
},
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
sounds = {
|
||||||
|
war_cry = "mobs_wolf_attack",
|
||||||
|
},
|
||||||
|
view_range = 15,
|
||||||
|
stepheight = 1.1,
|
||||||
|
owner = "",
|
||||||
|
order = "follow",
|
||||||
|
walk_velocity = 4,
|
||||||
|
run_velocity = 4,
|
||||||
|
damage = 2,
|
||||||
|
armor = 200,
|
||||||
|
attacks_monsters = true,
|
||||||
|
attack_type = "dogfight",
|
||||||
|
drops = {
|
||||||
|
{name = "mobs:meat_raw",
|
||||||
|
chance = 1,
|
||||||
|
min = 2,
|
||||||
|
max = 3,},
|
||||||
|
},
|
||||||
|
drawtype = "front",
|
||||||
|
water_damage = 0,
|
||||||
|
lava_damage = 5,
|
||||||
|
light_damage = 0,
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
local item = clicker:get_wielded_item()
|
||||||
|
if item:get_name() == "mobs:meat_raw" then
|
||||||
|
local hp = self.object:get_hp()
|
||||||
|
if hp + 4 > self.hp_max then return end
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
item:take_item()
|
||||||
|
clicker:set_wielded_item(item)
|
||||||
|
end
|
||||||
|
self.object:set_hp(hp+4)
|
||||||
|
else
|
||||||
|
if self.owner == "" then
|
||||||
|
self.owner = clicker:get_player_name()
|
||||||
|
else
|
||||||
|
if self.order == "follow" then
|
||||||
|
self.order = "stand"
|
||||||
|
else
|
||||||
|
self.order = "follow"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
animation = {
|
||||||
|
speed_normal = 20,
|
||||||
|
speed_run = 30,
|
||||||
|
stand_start = 10,
|
||||||
|
stand_end = 20,
|
||||||
|
walk_start = 75,
|
||||||
|
walk_end = 100,
|
||||||
|
run_start = 100,
|
||||||
|
run_end = 130,
|
||||||
|
punch_start = 135,
|
||||||
|
punch_end = 155,
|
||||||
|
},
|
||||||
|
jump = true,
|
||||||
|
step = 1,
|
||||||
|
blood_texture = "mobs_blood.png",
|
||||||
|
})
|
||||||
|
mobs:register_egg("mobs:dog", "Dog", "wool_brown.png", 1)
|
@ -24,6 +24,7 @@ dofile(minetest.get_modpath("mobs").."/stonemonster.lua") -- PilzAdam
|
|||||||
dofile(minetest.get_modpath("mobs").."/treemonster.lua") -- PilzAdam
|
dofile(minetest.get_modpath("mobs").."/treemonster.lua") -- PilzAdam
|
||||||
dofile(minetest.get_modpath("mobs").."/wolf.lua") -- PilzAdam
|
dofile(minetest.get_modpath("mobs").."/wolf.lua") -- PilzAdam
|
||||||
--dofile(minetest.get_modpath("mobs").."/dog-can-help.lua") -- ???
|
--dofile(minetest.get_modpath("mobs").."/dog-can-help.lua") -- ???
|
||||||
|
dofile(minetest.get_modpath("mobs").."/dog.lua") -- CProgrammerRU
|
||||||
--dofile(minetest.get_modpath("mobs").."/lava_flan.lua") -- Zeg9 --Remplaced by Lava Slimes
|
--dofile(minetest.get_modpath("mobs").."/lava_flan.lua") -- Zeg9 --Remplaced by Lava Slimes
|
||||||
dofile(minetest.get_modpath("mobs").."/mese_monster.lua") -- Zeg9
|
dofile(minetest.get_modpath("mobs").."/mese_monster.lua") -- Zeg9
|
||||||
dofile(minetest.get_modpath("mobs").."/spider.lua") -- AspireMint
|
dofile(minetest.get_modpath("mobs").."/spider.lua") -- AspireMint
|
||||||
|
@ -53,11 +53,12 @@ mobs:register_mob("mobs:wolf", {
|
|||||||
-- right clicking with "raw meat" 4 times will tame the wolf into a friendly dog
|
-- right clicking with "raw meat" 4 times will tame the wolf into a friendly dog
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
if item:get_name() == "mobs:raw_meat" and self.raw_meat_count == 4 then
|
if item:get_name() == "mobs:meat_raw" and self.raw_meat_count == 4 then
|
||||||
clicker:get_inventory():remove_item("main", "mobs:meat_raw")
|
clicker:get_inventory():remove_item("main", "mobs:meat_raw")
|
||||||
minetest.add_entity(self.object:getpos(), "mobs:dog")
|
local ent = minetest.add_entity(self.object:getpos(), "mobs:dog")
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
local dog_obj = minetest.add_entity(self.object:getpos(), "mobs:dog")
|
local dog_obj = ent:get_luaentity()
|
||||||
|
if not dog_obj then return end
|
||||||
dog_obj.tamed = true
|
dog_obj.tamed = true
|
||||||
dog_obj.textures = {"mobs_dog.png"}
|
dog_obj.textures = {"mobs_dog.png"}
|
||||||
dog_obj.damage = 3
|
dog_obj.damage = 3
|
||||||
@ -66,7 +67,7 @@ mobs:register_mob("mobs:wolf", {
|
|||||||
if dog_obj.owner == "" then
|
if dog_obj.owner == "" then
|
||||||
self.owner = clicker:get_player_name()
|
self.owner = clicker:get_player_name()
|
||||||
else return end
|
else return end
|
||||||
elseif item:get_name() == "mobs:raw_meat" and self.raw_meat_count ~= 4 then
|
elseif item:get_name() == "mobs:meat_raw" and self.raw_meat_count ~= 4 then
|
||||||
self.raw_meat_count = (self.raw_meat_count or 0) + 1
|
self.raw_meat_count = (self.raw_meat_count or 0) + 1
|
||||||
else return end
|
else return end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user