Creating UIs for Mods
Template:ModdingOutdated With 8.0 (and currently in Master) you will have the ability to define new components with UI for them directly on the server. For reference, check out the TollComponent in the mods folder, this is a component that is entirely made on the server, and has UI that the user can use from the client.
This is accomplished using tags applied to members in the component. Options at time of this writing are:
- AutogenAttribute. Tells the client that UIs should be created for this member.
- OwnerEditableAttribute. This parameter will be editable by the owner of the object.
- OwnerHiddenAttribute. Hidden to the owner
- GuestEditableAttribute. Editable by guests
- GuestHiddenAttribute. Hidden to guests.
- NegativeAllowedAttribute. If the parameter is a number, this will allow negatives to be specified.
- RangeAttribute. Determines the range of allowed values for number parameters.
- ActiveContractOnlyAttribute. For new contract clauses, makes the parameter only visible if its an active contract.
- AutoRPC. Allows the parameter to be changed by the client at all.
And for classes:
- AutogenClass. Dictates that the class will have generated UI
- AutogenName. Dictates a friendly name for displaying the class name on the client.
Note that RPC functions (like PayToll on the TollComponent) can also have AutoGenned UI, and a button will be created for them.
Only certain parameter types are supported to have generated UI. They are: - Float - Currency - Range (specify a min/max int) - Void (for RPCs that return void, creates a button)
More will be added over time, especially for choosing other objects/players. Pages related to Modding.