Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
I forgot to push changes as I go lol
  • Loading branch information
lrockreal committed Nov 26, 2023
1 parent e24a991 commit 45f66cc
Show file tree
Hide file tree
Showing 7 changed files with 544 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
__pycache__/
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# autopilot.lua

Full code completion for [pilot.lua](https://github.com/iimurpyh/pilot-lua/wiki/) using JohnnyMorganz' Luau Language Server.

## Getting Started

To get started, follow these simple steps:

1. **Download the Definitions File:**
- Head over to the [Releases](https://github.com/your-username/autopilot.lua/releases) tab.
- Download the latest version of the `pilot.d.lua` file.

3. **Install luau-lsp for VSCode:**
- Install JohnnyMorganz's [luau-lsp](https://github.com/JohnnyMorganz/luau-lsp) extension for Visual Studio Code.

4. **Configure VSCode Settings:**
- Place `pilot.d.lua` in your project directory.
- Create a `.vscode` folder in your project directory.
- Inside the `.vscode` folder, create a `settings.json` file.
- Add the following properties to `settings.json`:

```json
{
"luau-lsp.sourcemap.enabled": false,
"luau-lsp.types.roblox": true,
"luau-lsp.types.definitionFiles": [
"./pilot.d.lua"
]
}
```

5. **Enjoy Full Code Completion:**
- With the setup complete, you now have full code completion for `pilot.lua` in Visual Studio Code.

# Build Steps

If you want to build autopilot.lua from scratch, follow the steps below:

1. **Clone the Repository**
- Clone the repository to your local machine

```
git clone https://github.com/flxwed/autopilot-lua.git
```

2. **Generate Definitions via Script**
- Open your cloned repository in your favorite code editor
- Run `scripts/generateDefinitions.py` and pass the project directory as the first argument.
- After the script finishes, the generated code can be found at `build/pilot.d.lua`.

```
py scripts/generateDefinitions.py .
> .\build\pilot.d.lua created successfully
cat build/pilot.d.lua
> type PortLike = number | {GUID: string}
type Properties = {[string]: any}
...
```

## Contributions

We welcome contributions and bug reports. Feel free to fork the repository, make your changes, and submit a pull request. If you encounter any issues or have suggestions for improvement, please open an issue.

Happy coding with autopilot.lua!
12 changes: 12 additions & 0 deletions globals.d.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Microcontroller Globals
-- GetPartFromPort and GetPartsFromPort are generated via script
declare GetPort: (port: PortLike) -> Part
declare TriggerPort: (port: PortLike) -> Part

declare SandboxID: string
declare SandboxRunID: number

declare Beep: (pitch: number) -> ()
declare JSONDecode: (json: string) -> {[string]: any}
declare JSONEncode: (dataToEncode: {[string]: any}) -> string
declare Communicate: () -> ()
266 changes: 266 additions & 0 deletions parts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
{
"Part": {
"default": true,
"properties": {
"ClassName": "string",
"Position": "Vector2",
"CFrame": "CFrame",
"GUID": "string"
},
"methods": {
"Trigger": {},
"Configure": {
"arguments": [{"properties": "Properties"}]
}
},
"events": {
"Triggered": [],
"Configured": []
}
},
"Gyro": {
"extends": "Part",
"methods": {
"PointAt": {
"arguments": [{"position": "Vector3"}]
}
}
},
"Keyboard": {
"extends": "Part",
"methods": {
"SimulateKeyPress": {
"arguments": [{"key": "string?"}, {"player": "string"}]
},
"SimulateTextInput": {
"arguments": [{"input": "string?"}, {"player": "string"}]
}
},
"events": {
"KeyPressed": [{"key": "Enum.KeyCode"}, {"keyString": "string"}, {"state": "Enum.UserInputState"}, {"player": "string"}],
"TextInputted": [{"text": "string"}, {"player": "string"}]
}
},
"Microphone": {
"extends": "Part",
"events": {
"Chatted": [{"player": "string"}, {"message": "string"}]
}
},
"LifeSensor": {
"extends": "Part",
"methods": {
"GetReading": {
"returns": "{[string]: Vector3}"
}
}
},
"Instrument": {
"extends": "Part",
"methods": {
"GetReading": {
"arguments": [{"typeId": "number"}],
"returns": "number | Vector3"
}
}
},
"EnergyShield": {
"extends": "Part",
"methods": {
"GetShieldHealth": {
"returns": "number"
}
},
"properties": {
"ShieldStrength": "number",
"RegenerationSpeed": "number",
"ShieldRadius": "number"
}
},
"Disk": {
"extends": "Part",
"methods": {
"ClearDisk": {},
"Write": {
"arguments": [{"key": "string"}, {"data": "string"}]
},
"Read": {
"arguments": [{"key": "string"}],
"returns": "string"
},
"ReadEntireDisk": {
"returns": "{[string]: string}"
}
},
"properties": {
"ShieldStrength": "number",
"RegenerationSpeed": "number",
"ShieldRadius": "number"
}
},
"Bin": {
"extends": "Part",
"methods": {
"GetAmount": {
"returns": "number"
},
"GetResource": {
"returns": "string"
}
}
},
"Container": {
"extends": "Bin"
},
"Modem": {
"extends": "Part",
"methods": {
"PostRequest": {
"arguments": [{"domain": "string"}, {"data": "string"}]
},
"GetRequest": {
"arguments": [{"domain": "string"}],
"returns": "string"
},
"SendMessage": {
"arguments": [{"data": "string"}, {"id": "number"}]
},
"RealPostRequest": {
"arguments": [{"domain": "string"}, {"data": "string"}, {"asyncBool": "boolean"}, {"transformFunction": "(...any) -> ()"}, {"optionalHeaders": "{[string]: any}?"}],
"returns": "{response: string, success: boolean}"
}
},
"events": {
"MessageSent": [{"data": "string"}]
}
},
"Screen": {
"extends": "Part",
"methods": {
"GetDimensions": {
"returns": "Vector2"
},
"ClearElements": {
"arguments": [{"className": "string?"}, {"properties": "Properties?"}]
},
"CreateElement": {
"arguments": [{"className": "string"}, {"properties": "Properties"}],
"returns": "ScreenObject"
}
}
},
"TouchScreen": {
"extends": "Screen",
"methods": {
"GetCursor": {
"returns": "Cursor"
},
"GetCursors": {
"returns": "{Cursor}"
}
},
"events": {
"CursorMoved": [{"cursor": "Cursor"}],
"CursorPressed": [{"cursor": "Cursor"}],
"CursorReleased": [{"cursor": "Cursor"}]
}
},
"TouchSensor": {
"extends": "Part",
"events": {
"Touched": []
}
},
"Button": {
"extends": "Part",
"events": {
"OnClick": [{"player": "string"}]
}
},
"Light": {
"extends": "Part",
"methods": {
"SetColor": {
"arguments": [{"color": "Color3"}]
}
}
},
"Rail": {
"extends": "Part",
"methods": {
"SetPosition": {
"arguments": [{"depth": "number"}]
}
}
},
"StarMap": {
"extends": "Part",
"methods": {
"GetBodies": {
"returns": "Iterator<string, nil>"
},
"GetSystems": {
"returns": "Iterator<string, nil>"
}
}
},
"Telescope": {
"extends": "Part",
"methods": {
"GetCoordinate": {
"returns": "RegionInfo"
},
"WhenRegionLoads": {
"arguments": [{"callback": "(regionData: RegionInfo) -> ()"}]
}
}
},
"Speaker": {
"extends": "Part",
"methods": {
"PlaySound": {
"arguments": [{"soundId": "number"}]
},
"ClearSounds": {},
"Chat": {
"arguments": [{"message": "string"}]
}
}
},
"Reactor": {
"extends": "Part",
"methods": {
"GetFuel": {
"returns": "{[number]: number}"
},
"GetTemp": {
"returns": "number"
}
}
},
"Dispenser": {
"extends": "Part",
"methods": {
"Dispense": {}
}
},
"Faucet": {
"extends": "Dispenser"
},
"Servo": {
"extends": "Dispenser",
"methods": {
"SetAngle": {
"arguments": [{"angle": "number"}]
}
}
},
"BlackBox": {
"extends": "Part",
"methods": {
"GetLogs": {
"returns": "RegionLog"
}
}
}
}
Loading

0 comments on commit 45f66cc

Please sign in to comment.