1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 23:33:04 +01:00

Change plugin type to just local and remote

This commit is contained in:
Ted John
2020-02-24 17:40:36 +00:00
parent 08cdb831af
commit 2890faee0a
4 changed files with 10 additions and 22 deletions

View File

@@ -1483,7 +1483,7 @@ void Network::Server_Send_SCRIPTS(NetworkConnection& connection) const
for (const auto& plugin : plugins)
{
const auto& metadata = plugin->GetMetadata();
if (metadata.Type == OpenRCT2::Scripting::PluginType::ServerClient)
if (metadata.Type == OpenRCT2::Scripting::PluginType::Remote)
{
pluginsToSend.push_back(plugin);
}

View File

@@ -158,12 +158,10 @@ PluginMetadata Plugin::GetMetadata(const DukValue& dukMetadata)
PluginType Plugin::ParsePluginType(const std::string_view& type)
{
if (type == "server")
return PluginType::Server;
if (type == "client")
return PluginType::Client;
if (type == "server_client")
return PluginType::ServerClient;
if (type == "local")
return PluginType::Local;
if (type == "remote")
return PluginType::Remote;
throw std::invalid_argument("Unknown plugin type.");
}

View File

@@ -23,21 +23,16 @@ namespace OpenRCT2::Scripting
enum class PluginType
{
/**
* Scripts that can run on any client with no impact on the game state.
*/
Client,
/**
* Scripts that can run on servers with no impact on the game state and will not
* Scripts that can run on servers or clients with no impact on the game state and will not
* be uploaded to clients.
*/
Server,
Local,
/**
* Scripts that can run on servers and will be uploaded to clients with ability to
* modify game state in certain contexts.
*/
ServerClient,
Remote,
};
struct PluginMetadata

View File

@@ -271,14 +271,9 @@ bool ScriptEngine::ShouldStartPlugin(const std::shared_ptr<Plugin>& plugin)
{
// Only client plugins and plugins downloaded from server should be started
const auto& metadata = plugin->GetMetadata();
if (metadata.Type == PluginType::Server)
if (metadata.Type == PluginType::Remote && plugin->HasPath())
{
LogPluginInfo(plugin, "Server plugin not started");
return false;
}
else if (metadata.Type == PluginType::ServerClient && plugin->HasPath())
{
LogPluginInfo(plugin, "Server / client plugin not started");
LogPluginInfo(plugin, "Remote plugin not started");
return false;
}
}