Skip to content

server.services.ToggleButton.ToggleButton

Mahatma Kollu edited this page Oct 19, 2021 · 2 revisions

Class: ToggleButton

server/services/ToggleButton.ToggleButton

Hooks into ToolService's ToolAdded and ToolRemoved events and updates all of a player's tool to have updated buttons and fires a button event with informoration on the new buttons.

Implements

  • OnInit

Table of contents

Constructors

Methods

Constructors

constructor

new ToggleButton()

Methods

ConfigureToggleButtons

Private ConfigureToggleButtons(state, parent): void

Takes in a copy of a state from the tool store in toolservice and a parent which is the name of a player and re-configures all of the BUTTON_TOGGLE attributes of the player's tools.

Parameters

Name Type Description
state State a copy of a state from toolservice
parent string a string that will cause an error if it does not match up to a player's username in the game

Returns

void

Defined in

src/server/services/ToggleButton.ts:28


GetPlayerFromUserName

Private GetPlayerFromUserName(playerName): undefined | Player

Parameters

Name Type Description
playerName string a player's username

Returns

undefined | Player

a Player if it found a player from the username provided or undefined.

Defined in

src/server/services/ToggleButton.ts:82


getOrder

Private getOrder(tool): number

Gets a tool object and returns a number which indicates what priority in sorting tool buttons the tool should have (higher then number means the tool will be sorted closer to first)

Parameters

Name Type
tool ITool

Returns

number

Defined in

src/server/services/ToggleButton.ts:68


onInit

onInit(): void

Connects to the ToolAdded and ToolRemoved and calls ConfigureToggleButtons with the arguments from the connections.

Returns

void

Implementation of

OnInit.onInit

Defined in

src/server/services/ToggleButton.ts:16

Clone this wiki locally