Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a path to script folder for require to work properly. #264

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
33 changes: 19 additions & 14 deletions src/SSVOpenHexagon/Core/HGScripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
#include "SSVOpenHexagon/Global/Assets.hpp"
#include "SSVOpenHexagon/Utils/Utils.hpp"
#include "SSVOpenHexagon/Core/HexagonGame.hpp"
#include "SSVOpenHexagon/Components/CWall.hpp"
#include "SSVOpenHexagon/Components/CCustomWallHandle.hpp"
#include "SSVOpenHexagon/Components/CCustomWall.hpp"
Comment on lines -9 to -11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you removing this? There are custom wall functions defined here that need these headers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are not even used in the include.


using namespace sf;
using namespace ssvs;
Expand Down Expand Up @@ -1216,23 +1213,31 @@ void HexagonGame::initLua()
// ------------------------------------------------------------------------
// Register Lua function to get random seed for the current attempt:
addLuaFn("u_getAttemptRandomSeed", //
[this] { return rng.seed(); })
.doc(
"Obtain the current random seed, automatically generated at the "
"beginning of the level. `math.randomseed` is automatically "
"initialized with the result of this function at the beginning of "
"a level.");
[this]{ return rng.seed(); })
.doc(
"Obtain the current random seed, automatically generated at the "
"beginning of the level. `math.randomseed` is automatically "
"initialized with the result of this function at the beginning of "
"a level.");
Comment on lines 1215 to +1221
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be sure to stick to the .clang-format that Vee has defined for us.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you go away with it when the thing is god damn raw?


// ------------------------------------------------------------------------
// Initialize Lua paths:
try{
lua.executeCode("package.path = package.path:sub(1, -49)..\"" + levelData->packPath + "\\Scripts\\?.lua\"");
}
catch(...){
ssvu::lo("HexagonGame::initLua")
<< "Failure to initialize Lua paths\n";
}

// ------------------------------------------------------------------------
// Initialize Lua random seed from random generator one:
try
{
try{
lua.executeCode("math.randomseed(u_getAttemptRandomSeed())");
}
catch(...)
{
catch(...){
ssvu::lo("HexagonGame::initLua")
<< "Failure to initialize Lua random generator seed\n";
<< "Failure to initialize Lua random generator seed\n";
}
Comment on lines -1228 to 1241
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing applies here.


// ------------------------------------------------------------------------
Expand Down