repo
stringclasses
341 values
file_path
stringlengths
29
173
language
stringclasses
2 values
file_type
stringclasses
4 values
code
stringlengths
2
1.66M
tokens
int64
2
598k
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/client/ui/components/textLabel.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; interface Props extends React.PropsWithChildren { key?: string; text: string; textSize: number; textScaled?: boolean; size?: UDim2; position?: UDim2; anchorPoint?: Vector2; automaticSize?: Enum.AutomaticSize; textColor3?: Color3; textXAlignment?: Enum.TextXAlignment; textYA...
384
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/client/ui/components/textLabelButton.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import TextButton from "./textButton"; import TextLabel from "./textLabel"; interface Props extends React.PropsWithChildren { key?: string; text?: string; textSize?: number; size?: UDim2; position?: UDim2; textPosition?: UDim2; textAnchorPoint?: Vector2; ...
432
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/client/ui/components/title.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import Frame from "./frame"; import TextLabel from "./textLabel"; interface Props extends React.PropsWithChildren { text: string; textSize?: number; key?: string; uiStrokeSize?: number; position?: UDim2; anchorPoint?: Vector2; size?: UDim2; uiCornerSize?: UDim; backgroundColo...
382
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/client/ui/holder.story.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import ReactRoblox from "@rbxts/react-roblox"; import { store } from "client/store"; import { ReflexProvider } from "@rbxts/react-reflex"; import HolderApp from "./apps/holder/holder-app"; import { HOLDER_PAGES } from "shared/configs/Gui"; import { defaultPlayerData } from "shared/stor...
236
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/client/ui/utils/GetStatePlayerId.ts
roblox-ts
.ts
import { Players } from "@rbxts/services"; export function GetStatePlayerId () { const player = Players.LocalPlayer; return player ? tostring( player.UserId ) : "0"; }
41
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/server/cmdr/commands/giveCurrency.ts
roblox-ts
.ts
import { CommandDefinition } from "@rbxts/cmdr"; export = identity<CommandDefinition>({ Name: "giveCurrency", Aliases: ["gC"], Description: "Increase the Players Currency", Group: "Admin", Args: [ { Type: "player", Name: "player", Description: "Player", }, { Type: "currency", Name: "Currency"...
126
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/server/cmdr/commands/giveCurrencyServer.ts
roblox-ts
.ts
import { CommandContext } from "@rbxts/cmdr"; import { store } from "server/store"; import { Currency } from "shared/configs/Currency"; export = function (context: CommandContext, player: Player, currency: Currency, amount: number) { store.changeBalance(tostring(player.UserId), currency, amount); };
69
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/server/cmdr/startup.server.ts
roblox-ts
.ts
import { Cmdr } from "@rbxts/cmdr"; const parent = <Folder>script.Parent Cmdr.RegisterDefaultCommands() Cmdr.RegisterCommandsIn( <Folder>parent.FindFirstChild( "commands" ) ) Cmdr.RegisterTypesIn( <Folder>parent.FindFirstChild( "types" ) )
64
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/server/cmdr/types/currency.ts
roblox-ts
.ts
import { Registry } from "@rbxts/cmdr"; import { CURRENCIES } from "shared/configs/Currency"; export = function (registry: Registry) { registry.RegisterType("currency", registry.Cmdr.Util.MakeEnumType("currency", [...CURRENCIES])); };
59
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/server/services/PlayerDataService.ts
roblox-ts
.ts
/* eslint-disable roblox-ts/no-private-identifier */ import { OnInit, Service } from "@flamework/core"; import ProfileService from "@rbxts/profileservice"; import { Profile } from "@rbxts/profileservice/globals"; import { Players, RunService } from "@rbxts/services"; import { store } from "server/store"; import { selec...
663
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/server/store/index.ts
roblox-ts
.ts
import { InferState, combineProducers } from "@rbxts/reflex"; import { slices } from "shared/store"; import { broadcasterMiddleware } from "./middleware/broadcaster"; export type RootState = InferState<typeof store>; export function createStore() { const store = combineProducers({ ...slices, }); // Apply middle...
90
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/server/store/middleware/broadcaster.ts
roblox-ts
.ts
import { ProducerMiddleware, createBroadcaster } from "@rbxts/reflex"; import { Events } from "server/network"; import { slices } from "shared/store"; export function broadcasterMiddleware(): ProducerMiddleware { const broadcaster = createBroadcaster({ producers: slices, dispatch: (player, actions) => { Events...
101
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/network.ts
roblox-ts
.ts
/* eslint-disable no-unused-vars */ import { Networking } from "@flamework/networking"; import { BroadcastAction } from "@rbxts/reflex"; import { PlayerData } from "./store/slices/players/types"; import { Setting } from "./configs/Settings"; interface ServerEvents { reflex: { start: () => void; } toggleSetting: ...
168
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/store/index.ts
roblox-ts
.ts
import { CombineStates } from "@rbxts/reflex"; import { playersSlice } from "./slices/players"; import { clientSlice } from "./slices/client"; export type SharedState = CombineStates<typeof slices>; export const slices = { players: playersSlice, client: clientSlice, };
64
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/store/selectors/players.ts
roblox-ts
.ts
import { Currency } from "shared/configs/Currency"; import { SharedState } from ".."; import { createSelector } from "@rbxts/reflex"; import { defaultPlayerData } from "../slices/players/utils"; import { PlayerData } from "../slices/players/types"; import { Setting } from "shared/configs/Settings"; export const select...
309
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/store/slices/client/gui.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import { HolderPage } from "shared/configs/Gui"; export interface GuiState { holderPage?: HolderPage } const initalState: GuiState = { }; export const guiSlice = createProducer( initalState, { setHolderPage: ( state, page?: HolderPage ) => ( { ...stat...
91
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/store/slices/client/index.ts
roblox-ts
.ts
import { combineProducers } from "@rbxts/reflex"; import { guiSlice } from "./gui"; export const clientSlice = combineProducers( { gui: guiSlice })
40
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/store/slices/players/balance.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import { PlayerBalance, PlayerData } from "./types"; import { Currency } from "shared/configs/Currency"; export interface BalanceState { readonly [player: string]: PlayerBalance | undefined; } const initialState: BalanceState = {}; export const balanceSlice = creat...
204
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/store/slices/players/index.ts
roblox-ts
.ts
import { combineProducers } from "@rbxts/reflex"; import { balanceSlice } from "./balance"; import { settingsSlice } from "./settings"; export const playersSlice = combineProducers( { balance: balanceSlice, settings: settingsSlice })
55
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/store/slices/players/settings.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import { PlayerData, PlayerSettings } from "./types"; export interface SettingsState { readonly [player: string]: PlayerSettings | undefined; } const initialState: SettingsState = {}; export const settingsSlice = createProducer( initialState, { loadPlayerData: ...
176
MonzterDev/Roblox-TS-Template
MonzterDev-Roblox-TS-Template-c80afcb/src/shared/utils/functions/forEveryPlayer.ts
roblox-ts
.ts
import { Players } from "@rbxts/services"; type PlayerReceivingFunction = (player: Player) => unknown; export function forEveryPlayer( joinFunc: PlayerReceivingFunction, leaveFunc?: PlayerReceivingFunction, ): Array<RBXScriptConnection> { const events: Array<RBXScriptConnection> = []; Players.GetPlayers().forEac...
107
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/audio/sound-controller.ts
roblox-ts
.ts
import type { OnInit, OnStart } from "@flamework/core"; import { Controller } from "@flamework/core"; import type { Logger } from "@rbxts/log"; import { Inspect } from "@rbxts/rbx-debug"; import { SoundService, TweenService } from "@rbxts/services"; import { USER_ID } from "client/constants"; import { store } from "cl...
934
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/constants.ts
roblox-ts
.ts
import { Players } from "@rbxts/services"; export const { LocalPlayer } = Players; export const USER_ID = tostring(LocalPlayer.UserId); export const USER_NAME = LocalPlayer.Name; // eslint-disable-next-line ts/no-non-null-assertion, flawless/naming-convention -- Should always be present during usage. export const Pl...
82
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/player/character/character-controller.ts
roblox-ts
.ts
import type { OnStart } from "@flamework/core"; import { Controller } from "@flamework/core"; import type { Logger } from "@rbxts/log"; import { Error } from "@rbxts/luau-polyfill"; import Signal from "@rbxts/rbx-better-signal"; import { promiseTree } from "@rbxts/validate-tree"; import { LocalPlayer } from "client/co...
821
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/runtime.client.ts
roblox-ts
.ts
import { Flamework, Modding } from "@flamework/core"; import type { Logger } from "@rbxts/log"; import Log from "@rbxts/log"; import { GAME_NAME } from "shared/constants"; import { setupLogger } from "shared/functions/setup-logger"; import { createApp, reactConfig } from "./ui/react-config"; function start(): void {...
159
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/store/middleware/receiver.ts
roblox-ts
.ts
import type { ProducerMiddleware } from "@rbxts/reflex"; import { createBroadcastReceiver } from "@rbxts/reflex"; import { events } from "client/network"; import { $NODE_ENV } from "rbxts-transform-env"; import { IS_EDIT } from "shared/constants"; import { stateSerDes } from "shared/store"; /** * A middleware that l...
219
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/app.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { Layer } from "./components/primitive"; export function App(): React.ReactNode { return ( <> <Layer key="example-layer" /> <Layer key="example-layer1" /> </> ); }
59
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/background-blur.tsx
roblox-ts
.tsx
import { useBindingListener, useCamera } from "@rbxts/pretty-react-hooks"; import React, { useState } from "@rbxts/react"; import { createPortal } from "@rbxts/react-roblox"; import type { BindingValue } from "types/util/react"; interface BackgroundBlurProps { /** The size of the blur effect. */ BlurSize?: BindingV...
205
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/delay-render.tsx
roblox-ts
.tsx
import React, { useEffect, useState } from "@rbxts/react"; import { setTimeout } from "@rbxts/set-timeout"; interface DelayRenderProps extends React.PropsWithChildren { /** The delay (in seconds) before rendering the children component. */ MountDelay?: number; /** * Indicates whether the children component should...
386
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/error-handler/error-boundary.tsx
roblox-ts
.tsx
import Log from "@rbxts/log"; import type { ErrorInfo } from "@rbxts/react"; import React, { ReactComponent } from "@rbxts/react"; interface ErrorBoundaryProps extends React.PropsWithChildren { onFallback: (error: unknown) => React.ReactNode; } interface ErrorBoundaryState { hasError: boolean; message?: unknown; }...
306
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/error-handler/error-handler.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { ErrorBoundary } from "./error-boundary"; import { ErrorPage } from "./error-page"; type ErrorHandlerProps = React.PropsWithChildren; export function ErrorHandler({ children }: Readonly<ErrorHandlerProps>): React.ReactNode { return ( <ErrorBoundary onFallback={(err) =>...
102
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/error-handler/error-page.tsx
roblox-ts
.tsx
import type React from "@rbxts/react"; interface ErrorPageProps { Message: string; } export function ErrorPage({ Message }: Readonly<ErrorPageProps>): React.ReactNode { warn(Message); return undefined; }
44
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/object-viewport.tsx
roblox-ts
.tsx
import { useMountEffect } from "@rbxts/pretty-react-hooks"; import React, { useRef } from "@rbxts/react"; import Make from "shared/modules/make"; export interface ObjectViewportProps extends React.PropsWithChildren { /** Additional depth to push the camera back. */ ExtraCameraDepth?: number; /** The native props t...
574
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/button.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import type { FrameProps } from "./frame"; export interface ButtonProps extends FrameProps<TextButton> { /** The default properties of a `TextButton` component. */ Native?: Partial<React.InstanceProps<TextButton>>; /** A callback that is triggered when the button is clicked. */ o...
563
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/canvas-group.tsx
roblox-ts
.tsx
import React, { forwardRef } from "@rbxts/react"; import type { FrameProps } from "./frame"; export type CanvasGroupProps = FrameProps<CanvasGroup>; /** * A wrapper around the `CanvasGroup` component, a GuiObject that renders * descendants as a group with color and transparency applied to the render * result. * ...
305
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/frame.tsx
roblox-ts
.tsx
import type { Ref } from "@rbxts/react"; import React, { forwardRef } from "@rbxts/react"; import type { BindingValue } from "types/util/react"; export interface FrameProps<T extends Instance = Frame> extends React.PropsWithChildren { /** An optional helper that rounds the corners of the frame. */ CornerRadius?: Bi...
410
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/group.tsx
roblox-ts
.tsx
import React, { forwardRef } from "@rbxts/react"; interface GroupProps extends React.PropsWithChildren { /** All the default properties of a `Frame` component. */ Native?: Partial<Omit<React.InstanceProps<Frame>, "BackgroundTransparency">>; } /** * A container for grouping multiple components together. * * @exam...
306
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/image.tsx
roblox-ts
.tsx
import React, { forwardRef } from "@rbxts/react"; import type { BindingValue } from "types/util/react"; import type { AssetId } from "types/util/roblox"; import type { FrameProps } from "./frame"; export interface ImageProps extends FrameProps<ImageLabel> { /** The image to display. */ Image: BindingValue<AssetId>...
352
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/layer.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { $NODE_ENV } from "rbxts-transform-env"; import { IS_EDIT } from "shared/constants"; import { UltraWideContainer } from "../ultra-wide-container"; import { Group } from "./group"; export interface LayerProps extends React.PropsWithChildren { /** * Whether or not to constr...
498
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/padding-component.tsx
roblox-ts
.tsx
import type { PropsWithChildren } from "@rbxts/react"; import React, { forwardRef } from "@rbxts/react"; interface PaddingProps extends PropsWithChildren { Padding: number; } /** * A component for adding consistent padding around an element. * * @example * * ```tsx * <Padding Padding={10}> * ``` * * @compon...
227
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/scrolling-frame.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { useRem, useTheme } from "client/ui/hooks"; interface ScrollingFrameProps extends React.PropsWithChildren { /** The size of the canvas. */ CanvasSize: Vector2; /** All the default properties of a `ScrollingFrame` component. */ Native?: Partial<Omit<React.InstanceProps<Scr...
518
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/components/primitive/text.tsx
roblox-ts
.tsx
import React, { forwardRef } from "@rbxts/react"; import { useRem, useTheme } from "client/ui/hooks"; import type { BindingValue } from "types/util/react"; import type { FrameProps } from "./frame"; export interface TextLabelProps extends FrameProps<TextLabel> { /** * The font of the text, defaults to the primary...
553
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/functions/mount.tsx
roblox-ts
.tsx
import React, { StrictMode } from "@rbxts/react"; import { ReflexProvider } from "@rbxts/react-reflex"; import type { Root } from "@rbxts/react-roblox"; import { createPortal, createRoot } from "@rbxts/react-roblox"; import { PlayerGui } from "client/constants"; import { store } from "client/store"; import type { Rem...
340
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/functions/profiler.ts
roblox-ts
.ts
import type { FunctionComponent } from "@rbxts/react"; import React, { createElement } from "@rbxts/react"; export function profiler<P extends object>( name: string, render: FunctionComponent<P>, ): FunctionComponent<P> { return (props: P) => { debug.profilebegin(name); const result = render(props); debug.pro...
307
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/hooks/use-defined.tsx
roblox-ts
.tsx
import { useLatest } from "@rbxts/pretty-react-hooks"; function isEqualOrUndefined(previousValue: unknown, value: unknown): boolean { return previousValue === value || value === undefined; } /** * Returns the latest defined value. * * @param value - The value to use. * @param initialValue - The initial value to ...
154
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/hooks/use-orientation.tsx
roblox-ts
.tsx
import { useViewport } from "@rbxts/pretty-react-hooks"; import { useEffect, useState } from "@rbxts/react"; type Orientation = "landscape" | "portrait"; export function useOrientation(): Orientation { const [orientation, setOrientation] = useState<Orientation>("landscape"); const viewportBinding = useViewport((vi...
141
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/hooks/use-premium.tsx
roblox-ts
.tsx
import { useEventListener } from "@rbxts/pretty-react-hooks"; import { useState } from "@rbxts/react"; import { Players } from "@rbxts/services"; import { LocalPlayer } from "client/constants"; /** * Returns whether the local player has a premium membership or not. This will * update when the player's membership ch...
170
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/hooks/use-rem.tsx
roblox-ts
.tsx
import { useCallback, useContext } from "@rbxts/react"; import { DEFAULT_REM, RemContext } from "../providers/rem-provider"; export interface RemOptions { maximum?: number; minimum?: number; } interface RemFunction { (value: number, mode?: RemScaleMode): number; (value: UDim2, mode?: RemScaleMode): UDim2; (valu...
468
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/hooks/use-selector.tsx
roblox-ts
.tsx
import type { UseSelectorHook } from "@rbxts/react-reflex"; import { useSelector } from "@rbxts/react-reflex"; import type { RootStore } from "client/store"; export const useRootSelector: UseSelectorHook<RootStore> = useSelector;
56
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/hooks/use-store.tsx
roblox-ts
.tsx
import type { UseProducerHook } from "@rbxts/react-reflex"; import { useProducer } from "@rbxts/react-reflex"; import type { RootStore } from "client/store"; export const useStore: UseProducerHook<RootStore> = useProducer;
57
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/hooks/use-theme.tsx
roblox-ts
.tsx
import { useSelector } from "@rbxts/react-reflex"; import { selectPlayerTheme } from "client/store/theme"; import type { Theme } from "../themes/theme"; export function useTheme(): Theme { return useSelector(selectPlayerTheme); }
49
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/providers/rem-provider.tsx
roblox-ts
.tsx
import { map, useCamera, useDebounceState, useEventListener } from "@rbxts/pretty-react-hooks"; import React, { createContext, useCallback, useEffect } from "@rbxts/react"; export interface RemProviderProps extends React.PropsWithChildren { baseRem?: number | undefined; maximumRem?: number | undefined; minimumRem?:...
518
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/react-config.tsx
roblox-ts
.tsx
import type { ProfilerOnRenderCallback } from "@rbxts/react"; import { $NODE_ENV } from "rbxts-transform-env"; export function reactConfig(): void { if ($NODE_ENV !== "development") { return; } _G.__DEV__ = true; _G.__PROFILE__ = false; // Avoid implicit React import before setting the __DEV__ flag void imp...
302
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/client/ui/ui.storybook.ts
roblox-ts
.ts
import React from "@rbxts/react"; import { GAME_NAME } from "shared/constants"; interface Storybook { name: string; react?: typeof React; storyRoots: Array<Instance | undefined>; } export = identity<Storybook>({ name: GAME_NAME, react: React, storyRoots: [script.Parent], });
72
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/server/mtx-service.ts
roblox-ts
.ts
import type { OnInit, OnStart } from "@flamework/core"; import { Service } from "@flamework/core"; import type { Logger } from "@rbxts/log"; import { Error, Object } from "@rbxts/luau-polyfill"; import Signal from "@rbxts/rbx-better-signal"; import { MarketplaceService, Players } from "@rbxts/services"; import Sift fro...
2,735
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/server/player/character/character-service.ts
roblox-ts
.ts
import type { OnStart } from "@flamework/core"; import { Service } from "@flamework/core"; import type { Logger } from "@rbxts/log"; import { Error } from "@rbxts/luau-polyfill"; import { PhysicsService } from "@rbxts/services"; import { promiseTree } from "@rbxts/validate-tree"; import type { ListenerData } from "sha...
1,416
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/server/player/player-badge-service.ts
roblox-ts
.ts
import { Service } from "@flamework/core"; import type { Logger } from "@rbxts/log"; import { BadgeService } from "@rbxts/services"; import { store } from "server/store"; import { selectPlayerAchievements } from "shared/store/persistent"; import { Badge } from "types/enum/badge"; import type { PlayerEntity } from "./...
838
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/server/player/player-entity.ts
roblox-ts
.ts
import type { Janitor } from "@rbxts/janitor"; import type { Document } from "@rbxts/lapis"; import type { PlayerData } from "shared/store/persistent"; export class PlayerEntity { /** The player's username. */ public readonly name: string; /** A string representation of the player's UserId. */ public readonly use...
126
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/server/player/player-service.ts
roblox-ts
.ts
import type { OnStart } from "@flamework/core"; import { Service } from "@flamework/core"; import { Janitor } from "@rbxts/janitor"; import type { Document } from "@rbxts/lapis"; import type { Logger } from "@rbxts/log"; import { Object } from "@rbxts/luau-polyfill"; import Signal from "@rbxts/rbx-better-signal"; impor...
2,036
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/server/runtime.server.ts
roblox-ts
.ts
import { Flamework, Modding } from "@flamework/core"; import type { Logger } from "@rbxts/log"; import Log from "@rbxts/log"; import { GAME_NAME } from "shared/constants"; import { setupLogger } from "shared/functions/setup-logger"; function start(): void { setupLogger(); Log.Info(`${GAME_NAME} is starting up! Ver...
125
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/server/store/middleware/broadcaster.ts
roblox-ts
.ts
import type { BroadcastAction, ProducerMiddleware } from "@rbxts/reflex"; import { createBroadcaster } from "@rbxts/reflex"; import { Players } from "@rbxts/services"; import { $NODE_ENV } from "rbxts-transform-env"; import { events } from "server/network"; import { IS_EDIT } from "shared/constants"; import type { Ser...
443
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/assets.luau
luau
.luau
return { badges = { ["example-badge"] = "rbxassetid://18110928024", }, marketing = { ["example-icon"] = "rbxassetid://18110928241", googly = "rbxassetid://18110928530", }, }
69
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/constants.ts
roblox-ts
.ts
import { RunService } from "@rbxts/services"; export const GAME_NAME = "Template for roblox-ts"; export const IS_EDIT = RunService.IsStudio() && !RunService.IsRunning();
41
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/functions/game-config.ts
roblox-ts
.ts
import { $NODE_ENV } from "rbxts-transform-env"; export enum GameId { Development = 6031475575, Production = 6110424408, } function isGameId(value: number): value is GameId { return value in GameId; } export function getConfigValueForGame<const T>(gameIdToValueTable: Record<GameId, T>): T { if ($NODE_ENV === "de...
143
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/functions/setup-logger.ts
roblox-ts
.ts
import Log, { Logger, LogLevel } from "@rbxts/log"; import type { ILogEventSink, LogEvent } from "@rbxts/log/out/Core"; import { MessageTemplateParser, PlainTextMessageTemplateRenderer } from "@rbxts/message-templates"; import { RunService } from "@rbxts/services"; import { $package } from "rbxts-transform-debug"; imp...
603
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/modules/3d-sound-system/init.luau
luau
.luau
-- Services local RunService = game:GetService("RunService") local SoundService = game:GetService("SoundService") if not RunService:IsClient() then error("Sound System 3D is to be run on the client. Use RemoteEvents to have the client create the sound.") end -- Localize maths for optimization -- local acos, cos, pi ...
1,307
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/modules/make.ts
roblox-ts
.ts
/* eslint-disable eslint-comments/no-unlimited-disable -- See below. */ /* eslint-disable -- Taken directly from https://www.npmjs.com/package/@rbxts/make due to compiler type mismatch. */ type WritablePropertyNames<T> = { readonly [K in keyof T]-?: T[K] extends Callback ? never : (<F>() => F extends { [Q in K]: T...
669
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/network.ts
roblox-ts
.ts
import { Networking } from "@flamework/networking"; import type { BroadcastAction } from "@rbxts/reflex"; import type { GamePass } from "types/enum/mtx"; import type { SerializedSharedState } from "./store"; /** Fired by client to server. */ interface ClientToServerEvents { mtx: { /** * Sets the active state o...
356
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/store/index.ts
roblox-ts
.ts
import { createBinarySerializer } from "@rbxts/flamework-binary-serializer"; import type { CombineStates } from "@rbxts/reflex"; import { persistentSlice } from "./persistent/persistent-slice"; export type SharedState = CombineStates<typeof slices>; export type SerializedSharedState = ReturnType<typeof stateSerDes.se...
92
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/store/middleware/profiler.ts
roblox-ts
.ts
import type { ProducerMiddleware } from "@rbxts/reflex"; export const profilerMiddleware: ProducerMiddleware = () => { return (dispatch, name) => { return (...args) => { debug.profilebegin(name); const result = dispatch(...args); debug.profileend(); return result; }; }; };
69
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/store/persistent/persistent-selectors.ts
roblox-ts
.ts
import { createSelector } from "@rbxts/reflex"; import type { SharedState } from ".."; import type { PlayerData } from "./persistent-slice"; export function selectPlayerAchievements(playerId: string) { return (state: SharedState) => state.persistent.achievements[playerId]; } export function selectPlayerBalance(play...
266
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/store/persistent/persistent-slice/achievements.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import type { Badge } from "types/enum/badge"; import type { PlayerAchievements, PlayerData } from "./default-data"; export type AchievementState = Readonly<Record<string, PlayerAchievements | undefined>>; const initialState: AchievementState = {}; export const achie...
333
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/store/persistent/persistent-slice/balance.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import type { PlayerBalance, PlayerData } from "./default-data"; export type BalanceState = Readonly<Record<string, PlayerBalance | undefined>>; const initialState: BalanceState = {}; export const balanceSlice = createProducer(initialState, { /** @ignore */ closePla...
209
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/store/persistent/persistent-slice/index.ts
roblox-ts
.ts
import { combineProducers } from "@rbxts/reflex"; import { achievementsSlice } from "./achievements"; import { balanceSlice } from "./balance"; import { mtxSlice } from "./mtx"; import { settingsSlice } from "./settings"; export * from "./achievements"; export * from "./balance"; export * from "./default-data"; expor...
117
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/store/persistent/persistent-slice/settings.ts
roblox-ts
.ts
import { createProducer } from "@rbxts/reflex"; import type { PlayerData, PlayerSettings } from "./default-data"; export type SettingsState = Readonly<Record<string, PlayerSettings | undefined>>; const initialState: SettingsState = {}; export const settingsSlice = createProducer(initialState, { /** @ignore */ clo...
226
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/util/core-call/init.luau
luau
.luau
local coreCall do local MAX_RETRIES = 8 local StarterGui = game:GetService("StarterGui") local RunService = game:GetService("RunService") function coreCall(method, ...) local result = {} for _ = 1, MAX_RETRIES do result = { pcall(StarterGui[method], StarterGui, ...) } if result[1] then break end ...
116
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/util/no-yield/init.luau
luau
.luau
--!strict --[[ Calls a function and throws an error if it attempts to yield. Pass any number of arguments to the function after the callback. This function supports multiple return; all results returned from the given function will be returned. ]] local function resultHandler(co: thread, ok: boolean, ...) if not...
240
christopher-buss/roblox-ts-project-template
christopher-buss-roblox-ts-project-template-d9624aa/src/shared/util/player-util.ts
roblox-ts
.ts
import { Players } from "@rbxts/services"; import type { EvaluateInstanceTree } from "@rbxts/validate-tree"; export const CHARACTER_LOAD_TIMEOUT = 10; export type CharacterRig = EvaluateInstanceTree<typeof CharacterSchema>; export const CharacterSchema = { $className: "Model", Head: "MeshPart", Humanoid: { $cla...
815
littensy/slither
littensy-slither-56545f1/scripts/run-tests.server.lua
luau
.lua
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerScriptService = game:GetService("ServerScriptService") local TestEZ = require(ReplicatedStorage.rbxts_include.node_modules["@rbxts"].testez.src) TestEZ.TestBootstrap:run({ ServerScriptService.TS.test, ReplicatedStorage.TS.test, }, TestEZ.Rep...
80
littensy/slither
littensy-slither-56545f1/src/client/alerts/alert-factory.ts
roblox-ts
.ts
import { throttle } from "@rbxts/set-timeout"; import { store } from "client/store"; import { Alert, AlertScope, selectAlerts } from "client/store/alert"; import { palette } from "shared/constants/palette"; const defaultAlert: Alert = { id: 0, emoji: "✅", message: "Alert", color: palette.green, duration: 5, visi...
373
littensy/slither
littensy-slither-56545f1/src/client/app/app.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { Alerts } from "../components/alerts"; import { Controller } from "../components/controller"; import { ErrorHandler } from "../components/error-handler"; import { Game } from "../components/game"; import { Menu } from "../components/menu"; import { Music } from "../components/...
210
littensy/slither
littensy-slither-56545f1/src/client/app/index.client.tsx
roblox-ts
.tsx
import "./react-config"; import React, { StrictMode } from "@rbxts/react"; import { createPortal, createRoot } from "@rbxts/react-roblox"; import { Players } from "@rbxts/services"; import { RootProvider } from "client/providers/root-provider"; import { App } from "./app"; const root = createRoot(new Instance("Folde...
130
littensy/slither
littensy-slither-56545f1/src/client/app/react-config.ts
roblox-ts
.ts
import { backend } from "@rbxts/react-devtools-core"; import ReactGlobals from "@rbxts/react-globals"; import { RunService } from "@rbxts/services"; if (RunService.IsStudio()) { ReactGlobals.__DEV__ = true; ReactGlobals.__PROFILE__ = true; backend.connectToDevtools(); }
72
littensy/slither
littensy-slither-56545f1/src/client/components/alerts/alert-timer.tsx
roblox-ts
.tsx
import { lerpBinding, useEventListener } from "@rbxts/pretty-react-hooks"; import React, { useBinding } from "@rbxts/react"; import { RunService } from "@rbxts/services"; import { CanvasGroup } from "client/components/ui/canvas-group"; import { Frame } from "client/components/ui/frame"; import { useRem } from "client/h...
414
littensy/slither
littensy-slither-56545f1/src/client/components/alerts/alerts.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { useSelector } from "@rbxts/react-reflex"; import { selectAlerts } from "client/store/alert"; import { Alert } from "./alert"; export function Alerts() { const alerts = useSelector(selectAlerts); return ( <> {alerts.map((alert, index) => ( <Alert key={alert.id} al...
100
littensy/slither
littensy-slither-56545f1/src/client/components/controller/controller.tsx
roblox-ts
.tsx
import { useThrottleCallback } from "@rbxts/pretty-react-hooks"; import React, { useEffect } from "@rbxts/react"; import { useSelector } from "@rbxts/react-reflex"; import { useInputDevice, useStore } from "client/hooks"; import { REMOTE_TICK, WORLD_TICK } from "shared/constants/core"; import { remotes } from "shared/r...
415
littensy/slither
littensy-slither-56545f1/src/client/components/controller/controllers/gamepad.tsx
roblox-ts
.tsx
import { useEventListener } from "@rbxts/pretty-react-hooks"; import React from "@rbxts/react"; import { UserInputService } from "@rbxts/services"; interface GamepadProps { readonly updateAngle: (angle: number) => void; readonly setBoost: (boost: boolean) => void; } const BOOST_KEYS = new ReadonlySet<Enum.KeyCode>(...
338
littensy/slither
littensy-slither-56545f1/src/client/components/controller/controllers/mouse.tsx
roblox-ts
.tsx
import React, { useEffect, useState } from "@rbxts/react"; import { InputCapture } from "client/components/ui/input-capture"; import { lerpRadians } from "shared/utils/math-utils"; interface MouseProps { readonly updateAngle: (angle: number) => void; readonly setBoost: (boost: boolean) => void; } const KEY_CODES = ...
585
littensy/slither
littensy-slither-56545f1/src/client/components/controller/controllers/touch.tsx
roblox-ts
.tsx
import React, { useEffect } from "@rbxts/react"; import { useTouchMove } from "../utils/use-touch-move"; interface TouchProps { readonly updateAngle: (angle: number) => void; readonly setBoost: (boost: boolean) => void; } export function Touch({ updateAngle, setBoost }: TouchProps) { const [direction, jumping] = ...
145
littensy/slither
littensy-slither-56545f1/src/client/components/controller/utils/use-toggle-touch-controls.ts
roblox-ts
.ts
import { useEffect } from "@rbxts/react"; import { UserInputService } from "@rbxts/services"; export function useToggleTouchControls(visible: boolean) { useEffect(() => { // todo: use a non-deprecated method UserInputService.ModalEnabled = !visible; }, [visible]); }
69
littensy/slither
littensy-slither-56545f1/src/client/components/controller/utils/use-touch-move.ts
roblox-ts
.ts
import { useCamera, useEventListener } from "@rbxts/pretty-react-hooks"; import { useRef, useState } from "@rbxts/react"; import { Players, UserInputService } from "@rbxts/services"; import { useCharacter } from "client/hooks"; /** * Returns the direction the player is moving in and whether * or not they are jumping...
477
littensy/slither
littensy-slither-56545f1/src/client/components/error-handler/error-handler.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { ErrorBoundary } from "client/components/ui/error-boundary"; import { ErrorPage } from "./error-page"; export function ErrorHandler({ children }: React.PropsWithChildren) { return ( <ErrorBoundary fallback={(message) => { return <ErrorPage message={message} />; }...
92
littensy/slither
littensy-slither-56545f1/src/client/components/error-handler/error-page.tsx
roblox-ts
.tsx
import React, { useEffect } from "@rbxts/react"; import { TeleportService } from "@rbxts/services"; import { Frame } from "client/components/ui/frame"; import { Group } from "client/components/ui/group"; import { Layer } from "client/components/ui/layer"; import { PrimaryButton } from "client/components/ui/primary-butt...
971
littensy/slither
littensy-slither-56545f1/src/client/components/game/compass/utils.ts
roblox-ts
.ts
import { useEffect, useState } from "@rbxts/react"; import { useSelector } from "@rbxts/react-reflex"; import { setTimeout } from "@rbxts/set-timeout"; import { selectTopSnake } from "shared/store/snakes"; /** * Returns the current leader's state. If the ID changed, this value * will be debounced to prevent jitter a...
190
littensy/slither
littensy-slither-56545f1/src/client/components/game/minimap/minimap-nodes.tsx
roblox-ts
.tsx
import { map, useInterval } from "@rbxts/pretty-react-hooks"; import React, { Element, useState } from "@rbxts/react"; import { useSelector } from "@rbxts/react-reflex"; import { CanvasGroup } from "client/components/ui/canvas-group"; import { useDefined, useStore } from "client/hooks"; import { selectSnakeFromWorldSub...
565
littensy/slither
littensy-slither-56545f1/src/client/components/game/minimap/minimap-tracer.tsx
roblox-ts
.tsx
import React, { memo } from "@rbxts/react"; import { Image } from "client/components/ui/image"; import { images } from "shared/assets"; import { palette } from "shared/constants/palette"; import { useMinimapRem } from "./utils"; interface MinimapTracerProps { readonly from: Vector2; readonly to: Vector2; readonly ...
346
littensy/slither
littensy-slither-56545f1/src/client/components/game/minimap/minimap.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { Frame } from "client/components/ui/frame"; import { Group } from "client/components/ui/group"; import { Image } from "client/components/ui/image"; import { Shadow } from "client/components/ui/shadow"; import { useInputDevice } from "client/hooks"; import { RemProvider } from "...
660
littensy/slither
littensy-slither-56545f1/src/client/components/game/minimap/utils.ts
roblox-ts
.ts
import { map, useInterval } from "@rbxts/pretty-react-hooks"; import { useState } from "@rbxts/react"; import { Players } from "@rbxts/services"; import { useRem } from "client/hooks"; import { USER_ID, WORLD_BOUNDS } from "shared/constants/core"; export const MINIMUM_MINIMAP_REM = 10; export function useMinimapRem()...
299
littensy/slither
littensy-slither-56545f1/src/client/components/menu/home/home-footer.tsx
roblox-ts
.tsx
import React from "@rbxts/react"; import { Text } from "client/components/ui/text"; import { fonts } from "client/constants/fonts"; import { useRem } from "client/hooks"; import { palette } from "shared/constants/palette"; export function HomeFooter() { const rem = useRem(); return ( <Text richText font={fo...
192
littensy/slither
littensy-slither-56545f1/src/client/components/menu/home/home-title.tsx
roblox-ts
.tsx
import { useTimer } from "@rbxts/pretty-react-hooks"; import React from "@rbxts/react"; import { Image } from "client/components/ui/image"; import { useRem } from "client/hooks"; import { images } from "shared/assets"; import { gradientPinched } from "./utils"; interface HomeTitleProps { readonly position: UDim2; } ...
231