ComputerCraft icon indicating copy to clipboard operation
ComputerCraft copied to clipboard

Track which player "owns" a turtle

Open SquidDev opened this issue 7 years ago • 6 comments

When a player places a turtle, they are marked as its owner. Any actions they perform (such as breaking blocks, moving, etc...) are performed using this player's game profile.

This allows turtles to work correctly with various permissions/claim mods. Previously you would have to whitelist all turtles in order for them to function within a claimed area.

See SquidDev-CC/CC-Tweaked#8 for the original issue & explanation. It's worth noting that the SwitchCraft server has been running a build of CC with this patch applied and it has solved all permissions issues. I'll updated the PR should any issues arise.

SquidDev avatar Feb 05 '18 11:02 SquidDev

I assume turtles which are placed by turtles inherit the placing turtle's ownership?

What happens if I place a turtle using another mod? I would assume the mod's fake player get's ownership. (I may be wrong, but can a mod place blocks without a fake player? What about that?)

Lupus590 avatar Feb 05 '18 11:02 Lupus590

I assume turtles which are placed by turtles inherit the placing turtle's ownership?

Yep. You can have turtles all the way down!

What happens if I place a turtle using another mod?

It depends. If other mods are doing things "correctly" and tracking a tile's owner, then it'll inherit the owner from there too. Otherwise it'll either use that mod's fake user* or CC's fallback fake user.

*By "fake user" I mean a fabricated GameProfile. We're still using a FakePlayer (or TurtlePlayer to be precise), it's just we're constructing it with the owner's GameProfile.

SquidDev avatar Feb 05 '18 11:02 SquidDev

Is there a way to check who owns a given turtle via Lua?

Selim042 avatar Feb 05 '18 14:02 Selim042

Is there a way to check who owns a given turtle via Lua?

No, though that could be exposed in a later PR or through an upgrade. I'm only interested in fixing permissions mods here - anything else will probably add too much controversy :).

SquidDev avatar Feb 05 '18 14:02 SquidDev

Alright. I assumed that is what you were going to say, just curious.

Selim042 avatar Feb 05 '18 14:02 Selim042

Can one of the admins verify this patch?

thatcraniumguy avatar May 23 '18 00:05 thatcraniumguy