Skip to content
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

Grantme all adds "creative" privilege, which turns the game into creative mode #2838

Closed
kneekoo opened this issue Feb 27, 2021 · 18 comments
Closed

Comments

@kneekoo
Copy link

kneekoo commented Feb 27, 2021

I don't know what "creative" is supposed to do, but when I hit Esc to access the game menu, I see "Creative Mode: Off". That's not right, though, because the game still acts like in creative mode, with all the tabs in the crafting interface, and if I harvest my crops I will only get 1 finished product + 1 seed, nothing else. And when I plant the seed back on tilled soil, the seed stays in my inventory and I can fill all the farming spots with it, like in creative mode. And when I chopped wood, the log counter in my inventory remained the same, although the wood looked like being chopped normally, and they are gone.

Once I did /revokeme creative, things went back to normal - the counters started working again for the stuff that I harvested and planted.

@SmallJoker
Copy link
Member

SmallJoker commented Feb 27, 2021

This is intentional so that server owners can fix up their survival world easily. The creative privilege makes it a per-player permission. grant all grants you all privileges. Everything works as intended.
Do you need an indicator? What's your suggestion?

@kneekoo
Copy link
Author

kneekoo commented Feb 27, 2021

Yes, an indicator would help, considering most people are unaware of this. But the game's menu should also say "Creative Mode: On" when this is the case. All I had was guessing, so that's not right.

It also doesn't correspond to the game's behaviour in the past, so it's an unexpected change that can easily cause confusion.

@sfan5
Copy link
Member

sfan5 commented Feb 27, 2021

The issue here is sort of that /grantme all has been recommend for a long time as a way to enable "flying and such" when there is absolutely no guarantee from the game or any mods that granting yourself a privilege

  • only adds to the game experience without changing the basics
  • or has a positive effect on the game experience at all

@kneekoo
Copy link
Author

kneekoo commented Feb 27, 2021

Having this documented is a good idea, even if most people never read the docs. But making it easy for players to spot such changes while playing is more important. When there's no indicator and the menu also misleads you, that's something to fix.

In singleplayer, when you have the "creative" privilege or you started the game in creative mode, the game should say:
Creative Mode: On

In multiplayer, the game should say:

World Creative Mode: Off
Personal Creative Mode: On

Those should be changed because they should never contradict the real game mode of a player.

But as you can only see these if you open the menu, an indicator would help even more. Or maybe take the subtle way of "telling" the players they're in creative mode by hiding the health from the HUD, like Minecraft does. Now the thing is it works better for them because they have health, hunger, armor and XP in the HUD, so it's way easier to notice that compared to not seeing the health bar.

Additionally, Minecraft's crafting UI is distinctively different compared to the one in survival, which makes it very easy to tell the difference - as long as you're familiar with how both modes look like, of course. But the difference in Minetest Game is only the added tabs, which don't stand out as much as Minecraft's colored tabs.

@rubenwardy
Copy link
Member

The creative privilege is dumb and breaks the privilege system

@kneekoo
Copy link
Author

kneekoo commented Feb 27, 2021

I think it's useful for server admins, but you should be able to easily tell which mode you're in, and the menu should reflect that.

@sfan5
Copy link
Member

sfan5 commented Mar 5, 2021

Blocking the use of the creative priv in singleplayer could make sense, since after all you can enable it in the menu.
For multiplayer that's not a solution.

@neoh4x0r
Copy link

neoh4x0r commented Jul 5, 2021

TL;DR

PS: This is looking more like a minetest engine issue (related to the builtin privs system).

/revokeme creative seems to be the only real solution, and the only way to grant
a specific player with it, is to use /grant[me[ [player] [creative|all].

However, they both require that the user has the ability to grant/revoke privs -- an average
player won't have this ability unless it has been granted by another user with the required privs.

The revoke command might need to be modified to allow a non-privileged user the ability to revoke creative mode.
(Then they would have to ask and admin to grant it again).

I don't think an indicator alone would be sufficient, because an indicator only informs the user they are in creative mode, but doesn't give them the ability to change it and the admins would have to step-in every time to fix it.

Another interesting idea might be to allow certain privs to be granted for a period of time (such as being in creative for a set amount of time, and then it is automatically revoked afterwards).

TBH, the simplest solution might be to make all grant everything except for creative (even though the breaks the definition of all) and then creative would have to be granted/revoked explicitly.


So to summarize:

  1. /grantme all (grants all privs, including creative)
  2. /revokeme creative (revokes creative)
  3. Manmenu setting Creative Mode [on|off] does not affect this ?

According to these files in the minetest engine:
https://github.com/minetest/minetest/blob/a106bfd456509b676ccba0ac9bef75c214819028/builtin/mainmenu/tab_local.lua#L188
https://github.com/minetest/minetest/blob/a106bfd456509b676ccba0ac9bef75c214819028/builtin/mainmenu/common.lua#L218

cb_creative_mode is controlled via the mainmenu option, and sets the value globally in world.mt (and minetest.conf).

It should be noted that in order to use grant and revoke privileges you must hold one of the following privileges basic_privs or privs (and also the basic_privs must be configured to allow this).
https://github.com/minetest/minetest/blob/8cc04e0cb4fb186092732c7687543f67b4628c96/builtin/game/chat.lua#L226
https://github.com/minetest/minetest/blob/8cc04e0cb4fb186092732c7687543f67b4628c96/builtin/game/chat.lua#L295

This is further broken by the fact that a server admin could grant creative to a player, and that the player might be unable to revoke it themselves, relying on an admin to revoke it.

Thus, the use-case for changing to creative mode in-game seems really only to facilitate server administration/maintenance, as users of the system are unlikely to be able to grant privs to themselves initially.

Even having a pause menu (pressing escape) option to switch between creative/survival mode wouldn't work here (expect in a situation where you want to go from creative to survival -- eg. more privileged to less privileged).

I suppose that the revoke command could allow a player to implicitly revoke a privilege for themselves -- that would solve the above scenario (even though it is beyond the stated use-case).

@0-afflatus
Copy link

I don't really understand how this is an engine issue.
The vast majority of this is in the creative mod and the rest in /builtin/game/
What part of this could not be scripted in Lua?

@neoh4x0r
Copy link

neoh4x0r commented Jul 6, 2021

I don't really understand how this is an engine issue.
The vast majority of this is in the creative mod and the rest in /builtin/game/
What part of this could not be scripted in Lua?

These files (which dealt with "creative mode" setting, and grant/revoke) are in the MT repo (making it a minetest issue).

builtin/mainmenu/tab_local.lua
builtin/mainmenu/common.lua
builtin/game/chat.lua

Sure code could be added to MTG to correct it, but the issue is a fundamental way in which "creative" mode is turned on/off (and having some way of knowing when creative is active).

Solving it for MTG only would be a case of treating the symptoms rather than addressing the root issue.

The original issue:

  1. Have an indicator that shows creative mode is active.

game's menu should also say "Creative Mode: On" when this is the case.

This would require a change to the mainmenu lua code in minetest -- making it a minetest issue.

However, the way that the mainmenu functions means that this does not fundamentally work -- the creative mode setting is a quasi per-world/global setting and doesn't take into account that the "creative" priv could be granted to individual players.

I'd say what the OP really wants is a per-player indicator that is shown in the client's menu (when pressing the escape key).


The other stuff I mentioned -- was a possible solution for people to easily turn creative mode off when they don't need it anymore and they didn't have the privs to do that.

grant and revoke both require either privs or basic_privs (with the relevant privs added).
My suggestion was to allow a non-prived user to be able to revoke creative mode for themselves even if they don't have those privs.

Eg. the indicator in the menu, showing "creative mode on" could be a button allowing it to be toggled off (again that is the menu accessible by pressing the escape key, not the main menu).

@neoh4x0r
Copy link

neoh4x0r commented Jul 6, 2021

@kneekoo
I think a change of title might be needed to better reflect the issue.

Grantme all adds "creative" privilege, which turns the game into creative mode
Which is expected, since all grants every privilege.

Maybe change the title to:
It's currently not clear when/if creative mode is active.

@0-afflatus
Copy link

and /builtin/game/privileges.lua
What I'm driving at is whether this could all be done in Lua.
Essentially anything involving creative is a mod issue, disable creative mod and the issue goes away - all those core functions can be overridden. So I'm interested.
This really should be done in the creative mod or as a creative mod bolt-on (messy).
Only if there really is no other way should we change stuff in builtin, because this will affect the priv system for all games

@0-afflatus
Copy link

0-afflatus commented Jul 7, 2021

Creative is a MTG mod by the way.
I appreciate it seems like it should be a builtin
But it isn't
I am being a little pedantic about this ikr. The solution could be relatively trivial
We just need to create some visual indication of being in creative mode, so some sort of change to the HUD would satisfy the requirement

@kneekoo
Copy link
Author

kneekoo commented Jul 8, 2021

@kneekoo
I think a change of title might be needed to better reflect the issue.

Grantme all adds "creative" privilege, which turns the game into creative mode
Which is expected, since all grants every privilege.

Maybe change the title to:
It's currently not clear when/if creative mode is active.

Technically you're right according to how the engine does things right now. But I think "creative" should be a game mode, not simply a privilege. And if the player has the "gamemode" privilege, the game can then be toggled between whatever modes the game supports. This would put the responsibility on game makers to support different game modes, and even how they display it to the players, while the engine would only have to support the "gamemode" privilege itself.

@neoh4x0r
Copy link

neoh4x0r commented Jul 8, 2021

Technically you're right according to how the engine does things right now. But I think "creative" should be a game mode, not simply a privilege. And if the player has the "gamemode" privilege, the game can then be toggled between whatever modes the game supports. This would put the responsibility on game makers to support different game modes, and even how they display it to the players, while the engine would only have to support the "gamemode" privilege itself.

While this is true, and is basically what minecraft does (creative / survival / spectator, etc) -- it still requires proposing changes to minetest itself and would require an issue to be opened on the minetest repo.

As far as just showing an indicator (a ui element) on the inventory formspec would be trivial and could be directly implemented in lua for MTG -- if someone wants to override minetest core builtins to put the indicator on a menu other than the inventory formspec that could be done; However, I wouldn't recommend doing this....I think it would be a bad idea to start overriding core builtins (it could get out-of-hand very quickly).

Moreover, it is starting to sound like we have two* separate issues here.

  1. Show an indicator only when creative mode is active (this is a MTG issue)
  2. Add support for different game modes and the ability to easily switch between modes (this is an MT issue)

*Implied issue -- players who are granted "creative" priv (by someone else) cannot revoke it themselves (a player should be able to implicitly revoke them, for themselves, even if they don't have the requird privs to revoke: privs, basic_privs).
Eg. granted privs should be what a player is allowed to do, not what they are not allowed to do (an allow list vs a deny list).

I personally feel like the above (implied revoke) was not done correctly in MT.
https://github.com/minetest/minetest/blob/8cc04e0cb4fb186092732c7687543f67b4628c96/builtin/game/chat.lua#L295

Vis-a-vis: If someone grants a key for a house to someone, the recipient should be able to revoke (return) the key regardless of whatever privs they have, but they should not be able to grant (pass) the "key" to someone else (discretionary vs mandatory access controls, and least privilege).

@0-afflatus
Copy link

As far as just showing an indicator (a ui element) on the inventory formspec would be trivial and could be directly implemented in lua for MTG

Yes. Although I'd like to be more specific and suggest that this should be directly implemented in lua for the Creative mod.
The point being that the Creative mod is used by other games although it was developed as part of MTG

Moreover, it is starting to sound like we have two* separate issues here.

1. Show an indicator only when creative mode is active (this is a MTG issue)

And that would be the best title for the PR - it deals with the immediate issue

2. Add support for different game modes and the ability to easily switch between modes (this is an MT issue)

This requires greater discussion and a separate PR I agree

@sfan5
Copy link
Member

sfan5 commented Jul 10, 2021

it still requires proposing changes to minetest itself and would require an issue to be opened on the minetest repo.

Note that the engine only implements map-wide creative mode, the creative privilege is registered by MTG itself.
Changing the system to a per-player gamemode plus a privilege for changing that would not require engine changes.

@kneekoo
Copy link
Author

kneekoo commented Jul 15, 2021

  1. Show an indicator only when creative mode is active (this is a MTG issue)
  2. Add support for different game modes and the ability to easily switch between modes (this is an MT issue)

I created two new issues for each item: #2890 and #11457. I think having a separate place for the first issue makes more sense, considering this conversation got a bit long. I hope that's fine, and this one is probably best closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants