Change plugin type to just local and remote

This commit is contained in:
Ted John committed 2020-04-26 14:35:03 +01:00
1 parent 08cdb831af
commit 2890faee0a
4 files changed
+10 -22

No files matched your search

+1 -1
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);
}
+4 -6
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.");
}
+3 -8
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
+2 -7
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;
}
}