1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +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) for (const auto& plugin : plugins)
{ {
const auto& metadata = plugin->GetMetadata(); const auto& metadata = plugin->GetMetadata();
if (metadata.Type == OpenRCT2::Scripting::PluginType::ServerClient) if (metadata.Type == OpenRCT2::Scripting::PluginType::Remote)
{ {
pluginsToSend.push_back(plugin); pluginsToSend.push_back(plugin);
} }

View File

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

View File

@@ -23,21 +23,16 @@ namespace OpenRCT2::Scripting
enum class PluginType enum class PluginType
{ {
/** /**
* Scripts that can run on any client with no impact on the game state. * Scripts that can run on servers or clients with no impact on the game state and will not
*/
Client,
/**
* Scripts that can run on servers with no impact on the game state and will not
* be uploaded to clients. * be uploaded to clients.
*/ */
Server, Local,
/** /**
* Scripts that can run on servers and will be uploaded to clients with ability to * Scripts that can run on servers and will be uploaded to clients with ability to
* modify game state in certain contexts. * modify game state in certain contexts.
*/ */
ServerClient, Remote,
}; };
struct PluginMetadata 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 // Only client plugins and plugins downloaded from server should be started
const auto& metadata = plugin->GetMetadata(); const auto& metadata = plugin->GetMetadata();
if (metadata.Type == PluginType::Server) if (metadata.Type == PluginType::Remote && plugin->HasPath())
{ {
LogPluginInfo(plugin, "Server plugin not started"); LogPluginInfo(plugin, "Remote plugin not started");
return false;
}
else if (metadata.Type == PluginType::ServerClient && plugin->HasPath())
{
LogPluginInfo(plugin, "Server / client plugin not started");
return false; return false;
} }
} }