Skip to content

server.components.Tool.Tool

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

Class: Tool<A, I>

server/components/Tool.Tool

Type parameters

Name Type
A extends ToolAttributes
I extends ToolInstance

Hierarchy

  • BaseComponent<A, I>

    Tool

    ↳↳ Essential

Implements

  • OnStart

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Tool<A, I>()

Type parameters

Name Type
A extends ToolAttributes
I extends ToolInstance<I>

Inherited from

BaseComponent<A, I>.constructor

Properties

Actions

Abstract Actions: Actions

Defined in

src/server/components/Tool.ts:54


ButtonedInputInfo

Private Optional ButtonedInputInfo: InputInfo

Defined in

src/server/components/Tool.ts:60


InputInfo

Abstract InputInfo: InputInfo

Defined in

src/server/components/Tool.ts:55


Player

Optional Player: Player

Defined in

src/server/components/Tool.ts:64


attributes

attributes: A

Attributes attached to this instance.

Inherited from

BaseComponent.attributes

Defined in

node_modules/@flamework/components/out/index.d.ts:20


id

id: string

Defined in

src/server/components/Tool.ts:61


instance

instance: I

The instance this component is attached to. This should only be called in a component lifecycle event.

Inherited from

BaseComponent.instance

Defined in

node_modules/@flamework/components/out/index.d.ts:25


janitor

Protected janitor: Janitor<void>

Defined in

src/server/components/Tool.ts:59


maid

maid: Maid

A maid that will be destroyed when the component is.

Inherited from

BaseComponent.maid

Defined in

node_modules/@flamework/components/out/index.d.ts:16


state

state: string = "nil"

Defined in

src/server/components/Tool.ts:62


stateChanged

stateChanged: Signal<fn, false>

Defined in

src/server/components/Tool.ts:65


timeCreated

timeCreated: number

Defined in

src/server/components/Tool.ts:63

Methods

AddAction

Private AddAction(Action): void

Parameters

Name Type
Action Action

Returns

void

Defined in

src/server/components/Tool.ts:168


GetActionInfo

Private GetActionInfo(toolState, input): undefined | ActionInfo

Parameters

Name Type
toolState string
input Object
input.Input string
input.State string

Returns

undefined | ActionInfo

Defined in

src/server/components/Tool.ts:172


Init

Optional Abstract Init(): void

Returns

void

Defined in

src/server/components/Tool.ts:56


InitPlayer

Private InitPlayer(): void

Returns

void

Defined in

src/server/components/Tool.ts:130


InitWorkspace

Private InitWorkspace(): void

Returns

void

Defined in

src/server/components/Tool.ts:140


Input

Private Input(state, input): void

Parameters

Name Type
state string
input Object
input.Input string
input.State string

Returns

void

Defined in

src/server/components/Tool.ts:154


ManageAncestry

Private ManageAncestry(): void

Returns

void

Defined in

src/server/components/Tool.ts:103


ManageButtons

Private ManageButtons(): void

Returns

void

Defined in

src/server/components/Tool.ts:92


PlayerInit

Optional Abstract PlayerInit(): void

Returns

void

Defined in

src/server/components/Tool.ts:57


RequirePlayer

Private RequirePlayer(): Player

Returns

Player

Defined in

src/server/components/Tool.ts:122


SetupInput

Private SetupInput(): RBXScriptConnection

Returns

RBXScriptConnection

Defined in

src/server/components/Tool.ts:144


UpdateAncestry

Private UpdateAncestry(): void

Returns

void

Defined in

src/server/components/Tool.ts:108


UpdateButtons

Private UpdateButtons(): void

updates the ButtonedInputInfo to be accurate to newly assigned buttons

Returns

void

Defined in

src/server/components/Tool.ts:189


destroy

destroy(): void

Destroys this component instance.

Returns

void

Inherited from

BaseComponent.destroy

Defined in

node_modules/@flamework/components/out/index.d.ts:39


fillButtonsInTable

Private fillButtonsInTable<T>(Table): T

Takes in a table and loops through its indexes and values. Ensures that all of it's indexes if buttons are set to their actual attribute value and if any of it's values are tables that their indexes are also checked and made sure that any buttons in their indexes are set to their actual attribute values aswell.

example

const Table: InputInfo = {
		Holstered: {
			Begin: {
				BUTTON_TOGGLE: {
					Action = "Equip"
				}
			}
		}
}

const ButtonedInputInfo = fillButtonsInTable(Table) where this.attributes = { BUTTON_TOGGLE: "One" } // "One" being representative of the 1 key on the keyboard

// what ButtonedInputInfo is equal to:
// notice the purpose is to remove all BUTTON_ and replace them with their actual value
{
		Holstered: {
			Begin: {
				One: {
					Action = "Equip"
				}
			}
		}
	}

Type parameters

Name Type
T extends Object

Parameters

Name Type Description
Table T a table which has a string index

Returns

T

A Table who's indexes if buttons were replaced by their actual value

Defined in

src/server/components/Tool.ts:228


getState

getState(): string

Returns

string

Defined in

src/server/components/Tool.ts:67


isButton

Private isButton(str): boolean

returns if the string is an identifier for a button

Parameters

Name Type
str string

Returns

boolean

Defined in

src/server/components/Tool.ts:251


onAttributeChanged

onAttributeChanged<K>(name, cb): void

Connect a callback to the change of a specific attribute.

Type parameters

Name Type
K extends string | number | symbol

Parameters

Name Type Description
name K The name of the attribute
cb (newValue: A[K], oldValue: A[K]) => void The callback

Returns

void

Inherited from

BaseComponent.onAttributeChanged

Defined in

node_modules/@flamework/components/out/index.d.ts:35


onStart

onStart(): void

Returns

void

Implementation of

OnStart.onStart

Defined in

src/server/components/Tool.ts:76


setAttribute

setAttribute<T>(key, value, postfix?): A[T]

Type parameters

Name Type
T extends string | number | symbol

Parameters

Name Type
key T
value A[T]
postfix? boolean

Returns

A[T]

Inherited from

BaseComponent.setAttribute

Defined in

node_modules/@flamework/components/out/index.d.ts:27


setInstance

setInstance(instance, attributes): void

Parameters

Name Type
instance I
attributes unknown

Returns

void

Inherited from

BaseComponent.setInstance

Defined in

node_modules/@flamework/components/out/index.d.ts:26


setState

setState(state): void

Parameters

Name Type
state string

Returns

void

Defined in

src/server/components/Tool.ts:71

Clone this wiki locally