mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-09 00:29:33 +01:00
Fix undeclared (global) variable usage (#4803)
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4803 Reviewed-by: teknomunk <teknomunk@protonmail.com> Co-authored-by: Mikita Wiśniewski <rudzik8@protonmail.com> Co-committed-by: Mikita Wiśniewski <rudzik8@protonmail.com>
This commit is contained in:
parent
013679507b
commit
0385abc277
14 changed files with 34 additions and 43 deletions
|
@ -89,9 +89,9 @@ function render_frame(A, B)
|
||||||
zbuffer[yp][xp] = ooz
|
zbuffer[yp][xp] = ooz
|
||||||
local luminance = math.max( math.ceil( L * 180 ), 0 )
|
local luminance = math.max( math.ceil( L * 180 ), 0 )
|
||||||
-- luminance is now in the range 0 to 255
|
-- luminance is now in the range 0 to 255
|
||||||
r = math.ceil( (luminance + xp) / 2 )
|
local r = math.ceil( (luminance + xp) / 2 )
|
||||||
g = math.ceil( (luminance + yp) / 2 )
|
local g = math.ceil( (luminance + yp) / 2 )
|
||||||
b = math.ceil( (luminance + xp + yp) / 3 )
|
local b = math.ceil( (luminance + xp + yp) / 3 )
|
||||||
output[yp][xp] = { r, g, b }
|
output[yp][xp] = { r, g, b }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ doc.add_category("mobs", {
|
||||||
datastring = datastring .. S("Type: @1", data.type)
|
datastring = datastring .. S("Type: @1", data.type)
|
||||||
datastring = newline2(datastring)
|
datastring = newline2(datastring)
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.spawn_class then
|
if data.spawn_class then
|
||||||
datastring = datastring .. S("spawn class: @1", data.spawn_class)
|
datastring = datastring .. S("spawn class: @1", data.spawn_class)
|
||||||
datastring = newline2(datastring)
|
datastring = newline2(datastring)
|
||||||
|
@ -1167,25 +1167,18 @@ doc.add_category("mobs", {
|
||||||
datastring = datastring .. S("Can Fly")
|
datastring = datastring .. S("Can Fly")
|
||||||
datastring = newline2(datastring)
|
datastring = newline2(datastring)
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.drops then
|
if data.drops and #data.drops > 0 then
|
||||||
count = 0
|
datastring = datastring .. S("drops: ")
|
||||||
|
datastring = newline(datastring)
|
||||||
|
|
||||||
for _,item in ipairs(data.drops) do
|
for _,item in ipairs(data.drops) do
|
||||||
count = count + 1
|
local itemDescription = ItemStack(item.name):get_short_description()
|
||||||
end
|
datastring = datastring .. itemDescription
|
||||||
|
|
||||||
if count > 0 then
|
|
||||||
datastring = datastring .. S("drops: ")
|
|
||||||
datastring = newline(datastring)
|
datastring = newline(datastring)
|
||||||
|
|
||||||
for _,item in ipairs(data.drops) do
|
|
||||||
local itemDescription = ItemStack(item.name):get_short_description()
|
|
||||||
datastring = datastring .. itemDescription
|
|
||||||
datastring = newline(datastring)
|
|
||||||
end
|
|
||||||
|
|
||||||
datastring = newline2(datastring)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
datastring = newline2(datastring)
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.follow then
|
if data.follow then
|
||||||
|
@ -1203,12 +1196,11 @@ doc.add_category("mobs", {
|
||||||
datastring = newline(datastring)
|
datastring = newline(datastring)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
datastring = newline2(datastring)
|
datastring = newline2(datastring)
|
||||||
end
|
end
|
||||||
|
|
||||||
local formstring = doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2)
|
local formstring = doc.widgets.text(datastring, nil, nil, doc.FORMSPEC.ENTRY_WIDTH - 1.2)
|
||||||
|
|
||||||
return formstring
|
return formstring
|
||||||
else
|
else
|
||||||
return "label[0,1;NO DATA AVALIABLE!]"
|
return "label[0,1;NO DATA AVALIABLE!]"
|
||||||
|
|
|
@ -191,7 +191,7 @@ local dropperdef = {
|
||||||
local speed = 3
|
local speed = 3
|
||||||
item_entity:set_velocity(vector.multiply(drop_vel, speed))
|
item_entity:set_velocity(vector.multiply(drop_vel, speed))
|
||||||
stack:take_item()
|
stack:take_item()
|
||||||
item_dropped = trie
|
item_dropped = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove dropped items from inventory
|
-- Remove dropped items from inventory
|
||||||
|
|
|
@ -11,7 +11,7 @@ mod.initialize = function(meta)
|
||||||
meta:set_string("commander", "")
|
meta:set_string("commander", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
mod.place = function(meta, placer)
|
mod.place = function(meta, placer)
|
||||||
if not placer then return end
|
if not placer then return end
|
||||||
|
|
||||||
meta:set_string("commander", placer:get_player_name())
|
meta:set_string("commander", placer:get_player_name())
|
||||||
|
@ -118,7 +118,7 @@ end
|
||||||
|
|
||||||
local formspec_metas = {}
|
local formspec_metas = {}
|
||||||
|
|
||||||
mod.handle_rightclick = function(meta, player)
|
mod.handle_rightclick = function(meta, player, pos)
|
||||||
local can_edit = true
|
local can_edit = true
|
||||||
-- Only allow write access in Creative Mode
|
-- Only allow write access in Creative Mode
|
||||||
if not minetest.is_creative_enabled(player:get_player_name()) then
|
if not minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
|
@ -205,7 +205,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
-- Retrieve the metadata object this formspec data belongs to
|
-- Retrieve the metadata object this formspec data belongs to
|
||||||
local index, _, fs_id = string.find(formname, "commandblock_(-?%d+)")
|
local index, _, fs_id = string.find(formname, "commandblock_(-?%d+)")
|
||||||
fs_id = tonumber(fs_id)
|
fs_id = tonumber(fs_id)
|
||||||
if not index or not fs_id or not formspec_metas[fs_id] then
|
if not index or not fs_id or not formspec_metas[fs_id] then
|
||||||
print("index="..tostring(index)..", fs_id="..tostring(fs_id).."formspec_metas[fs_id]="..tostring(formspec_metas[fs_id]))
|
print("index="..tostring(index)..", fs_id="..tostring(fs_id).."formspec_metas[fs_id]="..tostring(formspec_metas[fs_id]))
|
||||||
minetest.chat_send_player(player:get_player_name(), S("Editing the command block has failed! The command block is gone."))
|
minetest.chat_send_player(player:get_player_name(), S("Editing the command block has failed! The command block is gone."))
|
||||||
return
|
return
|
||||||
|
|
|
@ -53,8 +53,7 @@ local function on_rightclick(pos, node, player, itemstack, pointed_thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
api.handle_rightclick(meta, player)
|
api.handle_rightclick(meta, player, pos)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_place(itemstack, placer, pointed_thing)
|
local function on_place(itemstack, placer, pointed_thing)
|
||||||
|
|
|
@ -366,7 +366,7 @@ minetest.register_node("mcl_beacons:beacon", {
|
||||||
remove_beacon_beam(pos)
|
remove_beacon_beam(pos)
|
||||||
for y = pos.y +1, pos.y + 201 do
|
for y = pos.y +1, pos.y + 201 do
|
||||||
local node = minetest.get_node({x=pos.x,y=y,z=pos.z})
|
local node = minetest.get_node({x=pos.x,y=y,z=pos.z})
|
||||||
if node.name == ignore then
|
if node.name == "ignore" then
|
||||||
minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z})
|
minetest.get_voxel_manip():read_from_map({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z})
|
||||||
node = minetest.get_node({x=pos.x,y=y,z=pos.z})
|
node = minetest.get_node({x=pos.x,y=y,z=pos.z})
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,7 +46,7 @@ core.register_craftitem("mcl_bows:rocket", {
|
||||||
end,
|
end,
|
||||||
_on_collide_with_entity = function(self, _, obj)
|
_on_collide_with_entity = function(self, _, obj)
|
||||||
if self._in_player == false then
|
if self._in_player == false then
|
||||||
pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
obj:punch(self.object, 1.0, {
|
obj:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=self._damage},
|
damage_groups={fleshy=self._damage},
|
||||||
|
|
|
@ -30,7 +30,7 @@ minetest.register_node("mcl_chests:ender_chest", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local formspec_ender_chest = table.concat({
|
mcl_chests.formspec_ender_chest = table.concat({
|
||||||
"formspec_version[4]",
|
"formspec_version[4]",
|
||||||
"size[11.75,10.425]",
|
"size[11.75,10.425]",
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ minetest.register_node("mcl_chests:ender_chest_small", {
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
minetest.show_formspec(clicker:get_player_name(), "mcl_chests:ender_chest_" .. clicker:get_player_name(),
|
minetest.show_formspec(clicker:get_player_name(), "mcl_chests:ender_chest_" .. clicker:get_player_name(),
|
||||||
formspec_ender_chest)
|
mcl_chests.formspec_ender_chest)
|
||||||
mcl_chests.player_chest_open(clicker, pos, "mcl_chests:ender_chest_small",
|
mcl_chests.player_chest_open(clicker, pos, "mcl_chests:ender_chest_small",
|
||||||
mcl_chests.tiles.ender_chest_texture, node.param2, false, "mcl_chests_enderchest",
|
mcl_chests.tiles.ender_chest_texture, node.param2, false, "mcl_chests_enderchest",
|
||||||
"mcl_chests_chest")
|
"mcl_chests_chest")
|
||||||
|
|
|
@ -85,7 +85,7 @@ minetest.register_lbm({
|
||||||
mcl_chests.chest_update_after_close(pos)
|
mcl_chests.chest_update_after_close(pos)
|
||||||
elseif node_name == "mcl_chests:ender_chest" then
|
elseif node_name == "mcl_chests:ender_chest" then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", formspec_ender_chest)
|
meta:set_string("formspec", mcl_chests.formspec_ender_chest)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
@ -162,10 +162,10 @@ minetest.register_node("mcl_crimson:twisting_vines", {
|
||||||
end
|
end
|
||||||
grow_vines(pos, 1, "mcl_crimson:twisting_vines")
|
grow_vines(pos, 1, "mcl_crimson:twisting_vines")
|
||||||
local idef = itemstack:get_definition()
|
local idef = itemstack:get_definition()
|
||||||
local itemstack, success = minetest.item_place_node(itemstack, placer, pointed_thing)
|
local itemstack, success = minetest.item_place_node(itemstack, clicker, pointed_thing)
|
||||||
if success then
|
if success then
|
||||||
if idef.sounds and idef.sounds.place then
|
if idef.sounds and idef.sounds.place then
|
||||||
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}, true)
|
minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -257,10 +257,10 @@ minetest.register_node("mcl_crimson:weeping_vines", {
|
||||||
end
|
end
|
||||||
grow_vines(pos, 1, "mcl_crimson:weeping_vines", -1)
|
grow_vines(pos, 1, "mcl_crimson:weeping_vines", -1)
|
||||||
local idef = itemstack:get_definition()
|
local idef = itemstack:get_definition()
|
||||||
local itemstack, success = minetest.item_place_node(itemstack, placer, pointed_thing)
|
local itemstack, success = minetest.item_place_node(itemstack, clicker, pointed_thing)
|
||||||
if success then
|
if success then
|
||||||
if idef.sounds and idef.sounds.place then
|
if idef.sounds and idef.sounds.place then
|
||||||
minetest.sound_play(idef.sounds.place, {pos=above, gain=1}, true)
|
minetest.sound_play(idef.sounds.place, {pos=pointed_thing.above, gain=1}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ local function update_grindstone_slots(meta)
|
||||||
local new_item = create_new_item(name, meta, wear)
|
local new_item = create_new_item(name, meta, wear)
|
||||||
new_output = transfer_curse(input1, new_item)
|
new_output = transfer_curse(input1, new_item)
|
||||||
elseif input1:get_name() == "mcl_enchanting:book_enchanted" then
|
elseif input1:get_name() == "mcl_enchanting:book_enchanted" then
|
||||||
new_item = create_new_item("mcl_books:book", meta, nil)
|
local new_item = create_new_item("mcl_books:book", meta, nil)
|
||||||
new_output = transfer_curse(input1, new_item)
|
new_output = transfer_curse(input1, new_item)
|
||||||
else
|
else
|
||||||
new_output = ""
|
new_output = ""
|
||||||
|
@ -164,7 +164,7 @@ local function update_grindstone_slots(meta)
|
||||||
local new_item = create_new_item(name, meta, wear)
|
local new_item = create_new_item(name, meta, wear)
|
||||||
new_output = transfer_curse(input2, new_item)
|
new_output = transfer_curse(input2, new_item)
|
||||||
elseif input2:get_name() == "mcl_enchanting:book_enchanted" then
|
elseif input2:get_name() == "mcl_enchanting:book_enchanted" then
|
||||||
new_item = create_new_item("mcl_books:book", meta, nil)
|
local new_item = create_new_item("mcl_books:book", meta, nil)
|
||||||
new_output = transfer_curse(input2, new_item)
|
new_output = transfer_curse(input2, new_item)
|
||||||
else
|
else
|
||||||
new_output = ""
|
new_output = ""
|
||||||
|
|
|
@ -1355,7 +1355,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
EF[name][object] = nil
|
EF[name][object] = nil
|
||||||
if effect.after_end then effect.after_end(object) end
|
if effect.after_end then effect.after_end(object) end
|
||||||
if object:is_player() then
|
if object:is_player() then
|
||||||
meta = object:get_meta()
|
local meta = object:get_meta()
|
||||||
meta:set_string("mcl_potions:_EF_"..name, "")
|
meta:set_string("mcl_potions:_EF_"..name, "")
|
||||||
potions_set_hud(object)
|
potions_set_hud(object)
|
||||||
else
|
else
|
||||||
|
@ -1500,7 +1500,7 @@ function mcl_potions._load_player_effects(player)
|
||||||
meta:set_string("_is_weak", "")
|
meta:set_string("_is_weak", "")
|
||||||
end
|
end
|
||||||
if legacy_water_breathing then
|
if legacy_water_breathing then
|
||||||
EF.water_breathing[player] = legacy_water_breating
|
EF.water_breathing[player] = legacy_water_breathing
|
||||||
meta:set_string("_is_water_breating", "")
|
meta:set_string("_is_water_breating", "")
|
||||||
end
|
end
|
||||||
if legacy_leaping then
|
if legacy_leaping then
|
||||||
|
|
|
@ -103,7 +103,7 @@ core.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
if vals.def.custom_effect
|
if vals.def.custom_effect
|
||||||
and vals.def.custom_effect(obj, (vals.potency+1) * mcl_potions.LINGERING_FACTOR, plus) then
|
and vals.def.custom_effect(obj, (vals.potency+1) * mcl_potions.LINGERING_FACTOR, vals.plus) then
|
||||||
applied = true
|
applied = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
mcl_hunger.eat_internal[player_name]._custom_wrapper(player_name)
|
mcl_hunger.eat_internal[player_name]._custom_wrapper(player_name)
|
||||||
|
|
||||||
player:get_inventory():set_stack("main", player:get_wield_index(), itemstack)
|
--player:get_inventory():set_stack("main", player:get_wield_index(), itemstack)
|
||||||
end
|
end
|
||||||
|
|
||||||
clear_eat_internal_and_timers(player, player_name)
|
clear_eat_internal_and_timers(player, player_name)
|
||||||
|
|
Loading…
Reference in a new issue