mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 16:25:36 +00:00
Update docs
This commit is contained in:
parent
f22c3fc69e
commit
919296ab15
@ -22,8 +22,7 @@ BeamingDrive Multiplayer (BeamMP) server compatible with BeamMP clients.
|
||||
- [ ] Console:
|
||||
- [x] Tabulation
|
||||
- [ ] _(Deferred)_ Normal text scroll
|
||||
- [ ] Documentation:
|
||||
- [x] [Plugins and Events](docs/plugins-and-events.md)
|
||||
- [x] [Documentation](docs/readme.md)
|
||||
|
||||
## Installation
|
||||
|
||||
|
36
docs/plugins/example.py
Normal file
36
docs/plugins/example.py
Normal file
@ -0,0 +1,36 @@
|
||||
import BEAMP # Import server object
|
||||
|
||||
beam = BEAMP("TestPlugin") # Init plugin with name "TestPlugin"
|
||||
log = beam.log # Use logger from server
|
||||
|
||||
|
||||
def on_load():
|
||||
# When plugin initialization Server uses plugin.load() to load plugin.
|
||||
# def load(): is really needed
|
||||
log.info(beam.name)
|
||||
|
||||
|
||||
# Events handlers
|
||||
|
||||
def on_started():
|
||||
# Simple event handler
|
||||
log.info("Server starting...")
|
||||
|
||||
|
||||
# Simple event register
|
||||
beam.register_event("on_started", on_started)
|
||||
|
||||
|
||||
def any_func(data=None):
|
||||
# Custom event handler
|
||||
log.info(f"Data from any_func: {data}")
|
||||
|
||||
|
||||
# Create custom event
|
||||
beam.register_event("my_event", any_func)
|
||||
|
||||
# Call custom event
|
||||
beam.call_event("my_event")
|
||||
beam.call_event("my_event", "Some data")
|
||||
# This will be an error since any_func accepts only one argument at the input
|
||||
beam.call_event("my_event", "Some data", "Some data1")
|
5
docs/readme.md
Normal file
5
docs/readme.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Documentation for KuiToi Server
|
||||
|
||||
1. Setup and Start server - [here](./setup)
|
||||
2. Plugins and Events system - [here](./plugins)
|
||||
3. Something new
|
33
docs/setup/readme.md
Normal file
33
docs/setup/readme.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Hello from KuiToi Server
|
||||
|
||||
## Start
|
||||
|
||||
* Need **Python 3.10.x** to start!
|
||||
* After cloning use this:
|
||||
```bash
|
||||
$ python3 --version # Python 3.10.6
|
||||
$ python3 main.py --help # Show help message
|
||||
$ python3 main.py # Start server
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
* After starting server creating `kuitoi.yaml`; Default:
|
||||
```yaml
|
||||
!!python/object:modules.ConfigProvider.config_provider.Config
|
||||
Auth:
|
||||
key: null
|
||||
private: true
|
||||
Game:
|
||||
map: gridmap_v2
|
||||
max_cars: 1
|
||||
players: 8
|
||||
Server:
|
||||
debug: true
|
||||
description: This server uses KuiToi!
|
||||
name: KuiToi-Server
|
||||
server_ip: 0.0.0.0
|
||||
server_port: 30814
|
||||
```
|
||||
* Server can't start without BEAM Auth.key
|
||||
|
Loading…
x
Reference in New Issue
Block a user