ComputerCraft
ComputerCraft copied to clipboard
Track which player "owns" a turtle
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.
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?)
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
.
Is there a way to check who owns a given turtle via Lua?
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 :).
Alright. I assumed that is what you were going to say, just curious.
Can one of the admins verify this patch?