@@ -452,6 +452,8 @@ declare global {
452452 setCanInteractThroughColliders ( canInteract : boolean ) : void ;
453453 setForceDisabled ( forceDisabled : boolean ) : void ;
454454 setInfo ( info : any ) : void ;
455+ remove ( zone : CircleShort | Rect ) : void ;
456+ onInteraction ?( ) : void ;
455457 }
456458
457459 interface DeviceInput {
@@ -515,6 +517,11 @@ declare global {
515517 update ( ) : void ;
516518 }
517519
520+ interface SkinSetupOptions extends SkinOptions {
521+ x ?: number ;
522+ y ?: number ;
523+ }
524+
518525 interface SkinOptions {
519526 id : string ;
520527 editStyles ?: Record < string , string > ;
@@ -527,7 +534,7 @@ declare global {
527534 scene : Scene ;
528535 skinId : string ;
529536 applyEditStyles ( options : SkinOptions ) : void ;
530- setupSkin ( position : Vector ) : void ;
537+ setupSkin ( position : SkinSetupOptions ) : void ;
531538 updateSkin ( options : SkinOptions ) : void ;
532539 }
533540
@@ -1077,6 +1084,8 @@ declare global {
10771084 device : Device ;
10781085 scene : Scene ;
10791086 angle : number ;
1087+ x : number ;
1088+ y : number ;
10801089 } & Partial < RectShort & CircleShort & Ellipse > ;
10811090
10821091 interface ColliderEntry {
@@ -2110,6 +2119,118 @@ declare global {
21102119 }
21112120 }
21122121
2122+ type SettingsChangeCallback = ( value : any , remote : boolean ) => void ;
2123+
2124+ interface CustomSection {
2125+ type : "customsection" ;
2126+ id : string ;
2127+ default ?: any ;
2128+ onChange ?: ( value : any , remote : boolean ) => void ;
2129+ render : (
2130+ container : HTMLElement ,
2131+ currentValue : any ,
2132+ onChange : ( newValue : any ) => void ,
2133+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
2134+ ) => ( ( ) => void ) | void ;
2135+ }
2136+
2137+ interface CustomSetting extends BaseSetting < any > {
2138+ type : "custom" ;
2139+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
2140+ render : ( container : HTMLElement , currentValue : any , update : ( newValue : any ) => void ) => ( ( ) => void ) | void ;
2141+ }
2142+
2143+ interface ColorSetting extends BaseSetting < string > {
2144+ type : "color" ;
2145+ rgba ?: boolean ;
2146+ }
2147+
2148+ interface RadioSetting extends BaseSetting < string > {
2149+ type : "radio" ;
2150+ options : {
2151+ label : string ;
2152+ value : string ;
2153+ } [ ] ;
2154+ }
2155+
2156+ interface SliderSetting extends BaseSetting < number > {
2157+ type : "slider" ;
2158+ min : number ;
2159+ max : number ;
2160+ step ?: number ;
2161+ ticks ?: number [ ] ;
2162+ formatter ?: ( value : number ) => string ;
2163+ }
2164+
2165+ interface TextSetting extends BaseSetting < string > {
2166+ type : "text" ;
2167+ placeholder ?: string ;
2168+ maxLength ?: number ;
2169+ }
2170+
2171+ interface ToggleSetting extends BaseSetting < boolean > {
2172+ type : "toggle" ;
2173+ }
2174+
2175+ interface NumberSetting extends BaseSetting < number > {
2176+ type : "number" ;
2177+ min ?: number ;
2178+ max ?: number ;
2179+ step ?: number ;
2180+ }
2181+
2182+ interface MultiselectSetting extends BaseSetting < string [ ] > {
2183+ type : "multiselect" ;
2184+ options : {
2185+ label : string ;
2186+ value : string ;
2187+ } [ ] ;
2188+ }
2189+
2190+ interface BaseSetting < T > {
2191+ id : string ;
2192+ default ?: T ;
2193+ title : string ;
2194+ description ?: string ;
2195+ onChange ?: ( value : T , remote : boolean ) => void ;
2196+ }
2197+
2198+ interface DropdownSetting extends BaseSetting < string > {
2199+ type : "dropdown" ;
2200+ options : {
2201+ label : string ;
2202+ value : string ;
2203+ } [ ] ;
2204+ allowNone ?: boolean ;
2205+ }
2206+
2207+ type PluginSetting =
2208+ | DropdownSetting
2209+ | MultiselectSetting
2210+ | NumberSetting
2211+ | ToggleSetting
2212+ | TextSetting
2213+ | SliderSetting
2214+ | RadioSetting
2215+ | ColorSetting
2216+ | CustomSetting
2217+ | CustomSection ;
2218+
2219+ interface SettingGroup {
2220+ type : "group" ;
2221+ title : string ;
2222+ settings : PluginSetting [ ] ;
2223+ }
2224+
2225+ type PluginSettingsDescription = ( PluginSetting | SettingGroup ) [ ] ;
2226+
2227+ interface SettingsMethods {
2228+ create : ( description : PluginSettingsDescription ) => void ;
2229+ listen : ( key : string , callback : SettingsChangeCallback ) => ( ) => void ;
2230+ }
2231+
2232+ type PluginSettings = SettingsMethods & Record < string , any > ;
2233+
21132234 class PluginsApi {
21142235 /** A list of all the plugins installed */
21152236 get list ( ) : string [ ] ;
@@ -2128,6 +2249,7 @@ declare global {
21282249 needsLib : string [ ] ;
21292250 optionalLib : string [ ] ;
21302251 syncEval : string ;
2252+ deprecated : string | null ;
21312253 gamemode : string [ ] ;
21322254 hasSettings : string ;
21332255 } ;
@@ -2160,6 +2282,7 @@ declare global {
21602282 needsLib : string [ ] ;
21612283 optionalLib : string [ ] ;
21622284 syncEval : string ;
2285+ deprecated : string | null ;
21632286 gamemode : string [ ] ;
21642287 hasSettings : string ;
21652288 } ;
@@ -2653,6 +2776,8 @@ declare global {
26532776 storage : Readonly < ScopedStorageApi > ;
26542777 /** Functions for intercepting the arguments and return values of functions */
26552778 patcher : Readonly < ScopedPatcherApi > ;
2779+ /** A utility for creating persistent settings menus, only available to plugins */
2780+ settings : PluginSettings ;
26562781 /** Methods for getting info on libraries */
26572782 libs : Readonly < LibsApi > ;
26582783 /** Gets the exported values of a library */
0 commit comments