mirror of
https://bitbucket.org/minetest_gamers/x_enchanting.git
synced 2025-06-28 22:06:17 +02:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
693ace14c2 | |||
f4ed507897 | |||
01703cb0a3 | |||
c5c53b63ee | |||
4a0b45f472 | |||
172eed1768 | |||
745708505f | |||
8090e23daf | |||
46633e5b44 | |||
48d215b08e | |||
f8f40d61a2 |
15
.gitattributes
vendored
Normal file
15
.gitattributes
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# Creating an archive
|
||||
|
||||
.* export-ignore
|
||||
assets export-ignore
|
||||
scripts export-ignore
|
||||
bin export-ignore
|
||||
docs export-ignore
|
||||
types export-ignore
|
||||
*.zip export-ignore
|
||||
bitbucket-pipelines.yml export-ignore
|
||||
package.json export-ignore
|
||||
package-lock.json export-ignore
|
||||
screenshot*.png export-ignore
|
||||
i18n.py export-ignore
|
||||
config.ld export-ignore
|
@ -1,7 +1,7 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
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
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
15
README.md
15
README.md
@ -18,8 +18,6 @@ Adds Enchanting Mechanics and API.
|
||||
* mesh node model
|
||||
* mesh entity model and animations
|
||||
|
||||
NOTE: item inventory/wield image will not be adjusted until this feature is supported by MT engine, see: https://github.com/minetest/minetest/issues/5686
|
||||
|
||||
## How To
|
||||
|
||||
### Enchanting Setup
|
||||
@ -178,6 +176,7 @@ end
|
||||
## Optional Dependencies
|
||||
|
||||
- xdecor (adjusts conflicting recipe)
|
||||
- item_drop (make sure fortune will execute before item_drop mod overrides `handle_node_drops`)
|
||||
|
||||
## License:
|
||||
|
||||
@ -187,7 +186,7 @@ GNU Lesser General Public License v2.1 or later (see included LICENSE file)
|
||||
|
||||
### Textures
|
||||
|
||||
**CC BY-SA 4.0, Pixel Perfection by XSSheep**, https://minecraft.curseforge.com/projects/pixel-perfection-freshly-updated
|
||||
**CC-BY-SA-4.0, Pixel Perfection by XSSheep**, https://minecraft.curseforge.com/projects/pixel-perfection-freshly-updated
|
||||
|
||||
- x_enchanting_symbol_1.png
|
||||
- x_enchanting_symbol_2.png
|
||||
@ -227,11 +226,11 @@ GNU Lesser General Public License v2.1 or later (see included LICENSE file)
|
||||
- x_enchanting_scroll_mesh.png -- Derived from a texture TumeniNodes (CC BY-SA 3.0)
|
||||
- x_enchanting_scroll_particle.png
|
||||
- x_enchanting_table.png
|
||||
- x_enchanting_gui_slot_bg.png -- Derived from texture Pixel Perfection by XSSheep (CC BY-SA 4.0)
|
||||
- x_enchanting_gui_cloth_bg.png -- Derived from texture Pixel Perfection by XSSheep (CC BY-SA 4.0)
|
||||
- x_enchanting_gui_cloth_trade_bg.png -- Derived from texture Pixel Perfection by XSSheep (CC BY-SA 4.0)
|
||||
- x_enchanting_gui_formbg.png -- Derived from texture Pixel Perfection by XSSheep (CC BY-SA 4.0)
|
||||
- x_enchanting_gui_hb_bg.png -- Derived from texture Pixel Perfection by XSSheep (CC BY-SA 4.0)
|
||||
- x_enchanting_gui_slot_bg.png -- Derived from texture Pixel Perfection by XSSheep (CC-BY-SA-4.0)
|
||||
- x_enchanting_gui_cloth_bg.png -- Derived from texture Pixel Perfection by XSSheep (CC-BY-SA-4.0)
|
||||
- x_enchanting_gui_cloth_trade_bg.png -- Derived from texture Pixel Perfection by XSSheep (CC-BY-SA-4.0)
|
||||
- x_enchanting_gui_formbg.png -- Derived from texture Pixel Perfection by XSSheep (CC-BY-SA-4.0)
|
||||
- x_enchanting_gui_hb_bg.png -- Derived from texture Pixel Perfection by XSSheep (CC-BY-SA-4.0)
|
||||
|
||||
### Models
|
||||
|
||||
|
40
api.lua
40
api.lua
@ -1,6 +1,6 @@
|
||||
--[[
|
||||
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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@ -306,6 +306,17 @@ local function get_table_length(table)
|
||||
return length
|
||||
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
|
||||
function XEnchanting.has_tool_group(self, name)
|
||||
if minetest.get_item_group(name, 'pickaxe') > 0 then
|
||||
@ -541,6 +552,23 @@ function XEnchanting.set_enchanted_tool(self, pos, itemstack, level, player_name
|
||||
stack_meta:set_int('is_enchanted', 1)
|
||||
stack_meta:set_string('x_enchanting', minetest.serialize(final_enchantments_meta))
|
||||
|
||||
|
||||
if tool_def and tool_def.inventory_image and tool_def.inventory_image ~= '' then
|
||||
stack_meta:set_string('inventory_image', tool_def.inventory_image .. '^((' .. tool_def.inventory_image .. '^[contrast:127:127)^[mask:x_enchanting_glint.png^[opacity:80)')
|
||||
end
|
||||
|
||||
if tool_def and tool_def.inventory_overlay and tool_def.inventory_overlay ~= '' then
|
||||
stack_meta:set_string('inventory_overlay', tool_def.inventory_overlay .. '^((' .. tool_def.inventory_overlay .. '^[contrast:127:127)^[mask:x_enchanting_glint.png^[opacity:80)')
|
||||
end
|
||||
|
||||
if tool_def and tool_def.wield_image and tool_def.wield_image ~= '' then
|
||||
stack_meta:set_string('wield_image', tool_def.wield_image .. '^((' .. tool_def.wield_image .. '^[contrast:127:127)^[mask:x_enchanting_glint.png^[opacity:80)')
|
||||
end
|
||||
|
||||
if tool_def and tool_def.wield_overlay and tool_def.wield_overlay ~= '' then
|
||||
stack_meta:set_string('wield_overlay', tool_def.wield_overlay .. '^((' .. tool_def.wield_overlay .. '^[contrast:127:127)^[mask:x_enchanting_glint.png^[opacity:80)')
|
||||
end
|
||||
|
||||
inv:set_stack('item', 1, itemstack)
|
||||
|
||||
local trade_stack = inv:get_stack('trade', 1)
|
||||
@ -767,11 +795,17 @@ function XEnchanting.get_enchantment_data(self, player, nr_of_bookshelfs, tool_d
|
||||
table.remove(possible_enchantments, idx)
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
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)
|
||||
|
||||
for idx, value in pairs(possible_enchantments) do
|
||||
|
@ -43,24 +43,24 @@ pipelines:
|
||||
- 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
|
||||
# - 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
|
||||
- step:
|
||||
name: Deploy to ContentDB
|
||||
caches:
|
||||
|
2
init.lua
2
init.lua
@ -1,6 +1,6 @@
|
||||
--[[
|
||||
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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
|
2
mod.conf
2
mod.conf
@ -1,6 +1,6 @@
|
||||
name = x_enchanting
|
||||
description = Adds Enchanting Mechanics and API.
|
||||
depends =
|
||||
optional_depends = xdecor
|
||||
optional_depends = xdecor, item_drop
|
||||
supported_games = minetest_game
|
||||
min_minetest_version = 5.4
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 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
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 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
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -1,6 +1,6 @@
|
||||
--[[
|
||||
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
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@ -31,6 +31,7 @@ minetest.register_node('x_enchanting:table', {
|
||||
drawtype = 'mesh',
|
||||
mesh = 'x_enchanting_table.obj',
|
||||
tiles = { 'x_enchanting_table.png' },
|
||||
use_texture_alpha = 'clip',
|
||||
paramtype = 'light',
|
||||
paramtype2 = 'facedir',
|
||||
walkable = true,
|
||||
|
BIN
textures/x_enchanting_glint.png
Normal file
BIN
textures/x_enchanting_glint.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 365 B |
Reference in New Issue
Block a user