-
Notifications
You must be signed in to change notification settings - Fork 5
Controllers
Once Quartz is installed as a mod in the 7 Days to Die mod folder, you can start using the new controllers in your mod. Do make sure that if you do use Quartz in your mod, that you point your users to the Quartz Nexus Mod page to download Quartz.
-
Quartz.Spinnerspins the widget that it is attached to -
Quartz.DialIndicatormakes the widget that it is attached to act like a dial indicator, useful to make a speedometer or fuel tank gauge -
Quartz.ContainerStandardControlsan updatedContainerStandardControlscontroller that includes proper interaction with inventory based controllers with individually locked slots. -
Quartz.ItemStackan updatedItemStackcontroller that includes some additional bindings and features -
Quartz.Backpackan updatedBackpackcontroller that includes new features like search -
Quartz.LootContaineran updatedLootContainercontroller that includes new features like search -
Quartz.VehicleContaineran updatedVehicleContainercontroller that includes new features like search -
Quartz.ItemInfoWindowan updatedItemInfoWindowcontroller that includes new bindings and allows more than 7 item stats to be displayed -
Quartz.MapInvitesListEntryan updatedMapInvitesListEntrycontroller that includes new bindings -
Quartz.MapWaypointListEntryan updatedMapWaypointListEntrycontroller that includes new bindings -
Quartz.RandomTextureallows textures to be randomly selected to be displayed when the window holding the element with the controller is opened -
Quartz.RandomTextallows text to be randomly selected to be displayed when the window holding the element with the controller is opened -
Quartz.RandomVideoallows a video to be randomly selected to be played when the window holding the element with the controller is opened, requires being paired up with the Quartz.VideoPlayer widget. -
Quartz.WorkstationFuelGridan updatedWorkstationFuelGridcontroller that allows restricting fuel slots in a workbench to only accept 1 type of item per slot in the grid. -
Quartz.WorkstationToolGridan updatedWorkstationToolGridcontroller that changes how required tools are defined, so they are now defined on the workstation in the blocks.xml instead of through an attribute on the controller, eliminating the need for unique windows for each workstation if they have tools.
In the widget that will use the controller, add the following line
<Widget
...
controller="Quartz.{Name of the controller}, Quartz"
...
/>For example, to use Quartz.Spinner, the xml will look like the following
<Widget
...
controller="Quartz.Spinner, Quartz"
...
/>Some controllers have additional attributes that is added to the widget that has the controller attached
The Spinner being used in SMXhud to show the player having an available skill
point
The controller is added to the widget that is to be spun by the controller
<Widget
...
controller="Quartz.Spinner, Quartz"
spin="true|false" - True if the Spinner should be actively spinning
angle_per_second="float" - The how fast of an angle in degrees the widget should
spin per second. A positive number spins the widget in a counter clockwise
direction, while a negative number spins the widget in a clockwise direction
...
/>
The Dial Indicator being used in SMXui as a fuel gauge in the vehicle screen
The controller is added to the widget that is to be moved by the controller. The controller will handle the animation and calculating where the indicator should be based on its current value and min and max range and their angles.
<Widget
...
controller="Quartz.DialIndicator, Quartz"
indicator_value="float" - The current value of the indicator
start_angle="float" - The angle in degrees of the dial for when the indicator value is equal to the range_min
end_angle="float" - The angle in degrees of the dial for when the indicator value is equal to the range_max
range_min="float" - The minimum value represented by the indicator
range_max="float" - The maximum value represented by the indicator
limit_indicator_to_range="true|false" - if the indicator is to be bound to the min and max range values. If true
the indicator will not move beyond the start and end angle if the indicator value is outside those ranges
animation_duration="float" - An estimate of how long the animation should take from changing from a previous value to
a new value. If the indicator value has changed during the animation, the animation time will reset with the
animation starting from the position it was in before the new indicator value.
...
/>Notes:
- The angles here are using Unity's rotation system.
- To have the indicator to go from right to left, add negatives to the range values and the indicator value
This controller is an extension of the vanilla ContainerStandardControls controller. Some of the features of the Quartz.ContainerStandardControls
requires the use of the Quartz.Backpack, Quartz.LootContainer, or Quartz.VehicleContainer controllers and the Quartz.ItemStack controllers. The Quartz.Backpack, Quartz.LootContainer, or Quartz.VehicleContainer controllers have to be
The Quartz.ContainerStandardControls controller features when used in conjuction of the controllers mentioned above, are as followed:
- Allowing the locking and unlocking of individual slots by either holding a key binding (default
left alt) while clicking an idividual slot or, clicking on a button that enables or disables the locking or unlocking of individual slots when clicking on the slot. When the button is enabled, it allows the user to lock or unlock the individual slot when clicking on the slot.
<Widget
...
controller="Quartz.ContainerStandardControls, Quartz"
...
/>The widget with the Quartz.ContainerStandardControls controller requires a child <button> widget, to enable or disable the locking or unlocking of individual slots when the button is pressed. The <button> widget must have the name btnIndividualLock for this to work. See below for an example of this.
<Widget
...
controller="Quartz.ContainerStandardControls, Quartz"
...>
<button
name="btnIndividualLock"
...
/>
</Widget>| XML Binding | Description |
|---|---|
{totallockedslotscount} |
How many inventory slots are currently being locked. |
{combolockedslots} |
How many inventory slots are locked using the ComboBoxInt
|
{individuallockedslotscount} |
How many inventory slots are locked using the individual locking system |
{unlockedslotscount} |
How many unlocked slots are in the inventory |
This controller is an extension of the vanilla ItemStack controller. Some of the features of the Quartz.ItemStack
requires the use of the Quartz.Backpack, Quartz.LootContainer, or Quartz.VehicleContainer controllers. Those controllers
need to be attached as a controller to a parent widget of the widget containing the Quartz.ItemStack controller.
The Quartz.ItemStack controller features when used in conjuction of the controllers mentioned above, are as followed:
- Showing if the
ItemStackis locked when using the inventory locking system in 7 Days to Die - Showing if the
ItemStackis found or not in a search result.
<Widget
...
controller="Quartz.ItemStack, Quartz"
lockedslot_color="color" - The color of that is returned to the {selectionbordercolor} binding if the slot is
locked
search_color="color" - The color of that is returned to the {selectionbordercolor} binding if the slot contains
an item that matches the search
nomatch_iconcolor="color" - The color that is returned to the {iconcolor} binding if the slot contains an item
that does not match the search. Also is used to tint the {durabilitycolor} of the item if in the slot has a
durabilitycolor
...
/>All those new attributes do not need to be set and only show up if they are set for that controller. The priority of the color being returned in the {selectionbordercolor} binding is as followed
select_color > highlight_color > holding_color > search_color > lockedslot_color > background_color
So if the item is in a locked slot and the player selects the slot, the select_color color will be returned from the {selectionbordercolor} instead of the lockedslot_color color.
| XML Binding | Description |
|---|---|
{isempty} |
Is the slot empty |
{isalockedslot} |
Is the ItemStack a locked slot |
{issearchactive} |
Is there an active search going on by the player |
{matchessearch} |
Does the item in this slot matches the search by the player |
{itemql} |
The item's quality level. Returns "" if the item does not have durability |
{stackcount} |
How how many items are in the stack. Returns "" if the item has durability |
Quartz.Backpack being used in SMXui to show players which slots are
locked and what items match their search in their inventory
This controller is an extension of the vanilla Backpack controller. Both the Search and Slot locking features require
the child ItemStack controllers to be replaced with Quartz.ItemStack. The locking of individual slots requires both the Quartz.ItemStack controllers and the ContainerStandardControls controller in the same window to be replaced Quartz.ContainerStandardControls
<Widget
...
controller="Quartz.Backpack, Quartz"
...
>
Quartz.Backpack being used in SMXui to show players which slots
and their items, match their search in their inventory
7 Days to Die has a inventory locking feature that is disabled in the vanilla UI. To enable the inventory locking,
a combobox with the ComboBoxInt controller has to be within the same window. The Quartz.Backpack controller will
use the first found widget with a ComboBoxInt controller attached to it, that is a child of ContainerStandardControls or Quartz.ContainerStandardControls.
If the Quartz.Backpack, Quartz. ItemStack and Quartz.ContainerStandardControls are used together, it allows the player
to decide which slots in the Backpack can be locked or unlocked. This can be done by the user, by holding down left Alt
while clicking on a slot. If the slot is already locked, it will be unlocked if the slot is not locked by the ComboBoxInt controller.
This key binding can be changed if the player has the Gears Mod Manager installed.
Quartz.Backpack being used in SMXui to show players which slots are
locked
To enable the inventory search, a widget with the TextInput controller has to be within the same window. It is possible to
use the vanilla textfield controls as the widget with the TextInput controller. The Quartz.Backpack controller will
use the first found widget with a TextInput controller attached to it.
This controller is an extension of the vanilla LootContainer controller. Both the Search and Slot locking features require the child ItemStack controllers to be Quartz.ItemStack. The locking of individual slots requires both the Quartz.ItemStack controllers and the ContainerStandardControls controller in the same window to be replaced Quartz.ContainerStandardControls.
The usage is the same as the Quartz.Backpack
<Widget
...
controller="Quartz.LootContainer, Quartz"
...
>7 Days to Die has a inventory locking feature that is disabled in the vanilla UI. To enable the inventory locking,
a combobox with the ComboBoxInt controller has to be within the same window. The Quartz.Backpack controller will
use the first found widget with a ComboBoxInt controller attached to it, that is a child of ContainerStandardControls or Quartz.ContainerStandardControls.
The locked slots are saved per Loot Container. If the players are on a server, if two different players open up the same secure loot container with locked slots, they will see the same locked slots.
If the Quartz.LootContainer, Quartz. ItemStack and Quartz.ContainerStandardControls controllers are used together, it allows the player
to decide which slots in the LootContainer can be locked or unlocked. This can be done by the user, by holding down left Alt
while clicking on a slot. If the slot is already locked, it will be unlocked if the slot is not locked by the ComboBoxInt controller.
This key binding can be changed if the player has the Gears Mod Manager installed.
Note: Due to a limitation of the game and keeping Quartz to be only required on the client, the saved locked slots are only usable on secure loot containers, like player placed chests. As soon as they become unsecured, the locked slots are wiped from the loot container. As well as the ComboBoxInt will be disabled. Also clearing or adding a password on a secure loot container will clear the locked slots.
This controller is an extension of the vanilla VehicleContainer controller. Both the Search and Slot locking features require the child ItemStack controllers to be Quartz.ItemStack. The locking of individual slots requires both the Quartz.ItemStack controllers and the ContainerStandardControls controller in the same window to be replaced Quartz.ContainerStandardControls.
The usage is the same as the Quartz.Backpack
<Widget
...
controller="Quartz.VehicleContainer, Quartz"
...
>7 Days to Die has a inventory locking feature that is disabled in the vanilla UI. To enable the inventory locking,
a combobox with the ComboBoxInt controller has to be within the same window. The Quartz.Backpack controller will
use the first found widget with a ComboBoxInt controller attached to it, that is a child of ContainerStandardControls or Quartz.ContainerStandardControls.
The locked slots are saved per vehicle. If the players are on a server, if two different players open up the same vehicle with locked slots, they will see the same locked slots.
If the Quartz.VehicleContainer, Quartz. ItemStack and Quartz.ContainerStandardControls controllers are used together, it allows the player
to decide which slots in the VehicleContainer can be locked or unlocked. This can be done by the user, by holding down left Alt
while clicking on a slot. If the slot is already locked, it will be unlocked if the slot is not locked by the ComboBoxInt controller.
This key binding can be changed if the player has the Gears Mod Manager installed.
Note: Due to a limitation of the game and keeping Quartz to be only required on the client, the existing saved locked slots for a vehicle will be cleared if a player clears or adds a password on that vehicle.
This controller is an extension of the vanilla ItemInfoWindow controller. It has some new bindings for each display_entry from a item_display_info entry in the ui_display.xml. This controller also allows showing of an icon based on a stat's display_entry in the ui_display.xml.
<Widget
...
controller="Quartz.ItemInfoWindow, Quartz"
...
><item_display_info>
...
<display_entry
...
icon="icon name"
...
/>
...
</item_display_info>| XML Binding | Description |
|---|---|
{itemstattitle-#} |
The title for the stat entry |
{itemstaticon-#} |
The icon for the stat entry as set in the icon attribute in the display_entry
|
{itemstatmain-#} |
The main stat number by itself, it does not include the compared value when the window is comparing two items |
{itemstatcompare-#} |
The compared stat number by itself, when the window is comparing two items. Returns "" when not comparing two items |
{itemstatincrease-#} |
Returns true if the compared stat is better than the currently viewed item's stat. |
{itemstat-#} |
The main stat number with the compared stat number in () if comparing two items. The compared stat number will be either green or red is the compared stat is better or worse than the currently view item's stat. |
Note: The # in the bindings is the index of the display_entry in the item_display_info. For example, if the binding {itemstattitle-1} is used, it will return the title for the first display_entry in the item_display_info.
This controller is an extension of the vanilla MapInvitesListEntry controller.
<Widget
...
controller="Quartz.MapInvitesListEntry, Quartz"
...
>| XML Binding | Description |
|---|---|
{isempty} |
Is the entry empty |
This controller is an extension of the vanilla MapWaypointListEntry controller.
<Widget
...
controller="Quartz.MapWaypointListEntry, Quartz"
...
>| XML Binding | Description |
|---|---|
{isempty} |
Is the entry empty |
<Widget
...
controller="Quartz.RandomTexture, Quartz"
textures="string" - The list of textures is used to pick which texture to return in the {randomtexture} binding.
Each new texture must be seperated by a `,`.
...
>The controller can be placed in the <texture> element or any parent elements. And example of the string value in the
textures attribute is as followed
@modfolder:Textures/test1.png,@modfolder:Textures/test2.png,Textures/UI/background
In the <texture> element, in the texture attribute, add the {randomtexture} binding, for example:
<texture
...
texture="{randomtexture}"
...
>| XML Binding | Description |
|---|---|
{randomtexture} |
The binding to fetch the random texture when the window is opened |
This controller allows replacing of a text in a label element randomly each time the window containing
the <label> element is opened. For example, this can be used to replace the text
every time the main menu is opened up.
<Widget
...
controller="Quartz.RandomText, Quartz"
texts="string" - The list of strings is used to pick which string to return in the {randomtext} binding.
Each new text must be seperated by a `,`. If the text is a Localization key, the text in the
Localization file belonging to that key will be returned instead.
...
>The controller can be placed in the <label> element or any parent elements. And example of the string value in the
texts attribute is as followed
"RandomText1,RandomText2,RandomText3"
In the <text> element, in the text attribute, add the {randomtext} binding, for example:
<label
...
text="{randomtext}"
...
>| XML Binding | Description |
|---|---|
{randomtext} |
The binding to fetch the random text when the window is opened |
This controller allows replacing of a video in a videoplayer element randomly each time the window containing
the <videplayer> element is opened. For example, this can be used to replace a background video
every time the main menu is opened up.
<Widget
...
controller="Quartz.RandomVideo, Quartz"
videos="string" - The list of video paths is used to pick which video path to return in the {randomvideo} binding.
Each new video path must be seperated by a `,`.
...
>The controller can be placed in the <videoplayer> element or any parent elements. And example of the string value in the
videos attribute is as followed
"@modfolder:Videos/test1.mp4,@modfolder:Videos/test2.mp4,Textures/UI/background"
In the <videoplayer> element, in the text attribute, add the {randomvideo} binding, for example:
<videoplayer
...
video="{randomvideo}"
...
>| XML Binding | Description |
|---|---|
{randomvideo} |
The binding to fetch the random video when the window is opened |
This controller allows replaces the vanilla WorkstationFuelGrid controller. This controller allows limiting a fuel slot in a workstation's
fuel grid to only accept a certain item type. For example, this can be used to set all the fuel slots to only accept wood. One limitation is
that the item must be a valid fuel type.
Required Fuels are defined in the blocks.xml file for each workstation. If a workstation doesn't have any required fuels defined, the slots will act like normal fuel slots, accepting any fuel item.
Defining the workstation's required fuel is done by adding a property to the Workstation properties of a workstation in the blocks.xml
blocks.xml
<block name="workstation_name">
<property class="Workstation">
...
<property name="RequiredFuels"
value="string,string,string,..." - The item name for the tool, with `,` separating each fuel and slot. There can only be
1 required fuel per slot.
/>
...
</property>
...
</block>The Controller the top most child classes to be using the RequiredItemStack controller, instead of using the ItemStack controller
like vanilla does.
windows.xml
<grid
...
controller="Quartz.WorkstationFuelGrid, Quartz"
...
>
<widget
...
controller="RequiredItemStack"
...
>
</grid>With this, only 1 WorkstationFuelGrid window is required.
This controller allows replaces the vanilla WorkstationToolGrid controller. The usage of this controller allows only needing
1 window for a Workstation's Tool Grid. Normally with vanilla, each workstation that has a tool grid, the windowgroup for that workstation
would require its own unique tool grid window. This is done by changing how the required tools are defined for a workstation.
Required tools are now defined in the blocks.xml file for each workstation. If the required tools are not defined for a given workstation, the slots will not restrict what items can go in the slot. Quartz currently adds the vanilla workstation's required tools property, so no additional work is required. But if adding a new workstation or want to change the required tools, the blocks.xml file will need to be modified.
Defining the workstation's required tools is done by adding a property to the Workstation properties of a workstation in the blocks.xml
blocks.xml
<block name="workstation_name">
<property class="Workstation">
...
<property name="RequiredTools"
value="string,string,string,..." - The item name for the tool, with `,` separating each tool and slot. There can only be
1 required tool per slot.
/>
...
</property>
...
</block>The Controller the top most child classes to be using the RequiredItemStack controller.
windows.xml
<grid
...
controller="Quartz.WorkstationToolGrid, Quartz"
...
>
<widget
...
controller="RequiredItemStack"
...
>
</grid>The window that the WorkstationToolGrid is in can now replace the existing vanilla windows that were used for any Workstation Tool Grids.