Merge branch 'master' into doc-refactoring

This commit is contained in:
AFCMS 2021-05-19 00:20:03 +02:00
commit daa3b8a46c
20 changed files with 196 additions and 161 deletions

View File

@ -22,6 +22,7 @@
* Nicu * Nicu
* aligator * aligator
* Code-Sploit * Code-Sploit
* NO11
## Contributors ## Contributors
* Laurent Rocher * Laurent Rocher
@ -40,7 +41,6 @@
* Jared Moody * Jared Moody
* Li0n * Li0n
* Midgard * Midgard
* NO11
* Saku Laesvuori * Saku Laesvuori
* Yukitty * Yukitty
* ZedekThePD * ZedekThePD
@ -102,6 +102,7 @@
* leorockway * leorockway
* xMrVizzy * xMrVizzy
* yutyo * yutyo
* NO11
## Translations ## Translations
* Wuzzy * Wuzzy

View File

@ -66,50 +66,48 @@ local function compute_sphere_rays(radius)
local rays = {} local rays = {}
local sphere = {} local sphere = {}
for i=1, 2 do local function add_ray(pos)
sphere[hash_node_position(pos)] = pos
end
for y = -radius, radius do for y = -radius, radius do
for z = -radius, radius do for z = -radius, radius do
for x = -radius, 0, 1 do for x = -radius, 0 do
local d = x * x + y * y + z * z local d = x * x + y * y + z * z
if d <= radius * radius then if d <= radius * radius then
local pos = { x = x, y = y, z = z } add_ray(vector.new(x, y, z))
sphere[hash_node_position(pos)] = pos add_ray(vector.new(-x, y, z))
break break
end end
end end
end end
end end
end
for i=1,2 do
for x = -radius, radius do for x = -radius, radius do
for z = -radius, radius do for z = -radius, radius do
for y = -radius, 0, 1 do for y = -radius, 0 do
local d = x * x + y * y + z * z local d = x * x + y * y + z * z
if d <= radius * radius then if d <= radius * radius then
local pos = { x = x, y = y, z = z } add_ray(vector.new(x, y, z))
sphere[hash_node_position(pos)] = pos add_ray(vector.new(x, -y, z))
break break
end end
end end
end end
end end
end
for i=1,2 do
for x = -radius, radius do for x = -radius, radius do
for y = -radius, radius do for y = -radius, radius do
for z = -radius, 0, 1 do for z = -radius, 0 do
local d = x * x + y * y + z * z local d = x * x + y * y + z * z
if d <= radius * radius then if d <= radius * radius then
local pos = { x = x, y = y, z = z } add_ray(vector.new(x, y, z))
sphere[hash_node_position(pos)] = pos add_ray(vector.new(x, y, -z))
break break
end end
end end
end end
end end
end
for _, pos in pairs(sphere) do for _, pos in pairs(sphere) do
rays[#rays + 1] = vector.normalize(pos) rays[#rays + 1] = vector.normalize(pos)
@ -260,12 +258,12 @@ local function trace_explode(pos, strength, raydirs, radius, info, direct, sourc
if collisionbox then if collisionbox then
-- Create rays from random points in the collision box -- Create rays from random points in the collision box
local x1 = collisionbox[1] * 2 local x1 = collisionbox[1]
local y1 = collisionbox[2] * 2 local y1 = collisionbox[2]
local z1 = collisionbox[3] * 2 local z1 = collisionbox[3]
local x2 = collisionbox[4] * 2 local x2 = collisionbox[4]
local y2 = collisionbox[5] * 2 local y2 = collisionbox[5]
local z2 = collisionbox[6] * 2 local z2 = collisionbox[6]
local x_len = math.abs(x2 - x1) local x_len = math.abs(x2 - x1)
local y_len = math.abs(y2 - y1) local y_len = math.abs(y2 - y1)
local z_len = math.abs(z2 - z1) local z_len = math.abs(z2 - z1)

View File

@ -61,20 +61,21 @@ In mc, you cant use clock in the nether and the end.
* pos: position * pos: position
## mcl_worlds.register_on_dimension_change(function(player, dimension)) ## mcl_worlds.register_on_dimension_change(function(player, dimension, last_dimension))
Register a callback function func(player, dimension). Register a callback function func(player, dimension).
It will be called whenever a player changes between dimensions. It will be called whenever a player changes between dimensions.
The void counts as dimension. The void counts as dimension.
* player: player, the player who changed the dimension * player: player, the player who changed of dimension
* dimension: position, The new dimension of the player ("overworld", "nether", "end", "void"). * dimension: string, The new dimension of the player ("overworld", "nether", "end", "void").
* last_dimension: string, The dimension where the player was ("overworld", "nether", "end", "void").
## mcl_worlds.registered_on_dimension_change ## mcl_worlds.registered_on_dimension_change
Table containing all function registered with mcl_worlds.register_on_dimension_change() Table containing all function registered with mcl_worlds.register_on_dimension_change()
## mcl_worlds.dimension_change(player, dimension) ## mcl_worlds.dimension_change(player, dimension)
Notify this mod of a dimmension change of <player> to <dimension> Notify this mod of a dimension change of <player> to <dimension>
* player: player, player who changed the dimension * player: player, player who changed the dimension
* dimension: string, new dimension ("overworld", "nether", "end", "void") * dimension: string, new dimension ("overworld", "nether", "end", "void")

View File

@ -112,10 +112,11 @@ local last_dimension = {}
-- * player: Player who changed the dimension -- * player: Player who changed the dimension
-- * dimension: New dimension ("overworld", "nether", "end", "void") -- * dimension: New dimension ("overworld", "nether", "end", "void")
function mcl_worlds.dimension_change(player, dimension) function mcl_worlds.dimension_change(player, dimension)
local playername = player:get_player_name()
for i=1, #mcl_worlds.registered_on_dimension_change do for i=1, #mcl_worlds.registered_on_dimension_change do
mcl_worlds.registered_on_dimension_change[i](player, dimension) mcl_worlds.registered_on_dimension_change[i](player, dimension, last_dimension[playername])
last_dimension[player:get_player_name()] = dimension
end end
last_dimension[playername] = dimension
end end
----------------------- INTERNAL STUFF ---------------------- ----------------------- INTERNAL STUFF ----------------------

View File

@ -938,12 +938,15 @@ mobs.mob_step = function(self, dtime)
end end
end end
if self.burn_timer == 0 and minetest_get_node_light(pos) > 12 and minetest_get_node_light(pos, 0.5) == 15 then if self.burn_timer == 0 then
local light_current, light_day = minetest_get_node_light(pos), minetest_get_node_light(pos, 0.5)
if light_current and light_day and light_current > 12 and light_day == 15 then
mcl_burning.set_on_fire(self.object, 1) mcl_burning.set_on_fire(self.object, 1)
self.burn_timer = 1 --1.7 seconds self.burn_timer = 1 --1.7 seconds
self.pause_timer = 0.4 self.pause_timer = 0.4
end end
end end
end

View File

@ -2,4 +2,4 @@ name = mcl_mobs
author = PilzAdam author = PilzAdam
description = Adds a mob API for mods to add animals or monsters, etc. description = Adds a mob API for mods to add animals or monsters, etc.
depends = mcl_particles depends = mcl_particles
optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience

View File

@ -15,7 +15,7 @@ with name "mobs_mc_gameconfig". ]]
-- Set to false in your gameconfig mod if you create your own monster egg nodes. -- Set to false in your gameconfig mod if you create your own monster egg nodes.
mobs_mc.create_monster_egg_nodes = true mobs_mc.create_monster_egg_nodes = true
mobs_mc.items = {} --mobs_mc.items = {}
mobs_mc.items = { mobs_mc.items = {
-- Items defined in mobs_mc -- Items defined in mobs_mc

View File

@ -28,6 +28,7 @@ mcl_credits.people = {
"Nicu", "Nicu",
"aligator", "aligator",
"Code-Sploit", "Code-Sploit",
"NO11",
}}, }},
{"Contributors", 0x52FF00, { {"Contributors", 0x52FF00, {
"Laurent Rocher", "Laurent Rocher",
@ -46,7 +47,6 @@ mcl_credits.people = {
"Jared Moody", "Jared Moody",
"Li0n", "Li0n",
"Midgard", "Midgard",
"NO11",
"Saku Laesvuori", "Saku Laesvuori",
"Yukitty", "Yukitty",
"ZedekThePD", "ZedekThePD",
@ -107,7 +107,8 @@ mcl_credits.people = {
"kingoscargames", "kingoscargames",
"leorockway", "leorockway",
"xMrVizzy", "xMrVizzy",
"yutyo" "yutyo",
"NO11",
}}, }},
{"Translations", 0x00FF60, { {"Translations", 0x00FF60, {
"Wuzzy", "Wuzzy",

View File

@ -275,10 +275,6 @@ function mcl_experience.add_experience(player, experience)
end end
stack:set_wear(math.floor(new_wear)) stack:set_wear(math.floor(new_wear))
inv:set_stack(list, index, stack) inv:set_stack(list, index, stack)
if can.list == "armor" then
local armor_inv = minetest.get_inventory({type = "detached", name = player:get_player_name() .. "_armor"})
armor_inv:set_stack(list, index, stack)
end
end end
local old_bar, old_xp, old_level = temp_pool.bar, temp_pool.xp, temp_pool.level local old_bar, old_xp, old_level = temp_pool.bar, temp_pool.xp, temp_pool.level

View File

@ -118,16 +118,6 @@ ARROW_ENTITY.on_step = function(self, dtime)
dpos = vector.round(dpos) dpos = vector.round(dpos)
local node = minetest.get_node(dpos) local node = minetest.get_node(dpos)
if self.object:get_attach() ~= nil and self.object:get_attach(parent):get_hp() < 1 then
self.object:remove()
end
minetest.register_on_leaveplayer(function(player)
if self.object:get_attach(parent) == player then
self.object:remove()
end
end)
if self._stuck then if self._stuck then
self._stucktimer = self._stucktimer + dtime self._stucktimer = self._stucktimer + dtime
self._stuckrechecktimer = self._stuckrechecktimer + dtime self._stuckrechecktimer = self._stuckrechecktimer + dtime

View File

@ -4,47 +4,30 @@
-- Crafting definition -- Crafting definition
-- --
local craft_planks = function(output, input)
minetest.register_craft({ minetest.register_craft({
output = 'mcl_core:wood 4', output = "mcl_core:"..output.."wood 4",
recipe = { recipe = {
{'mcl_core:tree'}, {"mcl_core:"..input},
} }
}) })
end
minetest.register_craft({ local planks = {
output = 'mcl_core:darkwood 4', {"", "oak"},
recipe = { {"dark", "dark_oak"},
{'mcl_core:darktree'}, {"jungle", "jungle"},
{"acacia", "acacia"},
{"spruce", "spruce"},
{"birch", "birch"}
} }
})
minetest.register_craft({ for _, p in pairs(planks) do
output = 'mcl_core:junglewood 4', craft_planks(p[1], p[1].."tree")
recipe = { craft_planks(p[1], p[1].."tree_bark")
{'mcl_core:jungletree'}, craft_planks(p[1], "stripped_"..p[2])
} craft_planks(p[1], "stripped_"..p[2].."_bark")
}) end
minetest.register_craft({
output = 'mcl_core:acaciawood 4',
recipe = {
{'mcl_core:acaciatree'},
}
})
minetest.register_craft({
output = 'mcl_core:sprucewood 4',
recipe = {
{'mcl_core:sprucetree'},
}
})
minetest.register_craft({
output = 'mcl_core:birchwood 4',
recipe = {
{'mcl_core:birchtree'},
}
})
minetest.register_craft({ minetest.register_craft({
type = 'shapeless', type = 'shapeless',

View File

@ -107,7 +107,7 @@ minetest.register_globalstep(function(dtime)
EF.invisible[player].timer = EF.invisible[player].timer + dtime EF.invisible[player].timer = EF.invisible[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#B0B0B0") end if player:get_pos() then mcl_potions._add_spawner(player, "#7F8392") end
if EF.invisible[player].timer >= EF.invisible[player].dur then if EF.invisible[player].timer >= EF.invisible[player].dur then
mcl_potions.make_invisible(player, false) mcl_potions.make_invisible(player, false)
@ -129,7 +129,7 @@ minetest.register_globalstep(function(dtime)
EF.poisoned[player].timer = EF.poisoned[player].timer + dtime EF.poisoned[player].timer = EF.poisoned[player].timer + dtime
EF.poisoned[player].hit_timer = (EF.poisoned[player].hit_timer or 0) + dtime EF.poisoned[player].hit_timer = (EF.poisoned[player].hit_timer or 0) + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#225533") end if player:get_pos() then mcl_potions._add_spawner(player, "#4E9331") end
if EF.poisoned[player].hit_timer >= EF.poisoned[player].step then if EF.poisoned[player].hit_timer >= EF.poisoned[player].step then
if mcl_util.get_hp(player) - 1 > 0 then if mcl_util.get_hp(player) - 1 > 0 then
@ -158,7 +158,7 @@ minetest.register_globalstep(function(dtime)
EF.regenerating[player].timer = EF.regenerating[player].timer + dtime EF.regenerating[player].timer = EF.regenerating[player].timer + dtime
EF.regenerating[player].heal_timer = (EF.regenerating[player].heal_timer or 0) + dtime EF.regenerating[player].heal_timer = (EF.regenerating[player].heal_timer or 0) + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#A52BB2") end if player:get_pos() then mcl_potions._add_spawner(player, "#CD5CAB") end
if EF.regenerating[player].heal_timer >= EF.regenerating[player].step then if EF.regenerating[player].heal_timer >= EF.regenerating[player].step then
@ -192,7 +192,7 @@ minetest.register_globalstep(function(dtime)
EF.water_breathing[player].timer = EF.water_breathing[player].timer + dtime EF.water_breathing[player].timer = EF.water_breathing[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#0000AA") end if player:get_pos() then mcl_potions._add_spawner(player, "#2E5299") end
if player:get_breath() then if player:get_breath() then
if player:get_breath() < 10 then player:set_breath(10) end if player:get_breath() < 10 then player:set_breath(10) end
@ -217,7 +217,7 @@ minetest.register_globalstep(function(dtime)
EF.leaping[player].timer = EF.leaping[player].timer + dtime EF.leaping[player].timer = EF.leaping[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#00CC33") end if player:get_pos() then mcl_potions._add_spawner(player, "#22FF4C") end
if EF.leaping[player].timer >= EF.leaping[player].dur then if EF.leaping[player].timer >= EF.leaping[player].dur then
playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping") playerphysics.remove_physics_factor(player, "jump", "mcl_potions:leaping")
@ -239,7 +239,7 @@ minetest.register_globalstep(function(dtime)
EF.swift[player].timer = EF.swift[player].timer + dtime EF.swift[player].timer = EF.swift[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#009999") end if player:get_pos() then mcl_potions._add_spawner(player, "#7CAFC6") end
if EF.swift[player].timer >= EF.swift[player].dur then if EF.swift[player].timer >= EF.swift[player].dur then
playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness") playerphysics.remove_physics_factor(player, "speed", "mcl_potions:swiftness")
@ -261,7 +261,7 @@ minetest.register_globalstep(function(dtime)
EF.night_vision[player].timer = EF.night_vision[player].timer + dtime EF.night_vision[player].timer = EF.night_vision[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#1010AA") end if player:get_pos() then mcl_potions._add_spawner(player, "#1F1FA1") end
if EF.night_vision[player].timer >= EF.night_vision[player].dur then if EF.night_vision[player].timer >= EF.night_vision[player].dur then
EF.night_vision[player] = nil EF.night_vision[player] = nil
@ -286,7 +286,7 @@ minetest.register_globalstep(function(dtime)
EF.fire_proof[player].timer = EF.fire_proof[player].timer + dtime EF.fire_proof[player].timer = EF.fire_proof[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#E0B050") end if player:get_pos() then mcl_potions._add_spawner(player, "#E49A3A") end
if EF.fire_proof[player].timer >= EF.fire_proof[player].dur then if EF.fire_proof[player].timer >= EF.fire_proof[player].dur then
EF.fire_proof[player] = nil EF.fire_proof[player] = nil
@ -307,7 +307,7 @@ minetest.register_globalstep(function(dtime)
EF.weak[player].timer = EF.weak[player].timer + dtime EF.weak[player].timer = EF.weak[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#7700BB") end if player:get_pos() then mcl_potions._add_spawner(player, "#484D48") end
if EF.weak[player].timer >= EF.weak[player].dur then if EF.weak[player].timer >= EF.weak[player].dur then
EF.weak[player] = nil EF.weak[player] = nil
@ -328,7 +328,7 @@ minetest.register_globalstep(function(dtime)
EF.strong[player].timer = EF.strong[player].timer + dtime EF.strong[player].timer = EF.strong[player].timer + dtime
if player:get_pos() then mcl_potions._add_spawner(player, "#7700BB") end if player:get_pos() then mcl_potions._add_spawner(player, "#932423") end
if EF.strong[player].timer >= EF.strong[player].dur then if EF.strong[player].timer >= EF.strong[player].dur then
EF.strong[player] = nil EF.strong[player] = nil

View File

@ -459,7 +459,7 @@ local healing_def = {
_tt = S("+4 HP"), _tt = S("+4 HP"),
_tt_2 = S("+8 HP"), _tt_2 = S("+8 HP"),
_longdesc = S("Instantly heals."), _longdesc = S("Instantly heals."),
color = "#CC0000", color = "#F82423",
effect = 4, effect = 4,
instant = true, instant = true,
on_use = mcl_potions.healing_func, on_use = mcl_potions.healing_func,
@ -473,7 +473,7 @@ local harming_def = {
_tt = S("-6 HP"), _tt = S("-6 HP"),
_tt_II = S("-12 HP"), _tt_II = S("-12 HP"),
_longdesc = S("Instantly deals damage."), _longdesc = S("Instantly deals damage."),
color = "#660099", color = "#430A09",
effect = -6, effect = -6,
instant = true, instant = true,
on_use = mcl_potions.healing_func, on_use = mcl_potions.healing_func,
@ -486,7 +486,7 @@ local night_vision_def = {
description = S("Night Vision"), description = S("Night Vision"),
_tt = nil, _tt = nil,
_longdesc = S("Increases the perceived brightness of light under a dark sky."), _longdesc = S("Increases the perceived brightness of light under a dark sky."),
color = "#1010AA", color = "#1F1FA1",
effect = nil, effect = nil,
is_dur = true, is_dur = true,
on_use = mcl_potions.night_vision_func, on_use = mcl_potions.night_vision_func,
@ -498,7 +498,7 @@ local swiftness_def = {
description = S("Swiftness"), description = S("Swiftness"),
_tt = nil, _tt = nil,
_longdesc = S("Increases walking speed."), _longdesc = S("Increases walking speed."),
color = "#009999", color = "#7CAFC6",
effect = 1.2, effect = 1.2,
is_dur = true, is_dur = true,
on_use = mcl_potions.swiftness_func, on_use = mcl_potions.swiftness_func,
@ -511,7 +511,7 @@ local slowness_def = {
description = S("Slowness"), description = S("Slowness"),
_tt = nil, _tt = nil,
_longdesc = S("Decreases walking speed."), _longdesc = S("Decreases walking speed."),
color = "#000080", color = "#5A6C81",
effect = 0.85, effect = 0.85,
is_dur = true, is_dur = true,
on_use = mcl_potions.swiftness_func, on_use = mcl_potions.swiftness_func,
@ -525,7 +525,7 @@ local leaping_def = {
description = S("Leaping"), description = S("Leaping"),
_tt = nil, _tt = nil,
_longdesc = S("Increases jump strength."), _longdesc = S("Increases jump strength."),
color = "#00CC33", color = "#22FF4C",
effect = 1.15, effect = 1.15,
is_dur = true, is_dur = true,
on_use = mcl_potions.leaping_func, on_use = mcl_potions.leaping_func,
@ -538,7 +538,7 @@ local poison_def = {
description = S("Poison"), description = S("Poison"),
_tt = nil, _tt = nil,
_longdesc = S("Applies the poison effect which deals damage at a regular interval."), _longdesc = S("Applies the poison effect which deals damage at a regular interval."),
color = "#447755", color = "#4E9331",
effect = 2.5, effect = 2.5,
is_dur = true, is_dur = true,
on_use = mcl_potions.poison_func, on_use = mcl_potions.poison_func,
@ -552,7 +552,7 @@ local regeneration_def = {
description = S("Regeneration"), description = S("Regeneration"),
_tt = nil, _tt = nil,
_longdesc = S("Regenerates health over time."), _longdesc = S("Regenerates health over time."),
color = "#B52CC2", color = "#CD5CAB",
effect = 2.5, effect = 2.5,
is_dur = true, is_dur = true,
on_use = mcl_potions.regeneration_func, on_use = mcl_potions.regeneration_func,
@ -565,7 +565,7 @@ local invisibility_def = {
description = S("Invisibility"), description = S("Invisibility"),
_tt = nil, _tt = nil,
_longdesc = S("Grants invisibility."), _longdesc = S("Grants invisibility."),
color = "#B0B0B0", color = "#7F8392",
is_dur = true, is_dur = true,
on_use = mcl_potions.invisiblility_func, on_use = mcl_potions.invisiblility_func,
is_plus = true, is_plus = true,
@ -576,7 +576,7 @@ local water_breathing_def = {
description = S("Water Breathing"), description = S("Water Breathing"),
_tt = nil, _tt = nil,
_longdesc = S("Grants limitless breath underwater."), _longdesc = S("Grants limitless breath underwater."),
color = "#0000AA", color = "#2E5299",
is_dur = true, is_dur = true,
on_use = mcl_potions.water_breathing_func, on_use = mcl_potions.water_breathing_func,
is_plus = true, is_plus = true,
@ -587,7 +587,7 @@ local fire_resistance_def = {
description = S("Fire Resistance"), description = S("Fire Resistance"),
_tt = nil, _tt = nil,
_longdesc = S("Grants immunity to damage from heat sources like fire."), _longdesc = S("Grants immunity to damage from heat sources like fire."),
color = "#D0A040", color = "#E49A3A",
is_dur = true, is_dur = true,
on_use = mcl_potions.fire_resistance_func, on_use = mcl_potions.fire_resistance_func,
is_plus = true, is_plus = true,
@ -611,22 +611,22 @@ end
-- description = S("Weakness"), -- description = S("Weakness"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#6600AA"), -- wield_image = potion_image("#484D48"),
-- inventory_image = potion_image("#6600AA"), -- inventory_image = potion_image("#484D48"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#6600AA") -- mcl_potions._use_potion(itemstack, user, "#484D48")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION*mcl_potions.INV_FACTOR)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#6600AA") -- mcl_potions._use_potion(itemstack, user, "#484D48")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })
@ -635,22 +635,22 @@ end
-- description = S("Weakness +"), -- description = S("Weakness +"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#7700BB"), -- wield_image = potion_image("#484D48"),
-- inventory_image = potion_image("#7700BB"), -- inventory_image = potion_image("#484D48"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#7700BB") -- mcl_potions._use_potion(itemstack, user, "#484D48")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR) -- mcl_potions.weakness_func(user, -4, mcl_potions.DURATION_2*mcl_potions.INV_FACTOR)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#7700BB") -- mcl_potions._use_potion(itemstack, user, "#484D48")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })
@ -659,22 +659,22 @@ end
-- description = S("Strength"), -- description = S("Strength"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#D444D4"), -- wield_image = potion_image("#932423"),
-- inventory_image = potion_image("#D444D4"), -- inventory_image = potion_image("#932423"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444D4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444D4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })
@ -683,22 +683,22 @@ end
-- description = S("Strength II"), -- description = S("Strength II"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#D444E4"), -- wield_image = potion_image("#932423"),
-- inventory_image = potion_image("#D444E4"), -- inventory_image = potion_image("#932423"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2) -- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444E4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2) -- mcl_potions.weakness_func(user, 6, mcl_potions.DURATION_2)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444E4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })
@ -707,22 +707,22 @@ end
-- description = S("Strength +"), -- description = S("Strength +"),
-- _tt_help = TODO, -- _tt_help = TODO,
-- _doc_items_longdesc = brewhelp, -- _doc_items_longdesc = brewhelp,
-- wield_image = potion_image("#D444F4"), -- wield_image = potion_image("#932423"),
-- inventory_image = potion_image("#D444F4"), -- inventory_image = potion_image("#932423"),
-- groups = { brewitem=1, food=3, can_eat_when_full=1 }, -- groups = { brewitem=1, food=3, can_eat_when_full=1 },
-- stack_max = 1, -- stack_max = 1,
-- --
-- on_place = function(itemstack, user, pointed_thing) -- on_place = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444F4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end, -- end,
-- --
-- on_secondary_use = function(itemstack, user, pointed_thing) -- on_secondary_use = function(itemstack, user, pointed_thing)
-- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS) -- mcl_potions.weakness_func(user, 3, mcl_potions.DURATION_PLUS)
-- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing) -- minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, user, pointed_thing)
-- mcl_potions._use_potion(itemstack, user, "#D444F4") -- mcl_potions._use_potion(itemstack, user, "#932423")
-- return itemstack -- return itemstack
-- end -- end
-- }) -- })

View File

@ -3974,7 +3974,7 @@ if mg_name ~= "singlenode" then
mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed) mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object("gennotify") local gennotify = minetest.get_mapgen_object("gennotify")
--local poslist = {} --local poslist = {}
local pr = PseudoRandom(blockseed + 14) pr = PseudoRandom(blockseed + 14)
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
local x, y, z = pos.x, pos.y, pos.z local x, y, z = pos.x, pos.y, pos.z
if x < -2 or x > 2 or z < -2 or z > 2 then if x < -2 or x > 2 or z < -2 or z > 2 then

View File

@ -7,7 +7,7 @@ end
--[[ Manually set in 'buildings.lua' --[[ Manually set in 'buildings.lua'
-- material to replace cobblestone with -- material to replace cobblestone with
wallmaterial = { local wallmaterial = {
"mcl_core:junglewood", "mcl_core:junglewood",
"mcl_core:sprucewood", "mcl_core:sprucewood",
"mcl_core:wood", "mcl_core:wood",

View File

@ -137,14 +137,14 @@ local timerMult = 1 -- Cycles from 0 to 7, each time when timer hits half a seco
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
main_timer = main_timer + dtime main_timer = main_timer + dtime
timer = timer + dtime timer = timer + dtime
if main_timer > mcl_hunger.HUD_TICK or timer > 0.5 then if main_timer > mcl_hunger.HUD_TICK or timer > 0.25 then
if main_timer > mcl_hunger.HUD_TICK then main_timer = 0 end if main_timer > mcl_hunger.HUD_TICK then main_timer = 0 end
for _,player in pairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name() local name = player:get_player_name()
local h = tonumber(mcl_hunger.get_hunger(player)) local h = tonumber(mcl_hunger.get_hunger(player))
local hp = player:get_hp() local hp = player:get_hp()
if timer > 0.5 then if timer > 0.25 then
-- Slow health regeneration, and hunger damage (every 4s). -- Slow health regeneration, and hunger damage (every 4s).
-- Regeneration rate based on tutorial video <https://www.youtube.com/watch?v=zs2t-xCVHBo>. -- Regeneration rate based on tutorial video <https://www.youtube.com/watch?v=zs2t-xCVHBo>.
-- Minecraft Wiki seems to be wrong in claiming that full hunger gives 0.5s regen rate. -- Minecraft Wiki seems to be wrong in claiming that full hunger gives 0.5s regen rate.
@ -166,9 +166,9 @@ minetest.register_globalstep(function(dtime)
end end
end end
end end
if timer > 0.5 then if timer > 0.25 then
timer = 0 timer = 0
timerMult = timerMult + 1 timerMult = timerMult + 2
if timerMult > 7 then if timerMult > 7 then
timerMult = 0 timerMult = 0
end end

View File

@ -549,6 +549,9 @@ mcl_damage.register_modifier(function(obj, damage, reason)
end end
return 0 return 0
end end
if node.name == "mcl_core:cobweb" then
return 0
end
end end
pos = vector.add(pos, step) pos = vector.add(pos, step)
node = minetest.get_node(pos) node = minetest.get_node(pos)

View File

@ -27,3 +27,17 @@ Usage:
- Convert the textures - Convert the textures
- Put the new texture directory in the Minetest texture pack directory, just like - Put the new texture directory in the Minetest texture pack directory, just like
any other Minetest texture pack any other Minetest texture pack
## Luacheck Globals Generators
This is a Python script which list every single global tables in mineclone2 source code.
It outputs a list to be used in luacheck conf files.
Modes of operation:
- List global tables
Requirements:
- Know how to use the console
- Python 3
Usage:
- In the console, run `python3 ./tools/create_luacheck.py` in the MineClone2 directory

44
tools/create_luacheck.py Normal file → Executable file
View File

@ -0,0 +1,44 @@
import os
import re
from pathlib import Path
# Just run this script from mineclone2 directory to get a list of every global vars to use in luacheck configuration files
path = "./mods/"
pattern = re.compile(r'^(?P<global_var>[A-Za-z_0-9]+)[ ]*=[ ]*\{')
pattern_local = re.compile(r'local (?P<local_var>[A-Za-z_0-9]+)')
global_vars = []
print("---Copy/Paste output in your luacheck conf file---\n")
pathlist = Path(path).rglob('*.lua')
for path in pathlist:
path_in_str = str(path)
# print(path_in_str)
trouve = False
with open(path_in_str) as f:
local_vars = []
for i, line in enumerate(f.readlines()):
m = pattern.match(line)
if m:
global_name = m.group('global_var')
if global_name not in local_vars:
#print(path_in_str, ":", i+1, ":", m.group('global_var').strip())
global_vars.append(m.group('global_var').strip())
found = True
break
else:
n = pattern_local.match(line)
if n:
local_vars.append(n.group('local_var'))
if not found:
nb_varloc = len(variables_locales)
#print(path_in_str, ": -", "({} variables locales)".format(nb_varloc) if nb_varloc > 0 else '')
print(', '.join(['"{}"'.format(v) for v in global_vars]))