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

Collection of RPC device documentation changes #243

Open
wants to merge 3 commits into
base: 1.18-forge
Choose a base branch
from

Conversation

zccafa3
Copy link
Contributor

@zccafa3 zccafa3 commented Sep 24, 2022

Disclaimer: I have no experience with java, nor have these changes been built and tested locally. So please validate them on your side (I'd be happy to do this myself, but don't know how).

Commits:

  • Added parameter names to RPC device handlers where missing, Deleted missing parameter name handling in scripts/lib/*/devices.*

I believe I have checked the documentation for all of the RPC devices.
Here is the list of (all?) the RPC device typeNames that I have checked; "robot", "inventory_operations", "block_operations", "redstone", "item_handler", "oc2:computer", "energy_storage", "file_import_export", "sound"
The "item_handler" device is the only one without named parameters. This commit provides the parameter names and thus negates the requirement for handling un-named parameters in scripts/lib/*/devices.*.
This script will print the documentation for an available device's methods (split at the 80th character):

d_tn = "item_handler"

for line in str(d_bus.find(type_name=d_tn)).split("\n"):
    doc = ""
    for index, char in enumerate(line):
        if index > 0 and index % 80 == 0:
            doc += "\n"
        doc += char
    print(doc)

Output:

getItemSlotCount(): int
getItemStackInSlot(arg0: int): ItemStack
getItemSlotLimit(arg0: int): int
...
  • Attempted to provide device documentation for BlockOperationsModuleDevice

I have attempted to provide getDeviceDocumentation for BlockOperationsModuleDevice.java following the format of RedstoneInterfaceCardItemDevice.java with the documentation in block_operations_module.md.
I would be happy to do the same for all of the remaining devices without getDeviceDocumentation. Please let me know if you would like me to do this, and of course, any and all feedback is appreciated.
Given my disclaimer above there's a decent chance I've not done this right. Also, I had to take a guess at the prefferred max line-width.

Copy link

@CoolCat467 CoolCat467 left a comment

Choose a reason for hiding this comment

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

Shouldn't getDeviceDocumentation return things based on current language localization instead of always English?

@zccafa3
Copy link
Contributor Author

zccafa3 commented Sep 26, 2022

Hi @CoolCat467, thanks for your response. Ultimately I think that is a question for @fnuecke to answer with how he would like to skin that cat (sorry! 😅).
But it is normal for documentation to be written in English by default, and other languages are potentially supported. There are exceptions ofc like if the application is indended to only be used in the native language in which it is written.
I assume that the purpose of the src/main/resources/assests/oc2/doc/* md documents is to provide additional language support for the APIs outside of the deployed code (as currently the ability to support has not been implemented within it).
Perhaps the final intention is for documentation to only reside outside of the deployed code, to avoid dual maintenance. However, currently device method documentation is supported for some but not all devices (see RedstoneInterfaceCardItemDevice.java for an example of where this has been implemented).

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

Successfully merging this pull request may close these issues.

2 participants