This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
vico's profile picture

The new turtle permission API...

Started by vico, 14 July 2015 - 03:50 AM
vico #1
Posted 14 July 2015 - 05:50 AM
Hi all!

According to CC changelog, a permission API for turtles was implemented.

But i can't find any example or documentation here or in wiki. Only thing pops out in my search was a 2013 topic (another question related).

So, what exactly is this API, and how we can use it? It in-game (in internal LUA api) or is "off-game"? Its like player/fake player permission (like bukkit/cauldron), or is a internal permission to determine what function/resource/tool/etc the turtle is able to do (like adventure mode)?

Last question: If this permission API is similar (in goal) to bukkit API, then is possible (in theory) to a developer create a bridge to (K)Cauldron permission system? If yes, what he need to do for publish this (license, credits, place to upload, whatever)?

Thank so much in advance, and sorry i sound dumb. English isn't my mother language.
HPWebcamAble #2
Posted 14 July 2015 - 06:20 AM
It's a mod API, other forge mods can use it to tell turtles what blocks they are allowed to break


I'm not sure if Bukkit can hook into it, I doubt it, but if you know Java well, it wouldn't be too difficult to do.
InDieTasten #3
Posted 14 July 2015 - 06:22 AM
As for the possibility of a bridge:

The changelog mentions mod authors, so I'm farily sure this accords to off-game(the java backend).

Whether it is possible to create a bridge I can't say. It would work, if the API allows to set the owner-uuid to a turtle, that is saved to the turtle directly, instead of the block where it currently sits.

This way a turtle can be owned by a player, and inherit it's rights, so when the turtles tries to break a block, the block will break in the name of the player who owns it. Theres just the problem, that you would limit access to turtles, as this does only make sense, if only the owner is able to access the interface. And removing the ownership is hard to do.
Edited on 14 July 2015 - 04:25 AM
Bomb Bloke #4
Posted 14 July 2015 - 07:07 AM
In the ComputerCraft mod archive file, there's an "api" folder, and a "docs" folder within that. I haven't checked to see if it has the info you're after, but that'd be a good place to start looking.
SquidDev #5
Posted 14 July 2015 - 08:05 AM
There is an interface that you implement: dan200.computercraft.api.permissions.ITurtlePermissionProvider. This provides two methods that check if a turtle can enter and edit a block. You can then register this with ComputerCraftAPI.registerPermissionProvider. I have no idea how Cauldron works so I can't say how integration between the Forge and Cauldron spheres would work.
Edited on 14 July 2015 - 06:05 AM