Hemiptera Bugtracker at bugs.linux-forks.de

advtrains

Wrong sign entity name

Send replies to 183@bugs.linux-forks.de or using the Form below.
avatar From: OP
Sun, 27 Jun 2021 11:05:01 -0000

A player on my server reported that a passing train will destroy a signs_lib sign text entity.

He pointed me to this section of code in advtrains/trainlogic.lua at line 701:

```lua

--- 8c damage other objects ---

if is_loaded_area then

local objs = minetest.get_objects_inside_radius(rcollpos, 2)

for _,obj in ipairs(objs) do

if not obj:is_player() and obj:get_armor_groups().fleshy and obj:get_armor_groups().fleshy > 0

and obj:get_luaentity() and obj:get_luaentity().name~="signs:text" then

obj:punch(obj, 1, { full_punch_interval = 1.0, damage_groups = {fleshy = 1000}, }, nil)

end

end

end

```

That "signs:text" entity name on line 706 is out-of-date. I changed that a long while back; signs_lib uses `signs_lib:text` now.

--

"There are some things in life worth obsessing over.  Most

things aren't, and when you learn that, life improves."

Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com>

avatar From: Developer
Mon, 28 Jun 2021 09:41:01 -0000

Yes, this certainly needs to be updated.

However I wonder why the signs-lib entity has the "fleshy" group set in the first place. If I understand correctly, "fleshy" is supposed to be used for living mobs, and not for "technical" entities, that's what the check is checking for. Is this group necessary for proper operation of the sign entities?

Am 27.06.21 um 13:06 schrieb 183@bugs.linux-forks.de:

> A player on my server reported that a passing train will destroy a signs_lib sign text entity.

>

> He pointed me to this section of code in advtrains/trainlogic.lua at line 701:

>

> ```lua

> --- 8c damage other objects ---

> if is_loaded_area then

> local objs = minetest.get_objects_inside_radius(rcollpos, 2)

> for _,obj in ipairs(objs) do

> if not obj:is_player() and obj:get_armor_groups().fleshy and obj:get_armor_groups().fleshy > 0

> and obj:get_luaentity() and obj:get_luaentity().name~="signs:text" then

> obj:punch(obj, 1, { full_punch_interval = 1.0, damage_groups = {fleshy = 1000}, }, nil)

> end

> end

> end

> ```

>

> That "signs:text" entity name on line 706 is out-of-date. I changed that a long while back; signs_lib uses `signs_lib:text` now.

>

avatar From: OP
Mon, 28 Jun 2021 11:24:01 -0000

On Mon, 28 Jun 2021 11:42:01 +0200 (CEST)

183@bugs.linux-forks.de wrote:

> Yes, this certainly needs to be updated.

>

> However I wonder why the signs-lib entity has the "fleshy" group set in the

Sign entities are not in that group (the word "flesh" does not appear in any file in my mod):

```lua

minetest.register_entity("signs_lib:text", {

collisionbox = { 0, 0, 0, 0, 0, 0 },

visual = "mesh",

mesh = "signs_lib_standard_sign_entity_wall.obj",

textures = {},

static_save = true,

backface_culling = false

})

```

--

"There are some things in life worth obsessing over.  Most

things aren't, and when you learn that, life improves."

Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com>

avatar From: Developer
Tue, 29 Jun 2021 07:31:01 -0000

I see... "fleshy" gets inserted into the armor groups by default...

AFAIK armor groups are not set in the entity definition, but instead by calling obj:set_armor_groups() in on_activate(). If you don't do this, then it apparently gets fleshy=100.

https://github.com/minetest/minetest/blob/5bf72468f3a0925a9fc3c9acacf3f6e138bff35e/src/server/unit_sao.cpp#L28

avatar From: OP
Tue, 29 Jun 2021 11:17:01 -0000

On Tue, 29 Jun 2021 09:32:01 +0200 (CEST)

183@bugs.linux-forks.de wrote:

> I see... "fleshy" gets inserted into the armor groups by default...

>

> AFAIK armor groups are not set in the entity definition, but instead by

> calling obj:set_armor_groups() in on_activate(). If you don't do this, then

> it apparently gets fleshy=100.

>

> https://github.com/minetest/minetest/blob/5bf72468f3a0925a9fc3c9acacf3f6e138bff35e/src/server/unit_sao.cpp#L28

I'd call that an engine bug, since entities are used for a lot more things than creatures...

--

"There are some things in life worth obsessing over.  Most

things aren't, and when you learn that, life improves."

Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com>

avatar Status Update
Tue, 29 Jun 2021 14:22:01 -0000
This bug was closed.
Reply