Sabers don't do full damage in MCL #22

Open
opened 2024-05-11 00:11:59 +02:00 by HandfulOfFrogs · 6 comments
Contributor

When I hit something with an electric saber (it's powered on), only 1 point of damage is dealt to the entity

When I hit something with an electric saber (it's powered on), only 1 point of damage is dealt to the entity
Owner

That's the limitation of Minetest engine itself because you cannot register callback that will be called after hitting entity, only players. Since all electric tools use callbacks to check if they are charged it's not possible to fix it right now.

That's the limitation of Minetest engine itself because you cannot register callback that will be called after hitting entity, only players. Since all electric tools use callbacks to check if they are charged it's not possible to fix it right now.
mrkubax10 added the
wontfix
label 2024-05-11 10:23:06 +02:00
Author
Contributor

Someone has been able to do a similar thing by overriding on_punch for all living entities. https://forum.minetest.net/viewtopic.php?t=11229

This is a hack but maybe it's what we need?

Someone has been able to do a similar thing by overriding `on_punch` for all living entities. https://forum.minetest.net/viewtopic.php?t=11229 This is a hack but maybe it's what we need?
Author
Contributor

I'm not sure where the issue is considering in UI it shows that damage of the saber is 9, but it still deals only inactive damage

I'm not sure where the issue is considering in UI it shows that damage of the saber is 9, but it still deals only inactive damage
Owner

The way how electric tools are implemented is that there are 2 variants registered for each tool: inactive and active. Just before usage in appropriate callback it's determined if tool can switch to active mode (if there is enough power stored) and it's replaced with active variant. Same in opposite way if tool doesn't have enough power it's replaced with inactive variant. That's why electric tools are dependent on callbacks.

The way how electric tools are implemented is that there are 2 variants registered for each tool: inactive and active. Just before usage in appropriate callback it's determined if tool can switch to active mode (if there is enough power stored) and it's replaced with active variant. Same in opposite way if tool doesn't have enough power it's replaced with inactive variant. That's why electric tools are dependent on callbacks.
Owner

This is a hack but maybe it's what we need?

Seems like a reasonable solution.

> This is a hack but maybe it's what we need? Seems like a reasonable solution.
Author
Contributor

it's replaced with active variant. Same in opposite way if tool doesn't have enough power it's replaced with inactive variant.

What I'm saying is that, I assume, the saber is already in its "active" variant after breaking a leaf block (GUI shows 9 damage) but it still deals 1

>it's replaced with active variant. Same in opposite way if tool doesn't have enough power it's replaced with inactive variant. What I'm saying is that, I assume, the saber is already in its "active" variant after breaking a leaf block (GUI shows 9 damage) but it still deals 1
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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: mrkubax10/industrialtest#22
No description provided.