mirror of
https://bitbucket.org/minetest_gamers/x_enchanting.git
synced 2025-04-21 17:50:21 +02:00
update licensing
This commit is contained in:
parent
f891170e45
commit
20b53db32d
65
LICENSE.txt
65
LICENSE.txt
@ -1,8 +1,7 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 2.1, February 1999
|
Version 2.1, February 1999
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ modified by someone else and passed on, the recipients should know
|
|||||||
that what they have is not the original version, so that the original
|
that what they have is not the original version, so that the original
|
||||||
author's reputation will not be affected by problems that might be
|
author's reputation will not be affected by problems that might be
|
||||||
introduced by others.
|
introduced by others.
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
Finally, software patents pose a constant threat to the existence of
|
||||||
any free program. We wish to make sure that a company cannot
|
any free program. We wish to make sure that a company cannot
|
||||||
effectively restrict the users of a free program by obtaining a
|
effectively restrict the users of a free program by obtaining a
|
||||||
@ -111,7 +110,7 @@ modification follow. Pay close attention to the difference between a
|
|||||||
"work based on the library" and a "work that uses the library". The
|
"work based on the library" and a "work that uses the library". The
|
||||||
former contains code derived from the library, whereas the latter must
|
former contains code derived from the library, whereas the latter must
|
||||||
be combined with the library in order to run.
|
be combined with the library in order to run.
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
@ -158,7 +157,7 @@ Library.
|
|||||||
You may charge a fee for the physical act of transferring a copy,
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
and you may at your option offer warranty protection in exchange for a
|
and you may at your option offer warranty protection in exchange for a
|
||||||
fee.
|
fee.
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
of it, thus forming a work based on the Library, and copy and
|
of it, thus forming a work based on the Library, and copy and
|
||||||
distribute such modifications or work under the terms of Section 1
|
distribute such modifications or work under the terms of Section 1
|
||||||
@ -216,7 +215,7 @@ instead of to this License. (If a newer version than version 2 of the
|
|||||||
ordinary GNU General Public License has appeared, then you can specify
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
that version instead if you wish.) Do not make any other change in
|
that version instead if you wish.) Do not make any other change in
|
||||||
these notices.
|
these notices.
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
Once this change is made in a given copy, it is irreversible for
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
subsequent copies and derivative works made from that copy.
|
subsequent copies and derivative works made from that copy.
|
||||||
@ -267,7 +266,7 @@ Library will still fall under Section 6.)
|
|||||||
distribute the object code for the work under the terms of Section 6.
|
distribute the object code for the work under the terms of Section 6.
|
||||||
Any executables containing that work also fall under Section 6,
|
Any executables containing that work also fall under Section 6,
|
||||||
whether or not they are linked directly with the Library itself.
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
6. As an exception to the Sections above, you may also combine or
|
||||||
link a "work that uses the Library" with the Library to produce a
|
link a "work that uses the Library" with the Library to produce a
|
||||||
work containing portions of the Library, and distribute that work
|
work containing portions of the Library, and distribute that work
|
||||||
@ -329,7 +328,7 @@ restrictions of other proprietary libraries that do not normally
|
|||||||
accompany the operating system. Such a contradiction means you cannot
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
use both them and the Library together in an executable that you
|
use both them and the Library together in an executable that you
|
||||||
distribute.
|
distribute.
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
7. You may place library facilities that are a work based on the
|
||||||
Library side-by-side in a single library together with other library
|
Library side-by-side in a single library together with other library
|
||||||
facilities not covered by this License, and distribute such a combined
|
facilities not covered by this License, and distribute such a combined
|
||||||
@ -370,7 +369,7 @@ subject to these terms and conditions. You may not impose any further
|
|||||||
restrictions on the recipients' exercise of the rights granted herein.
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
You are not responsible for enforcing compliance by third parties with
|
You are not responsible for enforcing compliance by third parties with
|
||||||
this License.
|
this License.
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
infringement or for any other reason (not limited to patent issues),
|
infringement or for any other reason (not limited to patent issues),
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
@ -422,7 +421,7 @@ conditions either of that version or of any later version published by
|
|||||||
the Free Software Foundation. If the Library does not specify a
|
the Free Software Foundation. If the Library does not specify a
|
||||||
license version number, you may choose any version ever published by
|
license version number, you may choose any version ever published by
|
||||||
the Free Software Foundation.
|
the Free Software Foundation.
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
programs whose distribution conditions are incompatible with these,
|
programs whose distribution conditions are incompatible with these,
|
||||||
write to the author to ask for permission. For software which is
|
write to the author to ask for permission. For software which is
|
||||||
@ -454,49 +453,3 @@ RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|||||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
DAMAGES.
|
DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
|
||||||
possible use to the public, we recommend making it free software that
|
|
||||||
everyone can redistribute and change. You can do so by permitting
|
|
||||||
redistribution under these terms (or, alternatively, under the terms of the
|
|
||||||
ordinary General Public License).
|
|
||||||
|
|
||||||
To apply these terms, attach the following notices to the library. It is
|
|
||||||
safest to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least the
|
|
||||||
"copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the library's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
|
||||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1990
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
That's all there is to it!
|
|
26
api.lua
26
api.lua
@ -1,3 +1,21 @@
|
|||||||
|
--[[
|
||||||
|
X Enchanting. Adds Enchanting Mechanics and API.
|
||||||
|
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to juraj.vajda@gmail.com
|
||||||
|
--]]
|
||||||
|
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
---@type XEnchanting
|
---@type XEnchanting
|
||||||
@ -288,6 +306,7 @@ local function get_table_length(table)
|
|||||||
return length
|
return length
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
function XEnchanting.has_tool_group(self, name)
|
function XEnchanting.has_tool_group(self, name)
|
||||||
if minetest.get_item_group(name, 'pickaxe') > 0 then
|
if minetest.get_item_group(name, 'pickaxe') > 0 then
|
||||||
return 'pickaxe'
|
return 'pickaxe'
|
||||||
@ -321,10 +340,12 @@ function XEnchanting.set_tool_enchantability(self, tool_def)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
function XEnchanting.get_enchanted_tool_capabilities(self, tool_def, enchantments)
|
function XEnchanting.get_enchanted_tool_capabilities(self, tool_def, enchantments)
|
||||||
local tool_stack = ItemStack({ name = tool_def.name })
|
local tool_stack = ItemStack({ name = tool_def.name })
|
||||||
local tool_capabilities = tool_stack:get_tool_capabilities()
|
local tool_capabilities = tool_stack:get_tool_capabilities()
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
for i, enchantment in ipairs(enchantments) do
|
for i, enchantment in ipairs(enchantments) do
|
||||||
-- Efficiency
|
-- Efficiency
|
||||||
if enchantment.id == 'efficiency' then
|
if enchantment.id == 'efficiency' then
|
||||||
@ -439,6 +460,7 @@ function XEnchanting.get_enchanted_tool_capabilities(self, tool_def, enchantment
|
|||||||
return tool_capabilities
|
return tool_capabilities
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
function XEnchanting.get_randomseed(self)
|
function XEnchanting.get_randomseed(self)
|
||||||
return tonumber(tostring(os.time()):reverse():sub(1, 9)) --[[@as integer]]
|
return tonumber(tostring(os.time()):reverse():sub(1, 9)) --[[@as integer]]
|
||||||
end
|
end
|
||||||
@ -447,6 +469,7 @@ function XEnchanting.get_enchanted_descriptions(self, enchantments)
|
|||||||
local enchantments_desc = {}
|
local enchantments_desc = {}
|
||||||
local enchantments_desc_masked = {}
|
local enchantments_desc_masked = {}
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
for i, enchantment in ipairs(enchantments) do
|
for i, enchantment in ipairs(enchantments) do
|
||||||
local add_roman_numbers = true
|
local add_roman_numbers = true
|
||||||
|
|
||||||
@ -503,6 +526,7 @@ function XEnchanting.set_enchanted_tool(self, pos, itemstack, level, player_name
|
|||||||
---@type table<string, {["value"]: number}>
|
---@type table<string, {["value"]: number}>
|
||||||
local final_enchantments_meta = {}
|
local final_enchantments_meta = {}
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
for i, enchantment in ipairs(final_enchantments) do
|
for i, enchantment in ipairs(final_enchantments) do
|
||||||
stack_meta:set_float('is_' .. enchantment.id, enchantment.value)
|
stack_meta:set_float('is_' .. enchantment.id, enchantment.value)
|
||||||
-- store only necessary data, keeping the meta optimized
|
-- store only necessary data, keeping the meta optimized
|
||||||
@ -611,6 +635,7 @@ function XEnchanting.get_enchantment_data(self, player, nr_of_bookshelfs, tool_d
|
|||||||
if not enchantment_def.groups then
|
if not enchantment_def.groups then
|
||||||
group_enchantments[enchantment_name] = enchantment_def
|
group_enchantments[enchantment_name] = enchantment_def
|
||||||
else
|
else
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
for i, group in ipairs(enchantment_def.groups) do
|
for i, group in ipairs(enchantment_def.groups) do
|
||||||
if minetest.get_item_group(tool_def.name, group) > 0 then
|
if minetest.get_item_group(tool_def.name, group) > 0 then
|
||||||
group_enchantments[enchantment_name] = enchantment_def
|
group_enchantments[enchantment_name] = enchantment_def
|
||||||
@ -697,6 +722,7 @@ function XEnchanting.get_enchantment_data(self, player, nr_of_bookshelfs, tool_d
|
|||||||
local total_weight = 0
|
local total_weight = 0
|
||||||
|
|
||||||
-- calculate total weight
|
-- calculate total weight
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
for j, enchantment in ipairs(possible_enchantments) do
|
for j, enchantment in ipairs(possible_enchantments) do
|
||||||
total_weight = total_weight + self.enchantment_defs[enchantment.id].weight
|
total_weight = total_weight + self.enchantment_defs[enchantment.id].weight
|
||||||
end
|
end
|
||||||
|
@ -31,36 +31,6 @@ pipelines:
|
|||||||
script:
|
script:
|
||||||
- nvm use v17.2.0
|
- nvm use v17.2.0
|
||||||
- npm run lua-diagnostics
|
- npm run lua-diagnostics
|
||||||
branches:
|
|
||||||
master:
|
|
||||||
- step:
|
|
||||||
name: Install Node Dependencies
|
|
||||||
caches:
|
|
||||||
- node-modules
|
|
||||||
- npm
|
|
||||||
- nvm
|
|
||||||
script:
|
|
||||||
- nvm install v17.2.0
|
|
||||||
- npm i -g npm@8
|
|
||||||
- npm ci
|
|
||||||
- parallel:
|
|
||||||
- step:
|
|
||||||
name: Lua Check
|
|
||||||
script:
|
|
||||||
- apt-get update
|
|
||||||
- apt-get -y install lua5.1
|
|
||||||
- apt-get -y install luarocks
|
|
||||||
- luarocks install luacheck
|
|
||||||
- luacheck .
|
|
||||||
- step:
|
|
||||||
name: Lua Diagnostics
|
|
||||||
caches:
|
|
||||||
- node-modules
|
|
||||||
- npm
|
|
||||||
- nvm
|
|
||||||
script:
|
|
||||||
- nvm use v17.2.0
|
|
||||||
- npm run lua-diagnostics
|
|
||||||
tags:
|
tags:
|
||||||
"*":
|
"*":
|
||||||
- step:
|
- step:
|
||||||
|
22
init.lua
22
init.lua
@ -1,5 +1,20 @@
|
|||||||
-- X Enchanting
|
--[[
|
||||||
-- by SaKeL
|
X Enchanting. Adds Enchanting Mechanics and API.
|
||||||
|
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to juraj.vajda@gmail.com
|
||||||
|
--]]
|
||||||
|
|
||||||
local path = minetest.get_modpath('x_enchanting')
|
local path = minetest.get_modpath('x_enchanting')
|
||||||
local mod_start_time = minetest.get_us_time()
|
local mod_start_time = minetest.get_us_time()
|
||||||
@ -156,6 +171,7 @@ minetest.register_on_mods_loaded(function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
minetest.register_on_joinplayer(function(player, last_login)
|
minetest.register_on_joinplayer(function(player, last_login)
|
||||||
XEnchanting.form_context[player:get_player_name()] = nil
|
XEnchanting.form_context[player:get_player_name()] = nil
|
||||||
|
|
||||||
@ -164,6 +180,7 @@ minetest.register_on_joinplayer(function(player, last_login)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
minetest.register_on_leaveplayer(function(player, timed_out)
|
minetest.register_on_leaveplayer(function(player, timed_out)
|
||||||
XEnchanting.form_context[player:get_player_name()] = nil
|
XEnchanting.form_context[player:get_player_name()] = nil
|
||||||
end)
|
end)
|
||||||
@ -229,6 +246,7 @@ function minetest.handle_node_drops(pos, drops, digger)
|
|||||||
return old_handle_node_drops(pos, drops, digger)
|
return old_handle_node_drops(pos, drops, digger)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||||
-- Curse of Vanishing
|
-- Curse of Vanishing
|
||||||
if (player:get_hp() + hp_change) <= 0 then
|
if (player:get_hp() + hp_change) <= 0 then
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Deploy code to CDB
|
||||||
|
* Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to juraj.vajda@gmail.com
|
||||||
|
*/
|
||||||
|
|
||||||
import fetch from 'node-fetch'
|
import fetch from 'node-fetch'
|
||||||
import yargs from 'yargs/yargs'
|
import yargs from 'yargs/yargs'
|
||||||
import {hideBin} from 'yargs/helpers'
|
import {hideBin} from 'yargs/helpers'
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* Run LUA diagnostics in continuous integration
|
||||||
|
* Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to juraj.vajda@gmail.com
|
||||||
|
*/
|
||||||
|
|
||||||
import * as path from 'node:path'
|
import * as path from 'node:path'
|
||||||
import * as fs from 'node:fs'
|
import * as fs from 'node:fs'
|
||||||
import {exec} from 'node:child_process'
|
import {exec} from 'node:child_process'
|
||||||
|
36
table.lua
36
table.lua
@ -1,3 +1,22 @@
|
|||||||
|
--[[
|
||||||
|
X Enchanting. Adds Enchanting Mechanics and API.
|
||||||
|
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to juraj.vajda@gmail.com
|
||||||
|
--]]
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line
|
||||||
screwdriver = minetest.global_exists('screwdriver') and screwdriver --[[@as MtgScrewdriver]]
|
screwdriver = minetest.global_exists('screwdriver') and screwdriver --[[@as MtgScrewdriver]]
|
||||||
|
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
@ -59,6 +78,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param placer ObjectRef | nil
|
---@param placer ObjectRef | nil
|
||||||
---@param itemstack ItemStack
|
---@param itemstack ItemStack
|
||||||
---@param pointed_thing PointedThingDef
|
---@param pointed_thing PointedThingDef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
@ -79,6 +99,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param clicker ObjectRef
|
---@param clicker ObjectRef
|
||||||
---@param itemstack ItemStack
|
---@param itemstack ItemStack
|
||||||
---@param pointed_thing? PointedThingDef
|
---@param pointed_thing? PointedThingDef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local p_name = clicker:get_player_name()
|
local p_name = clicker:get_player_name()
|
||||||
@ -123,6 +144,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param pos Vector
|
---@param pos Vector
|
||||||
---@param intensity? number
|
---@param intensity? number
|
||||||
---@return table | nil
|
---@return table | nil
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_blast = function(pos, intensity)
|
on_blast = function(pos, intensity)
|
||||||
if minetest.is_protected(pos, '') then
|
if minetest.is_protected(pos, '') then
|
||||||
return
|
return
|
||||||
@ -159,11 +181,13 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
and inv:is_empty('trade')
|
and inv:is_empty('trade')
|
||||||
and not minetest.is_protected(pos, player:get_player_name())
|
and not minetest.is_protected(pos, player:get_player_name())
|
||||||
end,
|
end,
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_rotate = function(pos, node, user, mode, new_param2)
|
on_rotate = function(pos, node, user, mode, new_param2)
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
---@param pos Vector
|
---@param pos Vector
|
||||||
---@param elapsed number
|
---@param elapsed number
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
-- entity
|
-- entity
|
||||||
local table_scroll = minetest.get_objects_inside_radius(pos, 0.9)
|
local table_scroll = minetest.get_objects_inside_radius(pos, 0.9)
|
||||||
@ -234,6 +258,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- symbol particles
|
-- symbol particles
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
for i = 1, 10, 1 do
|
for i = 1, 10, 1 do
|
||||||
local pos_random = bookshelfs[math.random(1, #bookshelfs)]
|
local pos_random = bookshelfs[math.random(1, #bookshelfs)]
|
||||||
local x = pos.x - pos_random.x
|
local x = pos.x - pos_random.x
|
||||||
@ -275,6 +300,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param index number
|
---@param index number
|
||||||
---@param stack ItemStack
|
---@param stack ItemStack
|
||||||
---@param player ObjectRef
|
---@param player ObjectRef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
local st_meta = stack:get_meta()
|
local st_meta = stack:get_meta()
|
||||||
local st_name = stack:get_name()
|
local st_name = stack:get_name()
|
||||||
@ -302,6 +328,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param index number
|
---@param index number
|
||||||
---@param stack ItemStack
|
---@param stack ItemStack
|
||||||
---@param player ObjectRef
|
---@param player ObjectRef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
local st_name = stack:get_name()
|
local st_name = stack:get_name()
|
||||||
|
|
||||||
@ -325,6 +352,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param to_index number
|
---@param to_index number
|
||||||
---@param count number
|
---@param count number
|
||||||
---@param player ObjectRef
|
---@param player ObjectRef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
@ -333,6 +361,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param index number
|
---@param index number
|
||||||
---@param stack ItemStack
|
---@param stack ItemStack
|
||||||
---@param player ObjectRef
|
---@param player ObjectRef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local p_name = player:get_player_name()
|
local p_name = player:get_player_name()
|
||||||
@ -368,6 +397,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param index number
|
---@param index number
|
||||||
---@param stack ItemStack
|
---@param stack ItemStack
|
||||||
---@param player ObjectRef
|
---@param player ObjectRef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local p_name = player:get_player_name()
|
local p_name = player:get_player_name()
|
||||||
@ -403,6 +433,7 @@ minetest.register_node('x_enchanting:table', {
|
|||||||
---@param formname string
|
---@param formname string
|
||||||
---@param fields table
|
---@param fields table
|
||||||
---@param sender ObjectRef
|
---@param sender ObjectRef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
local p_name = sender:get_player_name()
|
local p_name = sender:get_player_name()
|
||||||
|
|
||||||
@ -481,12 +512,14 @@ minetest.register_entity('x_enchanting:table_scroll', {
|
|||||||
},
|
},
|
||||||
---@param self table
|
---@param self table
|
||||||
---@param killer ObjectRef
|
---@param killer ObjectRef
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_death = function(self, killer)
|
on_death = function(self, killer)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end,
|
end,
|
||||||
---@param self table
|
---@param self table
|
||||||
---@param staticdata StringAbstract
|
---@param staticdata StringAbstract
|
||||||
---@param dtime_s number
|
---@param dtime_s number
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_activate = function(self, staticdata, dtime_s)
|
on_activate = function(self, staticdata, dtime_s)
|
||||||
self._scroll_closed = true
|
self._scroll_closed = true
|
||||||
self._tablechecktimer = 5
|
self._tablechecktimer = 5
|
||||||
@ -500,6 +533,7 @@ minetest.register_entity('x_enchanting:table_scroll', {
|
|||||||
---@param self table
|
---@param self table
|
||||||
---@param dtime number
|
---@param dtime number
|
||||||
---@param moveresult? table
|
---@param moveresult? table
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_step = function(self, dtime, moveresult)
|
on_step = function(self, dtime, moveresult)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
@ -528,6 +562,7 @@ minetest.register_entity('x_enchanting:table_scroll', {
|
|||||||
local found_player = false
|
local found_player = false
|
||||||
|
|
||||||
if #objects > 0 then
|
if #objects > 0 then
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
for i, obj in ipairs(objects) do
|
for i, obj in ipairs(objects) do
|
||||||
if obj:is_player() and obj:get_pos() then
|
if obj:is_player() and obj:get_pos() then
|
||||||
-- player
|
-- player
|
||||||
@ -589,6 +624,7 @@ minetest.register_entity('x_enchanting:table_scroll', {
|
|||||||
---@param dir Vector
|
---@param dir Vector
|
||||||
---@param damage number
|
---@param damage number
|
||||||
---@return boolean | nil
|
---@return boolean | nil
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
---@field get_node fun(pos: Vector): NodeDef Returns the node at the given position as table in the format `{name="node_name", param1=0, param2=0}`, returns `{name="ignore", param1=0, param2=0}` for unloaded areas.
|
---@field get_node fun(pos: Vector): NodeDef Returns the node at the given position as table in the format `{name="node_name", param1=0, param2=0}`, returns `{name="ignore", param1=0, param2=0}` for unloaded areas.
|
||||||
---@field registered_nodes table<string, NodeDef|ItemDef> Map of registered node definitions, indexed by name
|
---@field registered_nodes table<string, NodeDef|ItemDef> Map of registered node definitions, indexed by name
|
||||||
---@field registered_ores table<string, table> Map of registered ore definitions, indexed by name
|
---@field registered_ores table<string, table> Map of registered ore definitions, indexed by name
|
||||||
|
---@field registered_craftitems table<string, table> Map of registered craft items, indexed by name
|
||||||
---@field after fun(time: number|integer, func: fun(...), ...): JobTable Call the function `func` after `time` seconds, may be fractional. Optional: Variable number of arguments that are passed to `func`.
|
---@field after fun(time: number|integer, func: fun(...), ...): JobTable Call the function `func` after `time` seconds, may be fractional. Optional: Variable number of arguments that are passed to `func`.
|
||||||
---@field sound_play fun(spec: SimpleSoundSpec|string, parameters: SoundParamDef, ephemeral?: boolean): any Returns a `handle`. Ephemeral sounds will not return a handle and can't be stopped or faded. It is recommend to use this for short sounds that happen in response to player actions (e.g. door closing).
|
---@field sound_play fun(spec: SimpleSoundSpec|string, parameters: SoundParamDef, ephemeral?: boolean): any Returns a `handle`. Ephemeral sounds will not return a handle and can't be stopped or faded. It is recommend to use this for short sounds that happen in response to player actions (e.g. door closing).
|
||||||
---@field add_particlespawner fun(particlespawner_definition: ParticlespawnerDef): number|integer Add a `ParticleSpawner`, an object that spawns an amount of particles over `time` seconds. Returns an `id`, and -1 if adding didn't succeed.
|
---@field add_particlespawner fun(particlespawner_definition: ParticlespawnerDef): number|integer Add a `ParticleSpawner`, an object that spawns an amount of particles over `time` seconds. Returns an `id`, and -1 if adding didn't succeed.
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
---@field get_rotation fun(self: ObjectRef): Vector returns the rotation, a vector (radians)
|
---@field get_rotation fun(self: ObjectRef): Vector returns the rotation, a vector (radians)
|
||||||
---@field get_attach fun(self: ObjectRef): any Returns parent, bone, position, rotation, forced_visible, or nil if it isn't attached.
|
---@field get_attach fun(self: ObjectRef): any Returns parent, bone, position, rotation, forced_visible, or nil if it isn't attached.
|
||||||
---@field set_attach fun(self: ObjectRef, parent: ObjectRef, bone?: string, position?: Vector, rotation?: Vector, forced_visible?: boolean): any Returns parent, bone, position, rotation, forced_visible, or nil if it isn't attached.
|
---@field set_attach fun(self: ObjectRef, parent: ObjectRef, bone?: string, position?: Vector, rotation?: Vector, forced_visible?: boolean): any Returns parent, bone, position, rotation, forced_visible, or nil if it isn't attached.
|
||||||
|
---@field drops table Custom for mob drops
|
||||||
|
|
||||||
---`ObjectRef` armor groups
|
---`ObjectRef` armor groups
|
||||||
---@class ObjectRefArmorGroups
|
---@class ObjectRefArmorGroups
|
||||||
|
@ -50,5 +50,5 @@
|
|||||||
---@class EnchantmentDataSlot
|
---@class EnchantmentDataSlot
|
||||||
---@field level number
|
---@field level number
|
||||||
---@field final_enchantments Enchantment[]
|
---@field final_enchantments Enchantment[]
|
||||||
---@field tool_cap_data ToolCapabilitiesDef
|
---@field tool_cap_data ToolCapabilitiesDef | nil
|
||||||
---@field descriptions {["enchantments_desc"]: string, ["enchantments_desc_masked"]: string }
|
---@field descriptions {["enchantments_desc"]: string, ["enchantments_desc_masked"]: string }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user