Merge branch 'master' into damage

This commit is contained in:
Lizzy Fleckenstein 2021-04-17 12:58:19 +02:00
commit ca75a893db
65 changed files with 405 additions and 310 deletions

43
.luacheckrc Normal file
View File

@ -0,0 +1,43 @@
unused_args = false
allow_defined_top = true
max_line_length = false
redefined = false
globals = {
"minetest", "core",
}
read_globals = {
"DIR_DELIM",
"dump", "dump2",
"vector",
"VoxelManip", "VoxelArea",
"PseudoRandom", "PcgRandom", "PerlinNoise", "PerlinNoiseMap",
"ItemStack",
"Settings",
"unpack",
table = {
fields = {
"copy",
"indexof",
"insert_all",
"key_value_swap",
}
},
string = {
fields = {
"split",
"trim",
}
},
math = {
fields = {
"hypot",
"sign",
"factorial"
}
},
}

View File

@ -23,8 +23,10 @@ minetest.register_entity("mcl_burning:fire", {
minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
if player:get_meta():get_float("mcl_burning:burn_time") > 0 then
mcl_burning.tick(player, dtime)
end
end
end)
minetest.register_on_respawnplayer(function(player)

View File

@ -3447,7 +3447,7 @@ end
-- main mob function
local mob_step = function(self, dtime)
if not self.fire_resistant then
if not self.fire_resistant and self.mcl_burning_burn_time and self.mcl_burning_burn_time > 0 then
mcl_burning.tick(self.object, dtime)
end

View File

@ -67,7 +67,7 @@ doc_identifier.identify = function(itemstack, user, pointed_thing)
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if minetest.registered_nodes[node.name] ~= nil then
local nodedef = minetest.registered_nodes[node.name]
--local nodedef = minetest.registered_nodes[node.name]
if(node.name == "ignore") then
show_message(username, "error_ignore")
elseif doc.entry_exists("nodes", node.name) then

View File

@ -1269,7 +1269,6 @@ local function gather_descs()
if type(def._doc_items_hidden) == "boolean" then
hidden = def._doc_items_hidden
end
local custom_image
name = scrub_newlines(name)
local infotable = {
name = name,

View File

@ -33,7 +33,6 @@ local fmt, find, gmatch, match, sub, split, lower =
local min, max, floor, ceil = math.min, math.max, math.floor, math.ceil
local pairs, next, unpack = pairs, next, unpack
local vec_add, vec_mul = vector.add, vector.multiply
local DEFAULT_SIZE = 10
local MIN_LIMIT, MAX_LIMIT = 10, 12
@ -1001,7 +1000,7 @@ else
end
end)
local function on_use(user)
--[[local function on_use(user)
local name = user:get_player_name()
if next(recipe_filters) then
@ -1011,7 +1010,7 @@ else
end
show_formspec(name, "mcl_craftguide", make_formspec(name))
end
end]]
end
@ -1098,7 +1097,6 @@ if progressive_mode then
local name = player:get_player_name()
init_data(name)
local meta = player:get_meta()
local name = player:get_player_name()
local data = player_data[name]
data.inv_items = deserialize(meta:get_string("inv_items")) or {}
@ -1144,7 +1142,7 @@ else
end
function mcl_craftguide.show(name)
local player = minetest.get_player_by_name(name)
local player = get_player_by_name(name)
if next(recipe_filters) then
local data = player_data[name]
data.items_raw = get_filtered_items(player)

View File

@ -62,7 +62,6 @@ end)
-- nodes which have flower placement rules
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
local datastring = ""
if def.groups.place_flowerlike == 1 then
return S("This plant can only grow on grass blocks and dirt. To survive, it needs to have an unobstructed view to the sky above or be exposed to a light level of 8 or higher.")
elseif def.groups.place_flowerlike == 2 then
@ -130,7 +129,7 @@ end)
-- Armor
doc.sub.items.register_factoid(nil, "use", function(itemstring, def)
local def = minetest.registered_items[itemstring]
--local def = minetest.registered_items[itemstring]
local s = ""
local head = minetest.get_item_group(itemstring, "armor_head")
local torso = minetest.get_item_group(itemstring, "armor_torso")
@ -173,7 +172,6 @@ end)
doc.sub.items.register_factoid(nil, "groups", function(itemstring, def)
if def._repair_material then
local mdef = minetest.registered_items[def._repair_material]
local desc
if mdef and mdef.description and mdef.description ~= "" then
return S("This item can be repaired at an anvil with: @1.", mdef.description)
elseif def._repair_material == "group:wood" then

View File

@ -99,7 +99,7 @@ minetest.register_abm({
-- No decay near unloaded areas since these might include water.
if not check_surroundings(pos, "ignore") then
if wet <= 0 then
local n_def = minetest.registered_nodes[node.name] or nil
--local n_def = minetest.registered_nodes[node.name] or nil
local nn = minetest.get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
if not nn or not nn.name then
return

View File

@ -5,7 +5,10 @@ minetest.register_craftitem("mcl_farming:wheat_seeds", {
description = S("Wheat Seeds"),
_tt_help = S("Grows on farmland"),
_doc_items_longdesc = S("Grows into a wheat plant. Chickens like wheat seeds."),
_doc_items_usagehelp = S("Place the wheat seeds on farmland (which can be created with a hoe) to plant a wheat plant. They grow in sunlight and grow faster on hydrated farmland. Rightclick an animal to feed it wheat seeds."),
_doc_items_usagehelp = S([[
Place the wheat seeds on farmland (which can be created with a hoe) to plant a wheat plant.
They grow in sunlight and grow faster on hydrated farmland. Rightclick an animal to feed it wheat seeds.
]]),
groups = { craftitem=1 },
inventory_image = "mcl_farming_wheat_seeds.png",
on_place = function(itemstack, placer, pointed_thing)
@ -28,7 +31,10 @@ for i=1,7 do
if i == 1 then
create = true
name = S("Premature Wheat Plant")
longdesc = S("Premature wheat plants grow on farmland under sunlight in 8 stages. On hydrated farmland, they grow faster. They can be harvested at any time but will only yield a profit when mature.")
longdesc = S([[
Premature wheat plants grow on farmland under sunlight in 8 stages.
On hydrated farmland, they grow faster. They can be harvested at any time but will only yield a profit when mature.
]])
else
create = false
end
@ -54,7 +60,8 @@ for i=1,7 do
{-0.5, -0.5, -0.5, 0.5, sel_heights[i], 0.5}
},
},
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1,
dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
@ -62,7 +69,10 @@ end
minetest.register_node("mcl_farming:wheat", {
description = S("Mature Wheat Plant"),
_doc_items_longdesc = S("Mature wheat plants are ready to be harvested for wheat and wheat seeds. They won't grow any further."),
_doc_items_longdesc = S([[
Mature wheat plants are ready to be harvested for wheat and wheat seeds.
They won't grow any further.
]]),
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "meshoptions",
@ -81,7 +91,8 @@ minetest.register_node("mcl_farming:wheat", {
{ items = {'mcl_farming:wheat_item'} }
}
},
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
groups = {dig_immediate=3, not_in_creative_inventory=1, plant=1, attached_node=1,
dig_by_water=1,destroy_by_lava_flow=1, dig_by_piston=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0,
})
@ -144,9 +155,9 @@ minetest.register_node("mcl_farming:hay_block", {
is_ground_content = false,
stack_max = 64,
paramtype2 = "facedir",
is_ground_content = false,
on_place = mcl_util.rotate_axis,
groups = {handy=1, hoey=1, flammable=2, fire_encouragement=60, fire_flammability=20, building_block=1, fall_damage_add_percent=-80},
groups = {handy=1, hoey=1, flammable=2, fire_encouragement=60,
fire_flammability=20, building_block=1, fall_damage_add_percent=-80},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 0.5,

View File

@ -1,11 +1,6 @@
--Fishing Rod, Bobber, and Flying Bobber mechanics and Bobber artwork by Rootyjr.
local S = minetest.get_translator("mcl_fishing")
local mod_throwing = minetest.get_modpath("mcl_throwing")
local entity_mapping = {
["mcl_fishing:bobber"] = "mcl_fishing:bobber_entity",
}
local bobber_ENTITY={
physical = false,
@ -43,7 +38,6 @@ local fish = function(itemstack, player, pointed_thing)
local ent = nil
local noent = true
local durability = 65
local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking")
if unbreaking > 0 then
@ -61,7 +55,6 @@ local fish = function(itemstack, player, pointed_thing)
local itemname
local items
local itemcount = 1
local itemwear = 0
local pr = PseudoRandom(os.time() * math.random(1, 100))
local r = pr:next(1, 100)
local fish_values = {85, 84.8, 84.7, 84.5}
@ -173,7 +166,7 @@ local fish = function(itemstack, player, pointed_thing)
if noent == true then
local playerpos = player:get_pos()
local dir = player:get_look_dir()
local obj = mcl_throwing.throw("mcl_fishing:flying_bobber", {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, 15, player:get_player_name())
mcl_throwing.throw("mcl_fishing:flying_bobber", {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, 15, player:get_player_name())
end
end
@ -344,10 +337,8 @@ mcl_throwing.register_throwable_object("mcl_fishing:flying_bobber", "mcl_fishing
-- If player leaves area, remove bobber.
minetest.register_on_leaveplayer(function(player)
local objs = minetest.get_objects_inside_radius(player:get_pos(), 250)
local num = 0
local ent = nil
local noent = true
for n = 1, #objs do
ent = objs[n]:get_luaentity()
if ent then

View File

@ -180,7 +180,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
if not inv_img then
inv_img = top_img
end
local usagehelp, noncreative, create_entry, paramtype2, palette
local noncreative, create_entry, paramtype2, palette
if is_flower == nil then
is_flower = true
end
@ -475,9 +475,6 @@ local fix_doubleplants = minetest.settings:get_bool("fix_doubleplants", true)
if mod_mcimport and mg_name == "singlenode" and fix_doubleplants == true then
local flowernames = { "peony", "rose_bush", "lilac", "sunflower", "double_fern", "double_grass" }
for c=1, 6 do
local flowername = flowernames[c]
end
minetest.register_lbm({
label = "Add double plant tops.",

View File

@ -384,7 +384,6 @@ local function furnace_node_timer(pos, elapsed)
-- Update formspec and node
--
local formspec = inactive_formspec
local item_state
local item_percent = 0
if cookable then
item_percent = math.floor(src_time / cooked.time * 100)
@ -414,7 +413,7 @@ local function furnace_node_timer(pos, elapsed)
meta:set_float("fuel_time", fuel_time)
meta:set_float("src_time", src_time)
if srclist then
meta:set_string("src_item", srclist[1]:get_name())
meta:set_string("src_item", src_item)
else
meta:set_string("src_item", "")
end
@ -441,7 +440,12 @@ minetest.register_node("mcl_furnaces:furnace", {
_tt_help = S("Uses fuel to smelt or cook items"),
_doc_items_longdesc = S("Furnaces cook or smelt several items, using a furnace fuel, into something else."),
_doc_items_usagehelp =
S("Use the furnace to open the furnace menu. Place a furnace fuel in the lower slot and the source material in the upper slot. The furnace will slowly use its fuel to smelt the item. The result will be placed into the output slot at the right side.").."\n"..
S([[
Use the furnace to open the furnace menu.
Place a furnace fuel in the lower slot and the source material in the upper slot.
The furnace will slowly use its fuel to smelt the item.
The result will be placed into the output slot at the right side.
]]).."\n"..
S("Use the recipe book to see what you can smelt, what you can use as fuel and how long it will burn."),
_doc_items_hidden = false,
tiles = {

View File

@ -90,7 +90,7 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor)
local wdir = minetest.dir_to_wallmounted(diff)
local itemstring = itemstack:get_name()
local fakestack = ItemStack(itemstack)
--local fakestack = ItemStack(itemstack)
local idef = fakestack:get_definition()
local retval
if wdir == 0 or wdir == 1 then
@ -101,9 +101,7 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor)
if not retval then
return itemstack
end
local success
itemstack, success = minetest.item_place(fakestack, placer, pointed_thing, wdir)
itemstack,_ = minetest.item_place(fakestack, placer, pointed_thing, wdir)
itemstack:set_name(itemstring)
return itemstack
end,

View File

@ -152,7 +152,7 @@ def_hopper_enabled.on_place = function(itemstack, placer, pointed_thing)
local z = upos.z - apos.z
local fake_itemstack = ItemStack(itemstack)
local newnode, param2
local param2
if x == -1 then
fake_itemstack:set_name("mcl_hoppers:hopper_side")
param2 = 0
@ -166,7 +166,7 @@ def_hopper_enabled.on_place = function(itemstack, placer, pointed_thing)
fake_itemstack:set_name("mcl_hoppers:hopper_side")
param2 = 1
end
local itemstack, success = minetest.item_place_node(fake_itemstack, placer, pointed_thing, param2)
local itemstack,_ = minetest.item_place_node(fake_itemstack, placer, pointed_thing, param2)
itemstack:set_name("mcl_hoppers:hopper")
return itemstack
end
@ -411,7 +411,6 @@ minetest.register_abm({
-- Move an item from the hopper into container below
local downnode = minetest.get_node(downpos)
if not minetest.registered_nodes[downnode.name] then return end
g = minetest.registered_nodes[downnode.name].groups.container
mcl_util.move_item_container(pos, downpos)
end,
})
@ -462,7 +461,7 @@ minetest.register_abm({
-- Put fuel into fuel slot
local sinv = minetest.get_inventory({type="node", pos = pos})
local dinv = minetest.get_inventory({type="node", pos = front})
local slot_id, stack = mcl_util.get_eligible_transfer_item_slot(sinv, "main", dinv, "fuel", is_transferrable_fuel)
local slot_id,_ = mcl_util.get_eligible_transfer_item_slot(sinv, "main", dinv, "fuel", is_transferrable_fuel)
if slot_id then
mcl_util.move_item_container(pos, front, nil, slot_id, "fuel")
end

View File

@ -20,11 +20,13 @@ local register_block = function(subname, description, tiles, is_ground_content)
is_ground_content = is_ground_content,
groups = {dig_immediate = 3, spawns_silverfish = 1, deco_block = 1},
drop = '',
is_ground_content = false,
sounds = mcl_sounds.node_sound_stone_defaults(),
after_dig_node = spawn_silverfish,
_tt_help = S("Hides a silverfish"),
_doc_items_longdesc = S("An infested block is a block from which a silverfish will pop out when it is broken. It looks identical to its normal counterpart."),
_doc_items_longdesc = S([[
An infested block is a block from which a silverfish will pop out when it is broken.
It looks identical to its normal counterpart.
]]),
_mcl_hardness = 0,
_mcl_blast_resistance = 0.5,
})

View File

@ -4,7 +4,6 @@ local on_place = mcl_util.generate_on_place_plant_function(function(place_pos, p
local soil_node = minetest.get_node_or_nil({x=place_pos.x, y=place_pos.y-1, z=place_pos.z})
if not soil_node then return false end
local snn = soil_node.name -- soil node name
local sd = minetest.registered_nodes[snn] -- soil definition
-- Placement rules:
-- * Always allowed on podzol or mycelimu

View File

@ -265,7 +265,6 @@ minetest.register_abm({
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "mcl_core:water_source" then
-- Find dead form (it's the same as the node's drop)
local def = minetest.registered_nodes[node.name]
local dead
if def then
node.name = def.drop
else

View File

@ -37,14 +37,9 @@ local mt_record_protection_violation = minetest.record_protection_violation
local mt_is_creative_enabled = minetest.is_creative_enabled
local mt_sound_play = minetest.sound_play
local math_min = math.min
local math_max = math.max
local math_ceil = math.ceil
local math_floor = math.floor
local math_random = math.random
local string_format = string.format
local table_copy = table.copy
local table_insert = table.insert
local math = math
local string = string
local table = table
-- DEBUG: functions
-- local log = minetest.log
@ -122,7 +117,7 @@ function kelp.is_downward_flowing(pos, node, pos_above, node_above, __is_above__
-- Function params: (pos[, node]) or (node, pos_above) or (node, node_above)
local node = node or mt_get_node(pos)
local result = (math_floor(node.param2 / 8) % 2) == 1
local result = (math.floor(node.param2 / 8) % 2) == 1
if not (result or __is_above__) then
-- If not, also check node above.
-- (this is needed due a weird quirk in the definition of "downwards flowing"
@ -182,14 +177,14 @@ end
-- Roll whether to grow kelp or not.
function kelp.roll_growth(numerator, denominator)
-- Optional params: numerator, denominator
return math_random(denominator or kelp.ROLL_GROWTH_DENOMINATOR) <= (numerator or kelp.ROLL_GROWTH_NUMERATOR)
return math.random(denominator or kelp.ROLL_GROWTH_DENOMINATOR) <= (numerator or kelp.ROLL_GROWTH_NUMERATOR)
end
-- Roll initial age for kelp.
function kelp.roll_init_age(min, max)
-- Optional params
return math_random(min or kelp.MIN_AGE, (max or kelp.MAX_AGE)-1)
return math.random(min or kelp.MIN_AGE, (max or kelp.MAX_AGE)-1)
end
@ -197,7 +192,7 @@ end
-- For the special case where the max param2 is reached, interpret that as the
-- 16th kelp stem.
function kelp.get_height(param2)
return math_floor(param2 / 16) + math_floor(param2 % 16 / 8)
return math.floor(param2 / 16) + math.floor(param2 % 16 / 8)
end
@ -232,7 +227,7 @@ end
-- Obtain next param2.
function kelp.next_param2(param2)
-- param2 max value is 255, so adding to 256 causes overflow.
return math_min(param2+16 - param2 % 16, 255);
return math.min(param2+16 - param2 % 16, 255);
end
@ -242,8 +237,8 @@ function kelp.store_meta()
for _ in pairs(kelp.age_queue_pos) do
count = count + 1
end
-- chatlog(string_format("Storing age metadata: %d in queue", #kelp.age_queue))
-- chatlog(string_format("Storing age metadata: %d valid in queue", count))
-- chatlog(string.format("Storing age metadata: %d in queue", #kelp.age_queue))
-- chatlog(string.format("Storing age metadata: %d valid in queue", count))
for i=1,#kelp.age_queue do
local pos_hash = kelp.age_queue[i]
local pos = kelp.age_queue_pos[pos_hash]
@ -265,7 +260,7 @@ function kelp.store_age(age, pos, pos_hash)
kelp.age_pool[pos_hash] = age
if not kelp.age_queue_pos[pos_hash] then
table_insert(kelp.age_queue, pos_hash)
table.insert(kelp.age_queue, pos_hash)
kelp.age_queue_pos[pos_hash] = pos
return true, pos_hash
end
@ -713,7 +708,7 @@ function kelp.register_kelp_surface(surface, surface_deftemplate, surface_docs)
doc.add_entry_alias("nodes", surface_docs.entry_id_orig, "nodes", surfacename)
end
local sounds = table_copy(def.sounds)
local sounds = table.copy(def.sounds)
sounds.dig = kelp.leaf_sounds.dig
sounds.dug = kelp.leaf_sounds.dug
sounds.place = kelp.leaf_sounds.place
@ -732,9 +727,9 @@ end
-- Kelp surfaces nodes ---------------------------------------------------------
-- Dirt must be registered first, for the docs
kelp.register_kelp_surface(kelp.surfaces[1], table_copy(kelp.surface_deftemplate), kelp.surface_docs)
kelp.register_kelp_surface(kelp.surfaces[1], table.copy(kelp.surface_deftemplate), kelp.surface_docs)
for i=2, #kelp.surfaces do
kelp.register_kelp_surface(kelp.surfaces[i], table_copy(kelp.surface_deftemplate), kelp.surface_docs)
kelp.register_kelp_surface(kelp.surfaces[i], table.copy(kelp.surface_deftemplate), kelp.surface_docs)
end
-- Kelp item -------------------------------------------------------------------

View File

@ -25,11 +25,9 @@ dofile(modpath .. "/lingering.lua")
dofile(modpath .. "/tipped_arrow.lua")
dofile(modpath .. "/potions.lua")
local brewhelp = S("Try different combinations to create potions.")
minetest.register_craftitem("mcl_potions:fermented_spider_eye", {
description = S("Fermented Spider Eye"),
_doc_items_longdesc = brewhelp,
_doc_items_longdesc = S("Try different combinations to create potions."),
wield_image = "mcl_potions_spider_eye_fermented.png",
inventory_image = "mcl_potions_spider_eye_fermented.png",
groups = { brewitem = 1, },
@ -65,14 +63,12 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
-- Try to fill glass bottle with water
local get_water = false
local from_liquid_source = false
--local from_liquid_source = false
local river_water = false
if not def then
-- Unknown node: no-op
elseif def.groups and def.groups.water and def.liquidtype == "source" then
if def and def.groups and def.groups.water and def.liquidtype == "source" then
-- Water source
get_water = true
from_liquid_source = true
--from_liquid_source = true
river_water = node.name == "mclx_core:river_water_source"
-- Or reduce water level of cauldron by 1
elseif string.sub(node.name, 1, 14) == "mcl_cauldrons:" then
@ -440,7 +436,6 @@ function mcl_potions.get_alchemy(ingr, pot)
if brew_table[ingr] ~= nil then
return brew_table[ingr]
end
end
if mod_table[ingr] ~= nil then

View File

@ -1,5 +1,5 @@
local S = minetest.get_translator("mcl_potions")
local brewhelp = S("Try different combinations to create potions.")
--local brewhelp = S("Try different combinations to create potions.")
local potion_image = function(colorstring, opacity)
if not opacity then

View File

@ -123,6 +123,6 @@ function mcl_potions.register_splash(name, descr, color, def)
})
end
local function time_string(dur)
--[[local function time_string(dur)
return math.floor(dur/60)..string.format(":%02d",math.floor(dur % 60))
end
end]]

View File

@ -4,12 +4,12 @@ local ARROW_TIMEOUT = 60
-- Time after which stuck arrow is rechecked for being stuck
local STUCK_RECHECK_TIME = 5
local GRAVITY = 9.81
--local GRAVITY = 9.81
local YAW_OFFSET = -math.pi/2
local dir_to_pitch = function(dir)
local dir2 = vector.normalize(dir)
--local dir2 = vector.normalize(dir)
local xz = math.abs(dir.x) + math.abs(dir.z)
return -math.atan2(-dir.y, xz)
end
@ -197,7 +197,6 @@ function mcl_potions.register_arrow(name, desc, color, def)
glow = 1,
})
end
-- We just check for any hurtable objects nearby.
-- The radius of 3 is fairly liberal, but anything lower than than will cause
-- arrow to hilariously go through mobs often.
@ -360,7 +359,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
if not v then
v = 0
end
local old_v = self._viscosity
--local old_v = self._viscosity
self._viscosity = v
local vpenalty = math.max(0.1, 0.98 - 0.1 * v)
if math.abs(vel.x) > 0.001 then

View File

@ -93,7 +93,7 @@ local generate_line = function(s, ypos)
local chars = 0
local printed_char_width = CHAR_WIDTH + 1
while chars < LINE_LENGTH and i <= #s do
local file = nil
local file
-- Get and render character
if charmap[s:sub(i, i)] ~= nil then
file = charmap[s:sub(i, i)]
@ -185,7 +185,7 @@ local function get_wall_signtext_info(param2, nodename)
end
end
local sign_groups = {handy=1,axey=1, flammable=1, deco_block=1, material_wood=1, attached_node=1, dig_by_piston=1, flammable=-1}
local sign_groups = {handy=1,axey=1, deco_block=1, material_wood=1, attached_node=1, dig_by_piston=1, flammable=-1}
local destruct_sign = function(pos)
local objects = minetest.get_objects_inside_radius(pos, 0.5)
@ -322,7 +322,7 @@ minetest.register_node("mcl_signs:wall_sign", {
local wdir = minetest.dir_to_wallmounted(dir)
local placer_pos = placer:get_pos()
--local placer_pos = placer:get_pos()
local fdir = minetest.dir_to_facedir(dir)

View File

@ -20,7 +20,7 @@ local function place_slab_normal(itemstack, placer, pointed_thing)
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local placer_pos = placer:get_pos()
--local placer_pos = placer:get_pos()
local fpos = get_fpos(placer, pointed_thing)
@ -179,7 +179,7 @@ end
-- Slab facedir to placement 6d matching table
local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
--local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4}
-- Register slabs.
-- Node will be called mcl_stairs:slab_<subname>
@ -268,6 +268,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
end
end,
_mcl_hardness = hardness,
_mcl_blast_resistance = blast_resistance,
_mcl_other_slab_half = upper_slab,
on_rotate = function(pos, node, user, mode, param2)
-- Flip slab
@ -331,6 +332,7 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti
sounds = sounds,
drop = lower_slab .. " 2",
_mcl_hardness = hardness,
_mcl_blast_resistance = blast_resistance,
})
if recipeitem then

View File

@ -1,7 +1,5 @@
mcl_throwing = {}
local S = minetest.get_translator("mcl_throwing")
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
local modpath = minetest.get_modpath(minetest.get_current_modname())
--
@ -42,7 +40,7 @@ function mcl_throwing.get_player_throw_function(entity_name, velocity)
local func = function(item, player, pointed_thing)
local playerpos = player:get_pos()
local dir = player:get_look_dir()
local obj = mcl_throwing.throw(item, {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, velocity, player:get_player_name())
mcl_throwing.throw(item, {x=playerpos.x, y=playerpos.y+1.5, z=playerpos.z}, dir, velocity, player:get_player_name())
if not minetest.is_creative_enabled(player:get_player_name()) then
item:take_item()
end

View File

@ -224,7 +224,7 @@ local pearl_on_step = function(self, dtime)
lv, ld = math.abs(vc.x), "x"
end
if math.abs(vc.z) > lv then
lv, ld = math.abs(vc.z), "z"
ld = "z" --math.abs(vc.z)
end
if ld ~= "x" then vc.x = 0 end
if ld ~= "y" then vc.y = 0 end

View File

@ -1,8 +1,6 @@
local S = minetest.get_translator("mcl_tnt")
local tnt_griefing = minetest.settings:get_bool("mcl_tnt_griefing", true)
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
local function spawn_tnt(pos, entname)
minetest.sound_play("tnt_ignite", {pos = pos,gain = 1.0,max_hear_distance = 15,}, true)
local tnt = minetest.add_entity(pos, entname)

View File

@ -233,7 +233,7 @@ if minetest.get_modpath("mcl_farming") then
local wear = mcl_autogroup.get_wear(toolname, "shearsy")
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pointed_thing.above}, true)
local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
local param2 = minetest.dir_to_facedir(dir)
minetest.swap_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})

View File

@ -30,7 +30,7 @@ local spawn_flames_floor = function(pos)
end
local spawn_flames_wall = function(pos)
local minrelpos, maxrelpos
--local minrelpos, maxrelpos
local node = minetest.get_node(pos)
local dir = minetest.wallmounted_to_dir(node.param2)

View File

@ -157,7 +157,6 @@ screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses)
if should_rotate and new_param2 ~= node.param2 then
node.param2 = new_param2
minetest.swap_node(pos, node)
minetest.check_for_falling(pos)
if ndef.after_rotate then
ndef.after_rotate(vector.new(pos))

View File

@ -142,7 +142,7 @@ function xpanes.register_pane(name, def)
tiles = {def.textures[3], def.textures[2], def.textures[1]},
use_texture_alpha = def.use_texture_alpha,
groups = groups,
drop = "xpanes:" .. name .. "_flat",
drop = drop,
sounds = def.sounds,
node_box = {
type = "connected",
@ -153,7 +153,6 @@ function xpanes.register_pane(name, def)
connect_right = {{1/32, -1/2, -1/32, 1/2, 1/2, 1/32}},
},
connects_to = {"group:pane", "group:stone", "group:glass", "group:wood", "group:tree"},
drop = drop,
_mcl_blast_resistance = def._mcl_blast_resistance,
_mcl_hardness = def._mcl_hardness,
_mcl_silk_touch_drop = def._mcl_silk_touch_drop and {"xpanes:" .. name .. "_flat"},

View File

@ -3973,7 +3973,7 @@ if mg_name ~= "singlenode" then
if deco_id_chorus_plant then
mcl_mapgen_core.register_generator("chorus_grow", nil, function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object("gennotify")
local poslist = {}
--local poslist = {}
for _, pos in ipairs(gennotify["decoration#"..deco_id_chorus_plant] or {}) do
local realpos = { x = pos.x, y = pos.y + 1, z = pos.z }
mcl_end.grow_chorus_plant(realpos)

View File

@ -49,12 +49,12 @@ local dungeonsizes = {
{ x=7, y=4, z=7},
}
local dirs = {
--[[local dirs = {
{ x= 1, y=0, z= 0 },
{ x= 0, y=0, z= 1 },
{ x=-1, y=0, z= 0 },
{ x= 0, y=0, z=-1 },
}
}]]
local surround_vectors = {
{ x=-1, y=0, z=0 },
@ -66,7 +66,7 @@ local surround_vectors = {
local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
if calls_remaining >= 1 then return end
local p1, p2, dim, pr = param.p1, param.p2, param.dim, param.pr
local p1, _, dim, pr = param.p1, param.p2, param.dim, param.pr
local x, y, z = p1.x, p1.y, p1.z
local check = not (param.dontcheck or false)
@ -404,8 +404,7 @@ local function dungeons_nodes(minp, maxp, blockseed)
local p1 = {x=x,y=y,z=z}
local p2 = {x = x+dim.x+1, y = y+dim.y+1, z = z+dim.z+1}
minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
local param = {p1=p1, p2=p2, dim=dim, pr=pr}
emerge_area(p1, p2, ecb_spawn_dungeon, param)
emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr})
end
end
@ -414,8 +413,7 @@ function mcl_dungeons.spawn_dungeon(p1, _, pr)
local dim = dungeonsizes[pr:next(1, #dungeonsizes)]
local p2 = {x = p1.x+dim.x+1, y = p1.y+dim.y+1, z = p1.z+dim.z+1}
minetest.log("verbose","[mcl_dungeons] size=" ..minetest.pos_to_string(dim) .. ", emerge from "..minetest.pos_to_string(p1) .. " to " .. minetest.pos_to_string(p2))
local param = {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true}
emerge_area(p1, p2, ecb_spawn_dungeon, param)
emerge_area(p1, p2, ecb_spawn_dungeon, {p1=p1, p2=p2, dim=dim, pr=pr, dontcheck=true})
end
mcl_mapgen_core.register_generator("dungeons", nil, dungeons_nodes, 999999)

View File

@ -65,21 +65,21 @@ local c_dirt = minetest.get_content_id("mcl_core:dirt")
local c_dirt_with_grass = minetest.get_content_id("mcl_core:dirt_with_grass")
local c_dirt_with_grass_snow = minetest.get_content_id("mcl_core:dirt_with_grass_snow")
local c_sand = minetest.get_content_id("mcl_core:sand")
local c_sandstone = minetest.get_content_id("mcl_core:sandstone")
--local c_sandstone = minetest.get_content_id("mcl_core:sandstone")
local c_void = minetest.get_content_id("mcl_core:void")
local c_lava = minetest.get_content_id("mcl_core:lava_source")
local c_water = minetest.get_content_id("mcl_core:water_source")
local c_soul_sand = minetest.get_content_id("mcl_nether:soul_sand")
local c_netherrack = minetest.get_content_id("mcl_nether:netherrack")
local c_nether_lava = minetest.get_content_id("mcl_nether:nether_lava_source")
local c_end_stone = minetest.get_content_id("mcl_end:end_stone")
--local c_end_stone = minetest.get_content_id("mcl_end:end_stone")
local c_realm_barrier = minetest.get_content_id("mcl_core:realm_barrier")
local c_top_snow = minetest.get_content_id("mcl_core:snow")
local c_snow_block = minetest.get_content_id("mcl_core:snowblock")
local c_clay = minetest.get_content_id("mcl_core:clay")
local c_leaves = minetest.get_content_id("mcl_core:leaves")
local c_jungleleaves = minetest.get_content_id("mcl_core:jungleleaves")
local c_jungletree = minetest.get_content_id("mcl_core:jungletree")
--local c_jungletree = minetest.get_content_id("mcl_core:jungletree")
local c_cocoa_1 = minetest.get_content_id("mcl_cocoas:cocoa_1")
local c_cocoa_2 = minetest.get_content_id("mcl_cocoas:cocoa_2")
local c_cocoa_3 = minetest.get_content_id("mcl_cocoas:cocoa_3")
@ -1169,13 +1169,13 @@ end
-- minp and maxp (from an on_generated callback) and returns the real world coordinates
-- as X, Z.
-- Inverse function of xz_to_biomemap
local biomemap_to_xz = function(index, minp, maxp)
--[[local biomemap_to_xz = function(index, minp, maxp)
local xwidth = maxp.x - minp.x + 1
local zwidth = maxp.z - minp.z + 1
local x = ((index-1) % xwidth) + minp.x
local z = ((index-1) / zwidth) + minp.z
return x, z
end
end]]
-- Takes x and z coordinates and minp and maxp of a generated chunk
-- (in on_generated callback) and returns a biomemap index)
@ -1897,7 +1897,7 @@ function mcl_mapgen_core.unregister_generator(id)
local rec = registered_generators[id]
registered_generators[id] = nil
if rec.vf then lvm = lvm - 1 end
if rev.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_level0 then level0 = level0 - 1 end
end
@ -1979,7 +1979,7 @@ end
-- Below the bedrock, generate air/void
local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
local biomemap, ymin, ymax
local biomemap --ymin, ymax
local lvm_used = false
local pr = PseudoRandom(blockseed)
@ -2077,7 +2077,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
local n = nodes[n]
local p_pos = area:index(n.x, n.y, n.z)
local p_pos_above = area:index(n.x, n.y+1, n.z)
local p_pos_below = area:index(n.x, n.y-1, n.z)
--local p_pos_below = area:index(n.x, n.y-1, n.z)
local b_pos = aream:index(n.x, 0, n.z)
local bn = minetest.get_biome_name(biomemap[b_pos])
if bn then
@ -2126,7 +2126,7 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- * Remove stone, sand, dirt in v6 so our End map generator works in v6.
-- * Generate spawn platform (End portal destination)
elseif minp.y <= mcl_vars.mg_end_max and maxp.y >= mcl_vars.mg_end_min then
local nodes, n
local nodes
if mg_name == "v6" then
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
else
@ -2144,8 +2144,8 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
minp.x <= mcl_vars.mg_end_platform_pos.x and maxp.x >= mcl_vars.mg_end_platform_pos.z and
minp.z <= mcl_vars.mg_end_platform_pos.z and maxp.z >= mcl_vars.mg_end_platform_pos.z then
local pos1 = {x = math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), y = math.max(minp.y, mcl_vars.mg_end_platform_pos.y), z = math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2)}
local pos2 = {x = math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2), y = math.min(maxp.y, mcl_vars.mg_end_platform_pos.y+2), z = math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2)}
--local pos1 = {x = math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), y = math.max(minp.y, mcl_vars.mg_end_platform_pos.y), z = math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2)}
--local pos2 = {x = math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2), y = math.min(maxp.y, mcl_vars.mg_end_platform_pos.y+2), z = math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2)}
for x=math.max(minp.x, mcl_vars.mg_end_platform_pos.x-2), math.min(maxp.x, mcl_vars.mg_end_platform_pos.x+2) do
for z=math.max(minp.z, mcl_vars.mg_end_platform_pos.z-2), math.min(maxp.z, mcl_vars.mg_end_platform_pos.z+2) do

View File

@ -110,7 +110,8 @@ mcl_structures.generate_igloo = function(pos, rotation, pr)
if r == 1 then
-- Select basement depth
local dim = mcl_worlds.pos_to_dimension(pos)
local buffer = pos.y - (mcl_vars.mg_lava_overworld_max + 10)
--local buffer = pos.y - (mcl_vars.mg_lava_overworld_max + 10)
local buffer
if dim == "nether" then
buffer = pos.y - (mcl_vars.mg_lava_nether_max + 10)
elseif dim == "end" then
@ -219,7 +220,7 @@ local function igloo_placement_callback(p1, p2, size, orientation, pr)
else
return
end
local size = {x=9,y=5,z=7}
--local size = {x=9,y=5,z=7}
local lootitems = mcl_loot.get_multi_loot({
{
stacks_min = 1,
@ -335,7 +336,7 @@ local function shrine_placement_callback(p1, p2, size, rotation, pr)
-- Find and setup spawner with silverfish
local spawners = minetest.find_nodes_in_area(p1, p2, "mcl_mobspawners:spawner")
for s=1, #spawners do
local meta = minetest.get_meta(spawners[s])
--local meta = minetest.get_meta(spawners[s])
mcl_mobspawners.setup_spawner(spawners[s], "mobs_mc:silverfish")
end
@ -411,7 +412,7 @@ end
mcl_structures.generate_end_portal_shrine = function(pos, rotation, pr)
local offset = {x=6, y=4, z=6}
local size = {x=13, y=8, z=13}
--local size = {x=13, y=8, z=13}
local newpos = { x = pos.x - offset.x, y = pos.y, z = pos.z - offset.z }
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_portal_room_simple.mts"
@ -471,8 +472,6 @@ local function temple_placement_callback(p1, p2, size, rotation, pr)
{ itemstring = "mcl_mobitems:string", weight = 10, amount_min = 1, amount_max = 8 },
}
}}, pr)
local meta = minetest.get_meta(chests[c])
init_node_construct(chests[c])
local meta = minetest.get_meta(chests[c])
local inv = meta:get_inventory()
@ -498,7 +497,7 @@ mcl_structures.generate_desert_temple = function(pos, rotation, pr)
-- No Generating for the temple ... Why using it ? No Change
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_desert_temple.mts"
local newpos = {x=pos.x,y=pos.y-12,z=pos.z}
local size = {x=22, y=24, z=22}
--local size = {x=22, y=24, z=22}
if newpos == nil then
return
end

View File

@ -78,4 +78,4 @@ max_height_difference = 56
--
--
half_map_chunk_size = 40
quarter_map_chunk_size = 20
--quarter_map_chunk_size = 20

View File

@ -85,7 +85,7 @@ if mg_name ~= "singlenode" then
if blockseed % 77 ~= 17 then return end
-- needed for manual and automated settlement building
-- don't build settlements on (too) uneven terrain
local heightmap = minetest.get_mapgen_object("heightmap")
--local heightmap = minetest.get_mapgen_object("heightmap")
local height_difference = settlements.evaluate_heightmap()
if height_difference > max_height_difference then return end

View File

@ -126,7 +126,7 @@ function settlements.fill_chest(pos, pr)
-- fill chest
local inv = minetest.get_inventory( {type="node", pos=pos} )
local function get_treasures(pr)
local function get_treasures(prand)
local loottable = {{
stacks_min = 3,
stacks_max = 8,
@ -150,7 +150,7 @@ function settlements.fill_chest(pos, pr)
{ itemstring = "mobs_mc:diamond_horse_armor", weight = 1 },
}
}}
local items = mcl_loot.get_multi_loot(loottable, pr)
local items = mcl_loot.get_multi_loot(loottable, prand)
return items
end

View File

@ -823,7 +823,7 @@ local function create_corridor_line(waypoint, axis, sign, length, wood, post, da
local s = sign
local ud = false -- Up or down
local udn = false -- Up or down is next
local udp = false -- Up or down was previous
local udp -- Up or down was previous
local up = false -- true if going up
local upp = false -- true if was going up previously
for i=1,length do

View File

@ -119,7 +119,7 @@ local function find_biome(pos, biomes)
local edge_dist = 0
local dir_step = 0
local dir_ind = 1
local success = false
local success
local spawn_pos
local biome_ids
@ -166,7 +166,7 @@ local function find_biome(pos, biomes)
spawn_pos = {x = spos.x, y = spos.y, z = spos.z}
end
if spawn_pos then
local adjusted_pos, outside = adjust_pos_to_biome_limits(spawn_pos, biome_id)
local _,outside = adjust_pos_to_biome_limits(spawn_pos, biome_id)
if is_in_world(spawn_pos) and not outside then
return true
end

View File

@ -1,7 +1,3 @@
local S = minetest.get_translator("mcl_commands")
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/kill.lua")

View File

@ -6,7 +6,7 @@ minetest.register_chatcommand("setblock", {
privs = {give=true, interact=true},
func = function(name, param)
local p = {}
local nodestring = nil
local nodestring
p.x, p.y, p.z, nodestring = param:match("^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+) +(.+)$")
p.x, p.y, p.z = tonumber(p.x), tonumber(p.y), tonumber(p.z)
if p.x and p.y and p.z and nodestring then

View File

@ -4,39 +4,34 @@ minetest.register_chatcommand("playsound",{
params = S("<sound> <target>"), --TODO:add source
description = S("Play a sound. Arguments: <sound>: name of the sound. <target>: Target."),
privs = {server = true},
func = function(name, params)
func = function(name, rawparams)
local P = {}
local i = 0
for str in string.gmatch(params, "([^ ]+)") do
for str in string.gmatch(rawparams, "([^ ]+)") do
i = i + 1
P[i] = str
end
local params = {}
if P[1] == tostring(P[1]) then
params.name = P[1]
else
return false, S("Sound name is invalid!") --TODO: add mc chat message
end
if P[2] == tostring(P[2]) and minetest.player_exists(P[2]) then
params.target = P[2]
else
return false, S("Target is invalid!!")
end
-- if P[3] then
-- params.pos = nil --TODO:position
-- else
-- params.pos = nil
-- end
-- if P[4] == tonumber(P[4]) then
-- params.gain = P[4]
-- else
-- params.gain = 1.0
-- end
-- if P[5] == tonumber(P[5]) then
-- params.pitch = P[5]
-- else

View File

@ -27,7 +27,12 @@ minetest.register_craft({
minetest.register_craft({
type = "shapeless",
output = "mcl_ocean:prismarine_crystals",
recipe = { "mcl_ocean:prismarine_shard", "mcl_ocean:prismarine_shard", "mcl_ocean:prismarine_shard", "mcl_core:gold_ingot" },
recipe = {
"mcl_ocean:prismarine_shard",
"mcl_ocean:prismarine_shard",
"mcl_ocean:prismarine_shard",
"mcl_core:gold_ingot",
},
})
minetest.register_craft({

View File

@ -19,7 +19,7 @@ minetest.register_on_dieplayer(function(player)
local playerinv = player:get_inventory()
local pos = player:get_pos()
-- No item drop if in deep void
local void, void_deadly = mcl_worlds.is_in_void(pos)
local _, void_deadly = mcl_worlds.is_in_void(pos)
for l=1,#mcl_death_drop.registered_dropped_lists do
local inv = mcl_death_drop.registered_dropped_lists[l].inv

View File

@ -86,7 +86,8 @@ if mcl_hunger.active then
function mcl_hunger.saturate(playername, increase, update_hudbar)
local player = minetest.get_player_by_name(playername)
local ok = mcl_hunger.set_saturation(player, math.min(mcl_hunger.get_saturation(player) + increase, mcl_hunger.get_hunger(player)))
local ok = mcl_hunger.set_saturation(player,
math.min(mcl_hunger.get_saturation(player) + increase, mcl_hunger.get_hunger(player)))
if update_hudbar ~= false then
mcl_hunger.update_saturation_hud(player, mcl_hunger.get_saturation(player), mcl_hunger.get_hunger(player))
end
@ -105,7 +106,7 @@ if mcl_hunger.active then
-- otherwise the following poison/exhaust fields are ignored
food[name].poison = poison -- poison damage per tick for poisonous food
food[name].exhaust = exhaust -- exhaustion per tick for poisonous food
food[name].poisonchance = poisonchance -- chance percentage that this item poisons the player (default: 100% if poisoning is enabled)
food[name].poisonchance = poisonchance -- chance percentage that this item poisons the player (default: 100%)
food[name].sound = sound -- special sound that is played when eating
end

View File

@ -2,7 +2,6 @@ local S = minetest.get_translator("mcl_hunger")
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
-- wrapper for minetest.item_eat (this way we make sure other mods can't break this one)
local org_eat = minetest.do_item_eat
minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
if not user or user:is_player() == false then
@ -38,7 +37,8 @@ minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, p
-- FIXME: In singleplayer, there's a cheat to circumvent this, simply by pausing the game between eats.
-- This is because os.time() obviously does not care about the pause. A fix needs a different timer mechanism.
if no_eat_delay or (mcl_hunger.last_eat[name] < 0) or (os.difftime(os.time(), mcl_hunger.last_eat[name]) >= 2) then
local can_eat_when_full = creative or (mcl_hunger.active == false) or minetest.get_item_group(itemstack:get_name(), "can_eat_when_full") == 1
local can_eat_when_full = creative or (mcl_hunger.active == false)
or minetest.get_item_group(itemstack:get_name(), "can_eat_when_full") == 1
-- Don't allow eating when player has full hunger bar (some exceptional items apply)
if can_eat_when_full or (mcl_hunger.get_hunger(user) < 20) then
itemstack = mcl_hunger.eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
@ -67,7 +67,8 @@ function mcl_hunger.eat(hp_change, replace_with_item, itemstack, user, pointed_t
def.saturation = hp_change
def.replace = replace_with_item
end
local func = mcl_hunger.item_eat(def.saturation, def.replace, def.poisontime, def.poison, def.exhaust, def.poisonchance, def.sound)
local func = mcl_hunger.item_eat(def.saturation, def.replace, def.poisontime,
def.poison, def.exhaust, def.poisonchance, def.sound)
return func(itemstack, user, pointed_thing)
end
@ -90,7 +91,6 @@ local function poisonp(tick, time, time_left, damage, exhaustion, name)
if not player then
return
end
local name = player:get_player_name()
-- Abort if food poisonings have been stopped
if mcl_hunger.poison_hunger[name] == 0 then
return
@ -131,7 +131,7 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso
itemstack:take_item()
end
local name = user:get_player_name()
local hp = user:get_hp()
--local hp = user:get_hp()
local pos = user:get_pos()
-- player height

View File

@ -65,9 +65,7 @@ end
-- Count number of poisonings a player has at once
mcl_hunger.poison_hunger = {} -- food poisoning, increasing hunger
-- HUD item ids
local hunger_hud = {}
-- HUD
local function init_hud(player)
hb.init_hudbar(player, "hunger", mcl_hunger.get_hunger(player))
if mcl_hunger.debug then

View File

@ -63,7 +63,6 @@ end
if has_mcl_skins == true then
--change the player's hand to their skin
mcl_skins.register_on_set_skin(function(player, skin)
local name = player:get_player_name()
local meta = mcl_skins.meta[skin]
if meta.gender == "female" then
player:get_inventory():set_stack("hand", 1, "mcl_meshhand:"..skin.."_female")

View File

@ -9,7 +9,7 @@ local animation_blend = 0
local function get_mouse_button(player)
local controls = player:get_player_control()
local get_wielded_item_name = player:get_wielded_item():get_name()
if controls.RMB and not string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") or controls.LMB then
if controls.RMB and not string.find(get_wielded_item_name, "mcl_bows:bow") or controls.LMB then
return true
else
return false
@ -200,7 +200,10 @@ minetest.register_globalstep(function(dtime)
-- Apply animations based on what the player is doing
if player:get_hp() == 0 then
player_set_animation(player, "die")
elseif walking and velocity.x > 0.35 or walking and velocity.x < -0.35 or walking and velocity.z > 0.35 or walking and velocity.z < -0.35 then
elseif walking and velocity.x > 0.35
or walking and velocity.x < -0.35
or walking and velocity.z > 0.35
or walking and velocity.z < -0.35 then
if player_sneak[name] ~= controls.sneak then
player_anim[name] = nil
player_sneak[name] = controls.sneak

View File

@ -22,14 +22,13 @@ local math = math
-- Internal player state
local mcl_playerplus_internal = {}
local def = {}
local time = 0
local look_pitch = 0
local player_collision = function(player)
local pos = player:get_pos()
local vel = player:get_velocity()
--local vel = player:get_velocity()
local x = 0
local z = 0
local width = .75
@ -58,18 +57,8 @@ local function degrees(rad)
return rad * 180.0 / math.pi
end
local pi = math.pi
local atann = math.atan
local atan = function(x)
if not x or x ~= x then
return 0
else
return atann(x)
end
end
local dir_to_pitch = function(dir)
local dir2 = vector.normalize(dir)
--local dir2 = vector.normalize(dir)
local xz = math.abs(dir.x) + math.abs(dir.z)
return -math.atan2(-dir.y, xz)
end
@ -121,7 +110,7 @@ function limit_vel_yaw(player_vel_yaw, yaw)
return player_vel_yaw
end
local pitch, name, node_stand, node_stand_below, node_head, node_feet, pos
local node_stand, node_stand_below, node_head, node_feet
minetest.register_on_punchplayer(function(player, hitter, damage)
@ -178,7 +167,7 @@ minetest.register_globalstep(function(dtime)
local control = player:get_player_control()
local name = player:get_player_name()
local meta = player:get_meta()
--local meta = player:get_meta()
local parent = player:get_attach()
local wielded = player:get_wielded_item()
local player_velocity = player:get_velocity() or player:get_player_velocity()
@ -219,7 +208,7 @@ minetest.register_globalstep(function(dtime)
elytra[player] = true
elseif key=="RMB" then
if wielded:get_name() == "mcl_tools:rocket" then
local item = wielded:take_item()
wielded:take_item()
player:set_wielded_item(wielded)
end
end
@ -324,7 +313,7 @@ minetest.register_globalstep(function(dtime)
if control.jump and mcl_playerplus_internal[name].jump_cooldown <= 0 then
pos = player:get_pos()
--pos = player:get_pos()
node_stand = mcl_playerinfo[name].node_stand
node_stand_below = mcl_playerinfo[name].node_stand_below
@ -396,9 +385,6 @@ minetest.register_globalstep(function(dtime)
return
end
-- set defaults
def.speed = 1
-- Standing on soul sand? If so, walk slower (unless player wears Soul Speed boots)
if node_stand == "mcl_nether:soul_sand" then
-- TODO: Tweak walk speed

View File

@ -193,7 +193,6 @@ minetest.register_chatcommand("setskin", {
end
end
local skin
local ok = mcl_skins.set_player_skin(player, skin_id)
if not ok then
return false, S("Invalid skin number! Valid numbers: 0 to @1", mcl_skins.skin_count)

View File

@ -1,45 +0,0 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

View File

@ -500,10 +500,8 @@ function mcl_spawn.shadow_worker()
if success then
local wsp_node = minetest.get_node(wsp)
if wsp_node and wsp_node.name == "ignore" then
-- special case - respawn area unloaded from memory - it's okay, skip for now
elseif ((not good_for_respawn(wsp)) or ((no_trees_area_counter >= 0) and not can_find_tree(wsp))) then
if not (wsp_node and wsp_node.name == "ignore")
and ((not good_for_respawn(wsp)) or ((no_trees_area_counter >= 0) and not can_find_tree(wsp))) then
success = false
minetest.log("action", "[mcl_spawn] World spawn position isn't safe anymore: "..minetest.pos_to_string(wsp))
mcl_spawn.search()

View File

@ -53,7 +53,10 @@ local function setSprinting(playerName, sprinting) --Sets the state of a player
local controls = player:get_player_control()
if players[playerName] then
players[playerName].sprinting = sprinting
if sprinting == true or controls.RMB and string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and player:get_wielded_item():get_name() ~= "mcl_bows:bow" then
if sprinting == true
or controls.RMB
and string.find(player:get_wielded_item():get_name(), "mcl_bows:bow")
and player:get_wielded_item():get_name() ~= "mcl_bows:bow" then
if sprinting == true then
players[playerName].fov = math.min(players[playerName].fov + 0.05, 1.2)
players[playerName].fade_time = .15
@ -65,7 +68,10 @@ local function setSprinting(playerName, sprinting) --Sets the state of a player
if sprinting == true then
playerphysics.add_physics_factor(player, "speed", "mcl_sprint:sprint", mcl_sprint.SPEED)
end
elseif sprinting == false and player:get_wielded_item():get_name() ~= "mcl_bows:bow_0" and player:get_wielded_item():get_name() ~= "mcl_bows:bow_1" and player:get_wielded_item():get_name() ~= "mcl_bows:bow_2" then
elseif sprinting == false
and player:get_wielded_item():get_name() ~= "mcl_bows:bow_0"
and player:get_wielded_item():get_name() ~= "mcl_bows:bow_1"
and player:get_wielded_item():get_name() ~= "mcl_bows:bow_2" then
players[playerName].fov = math.max(players[playerName].fov - 0.05, 1.0)
player:set_fov(players[playerName].fov, true, 0.15)
if sprinting == false then
@ -186,7 +192,8 @@ minetest.register_globalstep(function(dtime)
if players[playerName]["shouldSprint"] == true then --Stopped
local sprinting
-- Prevent sprinting if hungry or sleeping
if (mcl_hunger.active and mcl_hunger.get_hunger(player) <= 6) or (player:get_meta():get_string("mcl_beds:sleeping") == "true") then
if (mcl_hunger.active and mcl_hunger.get_hunger(player) <= 6)
or (player:get_meta():get_string("mcl_beds:sleeping") == "true") then
sprinting = false
cancelClientSprinting(playerName)
else

View File

@ -0,0 +1,131 @@
local update_time = tonumber(minetest.settings:get("wieldview_update_time"))
if not update_time then
update_time = 2
minetest.settings:set("wieldview_update_time", tostring(update_time))
end
local node_tiles = minetest.settings:get_bool("wieldview_node_tiles")
if not node_tiles then
node_tiles = false
minetest.settings:set("wieldview_node_tiles", "false")
end
wieldview = {
wielded_item = {},
transform = {},
}
dofile(minetest.get_modpath(minetest.get_current_modname()).."/transform.lua")
wieldview.get_item_texture = function(self, item)
local texture = "blank.png"
if item ~= "" then
if minetest.registered_items[item] then
if minetest.registered_items[item].inventory_image ~= "" then
texture = minetest.registered_items[item].inventory_image
elseif node_tiles == true and minetest.registered_items[item].tiles
and type(minetest.registered_items[item].tiles[1]) == "string"
and minetest.registered_items[item].tiles[1] ~= "" then
texture = minetest.inventorycube(minetest.registered_items[item].tiles[1])
end
end
-- Get item image transformation, first from group, then from transform.lua
local transform = minetest.get_item_group(item, "wieldview_transform")
if transform == 0 then
transform = wieldview.transform[item]
end
if transform then
-- This actually works with groups ratings because transform1, transform2, etc.
-- have meaning and transform0 is used for identidy, so it can be ignored
texture = texture.."^[transform"..tostring(transform)
end
end
return texture
end
wieldview.update_wielded_item = function(self, player)
if not player then
return
end
local name = player:get_player_name()
local stack = player:get_wielded_item()
local item = stack:get_name()
if not item then
return
end
if self.wielded_item[name] then
if self.wielded_item[name] == item then
return
end
if not armor.textures[name] then
return
end
armor.textures[name].wielditem = self:get_item_texture(item)
armor:update_player_visuals(player)
end
self.wielded_item[name] = item
end
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
wieldview.wielded_item[name] = ""
minetest.after(0, function(target)
-- if the player left :is_player() will return nil
if not target:is_player() then
return
end
wieldview:update_wielded_item(target)
local itementity = minetest.add_entity(target:get_pos(), "wieldview:wieldnode")
itementity:set_attach(target, "Hand_Right", vector.new(0, 1, 0), vector.new(90, 0, 45))
itementity:get_luaentity().wielder = name
end, player)
end)
minetest.register_globalstep(function()
for _,player in pairs(minetest.get_connected_players()) do
wieldview:update_wielded_item(player)
end
end)
minetest.register_entity("wieldview:wieldnode", {
initial_properties = {
hp_max = 1,
visual = "wielditem",
physical = false,
textures = {""},
automatic_rotate = 1.5,
is_visible = true,
pointable = false,
collide_with_objects = false,
static_save = false,
collisionbox = {-0.21, -0.21, -0.21, 0.21, 0.21, 0.21},
selectionbox = {-0.21, -0.21, -0.21, 0.21, 0.21, 0.21},
visual_size = {x = 0.21, y = 0.21},
},
itemstring = "",
on_step = function(self)
local player = minetest.get_player_by_name(self.wielder)
if player then
local wielded = player:get_wielded_item()
local itemstring = wielded:get_name()
if self.itemstring ~= itemstring then
local def = minetest.registered_items[itemstring]
self.object:set_properties({glow = def and def.light_source or 0})
-- wield item as cubic
if armor.textures[self.wielder].wielditem == "blank.png" then
self.object:set_properties({textures = {itemstring}})
-- wield item as flat
else
self.object:set_properties({textures = {""}})
end
self.itemstring = itemstring
end
else
self.object:remove()
end
end,
})

View File

@ -98,7 +98,7 @@ animated_chests (Animated chests) bool true
3d_player_preview (3D Player preview) bool true
# The maximum number of boss bars to simultaniously display on the screen
max_bossbars (Maximum Boss bars) int 4
max_bossbars (Maximum Boss bars) int 5
[Experimental]
# Whether ice is translucent. If disabled, ice is fully opaque.

0
tools/create_luacheck.py Normal file
View File