[Mod] X-Decor-libre [xdecor]

Post Reply
User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

[Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

X-Decor-libre

A libre decoration mod meant to be simple and well-featured.
e9cb40eb5e.jpg
e9cb40eb5e.jpg (81 KiB) Viewed 8480 times
X-Decor-libre is a fork and is the same as the original X-Decor by jp, except it is free software, including media. It is intentionally using the same technical name [xdecor] at it is meant to be a drop-in replacement. Additionally, a ton of bugs are fixed and a couple of maintenance changes were made.

Features (mostly identical to X-Decor):
Spoiler
  • Fully free software (includes media files)
  • Many decorative blocks, including floors, tiles, doors, light sources, etc.
  • Paintings
  • Enchant your tools with mese crystals at the enchanting table
  • The magical ender chest lets you keep you your items everywhere
  • Cut blocks and repair tools at the workbench
  • Brew a soup with a cauldron, water and food items
  • Build an artificial beehive at the flower meadow and produce honey
  • Send and receive mail and gifts with the mailbox
  • Show off your item at an item frame
  • Trampolines!
  • Use pressure plates and levers to open doors
  • Play Chess on the chessboard (learn how)
Why? Because the original X-Decor mod by jp includes some non-free media files, thus making it non-free software. Many aspiring FOSS coders have tripped over X-Decor, accidentally turning their own games/mods to non-free ones by including X-Decor.

I provide this fork as a community service so there is a safe replacement to X-Decor. Additionally, there are a lot of bugfixes. No new features or major gameplay changes are planned.

Read details and credits in the README file.
Last edited by Wuzzy on Fri Mar 08, 2024 12:14, edited 17 times in total.

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: [Mod] X-Decor-libre [xdecor]

by ShadMOrdre » Post

Why not just issue a pull request for the textures in question to the original x-decor mod?

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

There is a pull-request, but it has been stalling for months and I'm losing my patience. :P I recently saw yet another game which (probably accidentally) included non-free data from xdecor, and that was the final straw, so I decided to do something about it.

"If you want to get something done, you have to do it yourself."

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] X-Decor-libre [xdecor]

by MisterE » Post

Content db allows dropin replacements that have the same name, it is the exception to the right-to-a-name policy

User avatar
ROllerozxa
Member
Posts: 157
Joined: Sun Apr 25, 2021 12:25
GitHub: ROllerozxa
IRC: ROllerozxa
In-game: ROllerozxa
Location: Sweden
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by ROllerozxa » Post

Yeah forks with the same modname are allowed on ContentDB if they have something to distinguish themselves from upstream. In this case, making a libre fork, it would definitively be eligble for publishing onto ContentDB since upstream seems to have an issue with perfectionism over making it widely available as a free package.

Added onto ContentDB: https://content.minetest.net/packages/Wuzzy/xdecor/

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

Cool, thank you. I was unsure whether ContentDB supported this, but apparently, it does.

Papang
Member
Posts: 19
Joined: Sun Jul 10, 2022 17:28
IRC: Papang
In-game: Papang

Re: [Mod] X-Decor-libre [xdecor]

by Papang » Post

Hello @Wuzzy , I can't play more than a few moves with the chess (in singleplayer mode, i didn't try in multiplayer), it's the same with jp's mod and i hoped your mod was working better. Do you know why it's not working ?

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

This mod only changes one thing, namely replacing the non-free media files of xdecor.
Everyhing else remains the same (exception: the README file). This means every feature and even bug is still in there.

The reason is that I don't want to spend more time with maintaining this mod. This is basically just a soft fork.

Voidsabre
New member
Posts: 1
Joined: Sun Jun 25, 2023 01:10

Re: [Mod] X-Decor-libre [xdecor]

by Voidsabre » Post

Papang wrote:
Sat May 27, 2023 09:19
I can't play more than a few moves with the chess (in singleplayer mode, i didn't try in multiplayer), it's the same with jp's mod and i hoped your mod was working better. Do you know why it's not working ?
I'm having the same issue. I'm not sure why it's not working, but through in-game troubleshooting I figured out the chess works until you try to capture a piece and then it all breaks. I'm gonna start looking through the code to try to diagnose the problem, but I literally just started learning Lua for Minetest a week ago so I probably won't be able to fix it. I may be able to identify the problem code though and that would be a good start

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

Good news, everyone! Version "libre3" has just been released. This is a huge update with a LOT of bugfixes.
I also decided to remove the Chess game. Sorry, Chess fans! I tried to fix it but failed because Minetest makes it difficult. So the chessboard is now just pure decoration. If you're interested in my analysis of this problem, see here: https://codeberg.org/Wuzzy/xdecor-libre/issues/7

Since people kept complaining about bugs, I have decided I no longer want to ignore the bugs so today and yesterday, I've worked hard to hunt dont a lot of bugs and fix them. I originally wanted to be this a soft fork and ONLY replace the media files and leave the rest as-is. And so I kept ignoring your bug reports. However, the original non-free xdecor mod has been stale for a long time now so I think it's time to take matters in my own hand.

My development policy on changes for this mod is now this:
  • Translations: OK (help very welcome!)
  • Bugfixes: OK
  • Small maintenance changes: OK, but only if they don't change things too much
  • Text/documentation changes: OK
  • Graphics changes: Only in order to fix bugs
  • New features, nodes, items, major gameplay changes, breaking changes, etc.: Not OK
I still want to preserve xdecor as much as possible and not break compability with the original so it can be replaced easily. So don't expect any new features. If you find incompabilities, that's a bug; please report it.


Here is the changelog for the new version "libre3":

Minetest 5.7.0 is now required.

Bugfixes:
  • Changed packed ice recipe to avoid recipe collision with Ethereal
  • Changed prison door recipe colliding with Minetest Game's Iron Bar Door
  • Beehives no longer show that the bees are busy when they're not
  • Fixed incorrect/incomplete node sounds
  • Fix poorly placed buttons in enchantment screen
  • Fix broken texture of cut Permafrost with Moss nodes
  • Fix awkward lantern rotation
  • Lanterns can no longer attach to sides
  • Fix item stacking issues of curtains
  • Cauldrons no longer turn river water to normal water
  • Fix boiling water in cauldrons not reliably cooling down
  • Fix boiling water sound not playing when rejoining
  • Fix cauldron with soup boiling forever
  • Fix cauldrons being heated up by fireflies
  • Fix rope and painting not compatible with itemframe
  • Fix itemframe, lever being offset when put into itemframe
  • Fix storage formspecs not closing if exploded
  • Show short item description in itemframe instead of itemstring
  • Minor typo fixes
Maintenance updates:
  • Chess games are now disabled because they were too broken
  • Renamed blocks:
    • "Empty Shelf" to "Plain Shelf" (because you can put items into it, making it non-empty)
    • "Slide Door" to "Paper Door" (because it doesn't slide)
    • "Rooster" to "Weathercock" (because it is not a literal rooster)
    • "Stone Tile" to "Polished Stone Block" (to parallel the Stone Block from MTG)
    • "Desert Stone Tile" to "Polished Desert Stone Block" (to parallel the Desert Stone Block from MTG)
    • "Iron Light Box" to "Steel Lattice Light Box" (because it is crafted from steel bars, not iron)
    • "Wooden Light Box" to "Wooden Cross Light Box" ("Light Box 2" is clunky naming)
    • "Wooden Light Box 2" to "Wooden Rhombus Light Box" ("Light Box 2" is clunky naming)
  • Added fuel recipes for wooden-based things
  • Changed a few confusing recipes to make more sense
  • Improved textures for cut glass, obsidian glass, woodframed glass, permafrost with moss and permafrost with stones (this was neccessary because they looked horrible)
  • Improved side texture of wood frame and rusty bar
  • Add honey and cushion block to creative inventory
  • Doors now count as nodes in creative inventory
  • Cobwebs are no longer considered (fake) liquids
  • Storage blocks now drop their inventory when exploded
  • German translation is complete
  • Add support for playerphysics mod
  • Add description to every setting
  • Made several strings translatable

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version "libre4" released!

by Wuzzy » Post

New version libre4 released.

Changelog:
  • Changed rusty iron bar recipe to avoid recipe collision with homedecor
  • Can now Sneak-click items in mailbox formspec
  • Ivy is no longer considered flora (=a plant that spreads like a flower)
  • Fixed 2 broken fuel recipes
  • Fixed fallback code for lanterns
  • Fix duplicate lantern sound on place
  • Packed Ice now cools lava
  • Minor graphical tweak of mailbox donor list

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

Been working on making the Chess game working again because it is part of the original X-Decor. It turned out it was even more broken than I thought. appgurueu made the first crucial bugfix by making a workaround for the broken moving of pieces. This is the main reason why I started with this in the first place (XD). Later, I found a better trick so I decided to actually fix Chess. And it turned out, X-Decor's Chess wasn't even feature-complete since a few crucial rules like "en passant" were missing.

Screenshot here: https://cyberplace.social/@Wuzzy/110701024213251771

Things I've already done so far:

- (hopefully) fixed all the game breakages when moving pieces
- En passant captures added (FIDE Laws of Chess 3.7d.)
- Pawn can be promoted to either queen, rook, bishop or knight (FIDE 3.7e.)
- You no longer can castle while the king is attacked or would need to cross or reach an attacked square (FIDE 3.8b.(2)[a])
- Changed Chess notation to Figurine Algebraic Notation (very common). I haven't seen the old notation anywhere else so I decided to use something more common. Also, the notation was listed in reverse order for some reason.
- Upgraded formspec to version 2 to make it easier to fix the UI
- Chess pieces now properly align to the chessboard
- New UI for selection of singleplayer/multiplayer
- Fix "AI" sometimes moving twice
- Fix "AI" being allowed to move king into attacked squares

What I still have to do:

- Detect victory/draw/loss
- (maybe) 50-turn rule and "same position repeated 3 times" rule (FIDE 5.2d. and 5.2e.)
- (maybe) "AI" may also play Black
- (maybe) Replace the figurine icons for the notation because they are hard to read
- Test, test, test!


There isn't a release yet, so stay tuned!

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version "libre5" released!

by Wuzzy » Post

Chess has come back!
An example game of Chess in X-Decor-libre
An example game of Chess in X-Decor-libre
xdecorlibre_chess2.jpg (37.84 KiB) Viewed 5711 times
After a long and hard work, the next update to X-Decor-libre is available: libre5

This is a HUGE rework and restoration of the previously very broken Chess game of xdecor
You can play Chess again and it is actually more like real chess than it was in the original xdecor.

Additionally, this update comes with a few other changes.

The reason for restoring Chess is simple: It was part of xdecor and the point of the X-Decor-libre is to be a viable replacement for xdecor while retaining the feature set. And I tried to make a chess game that is more or less faithful to the modern rules (particularily, the FIDE Laws of Chess).

Changelog (Chess)
  • Can play Chess on the chessboard again
  • Chess now supports the following rules (from the 2023 FIDE Laws of Chess):
    • En passant
    • Choose to which piece to promote your pawn to instead of auto-promoting to queen
    • Can no longer castle while in check or if your king would have to cross or reach an attacked square
    • 50-turn rule and 75-turn rule
    • Threefold repetition rule and fivefold repetition rule
    • Stalemate
    • Draw by dead position (incomplete support)
    • Resigning
  • Added buttons to resign and to invoke the 50-turn rule and threefold repetition rule
  • Actually declare the winner on checkmate or draw
  • Changed chess notation to longform figurine algebraic notation
  • Changed chess notation icons to something readable
  • Changed chess main menu in which you select the game mode (single- or multiplayer)
  • In singleplayer, can now choose to to play as Black
  • Fix chess pieces not aligning well on the chessboard
  • Fixed the bot often making illegal moves
  • Added a new readme file that explains chess: CHESS_README.md
  • An arrow shows whose turn it is
  • Increased the size of the name plaques slightly
Changelog (other)
  • Honey is now supported in the Unified Inventory crafting guide (thanks, Niklp)
  • Fixed error with hanging lantern (thanks, Niklp)
  • Added simple tooltip extensions for some items (uses the "tt" mod)
  • When unmounting a cushion or chair, the player now stands on top of it instead of inside it
  • Rope no longer extends infinitely in Creative Mode (now limited by maximum stack size)
  • Refactor rope digging functionality
If you find any mistakes in the game of Chess, please let me know! This includes bugs, but also when the game behaves incorrectly and does not match the rules you would expect. I'm not a good Chess player myself (in fact, I am terrible at it).

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by LMD » Post

Thanks for taking the time to fix chess! Finally we can have chess that isn't completely broken in Minetest again :)
My stuff: Projects - Mods - Website

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version "libre6" released!

by Wuzzy » Post

Version "libre6" released!

Changelog:
  • Fix crash when placing a node with inventory
  • Chess: Fix player unable to resign sometimes
  • Chess: "protection_bypass" priv now allows to always dig the chessboard
  • Change German translation of Moon Brick to "Mondziegel"
  • Workbench is now able to cut blocks that have stair and slab variants but not xdecor variants (panel/nanoslab/microslab, etc.)
  • Workbench can now cut cabinet to half cabinets
  • Workbench can now cut cushion block to cushions
  • Workbench cutting is less wasteful when reaching the max.
  • Workbench can now repair more tools
  • Bowl of soup is now available in Creative Inventory
  • Fix node node overlap with wood tile and stone tile stair/slab/etc. from moreblocks mod
  • Node rename: xdecor:wood_tile → xdecor:wood_tile_x (also affects slab, stair and all cut variants)
  • Node rename: xdecor:stone_tile → xdecor:stone_tile_x (also affects slab, stair and all cut variants)

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version "libre7" released!

by Wuzzy » Post

Version "libre7" released! This version (hopefully) fixes a potential crash with the stairsplus mod.

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Version "libre8" released!

by Wuzzy » Post

Version "libre8" released! Changelog:
  • Change recipe for stone/desert stone tile
  • Fix "initial_properties" deprecation warning
Also, since the release of Minetest 5.8.0, the broken sitting animation on cushions should work now.

User avatar
Nininik
Member
Posts: 522
Joined: Thu Apr 06, 2023 01:55
GitHub: nininik0
IRC: nininik
In-game: nininik
Location: CA, Team thunderstrike headquarters
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Nininik » Post

I think you should add armor enchanting just like in original xdecor, also wuzzy,

I use devtest mods on my public server
xD
Attachments
Screenshot_20231230-105754_File Manager +.png
Screenshot_20231230-105754_File Manager +.png (87.6 KiB) Viewed 1192 times
↯Glory to Team Thunderstrike!↯
↯T.T.S.↯

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

Wait, original xdecor had armor enchanting? When and how (commit ID, please)?

User avatar
Nininik
Member
Posts: 522
Joined: Thu Apr 06, 2023 01:55
GitHub: nininik0
IRC: nininik
In-game: nininik
Location: CA, Team thunderstrike headquarters
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Nininik » Post

Well uhhhh I don't know what commit it was?.... I just have the old xdecor where it's on my server and people can enchant armor. ¯\_(ツ)_/¯ but I can get the code and put it here, or ya can join my server. (Not mandatory) (my server has devtest mods lol)
Here's code:

Code: Select all

screwdriver = screwdriver or {}
local ceil, abs, random = math.ceil, math.abs, math.random

-- Cost in Mese crystal(s) for enchanting.
local mese_cost = 1

-- Force of the enchantments.
local enchanting = {
	uses     = 1.2,  -- Durability
	times    = 0.1,  -- Efficiency
	damages  = 1,    -- Sharpness
	strength = 1.2,  -- Armor strength (3d_armor only)
	speed    = 0.2,  -- Player speed (3d_armor only)
	jump     = 0.2   -- Player jumping (3d_armor only)
}

local function cap(S) return S:gsub("^%l", string.upper) end
local function to_percent(orig_value, final_value)
	return abs(ceil(((final_value - orig_value) / orig_value) * 100))
end

function enchanting:get_tooltip(enchant, orig_caps, fleshy)
	local bonus = {durable=0, efficiency=0, damages=0}
	if orig_caps then
		bonus.durable = to_percent(orig_caps.uses, orig_caps.uses * enchanting.uses)
		local sum_caps_times = 0
		for i=1, #orig_caps.times do
			sum_caps_times = sum_caps_times + orig_caps.times[i]
		end
		local average_caps_time = sum_caps_times / #orig_caps.times
		bonus.efficiency = to_percent(average_caps_time, average_caps_time -
					      enchanting.times)
	end
	if fleshy then
		bonus.damages = to_percent(fleshy, fleshy + enchanting.damages)
	end

	local specs = { -- not finished, to complete
		durable = {"#00baff", " (+"..bonus.durable.."%)"},
		fast    = {"#74ff49", " (+"..bonus.efficiency.."%)"},
		sharp   = {"#ffff00", " (+"..bonus.damages.."%)"},
    strong  = {" ", ""},
		speed   = {" ", ""}
	}
	return minetest.colorize and minetest.colorize(specs[enchant][1],
			"\n"..cap(enchant)..specs[enchant][2]) or
			"\n"..cap(enchant)..specs[enchant][2]
end

local enchant_buttons = {
	[[ image_button[3.9,0.85;4,0.92;bg_btn.png;fast;Efficiency]
	image_button[3.9,1.77;4,1.12;bg_btn.png;durable;Durability] ]],
	"image_button[3.9,0.85;4,0.92;bg_btn.png;strong;Strength]",
	"image_button[3.9,2.9;4,0.92;bg_btn.png;sharp;Sharpness]",
	[[ image_button[3.9,0.85;4,0.92;bg_btn.png;strong;Strength]
	image_button[3.9,1.77;4,1.12;bg_btn.png;speed;Speed] ]]
}

function enchanting.formspec(pos, num)
	local meta = minetest.get_meta(pos)
	local formspec = [[ size[9,9;]
			bgcolor[#080808BB;true]
			background[0,0;9,9;ench_ui.png]
			list[context;tool;0.9,2.9;1,1;]
			list[context;mese;2,2.9;1,1;]
			list[current_player;main;0.5,4.5;8,4;]
			listring[current_player;main]
			listring[context;tool]
			listring[current_player;main]
			listring[context;mese]
			image[2,2.9;1,1;mese_layout.png]
			tooltip[sharp;Your weapon inflicts more damages]
			tooltip[durable;Your tool last longer]
			tooltip[fast;Your tool digs faster]
			tooltip[strong;Your armor is more resistant]
			tooltip[speed;Your speed is increased] ]]
			..default.gui_slots..default.get_hotbar_bg(0.5,4.5)

	formspec = formspec..(enchant_buttons[num] or "")
	meta:set_string("formspec", formspec)
end

function enchanting.on_put(pos, listname, _, stack)
	if listname == "tool" then
		local stackname = stack:get_name()
		local tool_groups = {
			"axe, pick, shovel",
			"chestplate, leggings, helmet",
			"sword", "boots"
		}

		for idx, tools in pairs(tool_groups) do
			if tools:find(stackname:match(":(%w+)")) then
				enchanting.formspec(pos, idx)
			end
		end
	end
end

function enchanting.fields(pos, _, fields, sender)
	if not next(fields) or fields.quit then return end
	local inv = minetest.get_meta(pos):get_inventory()
	local tool = inv:get_stack("tool", 1)
	local mese = inv:get_stack("mese", 1)
	local orig_wear = tool:get_wear()
	local mod, name = tool:get_name():match("(.*):(.*)")
	local enchanted_tool = (mod or "")..":enchanted_"..(name or "").."_"..next(fields)

	if mese:get_count() >= mese_cost and minetest.registered_tools[enchanted_tool] then
		minetest.sound_play("xdecor_enchanting", {
			to_player=sender:get_player_name(), gain=0.8})
		tool:replace(enchanted_tool)
		tool:add_wear(orig_wear)
		mese:take_item(mese_cost)
		inv:set_stack("mese", 1, mese)
		inv:set_stack("tool", 1, tool)
	end
end

function enchanting.dig(pos)
	local inv = minetest.get_meta(pos):get_inventory()
	return inv:is_empty("tool") and inv:is_empty("mese")
end

local function allowed(tool)
	if not tool then return false end
	for item in pairs(minetest.registered_tools) do
		if item:find("enchanted_"..tool) then return true end
	end
	return false
end

function enchanting.put(_, listname, _, stack)
	local stackname = stack:get_name()
	if listname == "mese" and stackname == "default:mese_crystal" then
		return stack:get_count()
	elseif listname == "tool" and allowed(stackname:match("[^:]+$")) then
		return 1
	end
	return 0
end

function enchanting.on_take(pos, listname)
	if listname == "tool" then enchanting.formspec(pos, nil) end
end

function enchanting.construct(pos)
	local meta = minetest.get_meta(pos)
	meta:set_string("infotext", "Enchantment Table")
	enchanting.formspec(pos, nil)

	local inv = meta:get_inventory()
	inv:set_size("tool", 1)
	inv:set_size("mese", 1)

	minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
	local timer = minetest.get_node_timer(pos)
	timer:start(5.0)
end

function enchanting.destruct(pos)
	for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.9)) do
		if obj and obj:get_luaentity() and
				obj:get_luaentity().name == "xdecor:book_open" then
			obj:remove()
			break
		end
	end
end

function enchanting.timer(pos)
	local num = #minetest.get_objects_inside_radius(pos, 0.9)
	if num == 0 then
		minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
	end

	local minp = {x=pos.x-2, y=pos.y, z=pos.z-2}
	local maxp = {x=pos.x+2, y=pos.y+1, z=pos.z+2}
	local bookshelves = minetest.find_nodes_in_area(minp, maxp, "default:bookshelf")
	if #bookshelves == 0 then return true end

	local bookshelf_pos = bookshelves[random(1, #bookshelves)]
	local x = pos.x - bookshelf_pos.x
	local y = bookshelf_pos.y - pos.y
	local z = pos.z - bookshelf_pos.z

	if tostring(x..z):find(2) then
		minetest.add_particle({
			pos = bookshelf_pos,
			velocity = {x=x, y=2-y, z=z},
			acceleration = {x=0, y=-2.2, z=0},
			expirationtime = 1,
			size = 2,
			texture = "xdecor_glyph"..random(1,18)..".png"
		})
	end
	return true
end

xdecor.register("enchantment_table", {
	description = "Enchantment Table",
	tiles = {"xdecor_enchantment_top.png",  "xdecor_enchantment_bottom.png",
		 "xdecor_enchantment_side.png", "xdecor_enchantment_side.png",
		 "xdecor_enchantment_side.png", "xdecor_enchantment_side.png"},
	groups = {cracky=1, level=1},
	sounds = default.node_sound_stone_defaults(),
	on_rotate = screwdriver.rotate_simple,
	can_dig = enchanting.dig,
	on_timer = enchanting.timer,
	on_construct = enchanting.construct,
	on_destruct = enchanting.destruct,
	on_receive_fields = enchanting.fields,
	on_metadata_inventory_put = enchanting.on_put,
	on_metadata_inventory_take = enchanting.on_take,
	allow_metadata_inventory_put = enchanting.put,
	allow_metadata_inventory_move = function() return 0 end
})

minetest.register_entity("xdecor:book_open", {
	visual = "sprite",
	visual_size = {x=0.75, y=0.75},
	collisionbox = {0},
	physical = false,
	textures = {"xdecor_book_open.png"},
	on_activate = function(self)
		local pos = self.object:getpos()
		local pos_under = {x=pos.x, y=pos.y-1, z=pos.z}

		if minetest.get_node(pos_under).name ~= "xdecor:enchantment_table" then
			self.object:remove()
		end
	end
})

function enchanting:register_tools(mod, def)
	for tool in pairs(def.tools) do
	for material in def.materials:gmatch("[%w_]+") do
	for enchant in def.tools[tool].enchants:gmatch("[%w_]+") do
		local original_tool = minetest.registered_tools[mod..":"..tool.."_"..material]
		if not original_tool then break end
		local original_toolcaps = original_tool.tool_capabilities

		if original_toolcaps then
			local original_damage_groups = original_toolcaps.damage_groups
			local original_groupcaps = original_toolcaps.groupcaps
			local groupcaps = table.copy(original_groupcaps)
			local fleshy = original_damage_groups.fleshy
			local full_punch_interval = original_toolcaps.full_punch_interval
			local max_drop_level = original_toolcaps.max_drop_level
			local group = next(original_groupcaps)

			if enchant == "durable" then
				groupcaps[group].uses = ceil(original_groupcaps[group].uses *
							     enchanting.uses)
			elseif enchant == "fast" then
				for i, time in pairs(original_groupcaps[group].times) do
					groupcaps[group].times[i] = time - enchanting.times
				end
			elseif enchant == "sharp" then
				fleshy = fleshy + enchanting.damages
			end

			minetest.register_tool(":"..mod..":enchanted_"..tool.."_"..material.."_"..enchant, {
				description = "Enchanted "..cap(material).." "..cap(tool)..
					self:get_tooltip(enchant, original_groupcaps[group], fleshy),
				inventory_image = original_tool.inventory_image.."^[colorize:violet:50",
				wield_image = original_tool.wield_image,
				groups = {not_in_creative_inventory=1},
				tool_capabilities = {
					groupcaps = groupcaps, damage_groups = {fleshy = fleshy},
					full_punch_interval = full_punch_interval,
					max_drop_level = max_drop_level
				}
			})
		end

		if mod == "3d_armor" then
			local original_armor_groups = original_tool.groups
			local armorcaps = {}
			armorcaps.not_in_creative_inventory = 1

			for armor_group, value in pairs(original_armor_groups) do
				if enchant == "strong" then
					armorcaps[armor_group] = ceil(value * enchanting.strength)
				elseif enchant == "speed" then
					armorcaps[armor_group] = value
					armorcaps.physics_speed = enchanting.speed
					armorcaps.physics_jump = enchanting.jump
				end
			end

			minetest.register_tool(":"..mod..":enchanted_"..tool.."_"..material.."_"..enchant, {
				description = "Enchanted "..cap(material).." "..cap(tool)..
					self:get_tooltip(enchant),
				inventory_image = original_tool.inventory_image,
				texture = "3d_armor_"..tool.."_"..material,
				wield_image = original_tool.wield_image,
				groups = armorcaps,
				wear = 0
			})
		end
	end
	end
	end
end

enchanting:register_tools("default", {
	materials = "steel, bronze, mese, diamond",
	tools = {
		axe    = {enchants = "durable, fast"},
		pick   = {enchants = "durable, fast"},
		shovel = {enchants = "durable, fast"},
		sword  = {enchants = "sharp"}
	}
})

enchanting:register_tools("3d_armor", {
	materials = "steel, bronze, gold, diamond",
	tools = {
		boots      = {enchants = "strong, speed"},
		chestplate = {enchants = "strong"},
		helmet     = {enchants = "strong"},
		leggings   = {enchants = "strong"}
	}
})
↯Glory to Team Thunderstrike!↯
↯T.T.S.↯

CalebJ
Member
Posts: 407
Joined: Sat Dec 29, 2018 19:21
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ
Location: Tunnelers' Abyss

Re: [Mod] X-Decor-libre [xdecor]

by CalebJ » Post

https://content.minetest.net/threads/7198/

Continuing from this thread. It does look like my minetest version had to do with it. I've just tested on minetest 5.8.0 so that I could get a fresh look at this mod.

Firstly- great job with the FIDE rule implementation! I like the move list too, that was already there before but it looks much more polished. I wasn't able to trigger any crashes in a few playthroughs, but there is still the bug that it can take a few tries to move a piece, especially when taking a piece. In servers, this is only intensified. The computer is also *way* weaker than in The Unexpected Gambit, but that's minor. Overall this seems way more stable, so good job renovating this :)

If there is any way to highlight all legal moves, when clicking on a piece, like in The Unexpected Gambit, I think that would be an instant major improvement.

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

Version "libre9" released!

This fixes a bug in Chess: When a promotion of a pawn caused a checkmate, the game only sees this as "check" and the game cannot continue so the players have to reset. The new version fixes that problem.

Also, Zughy kindly contributed an update to the Italian translation for Chess.

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] X-Decor-libre [xdecor]

by Wuzzy » Post

Version "libre10" released!
This improves the graphics of the trampoline and curtain a little.
The trampoline is now 3D and the invisible bottom is fixed.
The red curtain matches the color of red wool and is a little thinner.

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests