Smart Helmets
Smart helmets allow for computers to directly interact with a player. In order to be able to use a smart helmet, right click a smart helmet on an antenna to link it to that antenna. Currently, all the smart helmet does is let you interact with the wearer's HUD
The smart helmet item's description (in the tooltip) will be the connected antenna's label. If no label has been set for the antenna, the description will instead be the UUID of the connected antenna.
Smart Helmet HUD functions
A smart helmet HUD works with a stack (or technically 'Deque') based system. Meaning that you create a list of instructions, which are then synced to the player and are run in a FIFO ("First In First Out") order. With the smart helmet, you can modify a player's hud as well as create custom GUIs!
Hud Functions:
Function | Returns | Description |
---|---|---|
getResolution() | number width, number height | Gets the screen resolution of the smart helmet wearer in question |
sendMessage(string message) | nil | Simplified function to easily allow for sending messages to a player's HUD |
drawString(string message, number x, number y[, number color[, boolean shadow]]) | nil | Draws a string to a player's HUD |
drawTexture(string texture, number x, number y[, number width[, number height[, number u[, number v]]]]) | nil | Draws a rectangle with the passed texture (can be an item/block id or direct resource location) |
drawRectangle(number x1, number y1, number x2, number y2, number color[, number toColor]) | nil | Draws a solid colored rectangle, if passed two colors, it will draw the rectangle with a gradient |
drawHorizontalLine(number x1, number y, number x2, number color) | nil | Draws a horizontal line |
drawVerticalLine(number x1, number y1, number y2, number color) | nil | Draws a vertical line |
sync() | nil | Overwrites the player's render stack with the current one Note: Clears the current stack |
clear() | nil | Clears the player's render stack Note: Clears the current stack |
add() | nil | Adds to the current render stack to the player's one Note: Clears the current stack |
getColorFromRGB(number red, number green, number blue[, number alpha]) | number colorValue | Computes a color value from the given rgb (and a) values |
getGUI() | object guiObject | Returns a gui object for this hud, similar to the getHUD() function of the antenna |
Gui Functions
Function | Returns | Description |
---|---|---|
getResolution() | number width, number height | Gets the screen resolution of the smart helmet wearer in question |
sendMessage(string message) | nil | Simplified function to easily allow for sending messages to a player's HUD |
drawString(string message, number x, number y[, number color[, boolean shadow]]) | nil | Draws a string to a player's HUD |
drawTexture(string texture, number x, number y[, number width[, number height[, number u[, number v]]]]) | nil | Draws a rectangle with the passed texture (can be an item/block id or direct resource location) |
drawRectangle(number x1, number y1, number x2, number y2, number color[, number toColor]) | nil | Draws a solid colored rectangle, if passed two colors, it will draw the rectangle with a gradient |
drawHorizontalLine(number x1, number y, number x2, number color) | nil | Draws a horizontal line |
drawVerticalLine(number x1, number y1, number y2, number color) | nil | Draws a vertical line |
sync() | nil | Overwrites the player's render stack with the current one Note: Clears the current stack |
clear() | nil | Clears the player's render stack Note: Clears the current stack |
add() | nil | Adds to the current render stack to the player's one Note: Clears the current stack |
getColorFromRGB(number red, number green, number blue[, number alpha]) | number colorValue | Computes a color value from the given rgb (and a) values |
open() | nil | Opens the custom gui |
close() | nil | Closes the custom gui |
drawBackground([boolean defaultBackground]) | nil | Draws a background for the gui, dirt background if true and a simple black, transparent background if false |
addButton(number x1, number y1, number x2, number y2, number id, string label) | nil | Creates a button for the gui |
addTextField(number x1, number y1, number x2, number y2, number id[, string defaultEntry]) | nil | Adds a user-modifiable text field for the gui |
General Smart Helmet Events
Event | Parameter 1 | Parameter 2 | Parameter 3 | Parameter 4 | Description |
---|---|---|---|---|---|
mouseInput | "mouseInput" | string player | number mouseButton | boolean buttonState | This is called when a player wearing a smart helmet clicks their mouse |
keyInput | "keyInput" | string player | number keyNumber | boolean keyState | This is called when a player wearing a smart helmet types on their keyboard |
Custom Gui-Specific Smart Helmet Events
Event | Parameter 1 | Parameter 2 | Parameter 3 | Parameter 4 | Description |
---|---|---|---|---|---|
buttonClicked | "buttonClicked" | string player | number buttonId | This is called when a player in a custom gui clicks on a button | |
textboxEntry | "textboxEntry" | string player | number textFieldId | string textFieldContents | This is called when a player in a custom gui enters text to a textField |