1
0
Fork 0

Merge branch 'master' into grindstone_gui

mobs-redo
ChrisPHP 2022-08-18 19:59:30 +01:00
commit 183830e0a6
18 changed files with 181 additions and 20 deletions

View File

@ -161,9 +161,9 @@ minetest.register_on_dieplayer(function(player, mt_reason)
if mt_reason.approved then if mt_reason.approved then
mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason)) mcl_damage.run_death_callbacks(player, mcl_damage.from_mt(mt_reason))
end end
minetest.log("action","Player "..player:get_player_name().." died at "..minetest.pos_to_string(vector.round(player:get_pos())))
end) end)
minetest.register_on_mods_loaded(function() minetest.register_on_mods_loaded(function()
table.sort(mcl_damage.modifiers, function(a, b) return a.priority < b.priority end) table.sort(mcl_damage.modifiers, function(a, b) return a.priority < b.priority end)
end) end)

View File

@ -407,15 +407,15 @@ local set_animation = function(self, anim, fixed_frame)
if flight_check(self) and self.fly and anim == "walk" then anim = "fly" end if flight_check(self) and self.fly and anim == "walk" then anim = "fly" end
self.animation.current = self.animation.current or "" self._current_animation = self._current_animation or ""
if (anim == self.animation.current if (anim == self._current_animation
or not self.animation[anim .. "_start"] or not self.animation[anim .. "_start"]
or not self.animation[anim .. "_end"]) and self.state ~= "die" then or not self.animation[anim .. "_end"]) and self.state ~= "die" then
return return
end end
self.animation.current = anim self._current_animation = anim
local a_start = self.animation[anim .. "_start"] local a_start = self.animation[anim .. "_start"]
local a_end local a_end

View File

@ -513,6 +513,7 @@ if mobs_spawn then
local mob_def = mob_library_worker_table[mob_index] local mob_def = mob_library_worker_table[mob_index]
local mob_type = minetest.registered_entities[mob_def.name].type local mob_type = minetest.registered_entities[mob_def.name].type
local spawn_in_group = minetest.registered_entities[mob_def.name].spawn_in_group or 4 local spawn_in_group = minetest.registered_entities[mob_def.name].spawn_in_group or 4
local spawn_in_group_min = minetest.registered_entities[mob_def.name].spawn_in_group_min or 1
local mob_count_wide = count_mobs(pos,aoc_range,mob_type) local mob_count_wide = count_mobs(pos,aoc_range,mob_type)
local mob_count = count_mobs(spawning_position,32,mob_type) local mob_count = count_mobs(spawning_position,32,mob_type)
if mob_def if mob_def

View File

@ -312,10 +312,6 @@ mcl_mobs:register_mob("mobs_mc:enderman", {
else return end else return end
-- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE. -- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE.
if self.state == "attack" then if self.state == "attack" then
--if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
--self:teleport(nil)
--self.state = ""
--else
if self.attack then if self.attack then
local target = self.attack local target = self.attack
local pos = target:get_pos() local pos = target:get_pos()
@ -325,11 +321,15 @@ mcl_mobs:register_mob("mobs_mc:enderman", {
end end
end end
end end
--end else --if not attacking try to tp to the dark
if minetest.get_node_light(enderpos) > minetest.LIGHT_MAX then
self:teleport(nil)
end
end end
-- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE. -- ARROW / DAYTIME PEOPLE AVOIDANCE BEHAVIOUR HERE.
-- Check for arrows and people nearby. -- Check for arrows and people nearby.
local enderpos = self.object:get_pos()
enderpos = self.object:get_pos()
enderpos.y = enderpos.y + 1.5 enderpos.y = enderpos.y + 1.5
local objs = minetest.get_objects_inside_radius(enderpos, 2) local objs = minetest.get_objects_inside_radius(enderpos, 2)
for n = 1, #objs do for n = 1, #objs do

View File

@ -114,6 +114,7 @@ dofile(path .. "/squid.lua") -- Animation, sound and egg texture by daufinsyd
dofile(path .. "/villager.lua") -- KrupnoPavel Mesh and animation by toby109tt / https://github.com/22i dofile(path .. "/villager.lua") -- KrupnoPavel Mesh and animation by toby109tt / https://github.com/22i
-- Illagers and witch -- Illagers and witch
dofile(path .. "/pillager.lua") -- Mesh by KrupnoPavel and MrRar, animation by MrRar
dofile(path .. "/villager_evoker.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_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 .. "/villager_zombie.lua") -- Mesh and animation by toby109tt / https://github.com/22i

View File

@ -65,3 +65,4 @@ Nitwit=
Cod= Cod=
Salmon= Salmon=
Dolphin= Dolphin=
Pillager=

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,122 @@
local S = minetest.get_translator("mobs_mc")
local function reload(self)
if not self.object:get_pos() then return end
minetest.sound_play("mcl_bows_crossbow_drawback_1", {object = self.object, max_hear_distance=16}, true)
local props = self.object:get_properties()
if not props then return end
props.textures[2] = "mcl_bows_crossbow_3.png^[resize:16x16"
self.object:set_properties(props)
end
local function reset_animation(self, animation)
if not self.object:get_pos() or self._current_animation ~= animation then return end
self._current_animation = "stand_reload" -- Mobs Redo won't set the animation unless we do this
mcl_mobs:set_animation(self, animation)
end
pillager = {
description = S("Pillager"),
type = "monster",
spawn_class = "hostile",
hp_min = 24,
hp_max = 24,
xp_min = 6,
xp_max = 6,
breath_max = -1,
eye_height = 1.5,
shoot_interval = 3,
shoot_offset = 1.5,
armor = {fleshy = 100},
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
pathfinding = 1,
group_attack = true,
visual = "mesh",
mesh = "mobs_mc_pillager.b3d",
visual_size = {x=2.75, y=2.75},
makes_footstep_sound = true,
walk_velocity = 1.2,
run_velocity = 4,
view_range = 16,
fear_height = 4,
arrow = "mcl_bows:arrow_entity",
attack_type = "dogshoot", -- Alternate punching/shooting
reach = 0, -- Punching max distance
damage = 0, -- Punching damage
dogshoot_switch = 1, -- Start of shooting
dogshoot_count_max = 5, -- Max time spent shooting (standing)
dogshoot_count2_max = 1, -- Max time spent punching (running)
sounds = {
random = "mobs_mc_pillager_grunt2",
war_cry = "mobs_mc_pillager_grunt1",
death = "mobs_mc_pillager_ow2",
damage = "mobs_mc_pillager_ow1",
distance = 16,
},
textures = {
{
"mobs_mc_pillager.png", -- Skin
"mcl_bows_crossbow_3.png^[resize:16x16", -- Wielded item
}
},
drops = {
{
name = "mcl_bows:arrow",
chance = 1,
min = 0,
max = 2,
looting = "common",
},
{
name = "mcl_bows:crossbow",
chance = 100 / 8.5,
min = 1,
max = 1,
looting = "rare",
},
},
animation = {
unloaded_walk_start = 1, unloaded_walk_end = 40,
unloaded_stand_start = 41, unloaded_stand_end = 60,
reload_stand_start = 61, reload_stand_end = 100, reload_stand_speed = 20,
stand_start = 101, stand_end = 109, stand_speed = 6,
walk_start = 111, walk_end = 150, walk_speed = 30,
run_start = 111, run_end = 150, run_speed = 50,
reload_run_start = 151, reload_run_end = 190, reload_run_speed = 20,
die_start = 191, die_end = 192, die_speed = 15,
stand_unloaded_start = 40, stand_unloaded_end = 59,
die_loop = false,
},
shoot_arrow = function(self, pos, dir)
minetest.sound_play("mcl_bows_crossbow_shoot", {object = self.object, max_hear_distance=16}, true)
local props = self.object:get_properties()
props.textures[2] = "mcl_bows_crossbow_0.png^[resize:16x16"
self.object:set_properties(props)
local old_anim = self._current_animation
if old_anim == "run" or old_anim == "walk" then
mcl_mobs:set_animation(self, "reload_run")
end
if old_anim == "stand" then
mcl_mobs:set_animation(self, "reload_stand")
end
self._current_animation = old_anim -- Mobs Redo will imediately reset the animation otherwise
minetest.after(1, reload, self)
minetest.after(2, reset_animation, self, old_anim)
-- 2-4 damage per arrow
local dmg = math.max(4, math.random(2, 8))
mcl_bows_s.shoot_arrow_crossbow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object, nil, dmg)
-- While we are at it, change the sounds since there is no way to do this in Mobs Redo
if self.sounds and self.sounds.random then
self.sounds = table.copy(self.sounds)
self.sounds.random = "mobs_mc_pillager_grunt" .. math.random(2)
end
-- Randomize reload time
self.shoot_interval = math.random(3, 4)
end,
}
mcl_mobs:register_mob("mobs_mc:pillager", pillager)
mcl_mobs:register_egg("mobs_mc:pillager", S("Pillager"), "mobs_mc_spawn_icon_pillager.png", 0)

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

View File

@ -28,6 +28,11 @@ return {
"Code-Sploit", "Code-Sploit",
"NO11", "NO11",
"kabou", "kabou",
"rudzik8",
"chmodsayshello",
"PrarieWind",
"RandomLegoBrick",
"SumianVoice",
}}, }},
{S("Contributors"), 0x52FF00, { {S("Contributors"), 0x52FF00, {
"Laurent Rocher", "Laurent Rocher",
@ -72,6 +77,12 @@ return {
"Sven792", "Sven792",
"aldum", "aldum",
"Dieter44", "Dieter44",
"Pepebotella",
"MrRar",
"Lazerbeak12345",
"mrminer",
"Thunder1035",
"opfromthestart",
}}, }},
{S("MineClone5"), 0xA60014, { {S("MineClone5"), 0xA60014, {
"kay27", "kay27",
@ -79,10 +90,12 @@ return {
"epCode", "epCode",
"NO11", "NO11",
"j45", "j45",
"chmodsayshello",
"3raven", "3raven",
"PrarieWind", "PrarieWind",
"Gustavo1", "Gustavo1",
"CableGuy67", "CableGuy67",
"MrRar",
}}, }},
{S("Mineclonia"), 0xFFFFFF, { {S("Mineclonia"), 0xFFFFFF, {
"erlehmann", "erlehmann",
@ -135,6 +148,9 @@ return {
"yutyo", "yutyo",
"NO11", "NO11",
"kay27", "kay27",
"MysticTempest",
"RandomLegoBrick",
"cora",
}}, }},
{S("Translations"), 0x00FF60, { {S("Translations"), 0x00FF60, {
"Wuzzy", "Wuzzy",
@ -144,6 +160,8 @@ return {
"pitchum", "pitchum",
"todoporlalibertad", "todoporlalibertad",
"Marcin Serwin", "Marcin Serwin",
"Pepebotella",
"Emojigit",
}}, }},
{S("Funders"), 0xF7FF00, { {S("Funders"), 0xF7FF00, {
"40W", "40W",
@ -151,6 +169,7 @@ return {
{S("Special thanks"), 0x00E9FF, { {S("Special thanks"), 0x00E9FF, {
"celeron55 for creating Minetest", "celeron55 for creating Minetest",
"Jordach for the jukebox music compilation from Big Freaking Dig", "Jordach for the jukebox music compilation from Big Freaking Dig",
"wsor for working tirelessly in the shadows for the good of all of us, particularly helping with solving contentDB and copyright issues.",
"The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game", "The workaholics who spent way too much time writing for the Minecraft Wiki. It's an invaluable resource for creating this game",
"Notch and Jeb for being the major forces behind Minecraft", "Notch and Jeb for being the major forces behind Minecraft",
}}, }},

View File

@ -1,5 +1,6 @@
mcl_mapgen_core = {} mcl_mapgen_core = {}
local registered_generators = {} local registered_generators = {}
local registered_generators_count = 0
local lvm, nodes, param2 = 0, 0, 0 local lvm, nodes, param2 = 0, 0, 0
local lvm_buffer = {} local lvm_buffer = {}
@ -1866,7 +1867,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end) end)
function minetest.register_on_generated(node_function) function minetest.register_on_generated(node_function)
mcl_mapgen_core.register_generator("mod_"..tostring(#registered_generators+1), nil, node_function) mcl_mapgen_core.register_generator("mod_"..minetest.get_current_modname().."_"..tostring(registered_generators_count+1), nil, node_function)
end end
function mcl_mapgen_core.register_generator(id, lvm_function, node_function, priority, needs_param2) function mcl_mapgen_core.register_generator(id, lvm_function, node_function, priority, needs_param2)
@ -1875,7 +1876,7 @@ function mcl_mapgen_core.register_generator(id, lvm_function, node_function, pri
local priority = priority or 5000 local priority = priority or 5000
if lvm_function then lvm = lvm + 1 end if lvm_function then lvm = lvm + 1 end
if lvm_function then nodes = nodes + 1 end if node_function then nodes = nodes + 1 end
if needs_param2 then param2 = param2 + 1 end if needs_param2 then param2 = param2 + 1 end
local new_record = { local new_record = {
@ -1886,6 +1887,7 @@ function mcl_mapgen_core.register_generator(id, lvm_function, node_function, pri
} }
registered_generators[id] = new_record registered_generators[id] = new_record
registered_generators_count = registered_generators_count + 1
table.sort(registered_generators, function(a, b) table.sort(registered_generators, function(a, b)
return (a.i < b.i) or ((a.i == b.i) and a.vf and (b.vf == nil)) return (a.i < b.i) or ((a.i == b.i) and a.vf and (b.vf == nil))
end) end)
@ -1895,6 +1897,7 @@ function mcl_mapgen_core.unregister_generator(id)
if not registered_generators[id] then return end if not registered_generators[id] then return end
local rec = registered_generators[id] local rec = registered_generators[id]
registered_generators[id] = nil registered_generators[id] = nil
registered_generators_count = registered_generators_count - 1
if rec.vf then lvm = lvm - 1 end if rec.vf then lvm = lvm - 1 end
if rec.nf then nodes = nodes - 1 end if rec.nf then nodes = nodes - 1 end
if rec.needs_param2 then param2 = param2 - 1 end if rec.needs_param2 then param2 = param2 - 1 end

View File

@ -57,11 +57,25 @@ mcl_structures.register_structure("pillager_outpost",{
after_place = function(p,def,pr) after_place = function(p,def,pr)
local p1 = vector.offset(p,-7,0,-7) local p1 = vector.offset(p,-7,0,-7)
local p2 = vector.offset(p,7,14,7) local p2 = vector.offset(p,7,14,7)
local spawnon = {"mcl_core:stripped_oak"}
local sp = minetest.find_nodes_in_area_under_air(p1,p2,spawnon)
for _,n in pairs(minetest.find_nodes_in_area(p1,p2,{"group:wall"})) do for _,n in pairs(minetest.find_nodes_in_area(p1,p2,{"group:wall"})) do
local def = minetest.registered_nodes[minetest.get_node(n).name:gsub("_%d+$","")] local def = minetest.registered_nodes[minetest.get_node(n).name:gsub("_%d+$","")]
if def and def.on_construct then if def and def.on_construct then
def.on_construct(n) def.on_construct(n)
end end
end end
if sp and #sp > 0 then
for i=1,5 do
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mobs_mc:pillager")
end
end
local pos = sp[pr:next(1,#sp)]
if pos then
minetest.add_entity(pos,"mobs_mc:evoker")
end
end
end end
}) })