Skip to content

Noid ​

A state machine like the Humanoid's, for custom character controllers.

Noid does not move anything or cast anything, it decides what state a character is in and tells you when that changes. Physics, raycast and replication stay with you.

lua
local Noid = require(game:GetService("ReplicatedStorage").Packages.Noid)

local machine = Noid.Machine.new("Idle", "client")
local desired = Noid.Conditions.resolve({ grounded = true })

if desired then
    machine:Change({ state = desired, source = "sensor" })
end

Types ​

State type ​

luau
type State = "Idle"
	| "Grounded"
	| "Airborne"
	| "Jumping"
	| "Landed"
	| "Falling"
	| "Climbing"
	| "Swimming"
	| "Seated"
	| "Flying"
	| "Dead"
	| "Frozen"

StateInfo type ​

luau
type StateInfo = {
	grounded: boolean,
	airborne: boolean,
	manual: boolean,
	terminal: boolean,
	enum_name: string?,
}

ChangeSource type ​

luau
type ChangeSource = "sensor" | "driver" | "consumer" | "server" | "client"

ChangeRequest type ​

luau
type ChangeRequest = {
	state: State,
	source: ChangeSource,
}

StateChanged type ​

luau
type StateChanged = (old: State, new: State) -> ()

Realm type ​

luau
type Realm = "server" | "client" | "shared"

Connection type ​

luau
type Connection = signal.Connection

Conditions type ​

luau
type Conditions = conditions.Conditions

Machine type ​

luau
type Machine = machine.Machine

Lifecycle type ​

luau
type Lifecycle = lifecycle.Lifecycle

Transition type ​

luau
type Transition = {
	from: State | "*",
	to: State,
}

Disconnectable type ​

luau
type Disconnectable = {
	Disconnect: (() -> ())?,
	Destroy: (() -> ())?,
}

Properties ​

Conditions Module ​

luau
Noid.Conditions: conditions

Lifecycle Module ​

luau
Noid.Lifecycle: lifecycle

Machine Module ​

luau
Noid.Machine: machine

Realm Module ​

luau
Noid.Realm: realm

Signal Module ​

luau
Noid.Signal: signal

States Module ​

luau
Noid.States: states

Transitions Module ​

luau
Noid.Transitions: transitions