minetest / minetest_game

Minetest Game - A lightweight and well-maintained base for modding [https://github.com/minetest/minetest/]
http://minetest.net/
Other
1.42k stars 578 forks source link

Add a telescope item to gain the zoom privilege #1788

Closed paramat closed 7 years ago

paramat commented 7 years ago

New consideration of #1358

I'm considering adding a craftable telescope to gain the zoom priviledge. Any comments before i start on this?

Hmm i remember now there was a problem with this idea that @Wuzzy2 discovered, what was it? Would moving zoom to HUD flags help?

Maybe it was that crafting the item gives you the priviledge, but the priviledge remains even if you no longer have the telescope? Maybe 'on joinplayer' the inventory can be checked for the item and the priviledge updated accordingly?

Wuzzy do you have the code you developed or know of a reasonable way to implement this?

octacian commented 7 years ago

A telescope would really improve gameplay, :+1:

I'd also like to see the minimap disabled by default and instead, a map implemented that could be used to gain access to the minimap. However, it'd be preferable to have a few other engine features to allow setting the FOV server-side and showing/hiding the minimap so as to trigger these features only when the item was wielded.

tenplus1 commented 7 years ago

+1 crafting or obtaining a telescope would be an ideal way to introduce the zoom priv.

Wuzzy2 commented 7 years ago

I have written binoculars code here: http://repo.or.cz/minetest_orienteering.git/blob/2c0b61497023a8706b98febf4cde2742f4f6fa46:/init.lua

This is an old and discarded branch of my mod. It enables zoom while you wield the item and disables it when you don't. Very simple. This code should probably work, but I haven't used it since a while. You're on your own.

The map item idea suggested by octarian is implemented in my orienteering mod as well, and it is trivially easy to implement. Although my mod does not really have a map item, it is called “automapper” because you can only toggle the minimap entirely with both surface and radar mode. You can not just enable the map without also enabling the radar mode. This has of course gameplay implications.

By the way: I still think it was a terrible design choice that zooming requires a privilege, and not a player HUD flag (like the minimap does). https://github.com/minetest/minetest/issues/4700

stujones11 commented 7 years ago

The problem with items granting privs is what happens if someone has that priv already. Okay, you can check a players initial privs on join but there is a problem if the server goes down while a player has the temp priv, the player then rejoins with permanently elevated privs. I came across this issue myself when trying to add privs to armor items.

Forum post: https://forum.minetest.net/viewtopic.php?f=5&t=17383

I am not saying this can't be done, just some gotchas to watch out for, the basic idea is good.

paramat commented 7 years ago

Thanks to you both.

rubenwardy commented 7 years ago

Zoom should not be a privilege. It should be a HUD flag. You could then implement zoom as a privilege separately, although it would be best to have on grant / revoke callbacks

Wuzzy2 commented 7 years ago

Exactly, if the binoculars from my branch were to be taken, this means that the subgame basically “owns” the privilege, as it automatically grants and revokes the privilege and server operators should not touch this privilege (as it gets overwritten anyway).

This is of course bad and hacky but I think it's the only solution without changing the engine. Had zooming never been a privilege to begin with, we would not have this problem.

paramat commented 7 years ago

Found my former telescope issue #1358

paramat commented 7 years ago

PR #1881

paramat commented 7 years ago

1881 merged.