Vex, evoker, and vindicator

This commit is contained in:
maikerumine 2017-05-26 19:18:05 -04:00
parent 9027a3829e
commit 52b3394bcb
5 changed files with 181 additions and 464 deletions

View File

@ -30,11 +30,11 @@ dofile(path .. "/squid.lua") -- Animation, sound and egg texture by daufinsyd
-- NPC
dofile(path .. "/villager.lua") -- KrupnoPavel Mesh and animation by toby109tt / https://github.com/22i
--dofile(path .. "/villager_agent.lua") -- KrupnoPavel
--dofile(path .. "/villager_evoker.lua") -- KrupnoPavel
--dofile(path .. "/villager_vindicator.lua") -- KrupnoPavel
dofile(path .. "/villager_zombie.lua") -- KrupnoPavel
dofile(path .. "/witch.lua") -- KrupnoPavel
--dofile(path .. "/villager_agent.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/villager_evoker.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/villager_vindicator.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/villager_zombie.lua") -- Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/witch.lua") -- Mesh and animation by toby109tt / https://github.com/22i
--Monsters
dofile(path .. "/blaze.lua") -- Animation by daufinsyd
@ -58,7 +58,7 @@ dofile(path .. "/slimes_green.lua") -- Tomas J. Luis
--dofile(path .. "/snowman.lua") -- maikerumine Mesh and animation by toby109tt / https://github.com/22i
dofile(path .. "/spider.lua") -- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
dofile(path .. "/spider_cave.lua") -- Spider by AspireMint (fishyWET (CC-BY-SA 3.0 license for texture)
--dofile(path .. "/vex.lua") -- KrupnoPavel
dofile(path .. "/vex.lua") -- KrupnoPavel
dofile(path .. "/wither.lua") -- Mesh and animation by toby109tt / https://github.com/22i
--Heads

196
vex.lua
View File

@ -1,4 +1,4 @@
--MCmobs v0.2
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
@ -8,7 +8,7 @@
--###################
--################### VEX
--###################
--[[
mobs:register_mob("mobs_mc:30vex", {
type = "animal",
passive = true,
@ -37,187 +37,67 @@ mobs:register_mob("mobs_mc:30vex", {
})
mobs:register_egg("mobs_mc:30vex", "Vex", "vex_inv.png", 0)
]]
mobs:register_mob("mobs_mc:villager", {
type = "npc",
hp_min = 35,
hp_max = 75,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.95, 0.4},
textures = {
{"mobs_farmer.png"}
},
mobs:register_mob("mobs_mc:vex", {
type = "monster",
--pathfinding = 1,
--physical = false,
hp_min = 10,
hp_max = 15,
--collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.95, 0.4},
collisionbox = {-0.2, 0.01, -0.2, 0.2, 0.5, 0.2}, --bat
rotate = -180,
visual = "mesh",
mesh = "mobs_villager.x",
mesh = "vex.b3d",
textures = {
{"vex.png"},
},
visual_size = {x=1.5, y=1.5},
makes_footstep_sound = true,
damage = 2,
walk_velocity = 1.2,
run_velocity = 2.4,
damage = 1,
view_range = 7,
walk_velocity = 3.2,
run_velocity = 5.9,
group_attack = true,
attack_type = "dogfight",
drops = {
{name = "default:apple",
{name = "mobs_mc:totem",
chance = 10,
min = 1,
max = 2,},
},
armor = 90,
sounds = {
random = "Villager1",
death = "Villagerdead",
damage = "Villagerhurt1",
},
armor = 160,
sounds = {
random = "mobs_rat",
death = "green_slime_death",
},
animation = {
speed_normal = 30,
speed_run = 60,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
run_start = 24,
run_end = 49,
hurt_start = 85,
hurt_end = 115,
death_start = 117,
death_end = 145,
shoot_start = 50,
shoot_end = 82,
speed_normal = 25, speed_run = 50,
stand_start = 40, stand_end = 80,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
view_range = 16,
fear_height = 5,
--[[
on_rightclick = function(self, clicker)
local inv
inv = minetest.get_inventory({type="detached", name="trading_inv"})
if not inv then
inv = minetest.create_detached_inventory("trading_inv", {
allow_take = function(inv, listname, index, stack, player)
if listname == "output" then
inv:remove_item("input", inv:get_stack("wanted", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
end
if listname == "input" or listname == "output" then
--return 1000
return 0
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
if listname == "input" then
return 1000
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
on_take = function(inv, listname, index, stack, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
})
end
inv:set_size("input", 1)
inv:set_size("output", 1)
inv:set_size("wanted", 1)
inv:set_size("offered", 1)
floats=1,
fly = true,
jump_chance = 15,
fear_height = 6,
local trades = {
{"default:apple 12", "default:clay_lump 1"},
{"default:coal_lump 20", "default:clay_lump 1"},
{"default:paper 30", "default:clay_lump 1"},
{"mobs:leather 10", "default:clay_lump 1"},
{"default:book 2", "default:clay_lump 1"},
{"default:clay_lump 3", "default:clay_lump 1"},
{"farming:potato 15", "default:clay_lump 1"},
{"farming:wheat 20", "default:clay_lump 1"},
{"farming:carrot 15", "default:clay_lump 1"},
{"farming:melon_8 8", "default:clay_lump 1"},
{"mobs:rotten_flesh 40", "default:clay_lump 1"},
{"default:gold_ingot 10", "default:clay_lump 1"},
{"farming:cotton 10", "default:clay_lump 1"},
{"wool:white 15", "default:clay_lump 1"},
{"farming:pumpkin 8", "default:clay_lump 1"},
{"default:clay_lump 1", "mobs:beef_cooked 5"},
{"default:clay_lump 1", "mobs:chicken_cooked 7"},
{"default:clay_lump 1", "farming:cookie 6"},
{"default:clay_lump 1", "farming:pumpkin_bread 3"},
{"default:clay_lump 1", "mobs:arrow 10"},
{"default:clay_lump 3", "mobs:bow_wood 1"},
{"default:clay_lump 8", "fishing:pole_wood 1"},
--{"default:clay_lump 4", "potionspack:healthii 1"},
{"default:clay_lump 1", "cake:cake 1"},
{"default:clay_lump 10", "mobs:saddle 1"},
{"default:clay_lump 10", "clock:1 1"},
{"default:clay_lumpd 10", "compass:0 1"},
{"default:clay_lump 1", "default:glass 5"},
{"default:clay_lump 1", "nether:glowstone 3"},
{"default:clay_lump 3", "mobs:shears 1"},
{"default:clay_lump 10", "default:sword_diamond 1"},
{"default:clay_lump 20", "3d_armor:chestplate_diamond 1"},
}
local tradenum = math.random(#trades)
inv:set_stack("wanted", 1, ItemStack(trades[tradenum][1]))
inv:set_stack("offered", 1, ItemStack(trades[tradenum][2]))
local formspec =
"size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;trading_formspec_bg.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"
.."list[detached:trading_inv;wanted;2,1;1,1;]"
.."list[detached:trading_inv;offered;5.75,1;1,1;]"
.."list[detached:trading_inv;input;2,2.5;1,1;]"
.."list[detached:trading_inv;output;5.75,2.5;1,1;]"
minetest.sound_play("Villagertrade", {to_player = clicker:get_player_name()})
minetest.show_formspec(clicker:get_player_name(), "tradespec", formspec)
end,
]]
})
--mobs:register_spawn("mobs_mc:villager", {"default:gravel"}, 20, 8, 50, 8, 31000)
mobs:register_spawn("mobs_mc:villager", {"mg_villages:road"}, 20, 8, 500, 2, 31000)
-- compatibility
mobs:alias_mob("mobs:villager", "mobs_mc:villager")
-- spawn eggs
mobs:register_egg("mobs_mc:villager", "Villager", "spawn_egg_villager.png")
mobs:register_egg("mobs_mc:vex", "Vex", "vex_inv.png", 0)
if minetest.setting_get("log_mods") then
minetest.log("action", "MC mobs loaded")
minetest.log("action", "MC Vex loaded")
end

View File

@ -1,4 +1,4 @@
--MCmobs v0.2
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
@ -8,7 +8,7 @@
--###################
--################### EVOKER
--###################
--[[
mobs:register_mob("mobs_mc:60evoker", {
type = "animal",
passive = true,
@ -35,26 +35,36 @@ mobs:register_mob("mobs_mc:60evoker", {
})
mobs:register_egg("mobs_mc:60evoker", "Evoker", "evoker_inv.png", 0)
]]
mobs:register_mob("mobs_mc:villager", {
type = "npc",
mobs:register_mob("mobs_mc:evoker", {
type = "monster",
physical = false,
pathfinding = 1,
hp_min = 35,
hp_max = 75,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.95, 0.4},
textures = {
{"mobs_farmer.png"}
},
rotate = -180,
visual = "mesh",
mesh = "mobs_villager.x",
mesh = "villager.b3d",
textures = {{"evoker.png"}},
visual_size = {x=3, y=3},
makes_footstep_sound = true,
damage = 2,
walk_velocity = 1.2,
run_velocity = 2.4,
walk_velocity = 0.2,
run_velocity = 1.4,
damage = 1,
group_attack = true,
attack_type = "dogfight",
group_attack = true,
attack_type = "shoot",
arrow = "mobs_mc:vexarrow",
shoot_interval = 3.5,
shoot_offset = 1,
--'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight)
--'dogshoot_count_max' number of seconds before switching above modes.
dogshoot_switch = 1,
dogshoot_count_max =1,
passive = false,
drops = {
{name = "default:apple",
chance = 10,
@ -63,159 +73,107 @@ mobs:register_mob("mobs_mc:villager", {
},
armor = 90,
sounds = {
random = "Villager1",
random = "Villagerdead",
death = "Villagerdead",
damage = "Villagerhurt1",
damage = "mese_dragon",
attack = "zombiedeath",
},
animation = {
speed_normal = 30,
speed_run = 60,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
run_start = 24,
run_end = 49,
hurt_start = 85,
hurt_end = 115,
death_start = 117,
death_end = 145,
shoot_start = 50,
shoot_end = 82,
speed_normal = 25, speed_run = 50,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
view_range = 16,
fear_height = 5,
--[[
on_rightclick = function(self, clicker)
local inv
inv = minetest.get_inventory({type="detached", name="trading_inv"})
if not inv then
inv = minetest.create_detached_inventory("trading_inv", {
allow_take = function(inv, listname, index, stack, player)
if listname == "output" then
inv:remove_item("input", inv:get_stack("wanted", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
end
if listname == "input" or listname == "output" then
--return 1000
return 0
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
if listname == "input" then
return 1000
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
on_take = function(inv, listname, index, stack, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
})
end
inv:set_size("input", 1)
inv:set_size("output", 1)
inv:set_size("wanted", 1)
inv:set_size("offered", 1)
view_range = 13,
fear_height = 2,
local trades = {
{"default:apple 12", "default:clay_lump 1"},
{"default:coal_lump 20", "default:clay_lump 1"},
{"default:paper 30", "default:clay_lump 1"},
{"mobs:leather 10", "default:clay_lump 1"},
{"default:book 2", "default:clay_lump 1"},
{"default:clay_lump 3", "default:clay_lump 1"},
{"farming:potato 15", "default:clay_lump 1"},
{"farming:wheat 20", "default:clay_lump 1"},
{"farming:carrot 15", "default:clay_lump 1"},
{"farming:melon_8 8", "default:clay_lump 1"},
{"mobs:rotten_flesh 40", "default:clay_lump 1"},
{"default:gold_ingot 10", "default:clay_lump 1"},
{"farming:cotton 10", "default:clay_lump 1"},
{"wool:white 15", "default:clay_lump 1"},
{"farming:pumpkin 8", "default:clay_lump 1"},
{"default:clay_lump 1", "mobs:beef_cooked 5"},
{"default:clay_lump 1", "mobs:chicken_cooked 7"},
{"default:clay_lump 1", "farming:cookie 6"},
{"default:clay_lump 1", "farming:pumpkin_bread 3"},
{"default:clay_lump 1", "mobs:arrow 10"},
{"default:clay_lump 3", "mobs:bow_wood 1"},
{"default:clay_lump 8", "fishing:pole_wood 1"},
--{"default:clay_lump 4", "potionspack:healthii 1"},
{"default:clay_lump 1", "cake:cake 1"},
{"default:clay_lump 10", "mobs:saddle 1"},
{"default:clay_lump 10", "clock:1 1"},
{"default:clay_lumpd 10", "compass:0 1"},
{"default:clay_lump 1", "default:glass 5"},
{"default:clay_lump 1", "nether:glowstone 3"},
{"default:clay_lump 3", "mobs:shears 1"},
{"default:clay_lump 10", "default:sword_diamond 1"},
{"default:clay_lump 20", "3d_armor:chestplate_diamond 1"},
}
local tradenum = math.random(#trades)
inv:set_stack("wanted", 1, ItemStack(trades[tradenum][1]))
inv:set_stack("offered", 1, ItemStack(trades[tradenum][2]))
local formspec =
"size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;trading_formspec_bg.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"
.."list[detached:trading_inv;wanted;2,1;1,1;]"
.."list[detached:trading_inv;offered;5.75,1;1,1;]"
.."list[detached:trading_inv;input;2,2.5;1,1;]"
.."list[detached:trading_inv;output;5.75,2.5;1,1;]"
minetest.sound_play("Villagertrade", {to_player = clicker:get_player_name()})
minetest.show_formspec(clicker:get_player_name(), "tradespec", formspec)
end,
]]
})
--mobs:register_spawn("mobs_mc:villager", {"default:gravel"}, 20, 8, 50, 8, 31000)
mobs:register_spawn("mobs_mc:villager", {"mg_villages:road"}, 20, 8, 500, 2, 31000)
-- fireball (weapon)
mobs:register_arrow(":mobs_mc:vexarrow", {
visual = "sprite",
visual_size = {x = 0.5, y = 0.5},
textures = {"vex_inv.png"},
velocity = 6,
tail = 1, --'tail' when set to 1 adds a trail or tail to mob arrows
tail_texture = "vex_inv.png", --'tail_texture' texture string used for above effect
tail_size = {x = 100, y = 100}, --'tail_size' has size for above texture (defaults to between 5 and 10)
expire = 0.45, --'expire' contains float value for how long tail appears for (defaults to 0.25)
glow = 7,
drop = "mobs_mc:vex",
-- direct hit, no fire... just plenty of pain
hit_player = function(self, player)
--vexspawn = minetest.add_entity(self.object:getpos(), "mobs_mc:vex")
--ent = vexspawn:get_luaentity()
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 2},
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 2},
}, nil)
end,
-- node hit, spawn vex
hit_node = function(self, pos, node)
--mobs:explosion(pos, 0, 0, 0)
vexspawn = minetest.add_entity(self.object:getpos(), "mobs_mc:vex")
--ent = vexspawn:get_luaentity()
--drop = "mobs_mc:vex"
end
})
--[[
mobs:spawn_specfic(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height, day_toggle, on_spawn)
These functions register a spawn algorithm for the mob. Without this function the call the mobs won't spawn.
'name' is the name of the animal/monster
'nodes' is a list of nodenames on that the animal/monster can spawn on top of
'neighbors' is a list of nodenames on that the animal/monster will spawn beside (default is {"air"} for mobs:register_spawn)
'max_light' is the maximum of light
'min_light' is the minimum of light
'interval' is same as in register_abm() (default is 30 for mobs:register_spawn)
'chance' is same as in register_abm()
'active_object_count' mob is only spawned if active_object_count_wider of ABM is <= this
'min_height' is the minimum height the mob can spawn
'max_height' is the maximum height the mob can spawn
'day_toggle' true for day spawning, false for night or nil for anytime
'on_spawn' is a custom function which runs after mob has spawned and gives self and pos values.]]
--mobs:register_spawn("mobs_mc:evoker", {"mg_villages:road"}, 20, 8, 500, 2, 31000)
--mobs:spawn_specific("mobs_mc:evoker", {"default:acacia_tree"}, {"default:ladder_wood"}, 0, 20, 60, 300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:aspen_tree"}, {"default:ladder_wood"}, 0, 20, 60, 300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:tree"}, {"default:ladder_wood"}, 0, 20, 60, 300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:jungletree"}, {"default:ladder_wood"}, 0, 20, 60, 300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:pine_tree"}, {"default:ladder_wood"}, 0, 20, 60, 300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:acacia_tree"}, {"default:glass"}, 0, 20, 60, 1300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:aspen_tree"}, {"default:glass"}, 0, 20, 60, 1300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:tree"}, {"default:glass"}, 0, 20, 60, 1300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:jungletree"}, {"default:glass"}, 0, 20, 60, 1300, 1, -31000, 150)
--mobs:spawn_specific("mobs_mc:evoker", {"default:pine_tree"}, {"default:glass"}, 0, 20, 60, 1300, 1, -31000, 150)
mobs:spawn_specific("mobs_mc:evoker", {"stairs:slab_junglewood"}, {"air"}, 0, 20, 30, 3000, 1, -31000, 150, true)
mobs:spawn_specific("mobs_mc:evoker", {"stairs:slab_acacia_wood"}, {"air"}, 0, 10, 30, 3000, 1, -31000, 150, true)
mobs:spawn_specific("mobs_mc:evoker", {"stairs:slab_pine_wood"}, {"air"}, 0, 10, 30, 3000, 1, -31000, 150, true)
mobs:spawn_specific("mobs_mc:evoker", {"stairs:slab_aspen_wood"}, {"air"}, 0, 10, 30, 3000, 1, -31000, 150, true)
-- compatibility
mobs:alias_mob("mobs:villager", "mobs_mc:villager")
-- spawn eggs
mobs:register_egg("mobs_mc:villager", "Villager", "spawn_egg_villager.png")
mobs:register_egg("mobs_mc:evoker", "Evoker", "evoker_inv.png", 0)
if minetest.setting_get("log_mods") then
minetest.log("action", "MC mobs loaded")
minetest.log("action", "MC Evoker loaded")
end

View File

@ -1,4 +1,4 @@
--MCmobs v0.2
--MCmobs v0.4
--maikerumine
--made for MC like Survival game
--License for code WTFPL and otherwise stated in readmes
@ -8,7 +8,7 @@
--###################
--################### VINDICATOR
--###################
--[[
mobs:register_mob("mobs_mc:61vindicator", {
type = "animal",
passive = true,
@ -35,18 +35,20 @@ mobs:register_mob("mobs_mc:61vindicator", {
})
mobs:register_egg("mobs_mc:61vindicator", "Vindicator", "vindicator_inv.png", 0)
]]
mobs:register_mob("mobs_mc:villager", {
type = "npc",
mobs:register_mob("mobs_mc:vindicator", {
type = "monster",
physical = false,
pathfinding = 1,
hp_min = 35,
hp_max = 75,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.95, 0.4},
textures = {
{"mobs_farmer.png"}
},
rotate = -180,
visual = "mesh",
mesh = "mobs_villager.x",
mesh = "villager.b3d",
textures = {{"vindicator.png"}},
visual_size = {x=3, y=3},
makes_footstep_sound = true,
damage = 2,
walk_velocity = 1.2,
@ -67,154 +69,31 @@ mobs:register_mob("mobs_mc:villager", {
damage = "Villagerhurt1",
},
animation = {
speed_normal = 30,
speed_run = 60,
stand_start = 0,
stand_end = 23,
walk_start = 24,
walk_end = 49,
run_start = 24,
run_end = 49,
hurt_start = 85,
hurt_end = 115,
death_start = 117,
death_end = 145,
shoot_start = 50,
shoot_end = 82,
speed_normal = 25, speed_run = 50,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
},
drawtype = "front",
water_damage = 1,
lava_damage = 5,
light_damage = 0,
view_range = 16,
fear_height = 5,
--[[
on_rightclick = function(self, clicker)
local inv
inv = minetest.get_inventory({type="detached", name="trading_inv"})
if not inv then
inv = minetest.create_detached_inventory("trading_inv", {
allow_take = function(inv, listname, index, stack, player)
if listname == "output" then
inv:remove_item("input", inv:get_stack("wanted", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
end
if listname == "input" or listname == "output" then
--return 1000
return 0
else
return 0
end
end,
allow_put = function(inv, listname, index, stack, player)
if listname == "input" then
return 1000
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
on_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
on_take = function(inv, listname, index, stack, player)
if inv:contains_item("input", inv:get_stack("wanted", 1)) then
inv:set_stack("output", 1, inv:get_stack("offered", 1))
minetest.sound_play("Villageraccept", {to_player = player:get_player_name()})
else
inv:set_stack("output", 1, ItemStack(""))
minetest.sound_play("Villagerdeny", {to_player = player:get_player_name()})
end
end,
})
end
inv:set_size("input", 1)
inv:set_size("output", 1)
inv:set_size("wanted", 1)
inv:set_size("offered", 1)
view_range = 13,
fear_height = 3,
local trades = {
{"default:apple 12", "default:clay_lump 1"},
{"default:coal_lump 20", "default:clay_lump 1"},
{"default:paper 30", "default:clay_lump 1"},
{"mobs:leather 10", "default:clay_lump 1"},
{"default:book 2", "default:clay_lump 1"},
{"default:clay_lump 3", "default:clay_lump 1"},
{"farming:potato 15", "default:clay_lump 1"},
{"farming:wheat 20", "default:clay_lump 1"},
{"farming:carrot 15", "default:clay_lump 1"},
{"farming:melon_8 8", "default:clay_lump 1"},
{"mobs:rotten_flesh 40", "default:clay_lump 1"},
{"default:gold_ingot 10", "default:clay_lump 1"},
{"farming:cotton 10", "default:clay_lump 1"},
{"wool:white 15", "default:clay_lump 1"},
{"farming:pumpkin 8", "default:clay_lump 1"},
{"default:clay_lump 1", "mobs:beef_cooked 5"},
{"default:clay_lump 1", "mobs:chicken_cooked 7"},
{"default:clay_lump 1", "farming:cookie 6"},
{"default:clay_lump 1", "farming:pumpkin_bread 3"},
{"default:clay_lump 1", "mobs:arrow 10"},
{"default:clay_lump 3", "mobs:bow_wood 1"},
{"default:clay_lump 8", "fishing:pole_wood 1"},
--{"default:clay_lump 4", "potionspack:healthii 1"},
{"default:clay_lump 1", "cake:cake 1"},
{"default:clay_lump 10", "mobs:saddle 1"},
{"default:clay_lump 10", "clock:1 1"},
{"default:clay_lumpd 10", "compass:0 1"},
{"default:clay_lump 1", "default:glass 5"},
{"default:clay_lump 1", "nether:glowstone 3"},
{"default:clay_lump 3", "mobs:shears 1"},
{"default:clay_lump 10", "default:sword_diamond 1"},
{"default:clay_lump 20", "3d_armor:chestplate_diamond 1"},
}
local tradenum = math.random(#trades)
inv:set_stack("wanted", 1, ItemStack(trades[tradenum][1]))
inv:set_stack("offered", 1, ItemStack(trades[tradenum][2]))
local formspec =
"size[9,8.75]"..
"background[-0.19,-0.25;9.41,9.49;trading_formspec_bg.png]"..
"bgcolor[#080808BB;true]"..
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"
.."list[detached:trading_inv;wanted;2,1;1,1;]"
.."list[detached:trading_inv;offered;5.75,1;1,1;]"
.."list[detached:trading_inv;input;2,2.5;1,1;]"
.."list[detached:trading_inv;output;5.75,2.5;1,1;]"
minetest.sound_play("Villagertrade", {to_player = clicker:get_player_name()})
minetest.show_formspec(clicker:get_player_name(), "tradespec", formspec)
end,
]]
})
--mobs:register_spawn("mobs_mc:villager", {"default:gravel"}, 20, 8, 50, 8, 31000)
mobs:register_spawn("mobs_mc:villager", {"mg_villages:road"}, 20, 8, 500, 2, 31000)
--mobs:register_spawn("mobs_mc:vindicator", {"mg_villages:road"}, 20, 8, 500, 2, 31000)
mobs:spawn_specific("mobs_mc:vindicator", {"default:acacia_tree"}, {"default:ladder_wood"}, 0, 12, 60, 1300, 1, -31000, 150)
mobs:spawn_specific("mobs_mc:vindicator", {"default:aspen_tree"}, {"default:ladder_wood"}, 0, 12, 60, 1300, 1, -31000, 150)
mobs:spawn_specific("mobs_mc:vindicator", {"default:tree"}, {"default:ladder_wood"}, 0, 12, 60, 1300, 1, -31000, 150)
mobs:spawn_specific("mobs_mc:vindicator", {"default:jungletree"}, {"default:ladder_wood"}, 0, 12, 60, 1300, 1, -31000, 150)
mobs:spawn_specific("mobs_mc:vindicator", {"default:pine_tree"}, {"default:ladder_wood"}, 0, 12, 60, 1300, 1, -31000, 150)
-- compatibility
mobs:alias_mob("mobs:villager", "mobs_mc:villager")
mobs:spawn_specific("mobs_mc:evoker", {"doors:door_wood_b"}, {"air"}, 0, 60, 15, 3000, 1, -31000, 150, true)
-- spawn eggs
mobs:register_egg("mobs_mc:villager", "Villager", "spawn_egg_villager.png")
mobs:register_egg("mobs_mc:vindicator", "Vindicator", "vindicator_inv.png", 0)
if minetest.setting_get("log_mods") then
minetest.log("action", "MC mobs loaded")
minetest.log("action", "MC vindicator loaded")
end

View File

@ -110,7 +110,7 @@ local zombie = {
lava_damage = 5,
-- TODO: Burn mob only when in direct sunlight
light_damage = 1,
view_range = 40,
view_range = 17,
attack_type = "dogfight",
}