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

Add 'creative' privilege for survival servers #1543

Closed
wants to merge 1 commit into from
Closed

Add 'creative' privilege for survival servers #1543

wants to merge 1 commit into from

Conversation

tenplus1
Copy link
Contributor

@tenplus1 tenplus1 commented Feb 1, 2017

This adds a 'creative' privilege to survival servers which Ops can bestow on admin or competent builders to give access to creative features like the item inventory or continuous node placement.

@tenplus1 tenplus1 changed the title Add 'creative' privelage for survival servers Add 'creative' privilege for survival servers Feb 1, 2017
@Fixer-007
Copy link
Contributor

Very useful for admins/moderators to work on ingame infrastructure without using cumbersome /giveme whatever...

@@ -54,7 +57,7 @@ function minetest.handle_node_drops(pos, drops, digger)
end
local inv = digger:get_inventory()
if inv then
for _, item in ipairs(drops) do
for _, item in pairs(drops) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pairs is slightly faster than ipairs when dealing with tables not containing numbers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not exactly performance-critical code...

Whether pairs or ipairs is faster also depends on implementation:

local t = {1,1,2,3,5,8,13,21,34,55}

local function timeit(f)
	local n = 0
	local start = os.clock()
	for i = 1, 1000 do
		for _, x in f(t) do
			n = n + x
		end
	end
	return os.clock()-start
end

print("ipairs:", timeit(ipairs))
print("pairs:",  timeit(pairs))
# luajit pairs.lua
ipairs:	0.000156
pairs:	0.000598
# lua5.1 pairs.lua
ipairs:	0.001272
pairs:	0.001225

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that ipairs and luajit work well together :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can change behaviour of the code; it is also not performance-critical.

@numberZero
Copy link
Contributor

👍
unified_inventory gives admins (those who can giveme) access to the creative inventory already, but not other features like infinite stacks or instant recharge IIRC.

@@ -1,14 +1,17 @@
creative = {}

minetest.register_privilege("creative", {"Allow player to use creative inventory",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description =?

Does this even work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's running on Xanadu for now where admin have 'creative' privelages and access to the creative inventory/placement features.

@sofar
Copy link
Contributor

sofar commented Feb 4, 2017

This doesn't look so bad. But the new priv should be added to creative to assure those with the priv get the creative inventory tabs as well.

@tenplus1
Copy link
Contributor Author

tenplus1 commented Feb 4, 2017

Once the callbacks have been added for giving/revoking privs then we can tinker with the creative inventory side of things, but until then it'll set inventory on join.

@zaoqi
Copy link
Contributor

zaoqi commented Feb 9, 2017

#1554

@@ -1,14 +1,18 @@
creative = {}

minetest.register_privilege("creative", {
description = "Allow player to use creative inventory",
give_to_singleplayer = false})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use tabs here, as above in description.

@paramat paramat added the Feature label Mar 1, 2017
@tenplus1
Copy link
Contributor Author

Weird, says branch has conflicts even when it hasn't... what's up with travis ?!?!

@SmallJoker
Copy link
Member

@tenplus1 Your branch does not contain commit eec1c5a, thus it can't apply yor changes 1:1 on top of that.

This adds a 'creative' privilege to survival servers which Ops can bestow on admin or competent builders to give access to the creative inventory.
@tenplus1
Copy link
Contributor Author

@SmallJoker - thanks dude :)

@Zeno-
Copy link

Zeno- commented Jun 7, 2017

👍

@sfan5 sfan5 removed the One approval label Jun 7, 2017
@tenplus1
Copy link
Contributor Author

tenplus1 commented Jun 8, 2017

@sfan5 - this is a very handy feature for survival servers and works really well, giving a use to minetest.is_creative(name)'s 'name' field.

@paramat
Copy link
Contributor

paramat commented Jun 8, 2017

👍

Copy link
Member

@rubenwardy rubenwardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎 a privilege should be the right to do something, not a state you're in.

Being able to use the creative inventory based on a privilege is okay, but it's not okay to have node digging modified. Note that an admin has all privileges, as they have the right to do anything.

I think that get/set_attributes would be a better candidate for changing a player's creative/survival mode.

@tenplus1
Copy link
Contributor Author

tenplus1 commented Jun 9, 2017

@rubenwardy - I disagree, the creative priv will be granted to those trustworthy players on a survival server to allow them to build a lot easier with creative inventory and unlimited block placement. It is earned and definitely a privilege.

@paramat
Copy link
Contributor

paramat commented Jun 10, 2017

@Ekdohibs @ShadowNinja

@ShadowNinja
Copy link
Member

👍

@paramat
Copy link
Contributor

paramat commented Jun 14, 2017

0157175

@paramat paramat closed this Jun 14, 2017
@paramat
Copy link
Contributor

paramat commented Nov 8, 2017

@Ezhh i read on IRC some dissatisfaction with MTG creative priv recently, please could you explain what you think is wrong with the MTG implementation?

@rubenwardy
Copy link
Member

it changes the behaviour of the game, rather than giving you the right to do something.

Either:

  1. the priv only gives you access to the creative inventory, doesn't effect dig times/amount picked up
  2. or the priv allows you to change between creative and survival at will (my preference)

@paramat
Copy link
Contributor

paramat commented Nov 8, 2017

Oh just saw Ezhh was referring to MTG 'current stable', i read 'current' as meaning latest dev.
Dev version has the creative privilege, nevermind.

@paramat
Copy link
Contributor

paramat commented Nov 8, 2017

or the priv allows you to change between creative and survival at will (my preference)

Good idea, if someone has the creative priv they may sometimes find it irritating to be in creative mode due to how it affects inventory and crafting.

@Ezhh
Copy link
Contributor

Ezhh commented Nov 8, 2017

I'm travelling, so not able to test what creative is like in current dev at the moment, but my preference would be for it to do nothing other than let you take items from creative inventory. You should otherwise be able to collect items or craft as you wish. (This way even if you have creative priv on a survival server, you can still choose to play as normal if you wish to.)

I can't comment more than that until I know what current dev actually does.

@paramat
Copy link
Contributor

paramat commented Nov 9, 2017

I think anyone you grant creative to should also have long interact distance and fast node dig too, otherwise having creative won't be very useful for them when they need to alter the world.

I think anyone who is in 'creative mode' should have the full digging / placing / inventory abilities, and the priv should allow changing their gamemode to survival, as rubenwardy suggests. Then they will have both modes available instead of something halfway inbetween which does neither.
@rubenwardy i'll support the creative priv allowing choice of gamemode, i see you have a mod for this already.

Current master has tenplus1's creative priv added which puts the player into creative mode #1543

@Ezhh
Copy link
Contributor

Ezhh commented Nov 9, 2017

@paramat creative as I want it working certainly would not be considered "won't be very useful" by players or server owners, even without longer range / faster placement. Adding those automatically will make me less likely to give the priv to people because when I give someone creative on a survival server, I'm doing it so they have the variety of nodes to make a special building of some kind. (This is why it being a priv makes sense - it is giving the ability to use creative inventory). I'm not doing it to enable anything else and faster digging and so on is completely outside the scope of what I want.

The problem my comments were based on is when creative is either not an option at all on survival, or when it interferes with your ability to pick up nodes. I've seen versions of creative where you are reduced to stacks of 1 no matter how many of a node you pick up,and that's terrible for all kinds of reasons. But as I said before, I'm travelling until the weekend so I can't test what MTG is doing to see if it's this.

With all that said - it would be really nice if hand range was independently settable. This is something I have been wanting for a long time. Node removal range can already be adjusted by tools, but the hand is the hand, so placing is pretty limited. Even a separate setting for digging speed wouldn't be a bad thing, but please don't stack them all into survival mode creative without a lot more thought than this.

@paramat
Copy link
Contributor

paramat commented Nov 9, 2017

Ezhh has asked we don't touch creative until next week when she can test it. So everyone be lazy for a few days.

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

Successfully merging this pull request may close these issues.

None yet