OpenMods / OpenPeripheral

https://openmods.info
MIT License
67 stars 25 forks source link

New OpenP API Ideas #77

Closed theoriginalbit closed 10 years ago

theoriginalbit commented 10 years ago

Ability to specify optional arguments for methods.

This could allow for some more intuitive methods that can run off a default value to perform a common task, but can be changed by the developer. An example would be with getTankInfo where you have the ForgeDirection optional and when it is not supplied it becomes unknown, then if they supply an argument it MUST be valid and does not default to unknown, this would help with #76.

Ability to specify an argument should only be exposed for Turtles or Computers.

This would mean that if a Turtle looks at a TE it may see some different methods than if a Computer looks at the same TE. A basic example would be with EnderTanks. A refuel method could be exposed when a Turtle is reading it to allow it to refuel directly from the tank, but the Computer would not see the method.

Block/TileEntity BlackList

This would add the ability for mods to specify to OpenPeripheral any TE's they wish to be ignored and not perform integration for. Then when ComputerCraft asks if we wish to handle the TE of course we check the blacklist and make sure that it is not present. Obviously we would also need to create a list of TE's that cannot be added so that it doesn't break all the things, like the TileEntity or any of our own TE's

Removed

Ability to return multiple values.


Tell me what you think.

— BIT

SinZ163 commented 10 years ago

For the next release, this is a great idea.

My stargate control program is quite unstable due to the crashs that users can't handle.

theoriginalbit commented 10 years ago

Yeh definitely implied changes for the next release.

The new support that I added for SGCraft should make your program a little more stable with the ability for you to check isCompleteGate and isConnected... the only errors that will trip you up now will be if there is not enough fuel, and/or if you supply the wrong address. But I may address the latter (see what I did there ;P) one now. Added the extra method in 1a47b03de1069a4ec5a820c58cf173b0f7a94a2c

nevercast commented 10 years ago

claps slowly It's funny cause you said address twice but meant different things :P

On Thu, Oct 31, 2013 at 5:34 PM, Josh Asbury notifications@github.comwrote:

Yeh definitely implied changes for the next release.

The new support that I added for SGCraft should make your program a little more stable with the ability for you to check isCompleteGate and isConnected... the only errors that will trip you up now will be if there is not enough fuel, and/or if you supply the wrong address. But I may address the latter (see what I did there ;P) one now.

— Reply to this email directly or view it on GitHubhttps://github.com/OpenMods/OpenPeripheral/issues/77#issuecomment-27460667 .

mikeemoo commented 10 years ago

Multireturn exists.

Yes to the others for 1.7

theoriginalbit commented 10 years ago

How @mikeemoo?

mikeemoo commented 10 years ago

return new IMultiReturn() { @Override public Object[] getObjects() { return new Object[] { "hello", "world" }; } };

theoriginalbit commented 10 years ago

Ohhhh there it is! I missed that class every time. Ok I'll remove that from the op.

Actually, how does one specify that in the @LuaMethod annotations returnType?