This commit is contained in:
BotoX 2021-04-30 14:13:52 +02:00
parent d94fe1204f
commit 3d6c82227a
6 changed files with 56 additions and 33 deletions

View File

@ -5,21 +5,53 @@
* FFMPEG
* youtube-dl
* On game server:
* custom sourcemod
* sm-ext-AsyncSocket extension
* smjansson extension
* SMJSONAPI plugin
* sm-ext-Voice extension
* [custom sourcemod](https://github.com/BotoX/sourcemod)
* [sm-ext-AsyncSocket extension](https://git.botox.bz/CSSZombieEscape/sm-ext-AsyncSocket)
* [smjansson extension](https://forums.alliedmods.net/showthread.php?t=184604)
* [SMJSONAPI plugin](https://git.botox.bz/CSSZombieEscape/sm-plugins/src/branch/master/SMJSONAPI) or [here](https://cloud.botox.bz/s/TDRq7XwMFmW8NeQ)
* [sm-ext-Voice extension](https://git.botox.bz/CSSZombieEscape/sm-ext-Voice)
## 1. Install
* Install python3 and python-virtualenv
* Create a virtualenv: `virtualenv venv`
* Create a virtualenv: `python3 -m venv venv`
* Activate the virtualenv: `. venv/bin/activate`
* Install all dependencies: `pip install -r requirements.txt`
## 2. Usage
Set up game server stuff.
You need to have SourceTV enabled and use the vaudio_celt voice codec:
`cstrike/cfg/autoexec.cfg `
```
// Server Cvars
sv_consistency 0
sv_pure -1
// Source TV
tv_allow_camera_man 0
tv_autorecord 0
tv_delay 0
tv_enable 1
tv_maxclients 16
tv_maxrate 0
tv_name "TorchTV"
tv_transmitall 1
tv_chattimelimit 1
sv_voicecodec "vaudio_celt"
map de_dust2
```
Don't put `+map` into your startup cmdline.
Adapt config.json.
##### Make sure you are in the virtualenv! (`. venv/bin/activate`)
Run: `python main.py`
### Dectalk
* Install wine
* Run as normal user (not root)
* Run torchlight with: `xvfb-run -a python main.py`

View File

@ -80,7 +80,7 @@ class AsyncClient():
Data = json.dumps(obj, ensure_ascii = False, separators = (',', ':')).encode("UTF-8")
with (await self.SendLock):
async with self.SendLock:
if not self.Protocol:
return None

View File

@ -331,7 +331,7 @@ class OpenWeather(BaseCommand):
import geoip2.database
def __init__(self, torchlight):
super().__init__(torchlight)
self.GeoIP = self.geoip2.database.Reader("/usr/share/GeoIP/GeoLite2-City.mmdb")
self.GeoIP = self.geoip2.database.Reader("/var/lib/GeoIP/GeoLite2-City.mmdb")
self.Triggers = ["!w", "!vv"]
self.Level = 0
@ -713,7 +713,7 @@ class Say(BaseCommand):
asyncio.ensure_future(self.Say(player, Language, message[1]))
return 0
'''
class DECTalk(BaseCommand):
import tempfile
def __init__(self, torchlight):
@ -753,7 +753,7 @@ class DECTalk(BaseCommand):
asyncio.ensure_future(self.Say(player, message[1]))
return 0
'''
class Stop(BaseCommand):
def __init__(self, torchlight):

View File

@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-
import asyncio
import logging
import numpy
from .Constants import *
class PlayerManager():
@ -10,7 +9,7 @@ class PlayerManager():
self.Logger = logging.getLogger(__class__.__name__)
self.Torchlight = master
self.Players = numpy.empty(MAXPLAYERS + 1, dtype = object)
self.Players = [None] * (MAXPLAYERS + 1)
self.Storage = self.StorageManager(self)
self.Torchlight().GameEvents.HookEx("player_connect", self.Event_PlayerConnect)
@ -68,7 +67,7 @@ class PlayerManager():
self.Storage.Reset()
for i in range(1, self.Players.size):
for i in range(1, len(self.Players)):
if self.Players[i]:
self.Players[i].OnDisconnect("mapchange")
self.Players[i].OnConnect()
@ -90,7 +89,7 @@ class PlayerManager():
def __len__(self):
Count = 0
for i in range(1, self.Players.size):
for i in range(1, len(self.Players)):
if self.Players[i]:
Count += 1
return Count
@ -104,7 +103,7 @@ class PlayerManager():
return self.Players[key]
def __iter__(self):
for i in range(1, self.Players.size):
for i in range(1, len(self.Players)):
if self.Players[i]:
yield self.Players[i]

View File

@ -1,13 +1,13 @@
{
"VoiceServer":
{
"Host": "10.0.0.101",
"Host": "127.0.0.1",
"Port": 27020,
"SampleRate": 22050
},
"SMAPIServer":
{
"Host": "10.0.0.101",
"Host": "127.0.0.1",
"Port": 27021
},
@ -38,10 +38,16 @@
"ChatCooldown": 15
},
"Advertiser":
{
"MaxSpan": 30,
"AdStop": 10
},
"TorchRCON":
{
"Host": "0.0.0.0",
"Port": 27015,
"Port": 27115,
"Password": "***"
},

View File

@ -1,21 +1,7 @@
aiohttp
appdirs
async-timeout
beautifulsoup4
certifi
chardet
gTTS
gTTS-token
idna
lxml
multidict
numpy
olefile
packaging
Pillow
pyparsing
python-magic
requests
six
urllib3
yarl
geoip2