Skip to main content

Multiplayer

Alliance flags

Alliance:Self = 0b0001
Alliance:Ally = 0b0010
Alliance:Enemy = 0b0100
Alliance:Neutral = 0b1000

Alliance flags represent the alliance status between two players. See Alliance for more information on what these flags mean.

Alliance:Friendly = 0b0011
Alliance:NotFriendly = 0b1100
Alliance:All = 0b1111
Alliance:None = 0b0000

These compound alliance flags make it convenience to filter for multiple alliance statuses. Alliance:Friendly is equivalent to Alliance:Self | Alliance:Ally, and Alliance:NotFriendly is equivalent to Alliance:Enemy | Alliance:Neutral. Alliance:All includes all forms of alliance and Alliance:None represents no alliances.

Alliance

Alliance(a, b) -> flags

Alliance can be used to determine the alliance status between two entities. It first looks up who owns the entity according to what its Owner property is set to, and then determines the alliance status of the two owners by looking at their Team properties.

It can return one of four flags:

  • Alliance:Self if the two entities owned by the same player
  • Alliance:Neutral if at least one of the entities is not on any team
  • Alliance:Ally if the two entities are on the same team
  • Alliance:Enemy if the two entities are on different teams

If any parameter is nullish, returns Alliance:Neutral.

ChatEnabledDropdown

ChatEnabledDropdown(width?=, [ui])

Creates a dropdown in the user interface that allows the current player to change whether or not they can see the chat controls when in-game.

  • width (Number): the width of the chat editor in em units.
  • ui (UI): the slot in the user interface to insert the dropdown element.

ChatEnabledIntent

ChatEnabledIntent(enabled) -> intent

Returns an intent to change whether chat is enabled or disabled. Attach the intent to a button Button to trigger it.

  • enabled (Boolean): Whether to enable or disable chat.

ChatEnabledToggle

ChatEnabledToggle([ui=]) |use ui:whenOn, use ui:whenOff| { }

Creates an element in the user interface that allows the player to toggle the chat panel on or off.

  • ui (UI): The slot in the user interface where the element will be inserted.

Subblock: The subblock will be called immediately to populate the element's content. The subblock is optional as there are defaults for both the on and off states. Use the %ui:whenOn { ... } syntax to populate one of the slots, see UI for more information.

  • ui:whenOn (UI): populate this slot with the content that should be displayed when the chat is enabled. If left empty, will display a default button that will toggle the chat to off.
  • ui:whenOff (UI): populate this slot with the content that should be displayed when the chat is disabled If left empty, will display a default button that will toggle the chat to on.

Owner

this.Owner -> player
this.Owner = player

Gets or sets the owner of an entity. The owner must be a player entity.

PerformanceDialogIntent

PerformanceDialogIntent(show) -> intent

Returns an intent to change whether performance dialog is shown or hidden. Attach the intent to a button Button to trigger it.

  • show (Boolean): Whether to show or hide the performance dialog.

PerformanceDialogToggle

PerformanceDialogToggle([ui=]) |use ui:whenShowing, use ui:whenHidden| { }

Creates an element in the user interface that allows the player to toggle the performance dialog on or off. This dialog allows the player to view and modify their input latency settings.

  • ui (UI): The slot in the user interface where the element will be inserted.

Subblock: The subblock will be called immediately to populate the element's content. The subblock is optional and is only needed if you want to override the default toggle button styling. Use the %ui:whenShowing { ... } syntax to populate one of the slots, see UI for more information.

  • ui:whenShowing (UI): populate this slot with the content that should be displayed when the performance dialog is showing. If left empty, will display a default button that will toggle the performance dialog to hidden.
  • ui:whenHidden (UI): populate this slot with the content that should be displayed when the performance dialog is hidden. If left empty, will display a default button that will toggle the performance dialog to showing.

Team

owner.Team -> team

Gets the team of the given owner player Entity.

If the player has not been assigned to a team, the player is considered to be on an individual team of one, and so this will return owner.

If the owner is nullish or not a player, returns undefined.

owner.Team = team

Sets the team for a given owner player Entity. You should Spawn an entity to represent each team in your game.

For backwards compatibility reasons it is possible to use any Keyable value as a team, but it is recommended that you use an Entity.

Throws an error if owner is an Entity but is not a player Entity.

Does nothing is owner is nullish.