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