-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to easier override HP and breath engine logic by Lua. #14179
base: master
Are you sure you want to change the base?
Conversation
Wasn't there some discussion to move the entire logic to Lua? |
Yes, in #14125. |
Because, contrary to HPs, it's not something the majority of games need. It should be eradicated from the engine imho, it's only a burden for core devs |
I understand. But, before some time I created some mod that was doing something like breath in Lua. The problem with it was, that it did not work smoothly because of the non-constant time difference between steps. So, I think that the use of C++ HP and breath engine whatever is possible will look better from the player's side as a result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR is overkill for de-hardcoding breath; all you need for that would be a simple (player-only) flag that tells the engine to stop managing breath so that the modder can take over. (In fact, this PR goes a bit in the opposite direction of #14125 even IMO: It adds breath to entities, and complicates it by adding more features such as controllable intervals.)
I would suggest splitting this up into a PR which lets you disable engine breath handling for players, which will basically fix #8042 and half of #14125 and should be rather uncontroversial, and another PR for all the features, esp. adding node damage to entities etc. (which I'm frankly not sure belongs into the engine).
So, I think that the use of C++ HP and breath engine whatever is possible will look better from the player's side as a result.
I'm not so sure about this. If I see this correctly, this PR is entirely serverside and uses no server features not available to Lua, so why would it have clientside prediction advantages over a Lua-only solution, which would be entirely serverside as well?
(By the way, I think breath was moved to the server to combat cheating a rather long while ago?)
So, it looks like the idea of using a mask to add the ability to partially disable SAO damage/breath logic in combination with Lua callback does not sound interesting for Minetest developers. So, this idea is probably a step aside. So, the best way is probably to abandon this idea of a solution. Am I right? |
Not the idea I like that. Please do not be discouraged, we like contributions that make modding easier/possible. |
19fc22a
to
b8ed6bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR still contains the change to add node damage to entities. That doesn't belong in this PR and breaks backwards compatibility if enabled by default. Please remove it.
It is related to bug #9372. But yes, it breaks back compatibility. Will it be satisfying to disable it by default? |
Well, actually I'd be fine with adding node damage to entities as long as it's disabled by default. It would save modders from having to write their own node damage reimplementations in case they just want entities to behave the same as players. However, this seems to be a controversial idea considering the comments in #9372. Maybe it would be better to keep this PR simple and uncontroversial by just including the "allow disabling hardcoded engine features" change. |
@sfence reminder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new table-based form for engine_mask
isn't documented. Also, is there a reason for exposing the underlying bitmask to the Lua API by allowing to specify engine_mask
as a number?
I again suggest the https://dev.minetest.net/Code_style_guidelines, for example this:
When breaking conditionals, indent following lines of the conditional with two tabs and the statement body with one tab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the naming, but I currently have no better naming proposal.
Tested. The default value behavior didn't match my expectations. When not specifying engine_mask
, all flags default to true. When specifying engine_mask
as {breathing = false}
, the other flags default to false, not to true as I would expect. Defaulting to true in this case would also result in better forward-compatibility if more flags are added in the future.
Co-authored-by: grorp <gregor.parzefall@posteo.de>
Since you replied to everything else, I'm repeating this in case you missed it. |
In Lua
Does it sound better? |
Ok, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected now.
I think defaulting to the old values makes sense because that's how top-level object properties work too.
I like this PR and was about to submit my review when I got an idea. Wouldn't it be more helpful to control these damage ticks with floats for each? That would allow arbitrary delays, or also disabling it with values < 0. |
This possibility was included but rejected. So I removed it. After this PR, I want to create PR for the player |
To do
This PR is a Ready for Review
How to test
Run devtest game and change the
engine_mask
value via the included item for properties change.