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 * FFMPEG
* youtube-dl * youtube-dl
* On game server: * On game server:
* custom sourcemod * [custom sourcemod](https://github.com/BotoX/sourcemod)
* sm-ext-AsyncSocket extension * [sm-ext-AsyncSocket extension](https://git.botox.bz/CSSZombieEscape/sm-ext-AsyncSocket)
* smjansson extension * [smjansson extension](https://forums.alliedmods.net/showthread.php?t=184604)
* SMJSONAPI plugin * [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 * [sm-ext-Voice extension](https://git.botox.bz/CSSZombieEscape/sm-ext-Voice)
## 1. Install ## 1. Install
* Install python3 and python-virtualenv * Install python3 and python-virtualenv
* Create a virtualenv: `virtualenv venv` * Create a virtualenv: `python3 -m venv venv`
* Activate the virtualenv: `. venv/bin/activate` * Activate the virtualenv: `. venv/bin/activate`
* Install all dependencies: `pip install -r requirements.txt` * Install all dependencies: `pip install -r requirements.txt`
## 2. Usage ## 2. Usage
Set up game server stuff. 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. Adapt config.json.
##### Make sure you are in the virtualenv! (`. venv/bin/activate`) ##### Make sure you are in the virtualenv! (`. venv/bin/activate`)
Run: `python main.py` 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") Data = json.dumps(obj, ensure_ascii = False, separators = (',', ':')).encode("UTF-8")
with (await self.SendLock): async with self.SendLock:
if not self.Protocol: if not self.Protocol:
return None return None

View File

@ -331,7 +331,7 @@ class OpenWeather(BaseCommand):
import geoip2.database import geoip2.database
def __init__(self, torchlight): def __init__(self, torchlight):
super().__init__(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.Triggers = ["!w", "!vv"]
self.Level = 0 self.Level = 0
@ -713,7 +713,7 @@ class Say(BaseCommand):
asyncio.ensure_future(self.Say(player, Language, message[1])) asyncio.ensure_future(self.Say(player, Language, message[1]))
return 0 return 0
'''
class DECTalk(BaseCommand): class DECTalk(BaseCommand):
import tempfile import tempfile
def __init__(self, torchlight): def __init__(self, torchlight):
@ -753,7 +753,7 @@ class DECTalk(BaseCommand):
asyncio.ensure_future(self.Say(player, message[1])) asyncio.ensure_future(self.Say(player, message[1]))
return 0 return 0
'''
class Stop(BaseCommand): class Stop(BaseCommand):
def __init__(self, torchlight): def __init__(self, torchlight):

View File

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

View File

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

View File

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