Skip to content

[no squash] Some fixes#17016

Open
sfan5 wants to merge 7 commits intoluanti-org:masterfrom
sfan5:misc202603
Open

[no squash] Some fixes#17016
sfan5 wants to merge 7 commits intoluanti-org:masterfrom
sfan5:misc202603

Conversation

@sfan5
Copy link
Member

@sfan5 sfan5 commented Mar 11, 2026

A bug fix PR. It fixes bugs.

1&2: fixes #17012
3: fixes #17002
4: fixes #16554
5: fixes #16989

To do

This PR is Ready for Review.

How to test

code:

core.register_node("test2:node", {
	description = "Test Node",
	wield_image = "server_favorite.png",
	inventory_image = "server_favorite.png",
	groups = {cracky = 3},
	on_drop = function(itemstack, user, pos)
		core.chat_send_all("dropped: " .. itemstack:to_string())
		itemstack:get_meta():set_string("inventory_image", 
			string.format("server_favorite.png^[colorize:#%06x", math.random(0, 0xffffff)))
		return itemstack
	end,
})
core.register_allow_player_inventory_action(function(player, action, inventory, inventory_info)
    if action ~= "take" then return end
    if inventory_info.stack and inventory_info.stack:get_name() == "test2:node" then return 0 end
end)
core.register_on_player_inventory_action(function(player, action, inventory, inventory_info)
	if action == "take" then core.chat_send_all("taken: " .. inventory_info.stack:to_string()) end
end)

core.register_chatcommand("asdf", {
	func = function(name, param)
		core.chat_send_player(name, "Loading")
		local p = {filepath = core.get_worldpath() .. "/5mb_big.obj", to_player = name}
		core.dynamic_add_media(p, function(name) core.chat_send_player(name, "Loaded 1") end)
		core.dynamic_add_media(p, function(name) core.chat_send_player(name, "Loaded 2") end)
		return true
	end
})
  1. dropping the item should not show dropped:
  2. get rid of register_allow_player_inventory_action. dropping the item should cause it to change color
  3. see Early core.get_translated_string call breaks server translation #17002
  4. apply eyes to nametag
  5. run /asdf, it should load twice and show no warning at the client or server (make sure file is not in cache already)

@sfan5 sfan5 added the Bugfix 🐛 PRs that fix a bug label Mar 11, 2026
@sfan5 sfan5 marked this pull request as ready for review March 12, 2026 11:25
while (!done.empty()) {
// this looks stupid, but is a simple and correct way to chunk them
std::vector<u32> part;
while (!done.empty() && part.size() < 255) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes FIFO to FILO. Late requests are processed first. This is however not an issue, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No order guarantees.

@j-r
Copy link
Contributor

j-r commented Mar 12, 2026

FWIW, the on_drop changes are LGTM, but I think it'd be better to just disallow changing the item and/or increasing the count, at least for now. That opens the door for changing the order as @SmallJoker suggested and perhaps do onPut handling for the new items, or something like that. The behavior implemented here isn't worse than before, but it still is not really logical to e.g. allowing to drop a partial stack and then morph it into something totally different, and I think it'd be better if mods don't start to use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix 🐛 PRs that fix a bug

Projects

None yet

3 participants