Compare commits
13 Commits
@@ -7,6 +7,11 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: xmake-io/github-action-setup-xmake@v1
|
- uses: xmake-io/github-action-setup-xmake@v1
|
||||||
|
|||||||
+1
-1
Submodule SDK-GMLIB updated: 1c2918e15d...72e596afb1
@@ -2,15 +2,37 @@
|
|||||||
|
|
||||||
void Export_Compatibility_API() {
|
void Export_Compatibility_API() {
|
||||||
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
|
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
|
||||||
return GMLIB_Level::getLevel()->getServerMspt();
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
return level->getServerMspt();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getServerCurrentTps", []() -> float {
|
RemoteCall::exportAs("GMLIB_API", "getServerCurrentTps", []() -> float {
|
||||||
return GMLIB_Level::getLevel()->getServerCurrentTps();
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
return level->getServerCurrentTps();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getServerAverageTps", []() -> float {
|
RemoteCall::exportAs("GMLIB_API", "getServerAverageTps", []() -> float {
|
||||||
return GMLIB_Level::getLevel()->getServerAverageTps();
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
return level->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 "";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
+41
-1
@@ -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, 12, 15, 16};
|
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) {
|
std::variant<std::string, std::vector<RecipeIngredient>> makeRecipeUnlockingKey(std::string& key) {
|
||||||
if (HardCodedKeys.count(key)) {
|
if (HardCodedKeys.count(key)) {
|
||||||
@@ -23,6 +23,10 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
std::string result,
|
std::string result,
|
||||||
int count,
|
int count,
|
||||||
std::string unlock) -> void {
|
std::string unlock) -> void {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
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);
|
||||||
@@ -42,6 +46,10 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
std::string result,
|
std::string result,
|
||||||
int count,
|
int count,
|
||||||
std::string unlock) -> void {
|
std::string unlock) -> void {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
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);
|
||||||
@@ -56,6 +64,10 @@ 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 {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
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);
|
||||||
@@ -65,6 +77,10 @@ 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 {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
@@ -73,6 +89,10 @@ 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 {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
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);
|
||||||
@@ -87,6 +107,10 @@ 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 {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
GMLIB::Mod::CustomRecipe::registerSmithingTransformRecipe(
|
GMLIB::Mod::CustomRecipe::registerSmithingTransformRecipe(
|
||||||
recipe_id,
|
recipe_id,
|
||||||
smithing_template,
|
smithing_template,
|
||||||
@@ -100,6 +124,10 @@ 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 {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
GMLIB::Mod::CustomRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
|
GMLIB::Mod::CustomRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -112,6 +140,10 @@ 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 {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
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);
|
||||||
@@ -130,11 +162,19 @@ 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 {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
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 {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
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 {
|
||||||
|
|||||||
+51
-33
@@ -1,49 +1,67 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
|
||||||
void Export_Legacy_GMLib_ServerAPI() {
|
void Export_Legacy_GMLib_ServerAPI() {
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "setEducationFeatureEnabled", []() -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "setEducationFeatureEnabled", []() -> void {
|
||||||
GMLIB_Level::addEducationEditionRequired();
|
GMLIB_Level::addEducationEditionRequired();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "registerAbilityCommand", []() -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "registerAbilityCommand", []() -> void {
|
||||||
GMLIB_Level::forceEnableAbilityCommand();
|
GMLIB_Level::forceEnableAbilityCommand();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "addFloatingTextPacket", [](std::string text, std::pair<Vec3, int> pos, int dimid) -> int {
|
RemoteCall::exportAs(
|
||||||
auto ft = new FloatingText(text, pos.first, pos.second);
|
"GMLib_ServerAPI",
|
||||||
return ft->mRuntimeId;
|
"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", "deleteFloatingTextPacket", [](int id) -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "setEnableAchievement", []() -> void {
|
||||||
FloatingText::deleteFloatingText(id);
|
|
||||||
});
|
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "setEnableAchievement", []() -> void {
|
|
||||||
GMLIB_Level::setForceAchievementsEnabled();
|
GMLIB_Level::setForceAchievementsEnabled();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "setForceTrustSkins", []() -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "setForceTrustSkins", []() -> void { GMLIB_Level::setForceTrustSkin(); });
|
||||||
GMLIB_Level::setForceTrustSkin();
|
RemoteCall::exportAs("GMLib_ServerAPI", "enableCoResourcePack", []() -> void { GMLIB_Level::setCoResourcePack(); });
|
||||||
|
RemoteCall::exportAs("GMLib_ServerAPI", "getLevelName", []() -> std::string {
|
||||||
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return level->getLevelName();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "enableCoResourcePack", []() -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "setLevelName", [](std::string name) -> void {
|
||||||
GMLIB_Level::setCoResourcePack();
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return level->setLevelName(name);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "getLevelName", []() -> std::string {
|
RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void {
|
||||||
return GMLIB_Level::getLevel()->getLevelName();
|
auto level = GMLIB_Level::getLevel();
|
||||||
|
if (!level) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return level->setFakeSeed(seed);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "setLevelName", [](std::string name) -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "spawnEntity", [](std::pair<Vec3, int> pos, std::string name) -> Actor* {
|
||||||
GMLIB_Level::getLevel()->setLevelName(name);
|
|
||||||
});
|
|
||||||
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* {
|
|
||||||
return GMLIB_Spawner::spawnEntity(pos.first, pos.second, name);
|
return GMLIB_Spawner::spawnEntity(pos.first, pos.second, name);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "shootProjectile", [](Actor* owner, std::string name, float speed, float offset) -> Actor* {
|
RemoteCall::exportAs(
|
||||||
auto ac = (GMLIB_Actor*)owner;
|
"GMLib_ServerAPI",
|
||||||
return ac->shootProjectile(name, speed, offset);
|
"shootProjectile",
|
||||||
});
|
[](Actor* owner, std::string name, float speed, float offset) -> Actor* {
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "throwEntity", [](Actor* owner, Actor* actor, float speed, float offset) -> bool {
|
auto ac = (GMLIB_Actor*)owner;
|
||||||
auto ac = (GMLIB_Actor*)owner;
|
return ac->shootProjectile(name, speed, offset);
|
||||||
return ac->throwEntity(actor, speed, offset);
|
}
|
||||||
});
|
);
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "PlayerToEntity", [](Player* player) -> Actor* {
|
RemoteCall::exportAs(
|
||||||
return (Actor*)player;
|
"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; });
|
||||||
}
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"format_version": 2,
|
||||||
|
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
||||||
|
"version": "0.8.1",
|
||||||
|
"info": {
|
||||||
|
"name": "GMLIB-LegacyRemoteCallApi",
|
||||||
|
"description": "Legacy RemoteCall API for GMLIB",
|
||||||
|
"author": "GroupMountain",
|
||||||
|
"tags": [
|
||||||
|
"LeviLamina",
|
||||||
|
"GMLIB",
|
||||||
|
"GMLIB-LegacyRemoteCallApi",
|
||||||
|
"Library"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.8.1/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
||||||
|
"dependencies": {
|
||||||
|
"github.com/GroupMountain/GMLIB": ">=0.8.1"
|
||||||
|
},
|
||||||
|
"files": {
|
||||||
|
"place": [
|
||||||
|
{
|
||||||
|
"src": "GMLIB-LegacyRemoteCallApi/*",
|
||||||
|
"dest": "plugins/GMLIB-LegacyRemoteCallApi"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user