From 5da75f766a1d2d45a820f7c72f87059bc7d1095f Mon Sep 17 00:00:00 2001 From: luttje <2738114+luttje@users.noreply.github.com> Date: Thu, 15 Aug 2024 16:26:35 +0200 Subject: [PATCH] fix enum casing --- ...{activation_type.md => ACTIVATION_TYPE.MD} | 0 .../enumerations/{activity.md => ACTIVITY.MD} | 0 .../enumerations/{ai_class.md => AI_CLASS.MD} | 0 .../{auto_resize.md => AUTO_RESIZE.MD} | 0 .../{blood_color.md => BLOOD_COLOR.MD} | 0 docs/enumerations/{button.md => BUTTON.MD} | 0 .../{collide_type.md => COLLIDE_TYPE.MD} | 0 ...{collision_group.md => COLLISION_GROUP.MD} | 0 .../enumerations/{contents.md => CONTENTS.MD} | 0 .../{dock_type.md => DOCK_TYPE.MD} | 0 .../{edict_flag.md => EDICT_FLAG.MD} | 0 .../{engine_flag.md => ENGINE_FLAG.MD} | 0 .../{entity_effect.md => ENTITY_EFFECT.MD} | 0 .../{entity_flag.md => ENTITY_FLAG.MD} | 0 docs/enumerations/{fcvar.md => FCVAR.MD} | 0 ...warning_level.md => FILE_WARNING_LEVEL.MD} | 0 .../{font_draw_type.md => FONT_DRAW_TYPE.MD} | 0 .../{font_flag.md => FONT_FLAG.MD} | 0 .../{gesture_slot.md => GESTURE_SLOT.MD} | 0 docs/enumerations/{input.md => INPUT.MD} | 0 ...{label_alignment.md => LABEL_ALIGNMENT.MD} | 0 docs/enumerations/{life.md => LIFE.MD} | 0 docs/enumerations/{mask.md => MASK.MD} | 0 .../{move_collide.md => MOVE_COLLIDE.MD} | 0 .../{move_type.md => MOVE_TYPE.MD} | 0 .../{observer_mode.md => OBSERVER_MODE.MD} | 0 ...{panel_alignment.md => PANEL_ALIGNMENT.MD} | 0 .../{pin_corner.md => PIN_CORNER.MD} | 0 ...layer_animation.md => PLAYER_ANIMATION.MD} | 0 .../{render_effects.md => RENDER_EFFECTS.MD} | 0 .../{render_mode.md => RENDER_MODE.MD} | 0 ...h_path_add_to.md => SEARCH_PATH_ADD_TO.MD} | 0 .../{shadow_type.md => SHADOW_TYPE.MD} | 0 .../{shake_command.md => SHAKE_COMMAND.MD} | 0 ...box_visibility.md => SKYBOX_VISIBILITY.MD} | 0 docs/enumerations/{solid.md => SOLID.MD} | 0 .../{solid_flag.md => SOLID_FLAG.MD} | 0 docs/enumerations/{surface.md => SURFACE.MD} | 0 ...{surface_feature.md => SURFACE_FEATURE.MD} | 0 .../{vgui_panel.md => VGUI_PANEL.MD} | 0 .../portal_generate_enumerations.lua | 4 +-- src/game/shared/luamanager.h | 2 ++ src/lib/public/vgui_controls.lib | 2 +- src/public/lfilesystem.cpp | 16 +++++++++++ tools/docs-build-enumerations.js | 27 ++++++++++++++++++- 45 files changed, 47 insertions(+), 4 deletions(-) rename docs/enumerations/{activation_type.md => ACTIVATION_TYPE.MD} (100%) rename docs/enumerations/{activity.md => ACTIVITY.MD} (100%) rename docs/enumerations/{ai_class.md => AI_CLASS.MD} (100%) rename docs/enumerations/{auto_resize.md => AUTO_RESIZE.MD} (100%) rename docs/enumerations/{blood_color.md => BLOOD_COLOR.MD} (100%) rename docs/enumerations/{button.md => BUTTON.MD} (100%) rename docs/enumerations/{collide_type.md => COLLIDE_TYPE.MD} (100%) rename docs/enumerations/{collision_group.md => COLLISION_GROUP.MD} (100%) rename docs/enumerations/{contents.md => CONTENTS.MD} (100%) rename docs/enumerations/{dock_type.md => DOCK_TYPE.MD} (100%) rename docs/enumerations/{edict_flag.md => EDICT_FLAG.MD} (100%) rename docs/enumerations/{engine_flag.md => ENGINE_FLAG.MD} (100%) rename docs/enumerations/{entity_effect.md => ENTITY_EFFECT.MD} (100%) rename docs/enumerations/{entity_flag.md => ENTITY_FLAG.MD} (100%) rename docs/enumerations/{fcvar.md => FCVAR.MD} (100%) rename docs/enumerations/{file_warning_level.md => FILE_WARNING_LEVEL.MD} (100%) rename docs/enumerations/{font_draw_type.md => FONT_DRAW_TYPE.MD} (100%) rename docs/enumerations/{font_flag.md => FONT_FLAG.MD} (100%) rename docs/enumerations/{gesture_slot.md => GESTURE_SLOT.MD} (100%) rename docs/enumerations/{input.md => INPUT.MD} (100%) rename docs/enumerations/{label_alignment.md => LABEL_ALIGNMENT.MD} (100%) rename docs/enumerations/{life.md => LIFE.MD} (100%) rename docs/enumerations/{mask.md => MASK.MD} (100%) rename docs/enumerations/{move_collide.md => MOVE_COLLIDE.MD} (100%) rename docs/enumerations/{move_type.md => MOVE_TYPE.MD} (100%) rename docs/enumerations/{observer_mode.md => OBSERVER_MODE.MD} (100%) rename docs/enumerations/{panel_alignment.md => PANEL_ALIGNMENT.MD} (100%) rename docs/enumerations/{pin_corner.md => PIN_CORNER.MD} (100%) rename docs/enumerations/{player_animation.md => PLAYER_ANIMATION.MD} (100%) rename docs/enumerations/{render_effects.md => RENDER_EFFECTS.MD} (100%) rename docs/enumerations/{render_mode.md => RENDER_MODE.MD} (100%) rename docs/enumerations/{search_path_add_to.md => SEARCH_PATH_ADD_TO.MD} (100%) rename docs/enumerations/{shadow_type.md => SHADOW_TYPE.MD} (100%) rename docs/enumerations/{shake_command.md => SHAKE_COMMAND.MD} (100%) rename docs/enumerations/{skybox_visibility.md => SKYBOX_VISIBILITY.MD} (100%) rename docs/enumerations/{solid.md => SOLID.MD} (100%) rename docs/enumerations/{solid_flag.md => SOLID_FLAG.MD} (100%) rename docs/enumerations/{surface.md => SURFACE.MD} (100%) rename docs/enumerations/{surface_feature.md => SURFACE_FEATURE.MD} (100%) rename docs/enumerations/{vgui_panel.md => VGUI_PANEL.MD} (100%) diff --git a/docs/enumerations/activation_type.md b/docs/enumerations/ACTIVATION_TYPE.MD similarity index 100% rename from docs/enumerations/activation_type.md rename to docs/enumerations/ACTIVATION_TYPE.MD diff --git a/docs/enumerations/activity.md b/docs/enumerations/ACTIVITY.MD similarity index 100% rename from docs/enumerations/activity.md rename to docs/enumerations/ACTIVITY.MD diff --git a/docs/enumerations/ai_class.md b/docs/enumerations/AI_CLASS.MD similarity index 100% rename from docs/enumerations/ai_class.md rename to docs/enumerations/AI_CLASS.MD diff --git a/docs/enumerations/auto_resize.md b/docs/enumerations/AUTO_RESIZE.MD similarity index 100% rename from docs/enumerations/auto_resize.md rename to docs/enumerations/AUTO_RESIZE.MD diff --git a/docs/enumerations/blood_color.md b/docs/enumerations/BLOOD_COLOR.MD similarity index 100% rename from docs/enumerations/blood_color.md rename to docs/enumerations/BLOOD_COLOR.MD diff --git a/docs/enumerations/button.md b/docs/enumerations/BUTTON.MD similarity index 100% rename from docs/enumerations/button.md rename to docs/enumerations/BUTTON.MD diff --git a/docs/enumerations/collide_type.md b/docs/enumerations/COLLIDE_TYPE.MD similarity index 100% rename from docs/enumerations/collide_type.md rename to docs/enumerations/COLLIDE_TYPE.MD diff --git a/docs/enumerations/collision_group.md b/docs/enumerations/COLLISION_GROUP.MD similarity index 100% rename from docs/enumerations/collision_group.md rename to docs/enumerations/COLLISION_GROUP.MD diff --git a/docs/enumerations/contents.md b/docs/enumerations/CONTENTS.MD similarity index 100% rename from docs/enumerations/contents.md rename to docs/enumerations/CONTENTS.MD diff --git a/docs/enumerations/dock_type.md b/docs/enumerations/DOCK_TYPE.MD similarity index 100% rename from docs/enumerations/dock_type.md rename to docs/enumerations/DOCK_TYPE.MD diff --git a/docs/enumerations/edict_flag.md b/docs/enumerations/EDICT_FLAG.MD similarity index 100% rename from docs/enumerations/edict_flag.md rename to docs/enumerations/EDICT_FLAG.MD diff --git a/docs/enumerations/engine_flag.md b/docs/enumerations/ENGINE_FLAG.MD similarity index 100% rename from docs/enumerations/engine_flag.md rename to docs/enumerations/ENGINE_FLAG.MD diff --git a/docs/enumerations/entity_effect.md b/docs/enumerations/ENTITY_EFFECT.MD similarity index 100% rename from docs/enumerations/entity_effect.md rename to docs/enumerations/ENTITY_EFFECT.MD diff --git a/docs/enumerations/entity_flag.md b/docs/enumerations/ENTITY_FLAG.MD similarity index 100% rename from docs/enumerations/entity_flag.md rename to docs/enumerations/ENTITY_FLAG.MD diff --git a/docs/enumerations/fcvar.md b/docs/enumerations/FCVAR.MD similarity index 100% rename from docs/enumerations/fcvar.md rename to docs/enumerations/FCVAR.MD diff --git a/docs/enumerations/file_warning_level.md b/docs/enumerations/FILE_WARNING_LEVEL.MD similarity index 100% rename from docs/enumerations/file_warning_level.md rename to docs/enumerations/FILE_WARNING_LEVEL.MD diff --git a/docs/enumerations/font_draw_type.md b/docs/enumerations/FONT_DRAW_TYPE.MD similarity index 100% rename from docs/enumerations/font_draw_type.md rename to docs/enumerations/FONT_DRAW_TYPE.MD diff --git a/docs/enumerations/font_flag.md b/docs/enumerations/FONT_FLAG.MD similarity index 100% rename from docs/enumerations/font_flag.md rename to docs/enumerations/FONT_FLAG.MD diff --git a/docs/enumerations/gesture_slot.md b/docs/enumerations/GESTURE_SLOT.MD similarity index 100% rename from docs/enumerations/gesture_slot.md rename to docs/enumerations/GESTURE_SLOT.MD diff --git a/docs/enumerations/input.md b/docs/enumerations/INPUT.MD similarity index 100% rename from docs/enumerations/input.md rename to docs/enumerations/INPUT.MD diff --git a/docs/enumerations/label_alignment.md b/docs/enumerations/LABEL_ALIGNMENT.MD similarity index 100% rename from docs/enumerations/label_alignment.md rename to docs/enumerations/LABEL_ALIGNMENT.MD diff --git a/docs/enumerations/life.md b/docs/enumerations/LIFE.MD similarity index 100% rename from docs/enumerations/life.md rename to docs/enumerations/LIFE.MD diff --git a/docs/enumerations/mask.md b/docs/enumerations/MASK.MD similarity index 100% rename from docs/enumerations/mask.md rename to docs/enumerations/MASK.MD diff --git a/docs/enumerations/move_collide.md b/docs/enumerations/MOVE_COLLIDE.MD similarity index 100% rename from docs/enumerations/move_collide.md rename to docs/enumerations/MOVE_COLLIDE.MD diff --git a/docs/enumerations/move_type.md b/docs/enumerations/MOVE_TYPE.MD similarity index 100% rename from docs/enumerations/move_type.md rename to docs/enumerations/MOVE_TYPE.MD diff --git a/docs/enumerations/observer_mode.md b/docs/enumerations/OBSERVER_MODE.MD similarity index 100% rename from docs/enumerations/observer_mode.md rename to docs/enumerations/OBSERVER_MODE.MD diff --git a/docs/enumerations/panel_alignment.md b/docs/enumerations/PANEL_ALIGNMENT.MD similarity index 100% rename from docs/enumerations/panel_alignment.md rename to docs/enumerations/PANEL_ALIGNMENT.MD diff --git a/docs/enumerations/pin_corner.md b/docs/enumerations/PIN_CORNER.MD similarity index 100% rename from docs/enumerations/pin_corner.md rename to docs/enumerations/PIN_CORNER.MD diff --git a/docs/enumerations/player_animation.md b/docs/enumerations/PLAYER_ANIMATION.MD similarity index 100% rename from docs/enumerations/player_animation.md rename to docs/enumerations/PLAYER_ANIMATION.MD diff --git a/docs/enumerations/render_effects.md b/docs/enumerations/RENDER_EFFECTS.MD similarity index 100% rename from docs/enumerations/render_effects.md rename to docs/enumerations/RENDER_EFFECTS.MD diff --git a/docs/enumerations/render_mode.md b/docs/enumerations/RENDER_MODE.MD similarity index 100% rename from docs/enumerations/render_mode.md rename to docs/enumerations/RENDER_MODE.MD diff --git a/docs/enumerations/search_path_add_to.md b/docs/enumerations/SEARCH_PATH_ADD_TO.MD similarity index 100% rename from docs/enumerations/search_path_add_to.md rename to docs/enumerations/SEARCH_PATH_ADD_TO.MD diff --git a/docs/enumerations/shadow_type.md b/docs/enumerations/SHADOW_TYPE.MD similarity index 100% rename from docs/enumerations/shadow_type.md rename to docs/enumerations/SHADOW_TYPE.MD diff --git a/docs/enumerations/shake_command.md b/docs/enumerations/SHAKE_COMMAND.MD similarity index 100% rename from docs/enumerations/shake_command.md rename to docs/enumerations/SHAKE_COMMAND.MD diff --git a/docs/enumerations/skybox_visibility.md b/docs/enumerations/SKYBOX_VISIBILITY.MD similarity index 100% rename from docs/enumerations/skybox_visibility.md rename to docs/enumerations/SKYBOX_VISIBILITY.MD diff --git a/docs/enumerations/solid.md b/docs/enumerations/SOLID.MD similarity index 100% rename from docs/enumerations/solid.md rename to docs/enumerations/SOLID.MD diff --git a/docs/enumerations/solid_flag.md b/docs/enumerations/SOLID_FLAG.MD similarity index 100% rename from docs/enumerations/solid_flag.md rename to docs/enumerations/SOLID_FLAG.MD diff --git a/docs/enumerations/surface.md b/docs/enumerations/SURFACE.MD similarity index 100% rename from docs/enumerations/surface.md rename to docs/enumerations/SURFACE.MD diff --git a/docs/enumerations/surface_feature.md b/docs/enumerations/SURFACE_FEATURE.MD similarity index 100% rename from docs/enumerations/surface_feature.md rename to docs/enumerations/SURFACE_FEATURE.MD diff --git a/docs/enumerations/vgui_panel.md b/docs/enumerations/VGUI_PANEL.MD similarity index 100% rename from docs/enumerations/vgui_panel.md rename to docs/enumerations/VGUI_PANEL.MD diff --git a/game/experiment/scripts/lua/utilities/portal_generate_enumerations.lua b/game/experiment/scripts/lua/utilities/portal_generate_enumerations.lua index 17bacd4769..e539be21d5 100644 --- a/game/experiment/scripts/lua/utilities/portal_generate_enumerations.lua +++ b/game/experiment/scripts/lua/utilities/portal_generate_enumerations.lua @@ -80,8 +80,8 @@ end local function GenerateAllEnumerationsMarkdown() if (CLIENT) then - for _, file in ipairs(Files.Find("docs/lua/enumerations/*", "DATA")) do - Files.RemoveFile("docs/lua/enumerations/" .. file, "DATA") + for _, file in ipairs(Files.Find("docs/enumerations/*", "DATA")) do + Files.RemoveFile("docs/enumerations/" .. file, "DATA") end end diff --git a/src/game/shared/luamanager.h b/src/game/shared/luamanager.h index 95bf26790d..874afbb471 100644 --- a/src/game/shared/luamanager.h +++ b/src/game/shared/luamanager.h @@ -48,6 +48,8 @@ #define LUA_PATH_GAMEUI LUA_ROOT "\\gameui" #define LUA_PATH_WEAPONS LUA_ROOT "\\weapons" +#define LUA_PATH_DATA "data" + #define LUA_BASE_ENTITY_CLASS "prop_scripted" #define LUA_BASE_ENTITY_FACTORY "CBaseAnimating" #define LUA_BASE_WEAPON "weapon_experimentbase_scriptedweapon" diff --git a/src/lib/public/vgui_controls.lib b/src/lib/public/vgui_controls.lib index 9a6bc9a225..c1b651ec6b 100644 --- a/src/lib/public/vgui_controls.lib +++ b/src/lib/public/vgui_controls.lib @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:304d3c516b95b61d1886d230e5b3c609aaa4350cc6cef802ba9f3f07af29946c +oid sha256:0c3e4f4b0c51ff8f839095143933d14d14881bffb17d4c43f69cedfe3446411e size 19481334 diff --git a/src/public/lfilesystem.cpp b/src/public/lfilesystem.cpp index 112a0433a8..36f7a9a9fc 100644 --- a/src/public/lfilesystem.cpp +++ b/src/public/lfilesystem.cpp @@ -328,6 +328,22 @@ LUA_BINDING_BEGIN( Files, Open, "library", "Open a file." ) readMode = luaL_checkstring( L, 2 ); + // For now We will support writing only to DATA, we will allow reading only in GAME, and DATA + if ( readMode[0] == 'w' ) + { + if ( !V_stristr( pathId, "data" ) ) + { + luaL_argerror( L, 3, "Invalid pathId for writing (DATA expected)" ); + } + } + else if ( readMode[0] == 'r' ) + { + if ( !V_stristr( pathId, "game" ) && !V_stristr( pathId, "data" ) ) + { + luaL_argerror( L, 3, "Invalid pathId for reading (GAME or DATA expected)" ); + } + } + lua_pushfilehandle( L, filesystem->Open( filePath, readMode, pathId ) ); return 1; } diff --git a/tools/docs-build-enumerations.js b/tools/docs-build-enumerations.js index 4b5e0fd852..af1229b683 100644 --- a/tools/docs-build-enumerations.js +++ b/tools/docs-build-enumerations.js @@ -1 +1,26 @@ -// See /game/experiment/scripts/lua/utilities/portal_generate_enumerations.lua +/* + See `/game/experiment/scripts/lua/utilities/portal_generate_enumerations.lua` + for the script that generates markdown files to the game data folder. + + Due to how source engine writes, the path is forced lowercase. + + After running the Lua script, run this script to copy the files to the final + destination, fixing the casing to be SCREAMING_SNAKE_CASE. + + node ./tools/docs-build-enumerations.js +*/ + +const fs = require('fs'); +const path = require('path'); + +const srcDir = path.join('game', 'experiment', 'data', 'docs', 'enumerations'); +const outputDir = path.join('docs', 'enumerations'); + +const files = fs.readdirSync(srcDir); + +for (const file of files) { + const srcPath = path.join(srcDir, file); + const outputPath = path.join(outputDir, file.toUpperCase()); + + fs.copyFileSync(srcPath, outputPath); +}