-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
||
using namespace sf; | ||
using namespace ssvs; | ||
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Be sure to stick to the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing applies here. |
||
|
||
// ------------------------------------------------------------------------ | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.