debian44 reports: Clone Bug: If you do rightclic ... #666

Closed
opened 2021-06-23 14:41:08 +00:00 by yourland-report · 10 comments

debian44 reports a bug:

Clone Bug: If you do rightclick with a bow/slingshot and then take the bow slingshot to the craftin grid, you get one , if you take the weapon back to hand and scroll to another item in the hotbar, you get another , so you got two projectiles without even losing durability

Player position:

{
	y = 32,
	x = 2136.9890136719,
	z = 1133.3190917969
}

Player look:

{
	y = -0.64158350229263,
	x = 0.0844382122159,
	z = -0.76239150762558
}

Player information:

{
	min_rtt = 0.0089999996125698,
	max_rtt = 0.11800000071526,
	connection_uptime = 1826,
	max_jitter = 0.1059999987483,
	minor = 4,
	major = 5,
	ip_version = 6,
	formspec_version = 4,
	patch = 1,
	protocol_version = 39,
	serialization_version = 28,
	lang_code = "",
	version_string = "5.4.1",
	avg_rtt = 0.010999999940395,
	state = "Active",
	avg_jitter = 0.0010000001639128,
	min_jitter = 0,
	address = "::ffff:79.227.114.58"
}

Player meta:

{
	fields = {
		["3d_armor_inventory"] = "return {\"3d_armor:leggings_crystal 1 3400\", \"3d_armor:chestplate_crystal 1 3400\", \"3d_armor:boots_crystal 1 3400\", \"shields:shield_crystal 1 3400\", \"3d_armor:helmet_crystal 1 3400\", \"\"}",
		yl_commons_thankyou = "15",
		jointime = "1618588574",
		yl_commons_player_joined = "1624457462",
		["signslib:pos"] = "(2137,19,1136)",
		digged_nodes = "342184",
		bitten = "0",
		partychat = "party",
		yl_church = "return {[\"last_death\"] = {[\"y\"] = -10155, [\"x\"] = -1499, [\"z\"] = 1562}, [\"last_heal\"] = 1622882700, [\"last_death_portal\"] = 1624173822}",
		["stamina:level"] = "4",
		xp = "241926",
		arenalib_infobox_arenaID = "0",
		inflicted_damage = "191704",
		crafted = "32476",
		died = "185",
		punch_count = "16717",
		played_time = "1980492",
		placed_nodes = "132736",
		hud_state = "on",
		repellant = "0",
		yl_commons_player_created = "1618588574"
	}
}

Log identifier


[MOD] yl_report log identifier = DqPwreNAhXmNrIHVMwl36cXGeegILMcq

Profiler save:

profile-20210623T164108.json_pretty

Status:

# Server: version=5.4.1-yl, uptime=43757.8, max_lag=2.70257, clients={bralala, Alex9, Papi, debian44, Malevolentia, Oakenshield, DatOneFox, Yumpy, Bailiff, Service, AliasAlreadyTaken, whosit}
debian44 reports a bug: > Clone Bug: If you do rightclick with a bow/slingshot and then take the bow slingshot to the craftin grid, you get one <projectile>, if you take the weapon back to hand and scroll to another item in the hotbar, you get another <projectile>, so you got two projectiles without even losing durability Player position: ``` { y = 32, x = 2136.9890136719, z = 1133.3190917969 } ``` Player look: ``` { y = -0.64158350229263, x = 0.0844382122159, z = -0.76239150762558 } ``` Player information: ``` { min_rtt = 0.0089999996125698, max_rtt = 0.11800000071526, connection_uptime = 1826, max_jitter = 0.1059999987483, minor = 4, major = 5, ip_version = 6, formspec_version = 4, patch = 1, protocol_version = 39, serialization_version = 28, lang_code = "", version_string = "5.4.1", avg_rtt = 0.010999999940395, state = "Active", avg_jitter = 0.0010000001639128, min_jitter = 0, address = "::ffff:79.227.114.58" } ``` Player meta: ``` { fields = { ["3d_armor_inventory"] = "return {\"3d_armor:leggings_crystal 1 3400\", \"3d_armor:chestplate_crystal 1 3400\", \"3d_armor:boots_crystal 1 3400\", \"shields:shield_crystal 1 3400\", \"3d_armor:helmet_crystal 1 3400\", \"\"}", yl_commons_thankyou = "15", jointime = "1618588574", yl_commons_player_joined = "1624457462", ["signslib:pos"] = "(2137,19,1136)", digged_nodes = "342184", bitten = "0", partychat = "party", yl_church = "return {[\"last_death\"] = {[\"y\"] = -10155, [\"x\"] = -1499, [\"z\"] = 1562}, [\"last_heal\"] = 1622882700, [\"last_death_portal\"] = 1624173822}", ["stamina:level"] = "4", xp = "241926", arenalib_infobox_arenaID = "0", inflicted_damage = "191704", crafted = "32476", died = "185", punch_count = "16717", played_time = "1980492", placed_nodes = "132736", hud_state = "on", repellant = "0", yl_commons_player_created = "1618588574" } } ``` Log identifier ``` [MOD] yl_report log identifier = DqPwreNAhXmNrIHVMwl36cXGeegILMcq ``` Profiler save: ``` profile-20210623T164108.json_pretty ``` Status: ``` # Server: version=5.4.1-yl, uptime=43757.8, max_lag=2.70257, clients={bralala, Alex9, Papi, debian44, Malevolentia, Oakenshield, DatOneFox, Yumpy, Bailiff, Service, AliasAlreadyTaken, whosit} ```
AliasAlreadyTaken was assigned by yourland-report 2021-06-23 14:41:09 +00:00
whosit added the
1. kind/bug
label 2021-06-23 14:44:45 +00:00
AliasAlreadyTaken added the
2. prio/critical
label 2021-07-18 04:48:57 +00:00
Member

Wow, just replicated this. No wonder no-one buys my diamond arrows O_O.

Wow, just replicated this. No wonder no-one buys my diamond arrows O_O.
flux self-assigned this 2022-05-28 18:01:12 +00:00
Member

the locus of the bug is that the logic that unloads the bow is triggered any time the bow is put in a different inventory list, where the code can't properly "unload" the bow, and it still gives the player an arrow for some reason.

Options:

  1. dump the "unload if not in wielded hand" behavior entirely.
  2. only add an arrow to the player's inventory after a bow was successfully unloaded. this will result in loaded bows in chests or the crafting grid being a valid thing in a cursed (but not necessarily cheaty/crashy) state.
  3. monitor every inventory in the game (very tedious and possibly not fully possible) and properly unload the bow when it is moved into a different inventory.
the locus of the bug is that the logic that unloads the bow is triggered any time the bow is put in a different inventory list, where the code can't properly "unload" the bow, and it still gives the player an arrow for some reason. Options: 1. dump the "unload if not in wielded hand" behavior entirely. 2. only add an arrow to the player's inventory *after* a bow was *successfully* unloaded. this will result in loaded bows in chests or the crafting grid being a valid thing in a cursed (but not necessarily cheaty/crashy) state. 3. monitor every inventory in the game (very tedious and possibly not fully possible) and properly unload the bow when it is moved into a different inventory.
Member

A confound here is that a bow's "power" is determined by the time since it was loaded (though there is a ceiling on this, which keeps it from becoming OP). But if you don't unload the bows, you could have chests full of fully charged bows that you could use in rapid succession.

I remember suggesting that we entirely remove the "bow power increases over time after you load it" mechanic somewhere but I'm failing to find it (gitea's search functionality is terrible). The point was, that the "charge the bow" mechanic is already totally broken when there's any sort of lag, and there's often enough lag to make it very unreliable in practice.

A confound here is that a bow's "power" is determined by the time since it was loaded (though there is a ceiling on this, which keeps it from becoming OP). But if you don't unload the bows, you could have chests full of fully charged bows that you could use in rapid succession. I remember suggesting that we entirely remove the "bow power increases over time after you load it" mechanic *somewhere* but I'm failing to find it (gitea's search functionality is *terrible*). The point was, that the "charge the bow" mechanic is already totally broken when there's any sort of lag, and there's often enough lag to make it very unreliable in practice.

Do we really need a precision of microseconds to translate into damage or power?

Wouldn't it be cool if MT told us when an item gets unwielded?

There are buried/forgotten PRs to add on_item_unwield callbacks, this would be a usecase.

https://github.com/minetest/minetest/pull/9862
https://github.com/minetest/minetest/pull/7587

Obviously it is a bad idea to store the power, loaded_since or similar on the item meta. A local table might be a better option, but that requires a globalstep.

While some ranged weapons like slings and bows cannot preserve their power unless wielded, crossbows CAN be preloaded and then discharged in quick succession.

Unfortunately any mechanic becomes unreliable during lag, even hitting with swords.

Do we really need a precision of microseconds to translate into damage or power? Wouldn't it be cool if MT told us when an item gets unwielded? There are buried/forgotten PRs to add on_item_unwield callbacks, this would be a usecase. https://github.com/minetest/minetest/pull/9862 https://github.com/minetest/minetest/pull/7587 Obviously it is a bad idea to store the power, loaded_since or similar on the item meta. A local table might be a better option, but that requires a globalstep. While some ranged weapons like slings and bows cannot preserve their power unless wielded, crossbows CAN be preloaded and then discharged in quick succession. Unfortunately any mechanic becomes unreliable during lag, even hitting with swords.
Member

Do we really need a precision of microseconds to translate into damage or power?

no, but it does need at least 10ths of a second, and i'm not sure there's anything that'll give you milliseconds through a function call.

Obviously it is a bad idea to store the power, loaded_since or similar on the item meta. A local table might be a better option, but that requires a globalstep.

what's wrong w/ item metadata? how would a local table keep track of individual bows?

i think my current proposal for how i'd like to see this fixed, is to get rid of the current "unload" mechanic - perhaps instead, you could get your arrow back via the crafting grid. get rid of the power/damage increases over time mechanic, and just keep the player from firing the bow unless they've held it for a certain amount of time, after which they'd always fire at full power. ranged weapons will be getting a big overhaul at some point, and i don't want to do a lot of work on this that'll just be thrown out eventually.

> Do we really need a precision of microseconds to translate into damage or power? no, but it does need at least 10ths of a second, and i'm not sure there's anything that'll give you milliseconds through a function call. > Obviously it is a bad idea to store the power, loaded_since or similar on the item meta. A local table might be a better option, but that requires a globalstep. what's wrong w/ item metadata? how would a local table keep track of individual bows? i think my current proposal for how i'd like to see this fixed, is to get rid of the current "unload" mechanic - perhaps instead, you could get your arrow back via the crafting grid. get rid of the power/damage increases over time mechanic, and just keep the player from firing the bow unless they've held it for a certain amount of time, after which they'd always fire at full power. ranged weapons will be getting a big overhaul at some point, and i don't want to do a lot of work on this that'll just be thrown out eventually.

The clone bug must go away, that's kinda priority. If that means we must accept loaded bows in the inv, then so be it. But I'd prefer not having loaded bows in any other slot than the wielded one.

The clone bug must go away, that's kinda priority. If that means we must accept loaded bows in the inv, then so be it. But I'd prefer not having loaded bows in any other slot than the wielded one.
Member

Actually, after writing code to log inventory actions, I think using minetest.register_allow_player_inventory_action to prevent moving loaded bows ought to work... let me do some testing on that...

Actually, after writing code to log inventory actions, I think using [minetest.register_allow_player_inventory_action](https://github.com/minetest/minetest/blob/951604e29ff9d4b796003264574e06031c014a3f/doc/lua_api.txt#L5099) to prevent moving loaded bows ought to work... let me do some testing on that...
Member

fixed in 06cae09569

fixed in https://gitea.your-land.de/your-land/yl_commons/commit/06cae09569186e3e419ff88fc0564d9b864fadc1
flux added the
4. step/ready to QA test
label 2022-06-06 15:37:34 +00:00
flux added
5. result/fixed
and removed
4. step/ready to QA test
labels 2022-06-07 16:01:15 +00:00
Member

this is live

this is live

Seems fine to me. I cannot move, drop or do anything to the loaded bow.

Seems fine to me. I cannot move, drop or do anything to the loaded bow.
AliasAlreadyTaken added this to the 1.1.112 milestone 2022-06-08 14:52:15 +00:00
flux closed this issue 2022-06-08 18:32:53 +00:00
AliasAlreadyTaken was unassigned by flux 2022-09-21 00:08:09 +00:00
flux removed their assignment 2022-09-21 00:08:09 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: your-land/bugtracker#666
No description provided.