2017-07-05 03:15:46 +02:00
|
|
|
--MCmobs v0.4
|
|
|
|
--maikerumine
|
|
|
|
--made for MC like Survival game
|
|
|
|
--License for code WTFPL and otherwise stated in readmes
|
|
|
|
|
2022-02-13 21:40:12 +01:00
|
|
|
local S = minetest.get_translator("mobs_mc")
|
2017-07-05 03:15:46 +02:00
|
|
|
|
|
|
|
--###################
|
|
|
|
--################### ZOMBIE VILLAGER
|
|
|
|
--###################
|
|
|
|
|
2021-01-23 15:40:12 +01:00
|
|
|
local professions = {
|
|
|
|
farmer = "mobs_mc_villager_farmer.png",
|
|
|
|
fisherman = "mobs_mc_villager_farmer.png",
|
|
|
|
fletcher = "mobs_mc_villager_farmer.png",
|
|
|
|
shepherd = "mobs_mc_villager_farmer.png",
|
|
|
|
librarian = "mobs_mc_villager_librarian.png",
|
|
|
|
cartographer = "mobs_mc_villager_librarian.png",
|
|
|
|
armorer = "mobs_mc_villager_smith.png",
|
|
|
|
leatherworker = "mobs_mc_villager_butcher.png",
|
|
|
|
butcher = "mobs_mc_villager_butcher.png",
|
|
|
|
weapon_smith = "mobs_mc_villager_smith.png",
|
|
|
|
tool_smith = "mobs_mc_villager_smith.png",
|
|
|
|
cleric = "mobs_mc_villager_priest.png",
|
|
|
|
nitwit = "mobs_mc_villager.png",
|
|
|
|
}
|
2017-07-05 03:15:46 +02:00
|
|
|
|
2022-11-09 04:09:58 +01:00
|
|
|
mcl_mobs.register_mob("mobs_mc:villager_zombie", {
|
2021-04-25 17:30:15 +02:00
|
|
|
description = S("Zombie Villager"),
|
2017-07-05 03:15:46 +02:00
|
|
|
type = "monster",
|
2020-04-11 02:46:03 +02:00
|
|
|
spawn_class = "hostile",
|
2022-07-17 02:20:51 +02:00
|
|
|
spawn_in_group = 1,
|
2017-07-05 03:15:46 +02:00
|
|
|
hp_min = 20,
|
|
|
|
hp_max = 20,
|
2020-12-06 15:46:42 +01:00
|
|
|
xp_min = 5,
|
|
|
|
xp_max = 5,
|
2019-10-02 18:31:16 +02:00
|
|
|
breath_max = -1,
|
2020-11-09 18:59:08 +01:00
|
|
|
armor = {undead = 90, fleshy = 90},
|
2017-07-05 03:15:46 +02:00
|
|
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3},
|
|
|
|
visual = "mesh",
|
2017-09-13 23:13:47 +02:00
|
|
|
mesh = "mobs_mc_villager_zombie.b3d",
|
2022-10-06 03:30:02 +02:00
|
|
|
head_swivel = "Head_Control",
|
2024-11-11 17:29:07 +01:00
|
|
|
head_bone_position = vector.new( 0, 2.35, 0 ), -- for minetest <= 5.8
|
2022-10-06 03:30:02 +02:00
|
|
|
curiosity = 2,
|
2017-07-05 03:15:46 +02:00
|
|
|
textures = {
|
2022-10-06 03:30:02 +02:00
|
|
|
{"mobs_mc_zombie_butcher.png"},
|
|
|
|
{"mobs_mc_zombie_farmer.png"},
|
|
|
|
{"mobs_mc_zombie_librarian.png"},
|
|
|
|
{"mobs_mc_zombie_priest.png"},
|
|
|
|
{"mobs_mc_zombie_smith.png"},
|
|
|
|
{"mobs_mc_zombie_villager.png"},
|
2017-07-05 03:15:46 +02:00
|
|
|
},
|
2021-03-19 14:32:02 +01:00
|
|
|
visual_size = {x=2.75, y=2.75},
|
2017-07-05 03:15:46 +02:00
|
|
|
makes_footstep_sound = true,
|
|
|
|
damage = 3,
|
2017-07-26 00:26:18 +02:00
|
|
|
reach = 2,
|
2017-07-05 03:15:46 +02:00
|
|
|
walk_velocity = 1.2,
|
2023-03-19 02:33:36 +01:00
|
|
|
run_velocity = 1.8,
|
2022-02-13 21:40:12 +01:00
|
|
|
attack_type = "dogfight",
|
2017-07-05 03:15:46 +02:00
|
|
|
group_attack = true,
|
|
|
|
drops = {
|
2022-05-25 23:25:15 +02:00
|
|
|
{name = "mcl_mobitems:rotten_flesh",
|
2017-07-05 03:15:46 +02:00
|
|
|
chance = 1,
|
|
|
|
min = 0,
|
2020-12-23 17:41:42 +01:00
|
|
|
max = 2,
|
|
|
|
looting = "common",},
|
2022-05-25 23:25:15 +02:00
|
|
|
{name = "mcl_core:iron_ingot",
|
2018-01-23 23:13:55 +01:00
|
|
|
chance = 120, -- 2.5% / 3
|
2017-07-05 03:15:46 +02:00
|
|
|
min = 1,
|
2020-12-23 17:41:42 +01:00
|
|
|
max = 1,
|
|
|
|
looting = "rare",
|
|
|
|
looting_factor = 0.01 / 3,},
|
2022-05-25 23:25:15 +02:00
|
|
|
{name = "mcl_farming:carrot_item",
|
2018-01-23 23:13:55 +01:00
|
|
|
chance = 120, -- 2.5% / 3
|
2017-07-05 03:15:46 +02:00
|
|
|
min = 1,
|
2020-12-23 17:41:42 +01:00
|
|
|
max = 1,
|
|
|
|
looting = "rare",
|
|
|
|
looting_factor = 0.01 / 3,},
|
2022-05-25 23:25:15 +02:00
|
|
|
{name = "mcl_farming:potato_item",
|
2018-01-23 23:13:55 +01:00
|
|
|
chance = 120, -- 2.5% / 3
|
2017-07-05 03:15:46 +02:00
|
|
|
min = 1,
|
2020-12-23 17:41:42 +01:00
|
|
|
max = 1,
|
|
|
|
looting = "rare",
|
|
|
|
looting_factor = 0.01 / 3,},
|
2017-07-05 03:15:46 +02:00
|
|
|
},
|
|
|
|
sounds = {
|
2019-01-31 06:56:03 +01:00
|
|
|
random = "mobs_mc_zombie_growl",
|
|
|
|
war_cry = "mobs_mc_zombie_growl",
|
2017-07-20 16:34:16 +02:00
|
|
|
death = "mobs_mc_zombie_death",
|
|
|
|
damage = "mobs_mc_zombie_hurt",
|
2017-07-05 03:15:46 +02:00
|
|
|
distance = 16,
|
|
|
|
},
|
|
|
|
animation = {
|
|
|
|
speed_normal = 25,
|
|
|
|
speed_run = 50,
|
|
|
|
stand_start = 20,
|
|
|
|
stand_end = 40,
|
|
|
|
walk_start = 0,
|
|
|
|
walk_end = 20,
|
|
|
|
run_start = 0,
|
|
|
|
run_end = 20,
|
|
|
|
},
|
2021-01-23 15:40:12 +01:00
|
|
|
on_rightclick = function(self, clicker)
|
|
|
|
if not self._curing and clicker and clicker:is_player() then
|
|
|
|
local wielditem = clicker:get_wielded_item()
|
|
|
|
-- ToDo: Only cure if zombie villager has the weakness effect
|
|
|
|
if wielditem:get_name() == "mcl_core:apple_gold" then
|
|
|
|
wielditem:take_item()
|
|
|
|
clicker:set_wielded_item(wielditem)
|
|
|
|
self._curing = math.random(3 * 60, 5 * 60)
|
|
|
|
self.shaking = true
|
2023-05-04 22:14:16 +02:00
|
|
|
self.persistent = true
|
2021-01-23 15:40:12 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
do_custom = function(self, dtime)
|
|
|
|
if self._curing then
|
|
|
|
self._curing = self._curing - dtime
|
|
|
|
local obj = self.object
|
|
|
|
if self._curing <= 0 then
|
|
|
|
local villager_obj = minetest.add_entity(obj:get_pos(), "mobs_mc:villager")
|
|
|
|
local villager = villager_obj:get_luaentity()
|
|
|
|
local yaw = obj:get_yaw()
|
|
|
|
villager_obj:set_yaw(yaw)
|
|
|
|
villager.target_yaw = yaw
|
|
|
|
villager.nametag = self.nametag
|
2022-06-26 00:39:31 +02:00
|
|
|
villager._profession = "unemployed"
|
2021-01-23 15:40:12 +01:00
|
|
|
self._curing = nil
|
|
|
|
mcl_burning.extinguish(obj)
|
|
|
|
obj:remove()
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
2021-01-02 12:43:50 +01:00
|
|
|
sunlight_damage = 2,
|
|
|
|
ignited_by_sunlight = true,
|
2024-09-15 23:14:10 +02:00
|
|
|
floats = 0,
|
2017-07-05 03:15:46 +02:00
|
|
|
view_range = 16,
|
2019-03-09 00:54:49 +01:00
|
|
|
fear_height = 4,
|
2020-07-12 22:56:41 +02:00
|
|
|
harmed_by_heal = true,
|
2022-08-01 00:36:33 +02:00
|
|
|
attack_npcs = true,
|
2017-07-05 03:15:46 +02:00
|
|
|
})
|
|
|
|
|
2022-05-25 14:44:49 +02:00
|
|
|
mcl_mobs:spawn_specific(
|
2021-04-15 21:04:25 +02:00
|
|
|
"mobs_mc:villager_zombie",
|
|
|
|
"overworld",
|
2021-04-08 14:09:43 +02:00
|
|
|
"ground",
|
|
|
|
{
|
|
|
|
"FlowerForest_underground",
|
|
|
|
"JungleEdge_underground",
|
|
|
|
"StoneBeach_underground",
|
|
|
|
"MesaBryce_underground",
|
|
|
|
"Mesa_underground",
|
|
|
|
"RoofedForest_underground",
|
|
|
|
"Jungle_underground",
|
|
|
|
"Swampland_underground",
|
|
|
|
"BirchForest_underground",
|
|
|
|
"Plains_underground",
|
|
|
|
"MesaPlateauF_underground",
|
|
|
|
"ExtremeHills_underground",
|
|
|
|
"MegaSpruceTaiga_underground",
|
|
|
|
"BirchForestM_underground",
|
|
|
|
"SavannaM_underground",
|
|
|
|
"MesaPlateauFM_underground",
|
|
|
|
"Desert_underground",
|
|
|
|
"Savanna_underground",
|
|
|
|
"Forest_underground",
|
|
|
|
"SunflowerPlains_underground",
|
|
|
|
"ColdTaiga_underground",
|
|
|
|
"IcePlains_underground",
|
|
|
|
"IcePlainsSpikes_underground",
|
|
|
|
"MegaTaiga_underground",
|
|
|
|
"Taiga_underground",
|
|
|
|
"ExtremeHills+_underground",
|
|
|
|
"JungleM_underground",
|
|
|
|
"ExtremeHillsM_underground",
|
|
|
|
"JungleEdgeM_underground",
|
|
|
|
"Mesa",
|
|
|
|
"FlowerForest",
|
|
|
|
"Swampland",
|
|
|
|
"Taiga",
|
|
|
|
"ExtremeHills",
|
|
|
|
"Jungle",
|
|
|
|
"Savanna",
|
|
|
|
"BirchForest",
|
|
|
|
"MegaSpruceTaiga",
|
|
|
|
"MegaTaiga",
|
|
|
|
"ExtremeHills+",
|
|
|
|
"Forest",
|
|
|
|
"Plains",
|
|
|
|
"Desert",
|
|
|
|
"ColdTaiga",
|
|
|
|
"IcePlainsSpikes",
|
|
|
|
"SunflowerPlains",
|
|
|
|
"IcePlains",
|
|
|
|
"RoofedForest",
|
|
|
|
"ExtremeHills+_snowtop",
|
|
|
|
"MesaPlateauFM_grasstop",
|
|
|
|
"JungleEdgeM",
|
|
|
|
"ExtremeHillsM",
|
|
|
|
"JungleM",
|
|
|
|
"BirchForestM",
|
|
|
|
"MesaPlateauF",
|
|
|
|
"MesaPlateauFM",
|
|
|
|
"MesaPlateauF_grasstop",
|
|
|
|
"MesaBryce",
|
|
|
|
"JungleEdge",
|
|
|
|
"SavannaM",
|
|
|
|
"FlowerForest_beach",
|
|
|
|
"Forest_beach",
|
|
|
|
"StoneBeach",
|
|
|
|
"ColdTaiga_beach_water",
|
|
|
|
"Taiga_beach",
|
|
|
|
"Savanna_beach",
|
|
|
|
"Plains_beach",
|
|
|
|
"ExtremeHills_beach",
|
|
|
|
"ColdTaiga_beach",
|
|
|
|
"Swampland_shore",
|
|
|
|
"JungleM_shore",
|
|
|
|
"Jungle_shore",
|
|
|
|
"MesaPlateauFM_sandlevel",
|
|
|
|
"MesaPlateauF_sandlevel",
|
|
|
|
"MesaBryce_sandlevel",
|
|
|
|
"Mesa_sandlevel",
|
|
|
|
},
|
2021-04-15 21:04:25 +02:00
|
|
|
0,
|
|
|
|
7,
|
|
|
|
30,
|
2023-11-27 10:47:55 +01:00
|
|
|
50,
|
2021-04-15 21:04:25 +02:00
|
|
|
4,
|
2022-05-25 23:25:15 +02:00
|
|
|
mcl_vars.mg_overworld_min,
|
|
|
|
mcl_vars.mg_overworld_max)
|
|
|
|
--mcl_mobs:spawn_specific("mobs_mc:villager_zombie", "overworld", "ground", 0, 7, 30, 60000, 4, mcl_vars.mg_overworld_min, mcl_vars.mg_overworld_max)
|
2017-07-05 03:15:46 +02:00
|
|
|
|
|
|
|
-- spawn eggs
|
2022-11-09 04:09:58 +01:00
|
|
|
mcl_mobs.register_egg("mobs_mc:villager_zombie", S("Zombie Villager"), "#563d33", "#799c66", 0)
|