Merge pull request #667 from MihailRis/more-about-projects
More about projects (part 3)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "audio/audio.hpp"
|
||||
#include "assets/Assets.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "api_lua.hpp"
|
||||
|
||||
inline const char* DEFAULT_CHANNEL = "regular";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "content/Content.hpp"
|
||||
#include "content/ContentControl.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "io/engine_paths.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "io/io.hpp"
|
||||
#include "io/settings_io.hpp"
|
||||
#include "frontend/menu.hpp"
|
||||
@@ -43,7 +43,16 @@ static int l_reset_content(lua::State* L) {
|
||||
if (level != nullptr) {
|
||||
throw std::runtime_error("world must be closed before");
|
||||
}
|
||||
content_control->resetContent();
|
||||
std::vector<std::string> nonResetPacks;
|
||||
if (lua::istable(L, 1)) {
|
||||
int len = lua::objlen(L, 1);
|
||||
for (int i = 0; i < len; i++) {
|
||||
lua::rawgeti(L, i + 1, 1);
|
||||
nonResetPacks.emplace_back(lua::require_lstring(L, -1));
|
||||
lua::pop(L);
|
||||
}
|
||||
}
|
||||
content_control->resetContent(std::move(nonResetPacks));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "content/Content.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "objects/Entities.hpp"
|
||||
#include "objects/EntityDef.hpp"
|
||||
#include "objects/Entity.hpp"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "coders/gzip.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "io/engine_paths.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "io/io.hpp"
|
||||
#include "io/devices/ZipFileDevice.hpp"
|
||||
#include "util/stringutil.hpp"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "content/Content.hpp"
|
||||
#include "content/ContentControl.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "../lua_custom_types.hpp"
|
||||
|
||||
using namespace scripting;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "graphics/ui/elements/Menu.hpp"
|
||||
#include "frontend/locale.hpp"
|
||||
#include "world/files/WorldFiles.hpp"
|
||||
#include "io/engine_paths.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "world/Level.hpp"
|
||||
#include "world/World.hpp"
|
||||
#include "api_lua.hpp"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "content/ContentControl.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "world/files/WorldFiles.hpp"
|
||||
#include "io/engine_paths.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "io/io.hpp"
|
||||
#include "lighting/Lighting.hpp"
|
||||
#include "voxels/Chunk.hpp"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "io/io.hpp"
|
||||
#include "io/engine_paths.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "debug/Logger.hpp"
|
||||
#include "util/stringutil.hpp"
|
||||
#include "libs/api_lua.hpp"
|
||||
|
||||
@@ -336,6 +336,22 @@ int lua::create_environment(State* L, int parent) {
|
||||
return id;
|
||||
}
|
||||
|
||||
int lua::restore_pack_environment(lua::State* L, const std::string& packid) {
|
||||
if(!lua::getglobal(L, "__vc__pack_envs")) {
|
||||
return -1;
|
||||
}
|
||||
int id = nextEnvironment++;
|
||||
|
||||
if (lua::getfield(L, packid)) {
|
||||
// envname = env
|
||||
setglobal(L, env_name(id));
|
||||
lua::pop(L);
|
||||
return id;
|
||||
}
|
||||
lua::pop(L);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void lua::remove_environment(State* L, int id) {
|
||||
if (id == 0) {
|
||||
return;
|
||||
|
||||
@@ -614,6 +614,7 @@ namespace lua {
|
||||
return 0;
|
||||
}
|
||||
int create_environment(lua::State*, int parent);
|
||||
int restore_pack_environment(lua::State*, const std::string& packid);
|
||||
void remove_environment(lua::State*, int id);
|
||||
|
||||
inline void close(lua::State* L) {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "graphics/core/ImageData.hpp"
|
||||
#include "maths/Heightmap.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
#include "engine/EnginePaths.hpp"
|
||||
#include "../lua_util.hpp"
|
||||
|
||||
using namespace lua;
|
||||
|
||||
Reference in New Issue
Block a user