Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ void CLuaResourceDefs::LoadFunctions()
{"getResourceExportedFunctions", getResourceExportedFunctions},
{"getResourceOrganizationalPath", getResourceOrganizationalPath},
{"isResourceArchived", isResourceArchived},
{"isResourceProtected", isResourceProtected},

// Set stuff
{"setResourceInfo", setResourceInfo},
Expand Down Expand Up @@ -121,6 +122,7 @@ void CLuaResourceDefs::AddClass(lua_State* luaVM)
lua_classfunction(luaVM, "getState", "getResourceState");
lua_classfunction(luaVM, "getACLRequests", "getResourceACLRequests");
lua_classfunction(luaVM, "isArchived", "isResourceArchived");
lua_classfunction(luaVM, "isProtected", "isResourceProtected");

lua_classvariable(luaVM, "dynamicElementRoot", NULL, "getResourceDynamicElementRoot");
lua_classvariable(luaVM, "exportedFunctions", NULL, "getResourceExportedFunctions");
Expand All @@ -132,6 +134,7 @@ void CLuaResourceDefs::AddClass(lua_State* luaVM)
lua_classvariable(luaVM, "rootElement", NULL, "getResourceRootElement");
lua_classvariable(luaVM, "state", NULL, "getResourceState");
lua_classvariable(luaVM, "archived", NULL, "isResourceArchived");
lua_classvariable(luaVM, "protected", nullptr, "isResourceProtected");
lua_classvariable(luaVM, "loadFailureReason", NULL, "getResourceLoadFailureReason");
// lua_classvariable ( luaVM, "info", "setResourceInfo", "getResourceInfo", CLuaOOPDefs::SetResourceInfo, CLuaOOPDefs::GetResourceInfo ); // .key[value]
// lua_classvariable ( luaVM, "defaultSetting", "setResourceDefaultSetting", NULL, CLuaOOPDefs::SetResourceDefaultSetting, NULL ); // .key[value]
Expand Down Expand Up @@ -1462,3 +1465,18 @@ int CLuaResourceDefs::isResourceArchived(lua_State* luaVM)
lua_pushnil(luaVM);
return 1;
}

int CLuaResourceDefs::isResourceProtected(lua_State* luaVM)
{
// bool isResourceProtected ( resource theResource )
CResource* pResource;

CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pResource);

if (argStream.HasErrors())
return luaL_error(luaVM, argStream.GetFullErrorMessage());

lua_pushboolean(luaVM, pResource->IsProtected());
return 1;
}
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class CLuaResourceDefs : public CLuaDefs
LUA_DECLARE(getResourceExportedFunctions);
LUA_DECLARE(getResourceOrganizationalPath);
LUA_DECLARE(isResourceArchived);
LUA_DECLARE(isResourceProtected);

// Set stuff
LUA_DECLARE(setResourceInfo);
Expand Down