Revert "fix: fix crash"
This commit is contained in:
@@ -2,34 +2,15 @@
|
||||
|
||||
void Export_Compatibility_API() {
|
||||
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
|
||||
if (!isServerStarted) {
|
||||
return 0;
|
||||
}
|
||||
return GMLIB_Level::getLevel()->getServerMspt();
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getServerCurrentTps", []() -> float {
|
||||
if (!isServerStarted) {
|
||||
return 0;
|
||||
}
|
||||
return GMLIB_Level::getLevel()->getServerCurrentTps();
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getServerAverageTps", []() -> float {
|
||||
if (!isServerStarted) {
|
||||
return 0;
|
||||
}
|
||||
return GMLIB_Level::getLevel()->getServerAverageTps();
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getAllPlayerUuids", []() -> std::vector<std::string> {
|
||||
return GMLIB_Player::getAllUuids();
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getAllExperiments", []() -> std::vector<int> {
|
||||
return {6, 7, 8, 9, 10, 13, 16, 17, 18};
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getExperimentTranslatedName", [](int id) -> std::string {
|
||||
auto map = GMLIB_Level::getAllExperimentsTranslateKeys();
|
||||
if (map.count(id)) {
|
||||
return map[id];
|
||||
}
|
||||
return "";
|
||||
});
|
||||
}
|
||||
+1
-2
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
#include <RemoteCallAPI.h>
|
||||
#include <include_all.h>
|
||||
#include <RemoteCallAPI.h>
|
||||
|
||||
#define PLUGIN_NAME "GMLIB-LRCA"
|
||||
|
||||
extern ll::Logger logger;
|
||||
extern bool isServerStarted;
|
||||
|
||||
extern void Export_Legacy_GMLib_ModAPI();
|
||||
extern void Export_Legacy_GMLib_ServerAPI();
|
||||
|
||||
+1
-31
@@ -1,7 +1,7 @@
|
||||
#include "Global.h"
|
||||
|
||||
std::unordered_set<std::string> HardCodedKeys = {"AlwaysUnlocked", "PlayerHasManyItems", "PlayerInWater", "None"};
|
||||
std::unordered_set<int> ExperimentsList = {6, 7, 8, 9, 10, 13, 16, 17, 18};
|
||||
std::unordered_set<int> ExperimentsList = {6, 7, 8, 9, 10, 12, 15, 16};
|
||||
|
||||
std::variant<std::string, std::vector<RecipeIngredient>> makeRecipeUnlockingKey(std::string& key) {
|
||||
if (HardCodedKeys.count(key)) {
|
||||
@@ -23,9 +23,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
std::string result,
|
||||
int count,
|
||||
std::string unlock) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
std::vector<RecipeIngredient> types;
|
||||
for (auto ing : ingredients) {
|
||||
auto key = RecipeIngredient(ing, 0, 1);
|
||||
@@ -45,9 +42,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
std::string result,
|
||||
int count,
|
||||
std::string unlock) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
std::vector<RecipeIngredient> types;
|
||||
for (auto ing : ingredients) {
|
||||
auto key = RecipeIngredient(ing, 0, 1);
|
||||
@@ -62,9 +56,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
"GMLib_ModAPI",
|
||||
"registerFurnaceRecipe",
|
||||
[](std::string recipe_id, std::string input, std::string output, std::vector<std::string> tags) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
auto inp = RecipeIngredient(input, 0, 1);
|
||||
auto outp = RecipeIngredient(output, 0, 1);
|
||||
GMLIB::Mod::CustomRecipe::registerFurnaceRecipe(recipe_id, inp, outp, tags);
|
||||
@@ -74,9 +65,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
"GMLib_ModAPI",
|
||||
"registerBrewingMixRecipe",
|
||||
[](std::string recipe_id, std::string input, std::string output, std::string reagent) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
auto rea = RecipeIngredient(reagent, 0, 1);
|
||||
GMLIB::Mod::CustomRecipe::registerBrewingMixRecipe(recipe_id, input, output, rea);
|
||||
}
|
||||
@@ -85,9 +73,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
"GMLib_ModAPI",
|
||||
"registerBrewingContainerRecipe",
|
||||
[](std::string recipe_id, std::string input, std::string output, std::string reagent) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
auto inp = RecipeIngredient(input, 0, 1);
|
||||
auto outp = RecipeIngredient(output, 0, 1);
|
||||
auto rea = RecipeIngredient(reagent, 0, 1);
|
||||
@@ -102,9 +87,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
std::string base,
|
||||
std::string addition,
|
||||
std::string result) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
GMLIB::Mod::CustomRecipe::registerSmithingTransformRecipe(
|
||||
recipe_id,
|
||||
smithing_template,
|
||||
@@ -118,9 +100,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
"GMLib_ModAPI",
|
||||
"registerSmithingTrimRecipe",
|
||||
[](std::string recipe_id, std::string smithing_template, std::string base, std::string addition) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
GMLIB::Mod::CustomRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
|
||||
}
|
||||
);
|
||||
@@ -133,9 +112,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
std::string output,
|
||||
int output_data,
|
||||
int output_count) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
auto inp = RecipeIngredient(input, 0, 1);
|
||||
auto outp = RecipeIngredient(output, 0, 1);
|
||||
GMLIB::Mod::CustomRecipe::registerStoneCutterRecipe(recipe_id, inp, outp);
|
||||
@@ -154,17 +130,11 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
}
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ModAPI", "setExperimentEnabled", [](int experiment_id, bool value) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
if (ExperimentsList.count(experiment_id)) {
|
||||
GMLIB_Level::getLevel()->setExperimentEnabled(((AllExperiments)experiment_id), value);
|
||||
} else ll::Logger("Server").error("Experiment ID '{}' does not exist!", experiment_id);
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ModAPI", "getExperimentEnabled", [](int experiment_id) -> bool {
|
||||
if (!isServerStarted) {
|
||||
return false;
|
||||
}
|
||||
if (ExperimentsList.count(experiment_id)) {
|
||||
return GMLIB_Level::getLevel()->getExperimentEnabled(((AllExperiments)experiment_id));
|
||||
} else {
|
||||
|
||||
+29
-50
@@ -1,70 +1,49 @@
|
||||
#include "Global.h"
|
||||
|
||||
void Export_Legacy_GMLib_ServerAPI() {
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setEducationFeatureEnabled", []() -> void {
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setEducationFeatureEnabled", []() -> void {
|
||||
GMLIB_Level::addEducationEditionRequired();
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "registerAbilityCommand", []() -> void {
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "registerAbilityCommand", []() -> void {
|
||||
GMLIB_Level::forceEnableAbilityCommand();
|
||||
});
|
||||
RemoteCall::exportAs(
|
||||
"GMLib_ServerAPI",
|
||||
"addFloatingTextPacket",
|
||||
[](std::string text, std::pair<Vec3, int> pos, int dimid) -> int {
|
||||
if (!isServerStarted) {
|
||||
return -1;
|
||||
}
|
||||
auto ft = new GMLIB::Server::FloatingText(text, pos.first, pos.second);
|
||||
return ft->getRuntimeID();
|
||||
}
|
||||
);
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "deleteFloatingTextPacket", [](int id) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "addFloatingTextPacket", [](std::string text, std::pair<Vec3, int> pos, int dimid) -> int {
|
||||
auto ft = new GMLIB::Server::FloatingText(text, pos.first, pos.second);
|
||||
return ft->getRuntimeID();
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "deleteFloatingTextPacket", [](int id) -> void {
|
||||
GMLIB::Server::FloatingText::deleteFloatingText(id);
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setEnableAchievement", []() -> void {
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setEnableAchievement", []() -> void {
|
||||
GMLIB_Level::setForceAchievementsEnabled();
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setForceTrustSkins", []() -> void { GMLIB_Level::setForceTrustSkin(); });
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "enableCoResourcePack", []() -> void { GMLIB_Level::setCoResourcePack(); });
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "getLevelName", []() -> std::string {
|
||||
if (!isServerStarted) {
|
||||
return "";
|
||||
}
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setForceTrustSkins", []() -> void {
|
||||
GMLIB_Level::setForceTrustSkin();
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "enableCoResourcePack", []() -> void {
|
||||
GMLIB_Level::setCoResourcePack();
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "getLevelName", []() -> std::string {
|
||||
return GMLIB_Level::getLevel()->getLevelName();
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setLevelName", [](std::string name) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setLevelName", [](std::string name) -> void {
|
||||
GMLIB_Level::getLevel()->setLevelName(name);
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void {
|
||||
if (!isServerStarted) {
|
||||
return;
|
||||
}
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void {
|
||||
GMLIB_Level::getLevel()->setFakeSeed(seed);
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "spawnEntity", [](std::pair<Vec3, int> pos, std::string name) -> Actor* {
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "spawnEntity", [](std::pair<Vec3, int> pos, std::string name) -> Actor* {
|
||||
return GMLIB_Spawner::spawnEntity(pos.first, pos.second, name);
|
||||
});
|
||||
RemoteCall::exportAs(
|
||||
"GMLib_ServerAPI",
|
||||
"shootProjectile",
|
||||
[](Actor* owner, std::string name, float speed, float offset) -> Actor* {
|
||||
auto ac = (GMLIB_Actor*)owner;
|
||||
return ac->shootProjectile(name, speed, offset);
|
||||
}
|
||||
);
|
||||
RemoteCall::exportAs(
|
||||
"GMLib_ServerAPI",
|
||||
"throwEntity",
|
||||
[](Actor* owner, Actor* actor, float speed, float offset) -> bool {
|
||||
auto ac = (GMLIB_Actor*)owner;
|
||||
return ac->throwEntity(actor, speed, offset);
|
||||
}
|
||||
);
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "PlayerToEntity", [](Player* player) -> Actor* { return (Actor*)player; });
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "shootProjectile", [](Actor* owner, std::string name, float speed, float offset) -> Actor* {
|
||||
auto ac = (GMLIB_Actor*)owner;
|
||||
return ac->shootProjectile(name, speed, offset);
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "throwEntity", [](Actor* owner, Actor* actor, float speed, float offset) -> bool {
|
||||
auto ac = (GMLIB_Actor*)owner;
|
||||
return ac->throwEntity(actor, speed, offset);
|
||||
});
|
||||
RemoteCall::exportAs("GMLib_ServerAPI", "PlayerToEntity", [](Player* player) -> Actor* {
|
||||
return (Actor*)player;
|
||||
});
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "Global.h"
|
||||
|
||||
ll::Logger logger(PLUGIN_NAME);
|
||||
bool isServerStarted = false;
|
||||
|
||||
namespace plugin {
|
||||
|
||||
@@ -17,7 +16,6 @@ Plugin::Plugin(ll::plugin::NativePlugin& self) : mSelf(self) {
|
||||
}
|
||||
|
||||
bool Plugin::enable() {
|
||||
isServerStarted = true;
|
||||
// Code for enabling the plugin goes here.
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-2
@@ -15,8 +15,7 @@
|
||||
},
|
||||
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.8.0/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
||||
"dependencies": {
|
||||
"github.com/GroupMountain/GMLIB": ">=0.8.1",
|
||||
"github.com/LiteLDev/LegacyRemoteCall": "0.3.x"
|
||||
"github.com/GroupMountain/GMLIB": ">=0.8.0"
|
||||
},
|
||||
"files": {
|
||||
"place": [
|
||||
|
||||
Reference in New Issue
Block a user