refactor: remove shit copy
This commit is contained in:
+137
-73
@@ -6,7 +6,7 @@ bool isInteger(const std::string& str) {
|
|||||||
return std::regex_match(str, pattern);
|
return std::regex_match(str, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActorUniqueID parseScriptUniqueID(std::string uniqueId) {
|
ActorUniqueID parseScriptUniqueID(std::string const& uniqueId) {
|
||||||
if (!isInteger(uniqueId)) {
|
if (!isInteger(uniqueId)) {
|
||||||
return ActorUniqueID::INVALID_ID;
|
return ActorUniqueID::INVALID_ID;
|
||||||
}
|
}
|
||||||
@@ -14,14 +14,14 @@ ActorUniqueID parseScriptUniqueID(std::string uniqueId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Export_Compatibility_API() {
|
void Export_Compatibility_API() {
|
||||||
RemoteCall::exportAs("GMLIB_API", "unregisterRecipe", [](std::string id) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "unregisterRecipe", [](std::string const& id) -> bool {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return GMLIB::Mod::CustomRecipe::unregisterRecipe(id);
|
return GMLIB::Mod::CustomRecipe::unregisterRecipe(id);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "setCustomPackPath", [](std::string path) -> void {
|
RemoteCall::exportAs("GMLIB_API", "setCustomPackPath", [](std::string const& path) -> void {
|
||||||
GMLIB::Mod::CustomPacks::addCustomPackPath(path);
|
GMLIB::Mod::CustomPacks::addCustomPackPath(path);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
|
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
|
||||||
@@ -53,23 +53,27 @@ void Export_Compatibility_API() {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getPlayerNbt", [](std::string uuid) -> std::unique_ptr<CompoundTag> {
|
RemoteCall::exportAs("GMLIB_API", "getPlayerNbt", [](std::string const& uuid) -> std::unique_ptr<CompoundTag> {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return std::move(GMLIB_Player::getPlayerNbt(uid));
|
return std::move(GMLIB_Player::getPlayerNbt(uid));
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "setPlayerNbt", [](std::string uuid, CompoundTag* nbt, bool forceCreate) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"setPlayerNbt",
|
||||||
|
[](std::string const& uuid, CompoundTag* nbt, bool forceCreate) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return GMLIB_Player::setPlayerNbt(uid, *nbt, forceCreate);
|
return GMLIB_Player::setPlayerNbt(uid, *nbt, forceCreate);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"setPlayerNbtTags",
|
"setPlayerNbtTags",
|
||||||
[](std::string uuid, CompoundTag* nbt, std::vector<std::string> tags) -> bool {
|
[](std::string const& uuid, CompoundTag* nbt, std::vector<std::string> tags) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return GMLIB_Player::setPlayerNbtTags(uid, *nbt, tags);
|
return GMLIB_Player::setPlayerNbtTags(uid, *nbt, tags);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "deletePlayerNbt", [](std::string uuid) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "deletePlayerNbt", [](std::string const& uuid) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return GMLIB_Player::deletePlayerNbt(uid);
|
return GMLIB_Player::deletePlayerNbt(uid);
|
||||||
});
|
});
|
||||||
@@ -91,12 +95,12 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"createFloatingText",
|
"createFloatingText",
|
||||||
[](std::pair<Vec3, int> pos, std::string text, bool papi) -> int {
|
[](std::pair<Vec3, int> pos, std::string const& text, bool papi) -> int {
|
||||||
auto ft = new GMLIB::Server::StaticFloatingText(text, pos.first, pos.second, papi);
|
auto ft = new GMLIB::Server::StaticFloatingText(text, pos.first, pos.second, papi);
|
||||||
return ft->getRuntimeID();
|
return ft->getRuntimeID();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "setFloatingTextData", [](int id, std::string text) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "setFloatingTextData", [](int id, std::string const& text) -> bool {
|
||||||
auto ft = GMLIB::Server::FloatingText::getFloatingText(id);
|
auto ft = GMLIB::Server::FloatingText::getFloatingText(id);
|
||||||
if (ft) {
|
if (ft) {
|
||||||
ft->setText(text);
|
ft->setText(text);
|
||||||
@@ -166,16 +170,16 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"resourcePackDefaultTranslate",
|
"resourcePackDefaultTranslate",
|
||||||
[](std::string key, std::vector<std::string> params) -> std::string { return I18nAPI::get(key, params); }
|
[](std::string const& key, std::vector<std::string> params) -> std::string { return I18nAPI::get(key, params); }
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"resourcePackTranslate",
|
"resourcePackTranslate",
|
||||||
[](std::string key, std::vector<std::string> params, std::string code) -> std::string {
|
[](std::string const& key, std::vector<std::string> params, std::string const& code) -> std::string {
|
||||||
return I18nAPI::get(key, params, code);
|
return I18nAPI::get(key, params, code);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "chooseResourcePackI18nLanguage", [](std::string code) -> void {
|
RemoteCall::exportAs("GMLIB_API", "chooseResourcePackI18nLanguage", [](std::string const& code) -> void {
|
||||||
if (GMLIB_Level::getInstance()) {
|
if (GMLIB_Level::getInstance()) {
|
||||||
I18nAPI::chooseLanguage(code);
|
I18nAPI::chooseLanguage(code);
|
||||||
}
|
}
|
||||||
@@ -192,7 +196,7 @@ void Export_Compatibility_API() {
|
|||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "loadLanguage", [](std::string code, std::string lang) -> void {
|
RemoteCall::exportAs("GMLIB_API", "loadLanguage", [](std::string const& code, std::string const& lang) -> void {
|
||||||
if (GMLIB_Level::getInstance()) {
|
if (GMLIB_Level::getInstance()) {
|
||||||
I18nAPI::loadLanguage(code, lang);
|
I18nAPI::loadLanguage(code, lang);
|
||||||
}
|
}
|
||||||
@@ -200,18 +204,18 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"updateOrCreateLanguageFile",
|
"updateOrCreateLanguageFile",
|
||||||
[](std::string code, std::string lang, std::string path) -> void {
|
[](std::string const& code, std::string const& lang, std::string const& path) -> void {
|
||||||
if (GMLIB_Level::getInstance()) {
|
if (GMLIB_Level::getInstance()) {
|
||||||
I18nAPI::updateOrCreateLanguageFile(path, code, lang);
|
I18nAPI::updateOrCreateLanguageFile(path, code, lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "loadLanguagePath", [](std::string path) -> void {
|
RemoteCall::exportAs("GMLIB_API", "loadLanguagePath", [](std::string const& path) -> void {
|
||||||
if (GMLIB_Level::getInstance()) {
|
if (GMLIB_Level::getInstance()) {
|
||||||
I18nAPI::loadLanguagesFromDirectory(path);
|
I18nAPI::loadLanguagesFromDirectory(path);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getPlayerPosition", [](std::string uuid) -> std::pair<BlockPos, int> {
|
RemoteCall::exportAs("GMLIB_API", "getPlayerPosition", [](std::string const& uuid) -> std::pair<BlockPos, int> {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
auto pos = GMLIB_Player::getPlayerPosition(uid);
|
auto pos = GMLIB_Player::getPlayerPosition(uid);
|
||||||
if (pos.has_value()) {
|
if (pos.has_value()) {
|
||||||
@@ -222,78 +226,102 @@ void Export_Compatibility_API() {
|
|||||||
-1
|
-1
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "setPlayerPosition", [](std::string uuid, std::pair<BlockPos, int> pos) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"setPlayerPosition",
|
||||||
|
[](std::string const& uuid, std::pair<BlockPos, int> pos) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return GMLIB_Player::setPlayerPosition(uid, pos.first, pos.second);
|
return GMLIB_Player::setPlayerPosition(uid, pos.first, pos.second);
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "playerHasScore", [](std::string uuid, std::string obj) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "playerHasScore", [](std::string const& uuid, std::string const& obj) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
if (auto result = GMLIB_Player::getPlayerScore(uid, obj)) {
|
if (auto result = GMLIB_Player::getPlayerScore(uid, obj)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getPlayerScore", [](std::string uuid, std::string obj) -> int {
|
RemoteCall::exportAs("GMLIB_API", "getPlayerScore", [](std::string const& uuid, std::string const& obj) -> int {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
if (auto result = GMLIB_Player::getPlayerScore(uid, obj)) {
|
if (auto result = GMLIB_Player::getPlayerScore(uid, obj)) {
|
||||||
return result.value();
|
return result.value();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "addPlayerScore", [](std::string uuid, std::string obj, int value) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"addPlayerScore",
|
||||||
|
[](std::string const& uuid, std::string const& obj, int value) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
if (auto res = GMLIB_Player::setPlayerScore(uid, obj, value, PlayerScoreSetFunction::Add)) {
|
if (auto res = GMLIB_Player::setPlayerScore(uid, obj, value, PlayerScoreSetFunction::Add)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "reducePlayerScore", [](std::string uuid, std::string obj, int value) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"reducePlayerScore",
|
||||||
|
[](std::string const& uuid, std::string const& obj, int value) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
if (auto res = GMLIB_Player::setPlayerScore(uid, obj, value, PlayerScoreSetFunction::Subtract)) {
|
if (auto res = GMLIB_Player::setPlayerScore(uid, obj, value, PlayerScoreSetFunction::Subtract)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "setPlayerScore", [](std::string uuid, std::string obj, int value) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"setPlayerScore",
|
||||||
|
[](std::string const& uuid, std::string const& obj, int value) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
if (auto res = GMLIB_Player::setPlayerScore(uid, obj, value)) {
|
if (auto res = GMLIB_Player::setPlayerScore(uid, obj, value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "resetPlayerScore", [](std::string uuid, std::string obj) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "resetPlayerScore", [](std::string const& uuid, std::string const& obj) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return GMLIB_Player::resetPlayerScore(uid, obj);
|
return GMLIB_Player::resetPlayerScore(uid, obj);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "resetPlayerScores", [](std::string uuid) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "resetPlayerScores", [](std::string const& uuid) -> bool {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return GMLIB_Player::resetPlayerScore(uid);
|
return GMLIB_Player::resetPlayerScore(uid);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "entityHasScore", [](std::string uniqueId, std::string obj) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"entityHasScore",
|
||||||
|
[](std::string const& uniqueId, std::string const& obj) -> bool {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
if (auto result = GMLIB_Scoreboard::getInstance()->getScore(obj, auid)) {
|
if (auto result = GMLIB_Scoreboard::getInstance()->getScore(obj, auid)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "getEntityScore", [](std::string uniqueId, std::string obj) -> int {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getEntityScore", [](std::string const& uniqueId, std::string const& obj) -> int {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
if (auto result = GMLIB_Scoreboard::getInstance()->getScore(obj, auid)) {
|
if (auto result = GMLIB_Scoreboard::getInstance()->getScore(obj, auid)) {
|
||||||
return result.value();
|
return result.value();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "addEntityScore", [](std::string uniqueId, std::string obj, int value) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"addEntityScore",
|
||||||
|
[](std::string const& uniqueId, std::string const& obj, int value) -> bool {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
if (auto res = GMLIB_Scoreboard::getInstance()->setScore(obj, auid, value, PlayerScoreSetFunction::Add)) {
|
if (auto res = GMLIB_Scoreboard::getInstance()->setScore(obj, auid, value, PlayerScoreSetFunction::Add)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"reduceEntityScore",
|
"reduceEntityScore",
|
||||||
[](std::string uniqueId, std::string obj, int value) -> bool {
|
[](std::string const& uniqueId, std::string const& obj, int value) -> bool {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
if (auto res =
|
if (auto res =
|
||||||
GMLIB_Scoreboard::getInstance()->setScore(obj, auid, value, PlayerScoreSetFunction::Subtract)) {
|
GMLIB_Scoreboard::getInstance()->setScore(obj, auid, value, PlayerScoreSetFunction::Subtract)) {
|
||||||
@@ -302,43 +330,59 @@ void Export_Compatibility_API() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "setEntityScore", [](std::string uniqueId, std::string obj, int value) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"setEntityScore",
|
||||||
|
[](std::string const& uniqueId, std::string const& obj, int value) -> bool {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
if (auto res = GMLIB_Scoreboard::getInstance()->setScore(obj, auid, value)) {
|
if (auto res = GMLIB_Scoreboard::getInstance()->setScore(obj, auid, value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "resetEntityScore", [](std::string uniqueId, std::string obj) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"resetEntityScore",
|
||||||
|
[](std::string const& uniqueId, std::string const& obj) -> bool {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
return GMLIB_Scoreboard::getInstance()->resetScore(obj, auid);
|
return GMLIB_Scoreboard::getInstance()->resetScore(obj, auid);
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "resetEntityScores", [](std::string uniqueId) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "resetEntityScores", [](std::string const& uniqueId) -> bool {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
return GMLIB_Scoreboard::getInstance()->resetScore(auid);
|
return GMLIB_Scoreboard::getInstance()->resetScore(auid);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "fakePlayerHasScore", [](std::string name, std::string obj) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"fakePlayerHasScore",
|
||||||
|
[](std::string const& name, std::string const& obj) -> bool {
|
||||||
if (auto result = GMLIB_Scoreboard::getInstance()->getScore(obj, name)) {
|
if (auto result = GMLIB_Scoreboard::getInstance()->getScore(obj, name)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "getFakePlayerScore", [](std::string name, std::string obj) -> int {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getFakePlayerScore", [](std::string const& name, std::string const& obj) -> int {
|
||||||
if (auto result = GMLIB_Scoreboard::getInstance()->getScore(obj, name)) {
|
if (auto result = GMLIB_Scoreboard::getInstance()->getScore(obj, name)) {
|
||||||
return result.value();
|
return result.value();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "addFakePlayerScore", [](std::string name, std::string obj, int value) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"addFakePlayerScore",
|
||||||
|
[](std::string const& name, std::string const& obj, int value) -> bool {
|
||||||
if (auto res = GMLIB_Scoreboard::getInstance()->setScore(obj, name, value, PlayerScoreSetFunction::Add)) {
|
if (auto res = GMLIB_Scoreboard::getInstance()->setScore(obj, name, value, PlayerScoreSetFunction::Add)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"reduceFakePlayerScore",
|
"reduceFakePlayerScore",
|
||||||
[](std::string name, std::string obj, int value) -> bool {
|
[](std::string const& name, std::string const& obj, int value) -> bool {
|
||||||
if (auto res =
|
if (auto res =
|
||||||
GMLIB_Scoreboard::getInstance()->setScore(obj, name, value, PlayerScoreSetFunction::Subtract)) {
|
GMLIB_Scoreboard::getInstance()->setScore(obj, name, value, PlayerScoreSetFunction::Subtract)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -346,19 +390,27 @@ void Export_Compatibility_API() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "setFakePlayerScore", [](std::string name, std::string obj, int value) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"setFakePlayerScore",
|
||||||
|
[](std::string const& name, std::string const& obj, int value) -> bool {
|
||||||
if (auto res = GMLIB_Scoreboard::getInstance()->setScore(obj, name, value)) {
|
if (auto res = GMLIB_Scoreboard::getInstance()->setScore(obj, name, value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "resetFakePlayerScore", [](std::string name, std::string obj) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"resetFakePlayerScore",
|
||||||
|
[](std::string const& name, std::string const& obj) -> bool {
|
||||||
return GMLIB_Scoreboard::getInstance()->resetScore(obj, name);
|
return GMLIB_Scoreboard::getInstance()->resetScore(obj, name);
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "resetFakePlayerScores", [](std::string name) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "resetFakePlayerScores", [](std::string const& name) -> bool {
|
||||||
return GMLIB_Scoreboard::getInstance()->resetScore(name);
|
return GMLIB_Scoreboard::getInstance()->resetScore(name);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "addObjective", [](std::string obj) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "addObjective", [](std::string const& obj) -> bool {
|
||||||
if (auto res = GMLIB_Scoreboard::getInstance()->addObjective(obj)) {
|
if (auto res = GMLIB_Scoreboard::getInstance()->addObjective(obj)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -367,29 +419,37 @@ void Export_Compatibility_API() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"addObjectiveWithDisplayName",
|
"addObjectiveWithDisplayName",
|
||||||
[](std::string obj, std::string displayName) -> bool {
|
[](std::string const& obj, std::string const& displayName) -> bool {
|
||||||
if (auto res = GMLIB_Scoreboard::getInstance()->addObjective(obj, displayName)) {
|
if (auto res = GMLIB_Scoreboard::getInstance()->addObjective(obj, displayName)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "getDisplayName", [](std::string obj) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getDisplayName", [](std::string const& obj) -> std::string {
|
||||||
if (auto result = GMLIB_Scoreboard::getInstance()->getObjectiveDisplayName(obj)) {
|
if (auto result = GMLIB_Scoreboard::getInstance()->getObjectiveDisplayName(obj)) {
|
||||||
return result.value();
|
return result.value();
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "setDisplayName", [](std::string obj, std::string displayName) -> bool {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"setDisplayName",
|
||||||
|
[](std::string const& obj, std::string const& displayName) -> bool {
|
||||||
return GMLIB_Scoreboard::getInstance()->setObjectiveDisplayName(obj, displayName);
|
return GMLIB_Scoreboard::getInstance()->setObjectiveDisplayName(obj, displayName);
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "removeObjective", [](std::string obj) -> bool {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "removeObjective", [](std::string const& obj) -> bool {
|
||||||
return GMLIB_Scoreboard::getInstance()->removeObjective(obj);
|
return GMLIB_Scoreboard::getInstance()->removeObjective(obj);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "setDisplayObjective", [](std::string obj, std::string slot, int order) -> void {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"setDisplayObjective",
|
||||||
|
[](std::string const& obj, std::string const& slot, int order) -> void {
|
||||||
return GMLIB_Scoreboard::getInstance()->setObjectiveDisplay(obj, slot, (ObjectiveSortOrder)order);
|
return GMLIB_Scoreboard::getInstance()->setObjectiveDisplay(obj, slot, (ObjectiveSortOrder)order);
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "clearDisplayObjective", [](std::string slot) -> void {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "clearDisplayObjective", [](std::string const& slot) -> void {
|
||||||
return GMLIB_Scoreboard::getInstance()->clearObjectiveDisplay(slot);
|
return GMLIB_Scoreboard::getInstance()->clearObjectiveDisplay(slot);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getAllObjectives", []() -> std::vector<std::string> {
|
RemoteCall::exportAs("GMLIB_API", "getAllObjectives", []() -> std::vector<std::string> {
|
||||||
@@ -453,15 +513,15 @@ void Export_Compatibility_API() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "getPlayerFromUuid", [](std::string uuid) -> Player* {
|
RemoteCall::exportAs("GMLIB_API", "getPlayerFromUuid", [](std::string const& uuid) -> Player* {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
return ll::service::getLevel()->getPlayer(uuid);
|
return ll::service::getLevel()->getPlayer(uuid);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getPlayerFromUniqueId", [](std::string uniqueId) -> Actor* {
|
RemoteCall::exportAs("GMLIB_API", "getPlayerFromUniqueId", [](std::string const& uniqueId) -> Actor* {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
return ll::service::getLevel()->getPlayer(auid);
|
return ll::service::getLevel()->getPlayer(auid);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getEntityFromUniqueId", [](std::string uniqueId) -> Actor* {
|
RemoteCall::exportAs("GMLIB_API", "getEntityFromUniqueId", [](std::string const& uniqueId) -> Actor* {
|
||||||
auto auid = parseScriptUniqueID(uniqueId);
|
auto auid = parseScriptUniqueID(uniqueId);
|
||||||
return ll::service::getLevel()->fetchEntity(auid);
|
return ll::service::getLevel()->fetchEntity(auid);
|
||||||
});
|
});
|
||||||
@@ -488,39 +548,43 @@ void Export_Compatibility_API() {
|
|||||||
auto player = (GMLIB_Player*)pl;
|
auto player = (GMLIB_Player*)pl;
|
||||||
player->clearSpawnPoint();
|
player->clearSpawnPoint();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "mergePatchJson", [](std::string oldJson, std::string patchJson) -> std::string {
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"mergePatchJson",
|
||||||
|
[](std::string const& oldJson, std::string const& patchJson) -> std::string {
|
||||||
auto oldData = nlohmann::ordered_json::parse(oldJson);
|
auto oldData = nlohmann::ordered_json::parse(oldJson);
|
||||||
auto newData = nlohmann::ordered_json::parse(patchJson);
|
auto newData = nlohmann::ordered_json::parse(patchJson);
|
||||||
oldData.merge_patch(newData);
|
oldData.merge_patch(newData);
|
||||||
return oldData.dump();
|
return oldData.dump();
|
||||||
});
|
}
|
||||||
RemoteCall::exportAs("GMLIB_API", "getXuidByUuid", [](std::string uuid) -> std::string {
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getXuidByUuid", [](std::string const& uuid) -> std::string {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
auto result = GMLIB::UserCache::getXuidByUuid(uid);
|
auto result = GMLIB::UserCache::getXuidByUuid(uid);
|
||||||
return result ? result.value() : "";
|
return result ? result.value() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getNameByUuid", [](std::string uuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getNameByUuid", [](std::string const& uuid) -> std::string {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
auto result = GMLIB::UserCache::getNameByUuid(uid);
|
auto result = GMLIB::UserCache::getNameByUuid(uid);
|
||||||
return result ? result.value() : "";
|
return result ? result.value() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string xuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getUuidByXuid(xuid);
|
auto result = GMLIB::UserCache::getUuidByXuid(xuid);
|
||||||
return result ? result.value().asString() : "";
|
return result ? result.value().asString() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string xuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getNameByXuid(xuid);
|
auto result = GMLIB::UserCache::getNameByXuid(xuid);
|
||||||
return result ? result.value() : "";
|
return result ? result.value() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string name) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getXuidByName(name);
|
auto result = GMLIB::UserCache::getXuidByName(name);
|
||||||
return result ? result.value() : "";
|
return result ? result.value() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string name) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getUuidByName(name);
|
auto result = GMLIB::UserCache::getUuidByName(name);
|
||||||
return result ? result.value().asString() : "";
|
return result ? result.value().asString() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string name) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getUuidByName(name);
|
auto result = GMLIB::UserCache::getUuidByName(name);
|
||||||
return result ? result.value().asString() : "";
|
return result ? result.value().asString() : "";
|
||||||
});
|
});
|
||||||
@@ -539,7 +603,7 @@ void Export_Compatibility_API() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "getBlockRuntimeId", [](std::string blockName) -> uint {
|
RemoteCall::exportAs("GMLIB_API", "getBlockRuntimeId", [](std::string const& blockName) -> uint {
|
||||||
if (auto block = Block::tryGetFromRegistry(blockName)) {
|
if (auto block = Block::tryGetFromRegistry(blockName)) {
|
||||||
return block->getRuntimeId();
|
return block->getRuntimeId();
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-7
@@ -6,15 +6,16 @@ void Export_Event_API() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"callCustomEvent",
|
"callCustomEvent",
|
||||||
[eventBus](std::string eventName, std::string eventId) -> bool {
|
[eventBus](std::string const& eventName, std::string const& eventId) -> bool {
|
||||||
if (RemoteCall::hasFunc(eventName, eventId)) {
|
if (RemoteCall::hasFunc(eventName, eventId)) {
|
||||||
switch (doHash(eventName)) {
|
switch (doHash(eventName)) {
|
||||||
case doHash("onClientLogin"): {
|
case doHash("onClientLogin"): {
|
||||||
auto Call = RemoteCall::importAs<
|
auto Call = RemoteCall::importAs<bool(
|
||||||
bool(std::string realName, std::string uuid, std::string serverXuid, std::string clientXuid)>(
|
std::string const& realName,
|
||||||
eventName,
|
std::string const& uuid,
|
||||||
eventId
|
std::string const& serverXuid,
|
||||||
);
|
std::string const& clientXuid
|
||||||
|
)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<GMLIB::Event::PacketEvent::ClientLoginAfterEvent>(
|
eventBus->emplaceListener<GMLIB::Event::PacketEvent::ClientLoginAfterEvent>(
|
||||||
[Call](GMLIB::Event::PacketEvent::ClientLoginAfterEvent& ev) {
|
[Call](GMLIB::Event::PacketEvent::ClientLoginAfterEvent& ev) {
|
||||||
try {
|
try {
|
||||||
@@ -136,7 +137,8 @@ void Export_Event_API() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case doHash("onDeathMessage"): {
|
case doHash("onDeathMessage"): {
|
||||||
auto Call = RemoteCall::importAs<bool(std::string message, std::vector<std::string>, Actor * dead)>(
|
auto Call =
|
||||||
|
RemoteCall::importAs<bool(std::string const& message, std::vector<std::string>, Actor* dead)>(
|
||||||
eventName,
|
eventName,
|
||||||
eventId
|
eventId
|
||||||
);
|
);
|
||||||
|
|||||||
+27
-19
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
std::unordered_set<std::string> HardCodedKeys = {"AlwaysUnlocked", "PlayerHasManyItems", "PlayerInWater", "None"};
|
std::unordered_set<std::string> HardCodedKeys = {"AlwaysUnlocked", "PlayerHasManyItems", "PlayerInWater", "None"};
|
||||||
|
|
||||||
std::variant<std::string, std::vector<RecipeIngredient>> makeRecipeUnlockingKey(std::string& key) {
|
std::variant<std::string, std::vector<RecipeIngredient>> makeRecipeUnlockingKey(std::string const& key) {
|
||||||
if (HardCodedKeys.count(key)) {
|
if (HardCodedKeys.count(key)) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
@@ -17,11 +17,11 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
"registerShapelessRecipe",
|
"registerShapelessRecipe",
|
||||||
[](std::string recipe_id,
|
[](std::string const& recipe_id,
|
||||||
std::vector<std::string> ingredients,
|
std::vector<std::string> ingredients,
|
||||||
std::string result,
|
std::string const& result,
|
||||||
int count,
|
int count,
|
||||||
std::string unlock) -> void {
|
std::string const& unlock) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
@@ -39,12 +39,12 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
"registerShapedRecipe",
|
"registerShapedRecipe",
|
||||||
[](std::string recipe_id,
|
[](std::string const& recipe_id,
|
||||||
std::vector<std::string> shape,
|
std::vector<std::string> shape,
|
||||||
std::vector<std::string> ingredients,
|
std::vector<std::string> ingredients,
|
||||||
std::string result,
|
std::string const& result,
|
||||||
int count,
|
int count,
|
||||||
std::string unlock) -> void {
|
std::string const& unlock) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
@@ -62,7 +62,10 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
"registerFurnaceRecipe",
|
"registerFurnaceRecipe",
|
||||||
[](std::string recipe_id, std::string input, std::string output, std::vector<std::string> tags) -> void {
|
[](std::string const& recipe_id,
|
||||||
|
std::string const& input,
|
||||||
|
std::string const& output,
|
||||||
|
std::vector<std::string> tags) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
@@ -75,7 +78,8 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
"registerBrewingMixRecipe",
|
"registerBrewingMixRecipe",
|
||||||
[](std::string recipe_id, std::string input, std::string output, std::string reagent) -> void {
|
[](std::string const& recipe_id, std::string const& input, std::string const& output, std::string const& reagent
|
||||||
|
) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
@@ -87,7 +91,8 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
"registerBrewingContainerRecipe",
|
"registerBrewingContainerRecipe",
|
||||||
[](std::string recipe_id, std::string input, std::string output, std::string reagent) -> void {
|
[](std::string const& recipe_id, std::string const& input, std::string const& output, std::string const& reagent
|
||||||
|
) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
@@ -101,11 +106,11 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
"registerSmithingTransformRecipe",
|
"registerSmithingTransformRecipe",
|
||||||
[](std::string recipe_id,
|
[](std::string const& recipe_id,
|
||||||
std::string smithing_template,
|
std::string const& smithing_template,
|
||||||
std::string base,
|
std::string const& base,
|
||||||
std::string addition,
|
std::string const& addition,
|
||||||
std::string result) -> void {
|
std::string const& result) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
@@ -122,7 +127,10 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
"registerSmithingTrimRecipe",
|
"registerSmithingTrimRecipe",
|
||||||
[](std::string recipe_id, std::string smithing_template, std::string base, std::string addition) -> void {
|
[](std::string const& recipe_id,
|
||||||
|
std::string const& smithing_template,
|
||||||
|
std::string const& base,
|
||||||
|
std::string const& addition) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
@@ -133,10 +141,10 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
"registerStoneCutterRecipe",
|
"registerStoneCutterRecipe",
|
||||||
[](std::string recipe_id,
|
[](std::string const& recipe_id,
|
||||||
std::string input,
|
std::string const& input,
|
||||||
int input_data,
|
int input_data,
|
||||||
std::string output,
|
std::string const& output,
|
||||||
int output_data,
|
int output_data,
|
||||||
int output_count) -> void {
|
int output_count) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
|
|||||||
+21
-7
@@ -23,7 +23,7 @@ void Export_Legacy_GMLib_ServerAPI() {
|
|||||||
}
|
}
|
||||||
return level->getLevelName();
|
return level->getLevelName();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "setLevelName", [](std::string name) -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "setLevelName", [](std::string const& name) -> void {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
@@ -33,13 +33,17 @@ void Export_Legacy_GMLib_ServerAPI() {
|
|||||||
RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "setFakeSeed", [](int64_t seed) -> void {
|
||||||
return GMLIB_Level::setFakeSeed(seed);
|
return GMLIB_Level::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 const& 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",
|
"GMLib_ServerAPI",
|
||||||
"shootProjectile",
|
"shootProjectile",
|
||||||
[](Actor* owner, std::string name, float speed, float offset) -> Actor* {
|
[](Actor* owner, std::string const& name, float speed, float offset) -> Actor* {
|
||||||
auto ac = (GMLIB_Actor*)owner;
|
auto ac = (GMLIB_Actor*)owner;
|
||||||
return ac->shootProjectile(name, speed, offset);
|
return ac->shootProjectile(name, speed, offset);
|
||||||
}
|
}
|
||||||
@@ -53,7 +57,17 @@ void Export_Legacy_GMLib_ServerAPI() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "PlayerToEntity", [](Player* player) -> Actor* { return (Actor*)player; });
|
RemoteCall::exportAs("GMLib_ServerAPI", "PlayerToEntity", [](Player* player) -> Actor* { return (Actor*)player; });
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "addFakeList", [](const std::string& xuid,const std::string& name) -> bool { return GMLIB::Server::FakeList::addFakeList(name,xuid,ActorUniqueID(-1)); });
|
RemoteCall::exportAs(
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "removeFakeList", [](const std::string& nameOrXuid) -> bool { return GMLIB::Server::FakeList::removeFakeList(nameOrXuid); });
|
"GMLib_ServerAPI",
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "removeAllFakeList", []() -> void { return GMLIB::Server::FakeList::removeAllFakeLists(); });
|
"addFakeList",
|
||||||
|
[](const std::string& xuid, const std::string& name) -> bool {
|
||||||
|
return GMLIB::Server::FakeList::addFakeList(name, xuid, ActorUniqueID(-1));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
RemoteCall::exportAs("GMLib_ServerAPI", "removeFakeList", [](const std::string& nameOrXuid) -> bool {
|
||||||
|
return GMLIB::Server::FakeList::removeFakeList(nameOrXuid);
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLib_ServerAPI", "removeAllFakeList", []() -> void {
|
||||||
|
return GMLIB::Server::FakeList::removeAllFakeLists();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ std::string removeBrackets(std::string a1) {
|
|||||||
return a1;
|
return a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isParameters(std::string str) {
|
bool isParameters(std::string const& str) {
|
||||||
std::regex reg("[<]([^<>]+)[>]");
|
std::regex reg("[<]([^<>]+)[>]");
|
||||||
return std::regex_search(removeBrackets(str), reg);
|
return std::regex_search(removeBrackets(str), reg);
|
||||||
}
|
}
|
||||||
@@ -64,11 +64,7 @@ bool registerServerPlaceholder(
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
auto Call = RemoteCall::importAs<std::string()>(PluginName, FuncName);
|
auto Call = RemoteCall::importAs<std::string()>(PluginName, FuncName);
|
||||||
GMLIB::Server::PlaceholderAPI::registerServerPlaceholder(
|
GMLIB::Server::PlaceholderAPI::registerServerPlaceholder(PAPIName, [Call]() { return Call(); }, PluginName);
|
||||||
PAPIName,
|
|
||||||
[Call]() { return Call(); },
|
|
||||||
PluginName
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user