2017-01-16 19:40:08 +03:00
|
|
|
--MCmobs v0.2
|
|
|
|
--maikerumine
|
|
|
|
--made for MC like Survival game
|
|
|
|
--License for code WTFPL and otherwise stated in readmes
|
|
|
|
|
|
|
|
|
|
|
|
--dofile(minetest.get_modpath("mobs").."/api.lua")
|
|
|
|
|
|
|
|
|
|
|
|
-- Dog
|
|
|
|
mobs:register_mob("mobs_mc:dog", {
|
|
|
|
type = "npc",
|
|
|
|
passive = true,
|
2017-01-16 22:52:09 +03:00
|
|
|
hp_min = 6,
|
|
|
|
hp_max = 6,
|
2017-01-16 19:40:08 +03:00
|
|
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
|
|
|
visual = "mesh",
|
2017-03-03 03:27:10 +03:00
|
|
|
pathfinding = 1,
|
2017-01-16 19:40:08 +03:00
|
|
|
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",
|
|
|
|
floats = {x=0,y=0,z=0},
|
|
|
|
walk_velocity = 4,
|
|
|
|
run_velocity = 4,
|
|
|
|
stepheight = 1.1,
|
2017-01-16 22:52:09 +03:00
|
|
|
damage = 4,
|
2017-01-16 19:40:08 +03:00
|
|
|
armor = 100,
|
|
|
|
attacks_monsters = true,
|
|
|
|
attack_type = "dogfight",
|
2017-01-16 22:52:09 +03:00
|
|
|
drops = {},
|
2017-01-16 19:40:08 +03:00
|
|
|
drawtype = "front",
|
|
|
|
water_damage = 0,
|
2017-02-23 21:52:07 +03:00
|
|
|
lava_damage = minetest.registered_nodes["mcl_core:lava_source"].damage_per_second,
|
2017-01-16 19:40:08 +03:00
|
|
|
light_damage = 0,
|
|
|
|
on_rightclick = function(self, clicker)
|
|
|
|
local item = clicker:get_wielded_item()
|
2017-02-19 23:49:15 +03:00
|
|
|
if item:get_name() == "mcl:mobitems:bone" then
|
2017-01-16 19:40:08 +03:00
|
|
|
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
|
|
|
|
local formspec = "size[8,4]"
|
2017-02-19 23:57:58 +03:00
|
|
|
formspec = formspec .. "label[0,0;What are your commands for the tamed wolf?]"
|
|
|
|
formspec = formspec .. "button_exit[0,1;4,1;dfollow;Follow me!]"
|
|
|
|
formspec = formspec .. "button_exit[4,1;4,1;dstand;Stay here!]"
|
|
|
|
formspec = formspec .. "button_exit[0,2;4,1;dfandp;Follow and protect me!]"
|
|
|
|
formspec = formspec .. "button_exit[4,2;4,1;dsandp;Stay here and protect me!]"
|
|
|
|
formspec = formspec .. "button_exit[0,3;4,1;dsethome;This is your home!]"
|
|
|
|
formspec = formspec .. "button_exit[4,3;4,1;dgohome;Go home!]"
|
2017-01-16 19:40:08 +03:00
|
|
|
minetest.show_formspec(clicker:get_player_name(), "order", formspec)
|
|
|
|
minetest.register_on_player_receive_fields(function(clicker, formname, fields)
|
|
|
|
if fields.dfollow then
|
|
|
|
self.order = "follow"
|
|
|
|
self.attacks_monsters = false
|
|
|
|
end
|
|
|
|
if fields.dstand then
|
|
|
|
self.order = "stand"
|
|
|
|
self.attacks_monsters = false
|
|
|
|
end
|
|
|
|
if fields.dfandp then
|
|
|
|
self.order = "follow"
|
|
|
|
self.attacks_monsters = true
|
|
|
|
end
|
|
|
|
if fields.dsandp then
|
|
|
|
self.order = "stand"
|
|
|
|
self.attacks_monsters = true
|
|
|
|
end
|
|
|
|
if fields.dsethome then
|
|
|
|
self.floats = self.object:getpos()
|
|
|
|
end
|
|
|
|
if fields.dgohome then
|
|
|
|
if self.floats then
|
|
|
|
self.order = "stand"
|
|
|
|
self.object:setpos(self.floats)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
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",
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- Wolf by KrupnoPavel
|
|
|
|
mobs:register_mob("mobs_mc:wolf", {
|
|
|
|
type = "animal",
|
2017-01-16 22:52:09 +03:00
|
|
|
hp_min = 8,
|
|
|
|
hp_max = 8,
|
2017-01-16 19:40:08 +03:00
|
|
|
passive = false,
|
|
|
|
group_attack = true,
|
|
|
|
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1, 0.4},
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_wolf.x",
|
|
|
|
textures = {
|
|
|
|
{"mobs_wolf.png"},
|
|
|
|
},
|
|
|
|
makes_footstep_sound = true,
|
|
|
|
sounds = {
|
|
|
|
war_cry = "mobs_wolf_attack",
|
|
|
|
},
|
|
|
|
view_range = 7,
|
|
|
|
walk_velocity = 2,
|
|
|
|
run_velocity = 3,
|
|
|
|
stepheight = 1.1,
|
2017-01-16 22:52:09 +03:00
|
|
|
damage = 4,
|
|
|
|
armor = 100,
|
2017-01-16 19:40:08 +03:00
|
|
|
attack_type = "dogfight",
|
2017-01-16 22:52:09 +03:00
|
|
|
drops = {},
|
2017-01-16 19:40:08 +03:00
|
|
|
drawtype = "front",
|
|
|
|
water_damage = 0,
|
2017-02-23 21:52:07 +03:00
|
|
|
lava_damage = minetest.registered_nodes["mcl_core:lava_source"].damage_per_second,
|
2017-01-16 19:40:08 +03:00
|
|
|
light_damage = 0,
|
|
|
|
on_rightclick = function(self, clicker)
|
2017-01-24 04:31:49 +03:00
|
|
|
local tool = clicker:get_wielded_item()
|
2017-01-16 19:40:08 +03:00
|
|
|
local dog
|
|
|
|
local ent
|
2017-02-19 23:49:15 +03:00
|
|
|
if tool:get_name() == "mcl_mobitems:bone" then
|
|
|
|
clicker:get_inventory():remove_item("main", "mcl_mobitems:bone")
|
2017-01-16 19:40:08 +03:00
|
|
|
dog = minetest.add_entity(self.object:getpos(), "mobs_mc:dog")
|
|
|
|
ent = dog:get_luaentity()
|
|
|
|
ent.owner = clicker:get_player_name()
|
|
|
|
self.object:remove()
|
|
|
|
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 = 0.5,
|
|
|
|
blood_texture = "mobs_blood.png",
|
|
|
|
})
|
2017-02-20 05:00:03 +03:00
|
|
|
mobs:register_spawn("mobs_mc:wolf", {"mcl_core:dirt_with_grass", "mcl_core:dirt", "mcl_core:coarse_dirt", "mcl_core:snow", "mcl_core:snowblock", "mcl_core:podzol"}, 20, 0, 19000, 1, 31000)
|
2017-01-16 19:40:08 +03:00
|
|
|
|
|
|
|
|
|
|
|
-- compatibility
|
|
|
|
mobs:alias_mob("mobs:wolf", "mobs_mc:wolf")
|
|
|
|
mobs:alias_mob("mobs:dog", "mobs_mc:dog")
|
|
|
|
mobs:alias_mob("esmobs:wolf", "mobs_mc:wolf")
|
|
|
|
mobs:alias_mob("esmobs:dog", "mobs_mc:dog")
|
|
|
|
|
|
|
|
-- spawn eggs
|
2017-02-23 23:53:44 +03:00
|
|
|
mobs:register_egg("mobs_mc:wolf", "Spawn Wolf", "spawn_egg_wolf.png", 0)
|
2017-01-16 19:40:08 +03:00
|
|
|
|
|
|
|
|
|
|
|
if minetest.setting_get("log_mods") then
|
|
|
|
minetest.log("action", "MC Wolf loaded")
|
|
|
|
end
|