mirror of
https://bitbucket.org/minetest_gamers/x_enchanting.git
synced 2025-06-29 22:30:35 +02:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
01703cb0a3 | |||
c5c53b63ee | |||
4a0b45f472 | |||
172eed1768 | |||
745708505f | |||
8090e23daf | |||
46633e5b44 |
@ -1,7 +1,7 @@
|
|||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 2.1, February 1999
|
Version 2.1, February 1999
|
||||||
|
|
||||||
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
|
||||||
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.
|
||||||
|
|
||||||
|
@ -178,6 +178,7 @@ end
|
|||||||
## Optional Dependencies
|
## Optional Dependencies
|
||||||
|
|
||||||
- xdecor (adjusts conflicting recipe)
|
- xdecor (adjusts conflicting recipe)
|
||||||
|
- item_drop (make sure fortune will execute before item_drop mod overrides `handle_node_drops`)
|
||||||
|
|
||||||
## License:
|
## License:
|
||||||
|
|
||||||
|
23
api.lua
23
api.lua
@ -1,6 +1,6 @@
|
|||||||
--[[
|
--[[
|
||||||
X Enchanting. Adds Enchanting Mechanics and API.
|
X Enchanting. Adds Enchanting Mechanics and API.
|
||||||
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
@ -306,6 +306,17 @@ local function get_table_length(table)
|
|||||||
return length
|
return length
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Find element v of t satisfying f(v)
|
||||||
|
local function tableFind(t, f)
|
||||||
|
for _, v in ipairs(t) do
|
||||||
|
if f(v) then
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
---@diagnostic disable-next-line: unused-local
|
---@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
|
||||||
@ -767,11 +778,17 @@ function XEnchanting.get_enchantment_data(self, player, nr_of_bookshelfs, tool_d
|
|||||||
table.remove(possible_enchantments, idx)
|
table.remove(possible_enchantments, idx)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
local probability = (probability_level + 1) / 50
|
local probability = (probability_level + 1) / 50
|
||||||
|
|
||||||
table.insert(final_enchantments, rand_ench)
|
local alreadyInTable = tableFind(final_enchantments, function(value)
|
||||||
|
return value.id == rand_ench.id
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not alreadyInTable then
|
||||||
|
table.insert(final_enchantments, rand_ench)
|
||||||
|
end
|
||||||
|
|
||||||
table.remove(possible_enchantments, rand_ench_idx)
|
table.remove(possible_enchantments, rand_ench_idx)
|
||||||
|
|
||||||
for idx, value in pairs(possible_enchantments) do
|
for idx, value in pairs(possible_enchantments) do
|
||||||
|
@ -43,24 +43,24 @@ pipelines:
|
|||||||
- nvm install v17.2.0
|
- nvm install v17.2.0
|
||||||
- npm i -g npm@8
|
- npm i -g npm@8
|
||||||
- npm ci
|
- npm ci
|
||||||
- parallel:
|
# - parallel:
|
||||||
- step:
|
- step:
|
||||||
name: Lua Check
|
name: Lua Check
|
||||||
script:
|
script:
|
||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get -y install lua5.1
|
- apt-get -y install lua5.1
|
||||||
- apt-get -y install luarocks
|
- apt-get -y install luarocks
|
||||||
- luarocks install luacheck
|
- luarocks install luacheck
|
||||||
- luacheck .
|
- luacheck .
|
||||||
- step:
|
# - step:
|
||||||
name: Lua Diagnostics
|
# name: Lua Diagnostics
|
||||||
caches:
|
# caches:
|
||||||
- node-modules
|
# - node-modules
|
||||||
- npm
|
# - npm
|
||||||
- nvm
|
# - nvm
|
||||||
script:
|
# script:
|
||||||
- nvm use v17.2.0
|
# - nvm use v17.2.0
|
||||||
- npm run lua-diagnostics
|
# - npm run lua-diagnostics
|
||||||
- step:
|
- step:
|
||||||
name: Deploy to ContentDB
|
name: Deploy to ContentDB
|
||||||
caches:
|
caches:
|
||||||
|
2
init.lua
2
init.lua
@ -1,6 +1,6 @@
|
|||||||
--[[
|
--[[
|
||||||
X Enchanting. Adds Enchanting Mechanics and API.
|
X Enchanting. Adds Enchanting Mechanics and API.
|
||||||
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,6 +1,6 @@
|
|||||||
name = x_enchanting
|
name = x_enchanting
|
||||||
description = Adds Enchanting Mechanics and API.
|
description = Adds Enchanting Mechanics and API.
|
||||||
depends =
|
depends =
|
||||||
optional_depends = xdecor
|
optional_depends = xdecor, item_drop
|
||||||
supported_games = minetest_game
|
supported_games = minetest_game
|
||||||
min_minetest_version = 5.4
|
min_minetest_version = 5.4
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Deploy code to CDB
|
* Deploy code to CDB
|
||||||
* Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
* Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Run LUA diagnostics in continuous integration
|
* Run LUA diagnostics in continuous integration
|
||||||
* Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
* Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--[[
|
--[[
|
||||||
X Enchanting. Adds Enchanting Mechanics and API.
|
X Enchanting. Adds Enchanting Mechanics and API.
|
||||||
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
|
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
Reference in New Issue
Block a user