liamcottle / rustplus.js

Unofficial NodeJS library for controlling Smart Switches in the PC game Rust
224 stars 46 forks source link

Added name to map markers #56

Open Grimbyy opened 1 year ago

Grimbyy commented 1 year ago

Adds name to Note struct

New rust update allows you to have up to 5 labels now, with colors, symbols and names.

image

s8wa2 commented 4 months ago

Looks like there may be some confusion.

Map markers (notes) are not returned in AppMap (from getMap request), but rather AppTeamInfo.Note (from getTeamInfo). You added it to the wrong message struct.

I took a look at both aux01 and current server code. Monument type has not changed. However note now has the following properties:

public int type;
public float x;
public float y;
public int icon;
public int colourIndex;
public string label;

I would recommend adding these fields to AppTeamInfo.Note

message Note {
    required int32 type = 2;
    required float x = 3;
    required float y = 4;
+   required int32 icon = 5;
+   required int32 colourIndex = 6;
+   optional string label = 7;
}

And removing this from AppMap.Monument

message Monument {
    required string token = 1;
    required float x = 2;
    required float y = 3;
-   required float name = 7;
}

Great work getting the right field number for label 7 from 58 >> 3

The reason it's optional is because it only writes if string is not null.

if (instance.label != null)
        {
          stream.WriteByte((byte) 58);
          ProtocolParser.WriteString(stream, instance.label);
        }

Compare that to a required string like member.name:

if (instance.name == null)
          throw new ArgumentNullException("name", "Required by proto specification.");

At least from my understanding. Not 100% certain on how liam made the original proto schema.

jamezrin commented 4 months ago

Map markers (notes) are not returned in AppMap (from getMap request), but rather AppTeamInfo.Note (from getInfo). You added it to the wrong message struct.

Notes are actually returned from the getTeamInfo request. The getInfo request returns info about the server

s8wa2 commented 4 months ago

Thanks! Updated original comment