Aliza reports: can't rename the mob kitten by ... #5837

Closed
opened 2023-12-26 22:48:43 +00:00 by yourland-report · 24 comments

Aliza reports a bug:

can't rename the mob kitten by nametag

Player position:

{
	z = 312.25299072266,
	x = 3892.4038085938,
	y = 46.5
}

Player look:

{
	z = -0.28177872300148,
	x = 0.94100421667099,
	y = -0.18738131225109
}

Player information:

{
	major = 5,
	ip_version = 6,
	min_rtt = 0.20200000703335,
	avg_rtt = 0.30700001120567,
	min_jitter = 0,
	max_jitter = 13.549999237061,
	avg_jitter = 0.1000000089407,
	connection_uptime = 992,
	serialization_version = 29,
	protocol_version = 42,
	minor = 7,
	formspec_version = 6,
	state = "Active",
	lang_code = "",
	patch = 0,
	max_rtt = 13.786999702454,
	version_string = "5.7.0"
}

Player meta:

{
	fields = {
		played_time = "10485233",
		digged_nodes = "777457",
		placed_nodes = "377753",
		died = "1289",
		crafted = "288382",
		["stamina:exhaustion"] = "20",
		partypvp = "true",
		yl_commons_player_created = "1667732142",
		yl_commons_player_joined = "1703629985",
		yl_church = "return {[\"last_death\"] = {[\"z\"] = 364, [\"x\"] = 3877, [\"y\"] = 40}, [\"last_heal\"] = 1674098744, [\"last_death_portal\"] = 1703596568}",
		xp = "366442",
		["unified_inventory:bags"] = "return {\"unified_inventory:bag_large\", \"unified_inventory:bag_large\", \"unified_inventory:bag_large\", \"unified_inventory:bag_large\"}",
		["petz:werewolf"] = "0",
		["petz:lycanthropy"] = "0",
		["petz:werewolf_clan_idx"] = "3",
		partychat = "party",
		arenalib_infobox_arenaID = "0",
		jointime = "1667732142",
		bitten = "0",
		["petz:werewolf_vignette_id"] = "19",
		hud_state = "on",
		yl_commons_thankyou = "397",
		repellant = "0",
		["ocean_build.last_warning"] = "1697078231",
		["ocean_build.ocean_built"] = "4",
		punch_count = "135817",
		inflicted_damage = "2821702",
		["petz:old_override_table"] = "return {[\"jump\"] = 1.5, [\"gravity\"] = 1, [\"new_move\"] = true, [\"sneak_glitch\"] = false, [\"speed\"] = 2, [\"sneak\"] = true}",
		["3d_armor_inventory"] = "return {\"3d_armor:boots_crystal 1 4940\", \"3d_armor:chestplate_rainbow 1 302\", \"3d_armor:leggings_rainbow 1 302\", \"3d_armor:helmet_rainbow 1 302\", \"shields:shield_rainbow 1 22208\", \"\"}",
		["stamina:poisoned"] = "no",
		["stamina:level"] = "16",
		["signslib:pos"] = "(-1890,71,-3674)"
	}
}

Log identifier


[MOD] yl_report log identifier = 3QhfBGbKKxyyOpdLQvDW6DODqpaIIcM6

Profiler save:

profile-20231226T224843.json_prettyEE

Status:

# Server: version: 5.7.0-yl-thx-tmm | game: Minetest Game | uptime: 7d 10h 44min | max lag: 0.725s | clients (28/52): AliasAlreadyTaken, Aliza, Bailiff, Bla, BLuOXide, Boot, Boris, DanteLives, Deathwing, dias, DragonWrangler1, flux, formations52, Hallifax, Heron, Lucien_II, Lupercus, Masterbailiff, Mikiangel, NickNemre_123go, Nomtom, Pif, pium, rewired_X, rheo, Service, visibleObject2, whosit

Teleport command:

/teleport xyz 3892 47 312

Compass command:

/give_compass Construction 3QhfBGbKKxyyOpdLQvDW6DODqpaIIcM6 D2691E 3892 47 312
Aliza reports a bug: > can't rename the mob kitten by nametag Player position: ``` { z = 312.25299072266, x = 3892.4038085938, y = 46.5 } ``` Player look: ``` { z = -0.28177872300148, x = 0.94100421667099, y = -0.18738131225109 } ``` Player information: ``` { major = 5, ip_version = 6, min_rtt = 0.20200000703335, avg_rtt = 0.30700001120567, min_jitter = 0, max_jitter = 13.549999237061, avg_jitter = 0.1000000089407, connection_uptime = 992, serialization_version = 29, protocol_version = 42, minor = 7, formspec_version = 6, state = "Active", lang_code = "", patch = 0, max_rtt = 13.786999702454, version_string = "5.7.0" } ``` Player meta: ``` { fields = { played_time = "10485233", digged_nodes = "777457", placed_nodes = "377753", died = "1289", crafted = "288382", ["stamina:exhaustion"] = "20", partypvp = "true", yl_commons_player_created = "1667732142", yl_commons_player_joined = "1703629985", yl_church = "return {[\"last_death\"] = {[\"z\"] = 364, [\"x\"] = 3877, [\"y\"] = 40}, [\"last_heal\"] = 1674098744, [\"last_death_portal\"] = 1703596568}", xp = "366442", ["unified_inventory:bags"] = "return {\"unified_inventory:bag_large\", \"unified_inventory:bag_large\", \"unified_inventory:bag_large\", \"unified_inventory:bag_large\"}", ["petz:werewolf"] = "0", ["petz:lycanthropy"] = "0", ["petz:werewolf_clan_idx"] = "3", partychat = "party", arenalib_infobox_arenaID = "0", jointime = "1667732142", bitten = "0", ["petz:werewolf_vignette_id"] = "19", hud_state = "on", yl_commons_thankyou = "397", repellant = "0", ["ocean_build.last_warning"] = "1697078231", ["ocean_build.ocean_built"] = "4", punch_count = "135817", inflicted_damage = "2821702", ["petz:old_override_table"] = "return {[\"jump\"] = 1.5, [\"gravity\"] = 1, [\"new_move\"] = true, [\"sneak_glitch\"] = false, [\"speed\"] = 2, [\"sneak\"] = true}", ["3d_armor_inventory"] = "return {\"3d_armor:boots_crystal 1 4940\", \"3d_armor:chestplate_rainbow 1 302\", \"3d_armor:leggings_rainbow 1 302\", \"3d_armor:helmet_rainbow 1 302\", \"shields:shield_rainbow 1 22208\", \"\"}", ["stamina:poisoned"] = "no", ["stamina:level"] = "16", ["signslib:pos"] = "(-1890,71,-3674)" } } ``` Log identifier ``` [MOD] yl_report log identifier = 3QhfBGbKKxyyOpdLQvDW6DODqpaIIcM6 ``` Profiler save: ``` profile-20231226T224843.json_prettyEE ``` Status: ``` # Server: version: 5.7.0-yl-thx-tmm | game: Minetest Game | uptime: 7d 10h 44min | max lag: 0.725s | clients (28/52): AliasAlreadyTaken, Aliza, Bailiff, Bla, BLuOXide, Boot, Boris, DanteLives, Deathwing, dias, DragonWrangler1, flux, formations52, Hallifax, Heron, Lucien_II, Lupercus, Masterbailiff, Mikiangel, NickNemre_123go, Nomtom, Pif, pium, rewired_X, rheo, Service, visibleObject2, whosit ``` Teleport command: ``` /teleport xyz 3892 47 312 ``` Compass command: ``` /give_compass Construction 3QhfBGbKKxyyOpdLQvDW6DODqpaIIcM6 D2691E 3892 47 312 ```
AliasAlreadyTaken was assigned by yourland-report 2023-12-26 22:48:44 +00:00

tried this, the nametag gets used up but the name you assigned the mob doesn't appear over its head

tried this, the nametag gets used up but the name you assigned the mob doesn't appear over its head

Apparently that affects ALL mobs and could also explain the missing "Focus" nametag.

Apparently that affects ALL mobs and could also explain the missing "Focus" nametag.
AliasAlreadyTaken added the
1. kind/bug
3. source/unknown
labels 2023-12-27 00:22:17 +00:00

I wouldn't be so sure about ALL mobs - Scouts have their nametags on at all times

I wouldn't be so sure about ALL mobs - Scouts have their nametags on at all times

It seems like mobs_redo renamed the value the nametag is stored in from nametag to _nametag.
So everything which spawns mobs with nametags needs to change it. (quite sure this is wrong now.

if I understand this correctly, the first call to update_nametag will overwrite the newname in case the mob is "old" and still has the self.nametag value set. (the whole compat code looks weird)
be7b6bc5fe/api.lua (L658)

It seems like mobs_redo renamed the value the nametag is stored in from `nametag` to `_nametag`. So everything which spawns mobs with nametags needs to change it. (quite sure [this](https://codeberg.org/tenplus1/mobs_redo/src/commit/be7b6bc5fedcd100418e621269dfed013c7e5898/api.txt#L372) is wrong now. if I understand this correctly, the first call to update_nametag will overwrite the `newname` in case the mob is "old" and still has the `self.nametag` value set. (the whole compat code looks weird) https://codeberg.org/tenplus1/mobs_redo/src/commit/be7b6bc5fedcd100418e621269dfed013c7e5898/api.lua#L658
flux added the
2. prio/elevated
label 2023-12-27 18:17:36 +00:00
Member

i wonder if this is related to the smalls that only had 65 max HP... hm.

i wonder if this is related to the smalls that only had 65 max HP... hm.
Member

@AliasAlreadyTaken what commit of mobs_redo are we actually using? i've verified that scouts have a nametag attribute and not a _nametag attribute. foci have neither.

@AliasAlreadyTaken what commit of mobs_redo are we actually using? i've verified that scouts have a `nametag` attribute and not a `_nametag` attribute. foci have neither.
Member

actually probably should make a separate issue about the foci/smalls, forgot this was about nametag items

actually probably should make a separate issue about the foci/smalls, forgot this was about nametag items
Member
upstream issue https://codeberg.org/tenplus1/mobs_redo/issues/8
flux added
3. source/mod upstream
and removed
3. source/unknown
labels 2023-12-27 19:56:19 +00:00
Member

actually this appears to have already been fixed upstream

actually this appears to have already been fixed upstream
flux added the
4. step/ready to QA test
label 2023-12-27 20:01:06 +00:00
AliasAlreadyTaken added this to the 1.1.123 milestone 2023-12-27 21:52:06 +00:00

QA

I can't name any mobs_animal via nametag.

QA I can't name any mobs_animal via nametag.
AliasAlreadyTaken added the
ugh/QA NOK
label 2024-01-28 13:23:33 +00:00

Using latest upstream I cannot reproduce the issue.
mobs_redo: 97771f8e65
mobs_animal: bf12043fdc

We mirrored them and branched them off. Using the branches without the other YL mods, I can name animals. Using the branches WITH the other YL mods, I cannot name animals.

Using latest upstream I cannot reproduce the issue. mobs_redo: https://codeberg.org/tenplus1/mobs_redo/commit/97771f8e653e7e99b3c1c2e1135333292a7c6c9c mobs_animal: https://codeberg.org/tenplus1/mobs_animal/commit/bf12043fdcab68acfef299e26b6896a918ce1512 We mirrored them and branched them off. Using the branches without the other YL mods, I can name animals. Using the branches WITH the other YL mods, I cannot name animals.
Member

it's an issue with yl_speak_up that wraps mobs.mob_class.update_tag without passing the argument properly


diff --git a/interface_mobs_api.lua b/interface_mobs_api.lua
index 99bddfd..48f1ae0 100644
--- a/interface_mobs_api.lua
+++ b/interface_mobs_api.lua
@@ -134,11 +134,11 @@ if(not(yl_speak_up.orig_mobs_update_tag)) then
        yl_speak_up.orig_mobs_update_tag = mobs.mob_class.update_tag
 end
 -- update nametag and infotext
-mobs.mob_class.update_tag = function(self)
+mobs.mob_class.update_tag = function(self, nametag)

        -- we are only responsible for talking NPC
        if(not(self) or not(self.yl_speak_up)) then
-               return yl_speak_up.orig_mobs_update_tag(self)
+               return yl_speak_up.orig_mobs_update_tag(self, nametag)
        end

        local qua = 0

with this fix it works

it's an issue with yl_speak_up that wraps `mobs.mob_class.update_tag` without passing the argument properly ```diff diff --git a/interface_mobs_api.lua b/interface_mobs_api.lua index 99bddfd..48f1ae0 100644 --- a/interface_mobs_api.lua +++ b/interface_mobs_api.lua @@ -134,11 +134,11 @@ if(not(yl_speak_up.orig_mobs_update_tag)) then yl_speak_up.orig_mobs_update_tag = mobs.mob_class.update_tag end -- update nametag and infotext -mobs.mob_class.update_tag = function(self) +mobs.mob_class.update_tag = function(self, nametag) -- we are only responsible for talking NPC if(not(self) or not(self.yl_speak_up)) then - return yl_speak_up.orig_mobs_update_tag(self) + return yl_speak_up.orig_mobs_update_tag(self, nametag) end local qua = 0 ``` with this fix it works

2024-01-29 12:29:18: ACTION[Server]: [yl_commons] formspec "mobs_nametag": Administrator submitted {"mob_rename":"Umbenennen","name":"ASD","quit":"true"}

For some reason, EVERY mob calls update_tag once a second? Why?

Because yl_speak_up overwrites that function in interface_mobs_api.lua, line 137

2024-01-29 12:29:18: ACTION[Server]: [yl_commons] formspec "mobs_nametag": Administrator submitted {"mob_rename":"Umbenennen","name":"ASD","quit":"true"} For some reason, EVERY mob calls update_tag once a second? Why? Because yl_speak_up overwrites that function in interface_mobs_api.lua, line 137
Member

Sorry for spam, too many branches with inconsistent names 💁

This monkey-patching/wrapping is an antipattern and should be avoided...

For some reason, EVERY mob calls update_tag once a second? Why?

97771f8e65/api.lua (L3480)

because environmental damage updates it even when nothing is changed.
this also causes per-second ticking of network packets for every mob...

Sorry for spam, too many branches with inconsistent names 💁 This monkey-patching/wrapping is an antipattern and should be avoided... > For some reason, EVERY mob calls update_tag once a second? Why? https://gitea.your-land.de/your-land/mobs_redo/src/commit/97771f8e653e7e99b3c1c2e1135333292a7c6c9c/api.lua#L3480 because environmental damage updates it even when nothing is changed. this also causes per-second ticking of network packets for every mob...
Member

this also causes per-second ticking of network packets for every mob...

are you sure it does if the mob doesn't have any nametag? and does it still do that if the nametag doesn't actually change?

> this also causes per-second ticking of network packets for every mob... are you sure it does if the mob doesn't have any nametag? and does it still do that if the nametag doesn't actually change?
Member
function mob_class:on_step(dtime, moveresult)

...

	-- environmental damage timer (every 1 second)
	self.env_damage_timer = self.env_damage_timer + dtime

	if self.env_damage_timer > 1 then

		self.env_damage_timer = 0

		-- check for environmental damage (water, fire, lava etc.)
		if self:do_env_damage() then return end

		-- node replace check (cow eats grass etc.)
		self:replace(pos)
	end
...

function mob_class:do_env_damage()

	local pos = self.object:get_pos() ; if not pos then return end

	self:update_tag()
function mob_class:update_tag(newname)
...

	if newname or (self._nametag and self._nametag ~= "") then

...

		self.object:set_properties({nametag = self._nametag, nametag_color = col})
	end

...

	self.object:set_properties({infotext = self.infotext})

```lua function mob_class:on_step(dtime, moveresult) ... -- environmental damage timer (every 1 second) self.env_damage_timer = self.env_damage_timer + dtime if self.env_damage_timer > 1 then self.env_damage_timer = 0 -- check for environmental damage (water, fire, lava etc.) if self:do_env_damage() then return end -- node replace check (cow eats grass etc.) self:replace(pos) end ... ``` ```lua function mob_class:do_env_damage() local pos = self.object:get_pos() ; if not pos then return end self:update_tag() ``` ```lua function mob_class:update_tag(newname) ... if newname or (self._nametag and self._nametag ~= "") then ... self.object:set_properties({nametag = self._nametag, nametag_color = col}) end ... self.object:set_properties({infotext = self.infotext}) ```
Member

I tried commenting both set_properties lines out (didn't notice second one at first):

Screenshot 2024-01-30 074643

So, I'm pretty sure.

Feels like this should be fixed ASAP X)

I tried commenting both `set_properties` lines out (didn't notice second one at first): ![Screenshot 2024-01-30 074643](/attachments/1fe3a8da-e160-44e0-96ac-cbb883aee837) So, I'm pretty sure. Feels like this should be fixed ASAP X)
Member

With this patch tick is gone:

diff --git a/api.lua b/api.lua
index 77d5514..3d5cc5c 100644
--- a/api.lua
+++ b/api.lua
@@ -654,6 +654,9 @@ function mob_class:update_tag(newname)
        local prop = self.object:get_properties()
        local qua = prop.hp_max / 6

+       local old_nametag = prop.nametag
+       local old_nametag_color = minetest.colorspec_to_bytes(prop.nametag_color)
+
        -- backwards compatibility
        if self.nametag and self.nametag ~= "" then
                newname = self.nametag
@@ -662,6 +665,7 @@ function mob_class:update_tag(newname)

        if newname or (self._nametag and self._nametag ~= "") then

+
                self._nametag = newname or self._nametag -- adopt new name if one found

                -- choose tag colour depending on mob health
@@ -679,7 +683,9 @@ function mob_class:update_tag(newname)
                        col = "#00FF00"
                end

-               self.object:set_properties({nametag = self._nametag, nametag_color = col})
+               if self._nametag ~= old_nametag or minetest.colorspec_to_bytes(col) ~= old_nametag_color then
+                       self.object:set_properties({nametag = self._nametag, nametag_color = col})
+               end
        end

        local text = ""
@@ -708,7 +714,9 @@ function mob_class:update_tag(newname)
                .. text

        -- set infotext changes
-       self.object:set_properties({infotext = self.infotext})
+       if self.infotext ~= prop.infotext then
+               self.object:set_properties({infotext = self.infotext})
+       end
 end
With this patch tick is gone: ```diff diff --git a/api.lua b/api.lua index 77d5514..3d5cc5c 100644 --- a/api.lua +++ b/api.lua @@ -654,6 +654,9 @@ function mob_class:update_tag(newname) local prop = self.object:get_properties() local qua = prop.hp_max / 6 + local old_nametag = prop.nametag + local old_nametag_color = minetest.colorspec_to_bytes(prop.nametag_color) + -- backwards compatibility if self.nametag and self.nametag ~= "" then newname = self.nametag @@ -662,6 +665,7 @@ function mob_class:update_tag(newname) if newname or (self._nametag and self._nametag ~= "") then + self._nametag = newname or self._nametag -- adopt new name if one found -- choose tag colour depending on mob health @@ -679,7 +683,9 @@ function mob_class:update_tag(newname) col = "#00FF00" end - self.object:set_properties({nametag = self._nametag, nametag_color = col}) + if self._nametag ~= old_nametag or minetest.colorspec_to_bytes(col) ~= old_nametag_color then + self.object:set_properties({nametag = self._nametag, nametag_color = col}) + end end local text = "" @@ -708,7 +714,9 @@ function mob_class:update_tag(newname) .. text -- set infotext changes - self.object:set_properties({infotext = self.infotext}) + if self.infotext ~= prop.infotext then + self.object:set_properties({infotext = self.infotext}) + end end ```
AliasAlreadyTaken removed their assignment 2024-01-30 05:20:49 +00:00
Sokomine was assigned by AliasAlreadyTaken 2024-01-30 05:20:49 +00:00
Member

this issue is about naming things with a nametag - we should split the "only set_properties if things change" into a separate issue.

this issue is about naming things with a nametag - we should split the "only set_properties if things change" into a separate issue.
Member

That parameter to update_tag seems new to me. It'll now be passed on to the mobs mod for other mobs than those covered by yl_speak_up.

The reason I had to change this function for the NPC is that all those NPC standing around gave lots of us half of a heart attack :-) It looked like Voice came visiting. There needs to be a visual distinction (=diffrent color tag) between hostile mobs and NPC.

As the NPC are immune to environtment dammage, the current version of them doesn't call the do_env_damage() function from mobs_redo and thus saves a bit of traffic.

That parameter to update_tag seems new to me. It'll now be passed on to the mobs mod for other mobs than those covered by yl_speak_up. The reason I had to change this function for the NPC is that all those NPC standing around gave lots of us half of a heart attack :-) It looked like Voice came visiting. There needs to be a visual distinction (=diffrent color tag) between hostile mobs and NPC. As the NPC are immune to environtment dammage, the current version of them doesn't call the do_env_damage() function from mobs_redo and thus saves a bit of traffic.

QA

With whosit's fix the animals can now be named again. Yay!

QA With whosit's fix the animals can now be named again. Yay!
AliasAlreadyTaken added
ugh/QA OK
and removed
ugh/QA NOK
labels 2024-01-31 17:25:33 +00:00

QA

Only that the fix never made it into upstream : Sokomine/yl_speak_up#22

This is not solved, only by virtue of quickly editing the file :P

QA Only that the fix never made it into upstream : https://gitea.your-land.de/Sokomine/yl_speak_up/pulls/22 This is not solved, only by virtue of quickly editing the file :P
AliasAlreadyTaken added
ugh/QA NOK
and removed
ugh/QA OK
labels 2024-03-15 05:01:19 +00:00
Member

Oh. 😕

Oh. 😕
flux added
5. result/fixed
and removed
4. step/ready to QA test
labels 2024-03-29 05:04:58 +00:00
Member

nametags work (on kittens specifically)

nametags work (on kittens specifically)
flux closed this issue 2024-03-29 05:05:39 +00:00
flux added
ugh/QA OK
and removed
ugh/QA NOK
labels 2024-03-29 22:57:08 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 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#5837
No description provided.