fnuecke / oc2

RISC-V VMs in Minecraft.
https://www.curseforge.com/minecraft/mc-mods/oc2
Other
619 stars 77 forks source link

Device Documentation, returnValueDescription #231

Open zccafa3 opened 2 years ago

zccafa3 commented 2 years ago

Describe the bug A Device Documentation does not behave as expected/intended. The string output of a Device's methods, returns the description, not the returnValueDescription, for the returnValueDexcription field.

To Reproduce Steps to reproduce the behavior: Identified on a singleplayer world, but likely both Identified with mircopython, but likely both/any (RPCDevice)

  1. On a computer (in this case with micropython), start a micropython shell. micropython
  2. Enter the following;
    
    import devices

d_bus = devices.bus()

d_tn = "redstone" d_id = [d["deviceId"] for d in d_bus.list() if d_tn in d["typeNames"]][0] d_methods = d_bus.methods(device_id=d_id)

doc = "" for index, char in enumerate(str(d_methods)): if index > 0 and index % 80 == 0: doc += "\n" doc += char print(doc)

3. Which returns the following;

[{'name': 'getRedstoneOutput', 'description': "Get the current redstone level tr ansmitted on the specified side. This will return the value last set via setReds toneOutput().\nSides may be specified by name or zero-based index. Please note t hat the side depends on the orientation of the device's container.", 'returnValu eDescription': "Get the current redstone level transmitted on the specified side . This will return the value last set via setRedstoneOutput().\nSides may be spe cified by name or zero-based index. Please note that the side depends on the ori entation of the device's container.", 'returnType': 'int', 'parameters': [{'type ': 'Side', 'name': 'side', 'description': 'the side to read the output level fro m.'}]}, {'name': 'getRedstoneInput', 'description': "Get the current redstone le vel recieved on the specified side. Note that if the current output level on the specified side is not zero, this will affect the measured level.\nSides may be specified by name or zero-based index. Please note that the side depends on the orientation of the device's container.", 'returnValueDescription': "Get the curr ent redstone level recieved on the specified side. Note that if the current outp ut level on the specified side is not zero, this will affect the measured level. \nSides may be specified by name or zero-based index. Please note that the side depends on the orientation of the device's container.", 'returnType': 'int', 'pa rameters': [{'type': 'Side', 'name': 'side', 'description': 'the side to read th e input level from.'}]}, {'description': "Set the new redstone level transmitted on the specified side.\nSides may be specified by name or zero-based index. Ple ase note that the side depends on the orientation of the device's container.", ' parameters': [{'type': 'Side', 'name': 'side', 'description': 'the side to write the output level to.'}, {'type': 'int', 'name': 'value', 'description': 'the ou tput level to set, will be clamped to [0, 15].'}], 'name': 'setRedstoneOutput', 'returnType': 'void'}]



**Log files**
N/A

**Expected behavior**
The `returnValueDescription`'s should be;
  - `"the current received level on the specified side."`
  - `"the current transmitted level on the specified side."`
for the Device methods `getRedstoneInput` and `getRedstoneOutput` respectively.

**Screenshots**
N/A

**Versions:**
 - Minecraft: 1.18.2
 - Forge: 40.1.0
 - OC2: 0.1.7
 - Sedna: 1.0.13
 - Markdown Manual: 1.2.1

**Additional context**
Other devices with `returnValueDescription` values which also experience this bug;
  - `d_tn = "file_import_export"`