Skip to content

Commit 62d930b

Browse files
committed
feat: more annotations for 0.1.6
- Unity API - Mod Config - Mod Manager - Color & Vector3 types
1 parent 109d5f6 commit 62d930b

4 files changed

Lines changed: 212 additions & 0 deletions

File tree

libs/schedulelua_definitions/mods_api.lua

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,58 @@ MOD_PATH = ""
4646
---@type string
4747
MOD_VERSION = ""
4848

49+
-- Mod Configuration Functions
50+
51+
--- Gets the current mod's configuration
52+
---@return table # The mod configuration table
53+
function GetModConfig() end
54+
55+
--- Saves the current mod's configuration
56+
---@return boolean # True if the configuration was saved successfully, false otherwise
57+
function SaveModConfig() end
58+
59+
--- Defines a configuration value with a default
60+
---@param key string The configuration key
61+
---@param defaultValue any The default value if the key doesn't exist
62+
---@param description string The description of the configuration value
63+
---@return boolean # True if the value was defined successfully, false otherwise
64+
function DefineConfigValue(key, defaultValue, description) end
65+
66+
--- Gets a configuration value
67+
---@param key string The configuration key
68+
---@return any # The configuration value or nil if not found
69+
function GetConfigValue(key) end
70+
71+
--- Sets a configuration value
72+
---@param key string The configuration key
73+
---@param value any The value to set
74+
---@return boolean # True if the value was set successfully, false otherwise
75+
function SetConfigValue(key, value) end
76+
77+
--- Checks if a configuration key exists
78+
---@param key string The configuration key to check
79+
---@return boolean # True if the key exists, false otherwise
80+
function HasConfigKey(key) end
81+
82+
--- Gets all configuration keys
83+
---@return table # A table of all configuration keys
84+
function GetConfigKeys() end
85+
86+
-- Mod Manager UI Functions
87+
88+
--- Shows the mod manager UI
89+
function ShowModManager() end
90+
91+
--- Hides the mod manager UI
92+
function HideModManager() end
93+
94+
--- Toggles the visibility of the mod manager UI
95+
function ToggleModManager() end
96+
97+
--- Checks if the mod manager UI is currently visible
98+
---@return boolean # True if the mod manager is visible, false otherwise
99+
function IsModManagerVisible() end
100+
49101
-- Mod Event Handlers
50102

51103
--- Event triggered when all mods have been loaded

libs/schedulelua_definitions/schedule_api.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ require("scene_api")
5858
-- Mod management
5959
require("mods_api")
6060

61+
-- Unity API
62+
require("unity_api")
63+
64+
-- MoonSharp Types
65+
require("types")
66+
6167
-- Note: This file is not meant to be loaded at runtime.
6268
-- It serves as a reference for the Lua Language Server to provide
6369
-- code completion and type checking.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---@meta
2+
3+
---@class Color
4+
---@field r number The red component (0-1)
5+
---@field g number The green component (0-1)
6+
---@field b number The blue component (0-1)
7+
---@field a number The alpha component (0-1)
8+
9+
--- Creates a new Color with the specified RGBA components
10+
---@param r number The red component (0-1)
11+
---@param g number The green component (0-1)
12+
---@param b number The blue component (0-1)
13+
---@param a? number The alpha component (0-1), defaults to 1.0
14+
---@return Color
15+
function Color(r, g, b, a) end
16+
17+
--- Red color (1, 0, 0, 1)
18+
---@type Color
19+
Color.red = nil
20+
21+
--- Green color (0, 1, 0, 1)
22+
---@type Color
23+
Color.green = nil
24+
25+
--- Blue color (0, 0, 1, 1)
26+
---@type Color
27+
Color.blue = nil
28+
29+
--- White color (1, 1, 1, 1)
30+
---@type Color
31+
Color.white = nil
32+
33+
--- Black color (0, 0, 0, 1)
34+
---@type Color
35+
Color.black = nil
36+
37+
--- Yellow color (1, 1, 0, 1)
38+
---@type Color
39+
Color.yellow = nil
40+
41+
--- Cyan color (0, 1, 1, 1)
42+
---@type Color
43+
Color.cyan = nil
44+
45+
--- Magenta color (1, 0, 1, 1)
46+
---@type Color
47+
Color.magenta = nil
48+
49+
--- Gray color (0.5, 0.5, 0.5, 1)
50+
---@type Color
51+
Color.gray = nil
52+
53+
--- Clear color (0, 0, 0, 0)
54+
---@type Color
55+
Color.clear = nil
56+
57+
--- Linearly interpolates between two colors
58+
---@param a Color The starting color
59+
---@param b Color The target color
60+
---@param t number The interpolation factor (0-1)
61+
---@return Color # The interpolated color
62+
function ColorLerp(a, b, t) end
63+
64+
---@class Vector3
65+
---@field x number The x component
66+
---@field y number The y component
67+
---@field z number The z component
68+
---@field magnitude number The length of the vector (read-only)
69+
---@field sqrMagnitude number The squared length of the vector (read-only)
70+
---@field normalized Vector3 The normalized version of the vector (read-only)
71+
---@operator add(Vector3): Vector3 # Adds two vectors together
72+
---@operator sub(Vector3): Vector3 # Subtracts the second vector from the first
73+
---@operator mul(number): Vector3 # Multiplies the vector by a scalar
74+
---@operator div(number): Vector3 # Divides the vector by a scalar
75+
76+
--- Creates a new Vector3 with the specified components
77+
---@param x number The x component
78+
---@param y number The y component
79+
---@param z number The z component
80+
---@return Vector3
81+
function Vector3(x, y, z) end
82+
83+
--- Vector3 with components (0, 0, 0)
84+
---@type Vector3
85+
Vector3.zero = nil
86+
87+
--- Vector3 with components (1, 1, 1)
88+
---@type Vector3
89+
Vector3.one = nil
90+
91+
--- Vector3 pointing up (0, 1, 0)
92+
---@type Vector3
93+
Vector3.up = nil
94+
95+
--- Vector3 pointing down (0, -1, 0)
96+
---@type Vector3
97+
Vector3.down = nil
98+
99+
--- Vector3 pointing left (-1, 0, 0)
100+
---@type Vector3
101+
Vector3.left = nil
102+
103+
--- Vector3 pointing right (1, 0, 0)
104+
---@type Vector3
105+
Vector3.right = nil
106+
107+
--- Vector3 pointing forward (0, 0, 1)
108+
---@type Vector3
109+
Vector3.forward = nil
110+
111+
--- Vector3 pointing backward (0, 0, -1)
112+
---@type Vector3
113+
Vector3.back = nil
114+
115+
--- Returns the distance between two vectors
116+
---@param a Vector3 The first vector
117+
---@param b Vector3 The second vector
118+
---@return number # The distance between the vectors
119+
function Vector3Distance(a, b) end
120+
121+
--- Linearly interpolates between two vectors
122+
---@param a Vector3 The starting vector
123+
---@param b Vector3 The target vector
124+
---@param t number The interpolation factor (0-1)
125+
---@return Vector3 # The interpolated vector
126+
function Vector3Lerp(a, b, t) end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---@meta
2+
3+
-- Key Input Functions
4+
5+
--- Checks if a key is currently being held down
6+
---@param keyName string The name of the key to check
7+
---@return boolean # True if the key is being held down, false otherwise
8+
function IsKeyDown(keyName) end
9+
10+
--- Checks if a key was just pressed this frame
11+
---@param keyName string The name of the key to check
12+
---@return boolean # True if the key was just pressed, false otherwise
13+
function IsKeyPressed(keyName) end
14+
15+
-- Screen Functions
16+
17+
--- Gets the current screen width in pixels
18+
---@return integer # The screen width in pixels
19+
function GetScreenWidth() end
20+
21+
--- Gets the current screen height in pixels
22+
---@return integer # The screen height in pixels
23+
function GetScreenHeight() end
24+
25+
--- Gets both the screen width and height in pixels
26+
---@return integer width The screen width in pixels
27+
---@return integer height The screen height in pixels
28+
function GetScreenResolution() end

0 commit comments

Comments
 (0)