fix: fix api
This commit is contained in:
+1
-1
Submodule SDK-GMLIB updated: 72e596afb1...1a7e0ba55d
@@ -26,7 +26,12 @@ void Export_Compatibility_API() {
|
||||
return GMLIB_Player::getAllUuids();
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getAllExperiments", []() -> std::vector<int> {
|
||||
return {6, 7, 8, 9, 10, 13, 16, 17, 18};
|
||||
auto map = GMLIB_Level::getAllExperiments();
|
||||
std::vector<int> result;
|
||||
for (auto& key : map) {
|
||||
result.push_back(key.first);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getExperimentTranslatedName", [](int id) -> std::string {
|
||||
auto map = GMLIB_Level::getAllExperimentsTranslateKeys();
|
||||
@@ -35,4 +40,51 @@ void Export_Compatibility_API() {
|
||||
}
|
||||
return "";
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "createFloatingText", [](std::pair<Vec3, int> pos, std::string text) -> int64 {
|
||||
auto ft = new GMLIB::Server::FloatingText(text, pos.first, pos.second);
|
||||
return ft->getRuntimeID();
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "updateFloatingText", [](int64 id, std::string text) -> bool {
|
||||
auto ft = GMLIB::Server::FloatingText::getFloatingText(id);
|
||||
if (ft) {
|
||||
ft->setText(text);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "deleteFloatingText", [](int64 id) -> bool {
|
||||
return GMLIB::Server::FloatingText::deleteFloatingText(id);
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "sendFloatingTextToPlayer", [](int64 id, Player* pl) -> bool {
|
||||
auto ft = GMLIB::Server::FloatingText::getFloatingText(id);
|
||||
if (ft) {
|
||||
ft->sendToClient(pl);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "sendFloatingText", [](int64 id) -> bool {
|
||||
auto ft = GMLIB::Server::FloatingText::getFloatingText(id);
|
||||
if (ft) {
|
||||
ft->sendToAllClients();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "removeFloatingTextFromPlayer", [](int64 id, Player* pl) -> bool {
|
||||
auto ft = GMLIB::Server::FloatingText::getFloatingText(id);
|
||||
if (ft) {
|
||||
ft->removeFromClient(pl);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "removeFloatingText", [](int64 id) -> bool {
|
||||
auto ft = GMLIB::Server::FloatingText::getFloatingText(id);
|
||||
if (ft) {
|
||||
ft->removeFromAllClients();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
#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::variant<std::string, std::vector<RecipeIngredient>> makeRecipeUnlockingKey(std::string& key) {
|
||||
if (HardCodedKeys.count(key)) {
|
||||
@@ -155,7 +154,8 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
});
|
||||
// 实验性
|
||||
RemoteCall::exportAs("GMLib_ModAPI", "registerExperimentsRequire", [](int experiment_id) -> void {
|
||||
if (ExperimentsList.count(experiment_id)) {
|
||||
auto map = GMLIB_Level::getAllExperiments();
|
||||
if (map.count(experiment_id)) {
|
||||
GMLIB_Level::addExperimentsRequire((AllExperiments)experiment_id);
|
||||
} else {
|
||||
ll::Logger("Server").error("Experiment ID '{}' does not exist!", experiment_id);
|
||||
@@ -166,7 +166,8 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
if (!level) {
|
||||
return;
|
||||
}
|
||||
if (ExperimentsList.count(experiment_id)) {
|
||||
auto map = GMLIB_Level::getAllExperiments();
|
||||
if (map.count(experiment_id)) {
|
||||
GMLIB_Level::getLevel()->setExperimentEnabled(((AllExperiments)experiment_id), value);
|
||||
} else ll::Logger("Server").error("Experiment ID '{}' does not exist!", experiment_id);
|
||||
});
|
||||
@@ -175,7 +176,8 @@ void Export_Legacy_GMLib_ModAPI() {
|
||||
if (!level) {
|
||||
return false;
|
||||
}
|
||||
if (ExperimentsList.count(experiment_id)) {
|
||||
auto map = GMLIB_Level::getAllExperiments();
|
||||
if (map.count(experiment_id)) {
|
||||
return GMLIB_Level::getLevel()->getExperimentEnabled(((AllExperiments)experiment_id));
|
||||
} else {
|
||||
ll::Logger("Server").error("Experiment ID '{}' does not exist!", experiment_id);
|
||||
|
||||
@@ -7,17 +7,6 @@ void Export_Legacy_GMLib_ServerAPI() {
|
||||
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 {
|
||||
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 {
|
||||
GMLIB_Level::setForceAchievementsEnabled();
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"format_version": 2,
|
||||
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
||||
"version": "0.8.1",
|
||||
"version": "0.8.2",
|
||||
"info": {
|
||||
"name": "GMLIB-LegacyRemoteCallApi",
|
||||
"description": "Legacy RemoteCall API for GMLIB",
|
||||
@@ -13,7 +13,7 @@
|
||||
"Library"
|
||||
]
|
||||
},
|
||||
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.8.1/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
||||
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.8.2/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
||||
"dependencies": {
|
||||
"github.com/GroupMountain/GMLIB": ">=0.8.1"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user