Update scripts in accordance with #701 and #735

This commit is contained in:
hispidence 2022-09-13 21:28:38 +01:00
parent 732afdea87
commit 2c2d49cc5d
4 changed files with 7 additions and 38 deletions

View file

@ -1,32 +1,7 @@
-----
--- Misc Util functions
-- @luautil Util
local Util = {}
--- Adds all built-in functions and types to the global environment.
-- Put simply, this means that you do not have to write out the full name of a function.
-- e.g. Instead of writing
-- local door = TEN.Objects.GetMoveableByName("door_type4_14")
-- You can write
-- local door = GetMoveableByName("door_type4_14")
Util.ShortenTENCalls = function()
local ShortenInner
ShortenInner = function(tab)
for k, v in pairs(tab) do
if _G[k] then
print("WARNING! Key " .. k .. " already exists in global environment!")
else
_G[k] = v
if "table" == type(v) then
if nil == v.__type then
ShortenInner(v)
end
end
end
end
end
ShortenInner(TEN)
print("Util.ShortenTENCalls is deprecated; its functionality is now performed automatically by TombEngine.")
end
return Util

View file

@ -8,7 +8,7 @@ local Level = Flow.Level
local Color = TEN.Color
local Rotation = TEN.Rotation
local InventoryItem = Flow.InventoryItem
local InvID = Flow.InvID
local ObjID = TEN.Objects.ObjID
local RotationAxis = Flow.RotationAxis
local ItemAction = Flow.ItemAction
@ -64,7 +64,7 @@ test.fog = Flow.Fog.new(Color.new(0, 0, 0), 12, 20)
test.objects = {
InventoryItem.new(
"tut1_ba_cartouche1",
InvID.PUZZLE_ITEM3_COMBO1,
ObjID.PUZZLE_ITEM3_COMBO1,
0,
0.5,
Rotation.new(0, 0, 0),
@ -74,7 +74,7 @@ test.objects = {
),
InventoryItem.new(
"tut1_ba_cartouche2",
InvID.PUZZLE_ITEM3_COMBO2,
ObjID.PUZZLE_ITEM3_COMBO2,
0,
0.5,
Rotation.new(0, 0, 0),
@ -84,7 +84,7 @@ test.objects = {
),
InventoryItem.new(
"tut1_ba_cartouche",
InvID.PUZZLE_ITEM3,
ObjID.PUZZLE_ITEM3,
0,
0.5,
Rotation.new(0, 0, 0),
@ -94,7 +94,7 @@ test.objects = {
),
InventoryItem.new(
"tut1_hand_orion",
InvID.PUZZLE_ITEM6,
ObjID.PUZZLE_ITEM6,
0,
0.5,
Rotation.new(270, 180, 0),
@ -104,7 +104,7 @@ test.objects = {
),
InventoryItem.new(
"tut1_hand_sirius",
InvID.PUZZLE_ITEM8,
ObjID.PUZZLE_ITEM8,
0,
0.5,
Rotation.new(270, 180, 0),

View file

@ -1,9 +1,6 @@
-- New level script file.
-- To include other script files, you can use require("filename") command.
local Util = require("Engine.Util")
Util.ShortenTENCalls()
-- Called when entering a level, either after leveljump, new game or loading game
LevelFuncs.OnStart = function() end

View file

@ -1,8 +1,5 @@
-- Title script file
local Util = require("Engine.Util")
Util.ShortenTENCalls()
LevelFuncs.OnLoad = function() end
LevelFuncs.OnSave = function() end
LevelFuncs.OnEnd = function() end