forked from mirror/openmw-tes3mp
[Master] Init BanAddress/UnbanAddress before opening script
This commit is contained in:
parent
dc18916f46
commit
bb183457a6
1 changed files with 3 additions and 6 deletions
|
@ -29,6 +29,9 @@ MasterServer::MasterServer(const std::string &luaScript)
|
||||||
std::string package_path = state["package"]["path"];
|
std::string package_path = state["package"]["path"];
|
||||||
state["package"]["path"] = Utils::convertPath(absPath.parent_path().string() + "/?.lua") + ";" + package_path;
|
state["package"]["path"] = Utils::convertPath(absPath.parent_path().string() + "/?.lua") + ";" + package_path;
|
||||||
|
|
||||||
|
state.set_function("BanAddress", &MasterServer::ban, this);
|
||||||
|
state.set_function("UnbanAddress", &MasterServer::unban, this);
|
||||||
|
|
||||||
state.script_file(luaScript);
|
state.script_file(luaScript);
|
||||||
|
|
||||||
sol::table config = state["config"];
|
sol::table config = state["config"];
|
||||||
|
@ -44,18 +47,12 @@ MasterServer::MasterServer(const std::string &luaScript)
|
||||||
if (port.get_type() != sol::type::number)
|
if (port.get_type() != sol::type::number)
|
||||||
throw runtime_error("config.port is not correct");
|
throw runtime_error("config.port is not correct");
|
||||||
|
|
||||||
state.set_function("BanAddress", [this](const string &address) {
|
|
||||||
this->ban(address);
|
|
||||||
});
|
|
||||||
state.new_usertype<MasterServer::SServer>("Server",
|
state.new_usertype<MasterServer::SServer>("Server",
|
||||||
"name", sol::property(&MasterServer::SServer::GetName),
|
"name", sol::property(&MasterServer::SServer::GetName),
|
||||||
"gamemode", sol::property(&MasterServer::SServer::GetGameMode),
|
"gamemode", sol::property(&MasterServer::SServer::GetGameMode),
|
||||||
"version", sol::property(&MasterServer::SServer::GetVersion)
|
"version", sol::property(&MasterServer::SServer::GetVersion)
|
||||||
);
|
);
|
||||||
|
|
||||||
state.set_function("UnbanAddress", [this](const string &address) {
|
|
||||||
this->unban(address);
|
|
||||||
});
|
|
||||||
|
|
||||||
peer = RakPeerInterface::GetInstance();
|
peer = RakPeerInterface::GetInstance();
|
||||||
sockdescr = SocketDescriptor(port.as<unsigned short>(), nullptr);
|
sockdescr = SocketDescriptor(port.as<unsigned short>(), nullptr);
|
||||||
|
|
Loading…
Reference in a new issue