feat: Added docs via MkDocs

This commit is contained in:
AURUMVORXX
2024-11-04 05:09:59 +03:00
parent 810dd00dd8
commit 6a20d96bb5
21 changed files with 299 additions and 63 deletions

View File

@@ -0,0 +1,27 @@
# `event` onBan
!!! note
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
If timestamp doesn't exist, then ban was permanent.
This event is triggered when new ban is being added.
## Parameters
* `dict` **kwargs**:
* `str` **mac**: MAC address of the banned player.
* `str` **ip**: IP address of the banned player.
* `str` **serial**: serial of the banned player.
* `str` **name**: nickname of the banned player.
* `int` **timestamp**: timestamp when the ban expires.
## Usage
```python
import g2o
from datetime import datetime
@g2o.event('onBan')
def onBan(**kwargs):
print(f'Player {kwargs['name']} has been banned.')
if ('timestamp' in kwargs):
banExpires = datetime.fromtimestamp(kwargs['timestamp'])
print(f'Ban expires at {banExpires}')
```

View File

@@ -0,0 +1,15 @@
# `event` onExit
This event is triggered when server is going to shut down.
You can use it, to save some data before closing up, or do something else.
## Parameters
No parameters.
## Usage
```python
import g2o
@g2o.event('onExit')
def onExitEvt(**kwargs):
print('Bye')
```

View File

@@ -0,0 +1,14 @@
# `event` onInit
This event is triggered when server successfully starts up.
## Parameters
No parameters.
## Usage
```python
import g2o
@g2o.event('onInit')
def onInitEventHandler(**kwargs):
print('Called onInit event')
```

View File

@@ -0,0 +1,14 @@
# `event` onTick
This event is triggered in every server main loop iteration.
## Parameters
No parameters.
## Usage
```python
import g2o
@g2o.event('onTick')
def onTickEvt(**kwargs):
print('Tock')
```

View File

@@ -0,0 +1,20 @@
# `event` onTime
This event is triggered each time when game time minute passes.
## Parameters
* `dict` **kwargs**:
* `int` **day**: the current ingame day.
* `int` **hour**: the current ingame hour.
* `int` **min**: the current ingame minutes.
## Usage
```python
import g2o
@g2o.event('onTick')
def onTickEvt(**kwargs):
day = kwargs['day']
hour = kwargs['hour']
mins = kwargs['min']
print(f'Current time: Day {day}, Hour {hour}, Min {mins}')
```

View File

@@ -0,0 +1,23 @@
# `event` onUnban
!!! note
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
If timestamp doesn't exist, then ban was permanent.
This event is triggered when ban with specified info is being removed.
## Parameters
* `dict` **kwargs**:
* `str` **mac**: MAC address of the banned player.
* `str` **ip**: IP address of the banned player.
* `str` **serial**: serial of the banned player.
* `str` **name**: nickname of the banned player.
* `int` **timestamp**: timestamp when the ban expires.
## Usage
```python
import g2o
@g2o.event('onUnban')
def onUnban(**kwargs):
print(f'Player {kwargs['name']} has been unbanned.')
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,3 +0,0 @@
# Home
An example README that you can replace with your own content!

View File

@@ -1,7 +0,0 @@
:root {
--md-primary-fg-color: #8191ff;
}
.md-header {
background-color: #232323;
}

2
docs/events/addEvent.md Normal file
View File

@@ -0,0 +1,2 @@
# `function` addEvent
::: g2o.events.addEvent

2
docs/events/callEvent.md Normal file
View File

@@ -0,0 +1,2 @@
# `function` callEvent
::: g2o.events.callEvent

2
docs/events/event.md Normal file
View File

@@ -0,0 +1,2 @@
# `function` event
::: g2o.events.event

View File

@@ -0,0 +1,2 @@
# `function` removeEventHandler
::: g2o.events.removeEventHandler

1
docs/index.md Normal file
View File

@@ -0,0 +1 @@
# Blank

View File

@@ -1,37 +0,0 @@
site_name: Squirrel Template Module - Docs
repo_url: https://gitlab.com/GothicMultiplayerTeam/modules/squirrel-template
repo_name: Squirrel Template Module
edit_uri: ""
site_dir: "public"
extra_css:
- stylesheets/extra.css
extra:
version:
provider: mike
markdown_extensions:
- admonition
- attr_list
- pymdownx.tabbed
- pymdownx.highlight
- pymdownx.superfences
theme:
name: material
logo: assets/logo.png
icon:
repo: fontawesome/brands/gitlab
palette:
- media: "(prefers-color-scheme: light)"
scheme: default
toggle:
icon: material/eye-outline
name: Switch to dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
toggle:
icon: material/eye
name: Switch to light mode

View File

@@ -1,3 +0,0 @@
mkdocs==1.5.3
mkdocs-material==9.5.12
mike==2.0.0