- Changed how objects are added to HudGroups. The HudGroup's add proc can be used in one of three forms. Parameters written in square brackets are optional named parameters you can set.
- add(client/c) - adds a client to the list of players viewing the hud group. Returns 0 or 1.
- add(mob/m) - adds the mob's client to the list of viewers. Returns 0 or 1.
- add(x, y, ...) - creates a screen object at the specified location and returns the HudObject that was created. There are many named arguments you can also use to set properties of the new object: icon_state, text, layer, and value.
- Changed how objects are removed from HudGroups. The HudGroup's remove() proc can now be used in one of five forms. All return 1 or 0 to indicate success or failure:
- remove(client/c) - removes a client from the list of viewers
- remove(mob/m) - removes the mob's client from the list of viewers
- remove(HudObject/h) - removes the object from the group
- remove(index) - removes the object at the specified index in the group's "objects" list from the group.
- remove() - removes the last object in the group.
- Added the cut_word() proc to the Font object. The proc takes a string and a width (in pixels) and returns the part of the string that fits inside that width. For example, calling cut_word("testing", 16) might return "test", because that's all that can fit inside 16 pixels.
- Added the "border-demo" which shows how to create a border around the edge of the player's screen that can be updated as the player's screen size changes.
- Added the "party-demo", which shows how to create an on-screen indicator of where your allies are located.
There is now a new, single syntax for adding screen objects that have text or not. The first two parameters to the add() proc are the coordinates of the object, the remaining arguments are optional named arguments you can use to set additional properties. For example:
hud_group.add(32, 16, icon_state = "experience-meter")
The first line uses the icon_state parameter to set the object's icon_state. The object's icon is still inherited from the HudGroup object. The second line doesn't set an icon_state, but it does use the text argument to attach on-screen text to the object. It also sets the object's layer. You can do both of these same operations without using named arguments:
var/HudObject/h = hud_group.add(0, 0)
The named arguments provide a cleaner, more flexible syntax. I can add options without having to add a new proc. And because they are named, you don't have to remember their order and changes don't affect the order.
I also added two new demos: border-demo and party-demo. The border demo just creates a border around the player's screen using a HudGroup. The HudGroup can be resized to match the player's screen size. The party demo creates an on-screen indicator which shows you where party members are located. The indicator moves around the screen as you and your ally move, and always points in their direction.