-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
119 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,39 @@ | ||
-- Initialize Lua environment | ||
if not engine then | ||
error("Engine API not available") | ||
--- Loads the new lua files into the build directory | ||
|
||
local function copyScript(name) | ||
-- Define relative paths | ||
local sourcePath = "sandbox/assets/scripts/" .. name | ||
local destPath = "build/assets/scripts/" .. name | ||
|
||
-- Read source script | ||
local source = io.open(sourcePath, "rb") | ||
if not source then | ||
engine.error("Failed to open source script: " .. sourcePath) | ||
return false | ||
end | ||
|
||
local content = source:read("*all") | ||
source:close() | ||
|
||
-- Write to build directory | ||
local dest = io.open(destPath, "wb") | ||
if not dest then | ||
engine.error("Failed to create build script: " .. destPath) | ||
return false | ||
end | ||
|
||
local success = dest:write(content) | ||
dest:close() | ||
|
||
if success then | ||
engine.trace("Successfully copied: " .. name) | ||
return true | ||
else | ||
engine.error("Failed to write: " .. destPath) | ||
return false | ||
end | ||
end | ||
|
||
-- Set default terrain parameters | ||
engine.setTerrainHeight(10.0) | ||
engine.trace("Lua environment initialized") | ||
engine.log("Lua environment initialized") | ||
engine.warn("Lua environment initialized") | ||
engine.error("Lua environment initialized") | ||
-- Copy main script | ||
copyScript("main.lua") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- Initialize Lua environment | ||
if not engine then | ||
error("Engine API not available") | ||
end | ||
|
||
local debuggingEnabled = true | ||
|
||
-- Set default terrain parameters | ||
engine.setTerrainHeight(10.0) | ||
|
||
if debuggingEnabled then | ||
engine.log("debuggingEnabled") | ||
else | ||
engine.showFPSCounter(false) | ||
engine.showEventDebugger(false) | ||
engine.showRendererSettings(false) | ||
engine.showTerrainControls(false) | ||
engine.showProfiler(false) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters