From f35045aa872acf25d13dcd5cf81c9fbfa2dc7406 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Tue, 11 Mar 2025 12:47:53 -0400 Subject: [PATCH 01/29] Add files via upload --- .../TEN Node Catalogs/Environment.lua | 545 ++++++++++++++++++ 1 file changed, 545 insertions(+) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 7a7c2b739..17f461538 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -1,3 +1,168 @@ +local Timer = require("Engine.Timer") + +-- !Ignore +-- Construct timed transform data and start transform +LevelFuncs.Engine.Node.ConstructWeatherTimedData = function(dataType, operand, newValue, time, smooth) + + local prefix = nil + local value = nil + + if (dataType == 0) then + prefix = "_fog" + value = TEN.Flow.GetCurrentLevel().fog.color + elseif (dataType == 1) then + prefix = "_lensflare" + local pitch = TEN.Flow.GetCurrentLevel().lensFlare.pitch + local yaw = TEN.Flow.GetCurrentLevel().lensFlare.yaw + value = Vec2(pitch, yaw) + elseif (dataType == 2) then + prefix = "_skylayer1" + local color = TEN.Flow.GetCurrentLevel().layer1.color + value = {x1 = color.r, x2 = color.g, x3 = color.b, x4 = TEN.Flow.GetCurrentLevel().layer1.speed} + elseif (dataType == 3) then + prefix = "_skylayer2" + local color = TEN.Flow.GetCurrentLevel().layer2.color + value = {x1 = color.r, x2 = color.g, x3 = color.b, x4 = TEN.Flow.GetCurrentLevel().layer2.speed} + elseif (dataType == 4) then + prefix = "_starfield" + local starCount = TEN.Flow.GetCurrentLevel().starField.starCount + local meteorCount = TEN.Flow.GetCurrentLevel().starField.meteorCount + local meteorDensity = TEN.Flow.GetCurrentLevel().starField.meteorSpawnDensity + local meteorVelocity = TEN.Flow.GetCurrentLevel().starField.meteorVelocity + value = {x1 = starCount, x2 = meteorCount, x3 = meteorDensity, x4 = meteorVelocity} + elseif (dataType == 5) then + prefix = "_weaterStrength" + value = TEN.Flow.GetCurrentLevel().weatherStrength + elseif (dataType == 6) then + prefix = "_horizon1Position" + value = TEN.Flow.GetCurrentLevel().horizon1.position + elseif (dataType == 7) then + prefix = "_horizon1Rotation" + value = TEN.Flow.GetCurrentLevel().horizon1.rotation + elseif (dataType == 8) then + prefix = "_horizon1Transparency" + value = TEN.Flow.GetCurrentLevel().horizon1.transparency + elseif (dataType == 9) then + prefix = "_horizon2Position" + value = TEN.Flow.GetCurrentLevel().horizon2.position + elseif (dataType == 10) then + prefix = "_horizon2Rotation" + value = TEN.Flow.GetCurrentLevel().horizon2.rotation + elseif (dataType == 11) then + prefix = "_horizon2Transparency" + value = TEN.Flow.GetCurrentLevel().horizon2.transparency + elseif (dataType == 12) then + prefix = "_lensflareColor" + value = TEN.Flow.GetCurrentLevel().lensFlare.color + end + + local dataName = "Weather" .. prefix .. "_transform_data" + + if (LevelVars.Engine.WeatherData[dataName] ~= nil and Timer.Get(LevelVars.Engine.WeatherData[dataName].Name) ~= nil) then + if (Timer.Get(LevelVars.Engine.WeatherData[dataName].Name):IsActive()) then + return + else + Timer.Delete(LevelVars.Engine.WeatherData[dataName].Name) + LevelVars.Engine.WeatherData[dataName] = nil + end + end + + LevelVars.Engine.WeatherData = LevelVars.Engine.WeatherData or {} + + LevelVars.Engine.WeatherData[dataName] = {} + + LevelVars.Engine.WeatherData[dataName].Progress = 0 + LevelVars.Engine.WeatherData[dataName].Interval = 1 / (time * 30) + LevelVars.Engine.WeatherData[dataName].Smooth = smooth + LevelVars.Engine.WeatherData[dataName].DataType = dataType + LevelVars.Engine.WeatherData[dataName].Operand = operand + LevelVars.Engine.WeatherData[dataName].Name = dataName + LevelVars.Engine.WeatherData[dataName].NewValue = newValue + LevelVars.Engine.WeatherData[dataName].OldValue = value + + local timer = Timer.Create(dataName, 1 / 30, true, false, LevelFuncs.Engine.Node.TransformTimedData, dataName) + timer:Start() +end + +-- !Ignore +-- Transform object parameter using previously saved timed transform data +LevelFuncs.Engine.Node.TransformTimedData = function(dataName) + + LevelVars.Engine.WeatherData[dataName].Progress = math.min(LevelVars.Engine.WeatherData[dataName].Progress + LevelVars.Engine.WeatherData[dataName].Interval, 1) + local factor = LevelVars.Engine.WeatherData[dataName].Smooth and LevelFuncs.Engine.Node.Smoothstep(LevelVars.Engine.WeatherData[dataName].Progress) or LevelVars.Engine.WeatherData[dataName].Progress + + local newValue1 + local newValue2 + local newValue3 + local newValue4 + + if (LevelVars.Engine.WeatherData[dataName].Operand == 0) then + newValue1 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.r, LevelVars.Engine.WeatherData[dataName].NewValue.r, factor) + newValue2 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.g, LevelVars.Engine.WeatherData[dataName].NewValue.g, factor) + newValue3 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.b, LevelVars.Engine.WeatherData[dataName].NewValue.b, factor) + newValue4 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.a, LevelVars.Engine.WeatherData[dataName].NewValue.a, factor) + elseif + (LevelVars.Engine.WeatherData[dataName].Operand == 1) then + newValue1 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x, LevelVars.Engine.WeatherData[dataName].NewValue.x, factor) + newValue2 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.y, LevelVars.Engine.WeatherData[dataName].NewValue.y, factor) + elseif + (LevelVars.Engine.WeatherData[dataName].Operand == 2) then + newValue1 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x, LevelVars.Engine.WeatherData[dataName].NewValue.x, factor) + newValue2 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.y, LevelVars.Engine.WeatherData[dataName].NewValue.y, factor) + newValue3 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.z, LevelVars.Engine.WeatherData[dataName].NewValue.z, factor) + elseif + (LevelVars.Engine.WeatherData[dataName].Operand == 3) then + newValue1 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x1, LevelVars.Engine.WeatherData[dataName].NewValue.x1, factor) + newValue2 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x2, LevelVars.Engine.WeatherData[dataName].NewValue.x2, factor) + newValue3 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x3, LevelVars.Engine.WeatherData[dataName].NewValue.x3, factor) + newValue4 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x4, LevelVars.Engine.WeatherData[dataName].NewValue.x4, factor) + else + (LevelVars.Engine.WeatherData[dataName].Operand == 4) then + newValue1 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue, LevelVars.Engine.WeatherData[dataName].NewValue, factor) + end + + if (LevelVars.Engine.WeatherData[dataName].DataType == 0) then + TEN.Flow.GetCurrentLevel().fog.color = Color(newValue1, newValue2, newValue3) + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 1) then + TEN.Flow.GetCurrentLevel().lensFlare.pitch = newValue1 + TEN.Flow.GetCurrentLevel().lensFlare.yaw = newValue2 + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 2) then + TEN.Flow.GetCurrentLevel().layer1.color = Color(newValue1, newValue2, newValue3) + TEN.Flow.GetCurrentLevel().layer1.speed = newValue4 + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 3) then + TEN.Flow.GetCurrentLevel().layer2.color = Color(newValue1, newValue2, newValue3) + TEN.Flow.GetCurrentLevel().layer2.speed = newValue4 + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 4) then + TEN.Flow.GetCurrentLevel().starField.starCount = newValue1 + TEN.Flow.GetCurrentLevel().starField.meteorCount = newValue2 + TEN.Flow.GetCurrentLevel().starField.meteorSpawnDensity = newValue3 + TEN.Flow.GetCurrentLevel().starField.meteorVelocity = newValue4 + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 5) then + TEN.Flow.GetCurrentLevel().weatherStrength = newValue1 + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 6) then + TEN.Flow.GetCurrentLevel().horizon1.position = Vec3(newValue1, newValue2, newValue3) + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 7) then + TEN.Flow.GetCurrentLevel().horizon1.rotation = Rotation(newValue1, newValue2, newValue3) + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 8) then + TEN.Flow.GetCurrentLevel().horizon1.transparency = newValue1 + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 9) then + TEN.Flow.GetCurrentLevel().horizon2.position = Vec3(newValue1, newValue2, newValue3) + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 10) then + TEN.Flow.GetCurrentLevel().horizon2.rotation = Rotation(newValue1, newValue2, newValue3) + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 11) then + TEN.Flow.GetCurrentLevel().horizon2.transparency = newValue1 + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 12) then + TEN.Flow.GetCurrentLevel().lensFlare.color = Color(newValue1, newValue2, newValue3) + end + + if (LevelVars.Engine.WeatherData[dataName].Progress >= 1) then + Timer.Delete(LevelVars.Engine.WeatherData[dataName].Name) + LevelVars.Engine.WeatherData[dataName] = nil + end + +end + + -- !Name "If minimum fog distance is..." -- !Section "Environment" -- !Description "Checks current minimum (near) fog distance value in sectors." @@ -54,4 +219,384 @@ end LevelFuncs.Engine.Node.SetFogColor = function(color) TEN.Flow.GetCurrentLevel().fog.color = color +end + +-- !Name "Change fog color over time" +-- !Section "Environment" +-- !Description "Changes fog color over specified time." +-- !Arguments "NewLine, Color, 20, Fog color" "Numerical, 15, [ 0 | 65535 ], Time in seconds" "35, Boolean, Smooth motion" + +LevelFuncs.Engine.Node.ChangeFogColorOverTime = function(color, time, smooth) + + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(0, 0, color, time, smooth) end + +end + +-- !Name "Set draw distance" +-- !Section "Environment" +-- !Description "Sets draw distance to specified value in sectors." +-- !Arguments "Numerical, 15, [ 4 | 256 | 0 | 1 ], {20}, Maximum draw distance in sectors" + +LevelFuncs.Engine.Node.SetDrawDistance = function(distance) + TEN.Flow.GetCurrentLevel().farView = distance +end + +-- !Name "Add lens flare" +-- !Section "Environment" +-- !Description "Add a lens flare." +-- !Arguments "NewLine, Numerical, 15, [ 0 | 360 ], Pitch" "Numerical, 15, [ 0 | 360 ], Yaw" "Color, 20, Lens flare color" + +LevelFuncs.Engine.Node.AddLensFlare = function(pitch, yaw, color) + + TEN.Flow.GetCurrentLevel().lensFlare = Flow.LensFlare(pitch, yaw, color) + +end + +-- !Name "Change lens flare position over time" +-- !Section "Environment" +-- !Description "Changes lens flare position over specified time." +-- !Arguments "NewLine, Numerical, 15, [ 0 | 360 ], Pitch" "Numerical, 15, [ 0 | 360 ], Yaw" "Numerical, 15, [ 0 | 65535 ], Time in seconds" "35, Boolean, Smooth motion" + +LevelFuncs.Engine.Node.ChangeLensFlarePosOverTime = function(pitch, yaw, time, smooth) + + if TEN.Flow.GetCurrentLevel().lensFlare:GetEnabled() == true then + + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(1, 1, Vec2(pitch, yaw), time, smooth) end + + end + +end + +-- !Name "Change lens flare color over time" +-- !Section "Environment" +-- !Description "Changes lens flare color over specified time." +-- !Arguments "NewLine, Color, 20, Lens flare color" "Numerical, 15, [ 0 | 65535 ], Time in seconds" + +LevelFuncs.Engine.Node.ChangeLensFlareColorOverTime = function(color, time) + + if TEN.Flow.GetCurrentLevel().lensFlare:GetEnabled() == true then + + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(12, 0, color, time, true) end + + end + +end + +-- !Name "Set storm" +-- !Section "Environment" +-- !Description "Add a lightning storm to current level." +-- !Arguments "Boolean, 15, Storm" + +LevelFuncs.Engine.Node.SetStorm = function(storm) + + TEN.Flow.GetCurrentLevel().storm = storm + +end + +-- !Name "Set weather" +-- !Section "Environment" +-- !Description "Add a weather to current level." +-- !Arguments "NewLine, Enumeration, 25, [ None | Rain | Snow], {0}" "Numerical, 15, [ 0 | 1 | 2 | .1 ], Strength" + +LevelFuncs.Engine.Node.SetWeather = function(weather, strength) + + TEN.Flow.GetCurrentLevel().weather = weather + TEN.Flow.GetCurrentLevel().weatherStrength = strength + +end + +-- !Name "Change weather strength over time" +-- !Section "Environment" +-- !Description "Change weather strength over specified time." +-- !Arguments "Numerical, 15, [ 0 | 1 | 1 | .1 ], Strength" +-- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 65, Time (in seconds)" +-- !Arguments "30, Boolean, Relative" + +LevelFuncs.Engine.Node.ChangeWeatherOverTime = function(newStrength, time, relative) + + if (relative) then + newStrength = TEN.Flow.GetCurrentLevel().weatherStrength + newStrength + end + + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(5, 4, newStrength, time, true) end + +end + +-- !Name "Add starfield and meteors" +-- !Section "Environment" +-- !Description "Add a starfield to current level." +-- !Arguments "NewLine, Numerical, 15, [ 0 | 6000 ], Stars count" "Numerical, 15, [ 0 | 100 ], Meteors count" "Numerical, 15, [ 0 | 10 ], Meteors spawn density" "Numerical, 15, [ 0 | 40 ], Meteors velocity" + +LevelFuncs.Engine.Node.AddStarfield = function(stars, meteors, meteorSpawnDensity, meteorVel) + + TEN.Flow.GetCurrentLevel().starField.starCount = stars + TEN.Flow.GetCurrentLevel().starField.meteorCount = meteors + TEN.Flow.GetCurrentLevel().starField.meteorSpawnDensity = meteorSpawnDensity + TEN.Flow.GetCurrentLevel().starField.meteorVelocity = meteorVel + +end + +-- !Name "Change starfield over time" +-- !Section "Environment" +-- !Description "Changes stars and meteors over specified time." +-- !Arguments "NewLine, Numerical, 15, [ 0 | 6000 ], Stars count" "Numerical, 15, [ 0 | 100 ], Meteors count" "Numerical, 15, [ 0 | 10 ], Meteors spawn density" "Numerical, 15, [ 0 | 40 ], Meteors velocity" "Numerical, 15, [ 0 | 65535 ], Time in seconds" + +LevelFuncs.Engine.Node.ChangeStarfieldDensityOverTime = function(starCount, meteorCount, meteorDensity, meteorVelocity, time) + + local structure = {x1 = starCount, x2 = meteorCount, x3 = meteorDensity, x4 = meteorVelocity} + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(4, 3, structure, time, true) end + +end + +-- !Name "Add sky layer" +-- !Section "Environment" +-- !Description "Add or change sky layer of current level." +-- !Arguments "NewLine, Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Skylayer" "Color, 20, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" + +LevelFuncs.Engine.Node.AddSkyLayer = function(type, color, speed) + + if (type == 0) then + TEN.Flow.GetCurrentLevel().layer1 = Flow.SkyLayer.new(color, speed) + elseif (type == 1) then + TEN.Flow.GetCurrentLevel().layer2 = Flow.SkyLayer.new(color, speed) + end + +end + +-- !Name "Change sky layer over specified time" +-- !Section "Environment" +-- !Description "Add or change sky layer 1 of current level." +-- !Arguments "NewLine, Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Skylayer" "Color, 20, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" "Numerical, 15, [ 0 | 65535 ], Time in seconds" "35, Boolean, Smooth transition" + +LevelFuncs.Engine.Node.ChangeSkyLayerOverTime = function(type, color, speed, time, smooth) + + local structure = {x1 = color.r, x2 = color.g, x3 = color.b, x4 = speed} + + if (type == 0) then + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(2, 3, structure, time, smooth) end + elseif (type == 1) then + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(3, 3, structure, time, smooth) end + end + +end + +-- !Name "Add or remove horizon" +-- !Section "Environment" +-- !Description "Add or remove horizon of current level." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Choose moveable slot to create horizon" +-- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, Position value to define" +-- !Arguments "NewLine, Vector3, [ -360 | 360 | 0 | 1 | 32 ], 100, Rotation value to define" +-- !Arguments "NewLine, Numerical, 15, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" "35, Boolean, {true}, Enable" +LevelFuncs.Engine.Node.AddHorizon = function(type, slot, position, rotation, transparency, status) + + if (type == 0) then + TEN.Flow.GetCurrentLevel().horizon1.enabled = status + TEN.Flow.GetCurrentLevel().horizon1.objectID = slot + TEN.Flow.GetCurrentLevel().horizon1.position = position + TEN.Flow.GetCurrentLevel().horizon1.rotation = Rotation(rotation.x, rotation.y, rotation.z) + TEN.Flow.GetCurrentLevel().horizon1.transparency = transparency + + elseif (type == 1) then + TEN.Flow.GetCurrentLevel().horizon2.enabled = status + TEN.Flow.GetCurrentLevel().horizon2.objectID = slot + TEN.Flow.GetCurrentLevel().horizon2.position = position + TEN.Flow.GetCurrentLevel().horizon2.rotation = Rotation(rotation.x, rotation.y, rotation.z) + TEN.Flow.GetCurrentLevel().horizon2.transparency = transparency + end + +end + +-- !Name "Set position of horizon" +-- !Section "Environment" +-- !Description "Set position of horizon." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "35, Boolean, Relative coordinates" +-- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, New position value to define" +LevelFuncs.Engine.Node.SetHorizonPosition = function(type, relative, newPosition) + + if (type == 0) then + if (relative) then + newPosition = TEN.Flow.GetCurrentLevel().horizon1.position + newPosition + end + TEN.Flow.GetCurrentLevel().horizon1.position = newPosition + elseif (type == 1) then + if (relative) then + newPosition = TEN.Flow.GetCurrentLevel().horizon2.position + newPosition + end + TEN.Flow.GetCurrentLevel().horizon2.position = newPosition + end + +end + +-- !Name "Set rotation of horizon" +-- !Section "Environment" +-- !Description "Set position of horizon." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "35, Boolean, Relative coordinates" +-- !Arguments "NewLine, Vector3, [ -360 | 360 | 0 | 1 | 1 ], 100, New rotation value to define" + +LevelFuncs.Engine.Node.SetHorizonRotation = function(type, relative, newRotation) + + if (type == 0) then + if (relative) then + currentRotation = Vec3(TEN.Flow.GetCurrentLevel().horizon1.rotation.x, TEN.Flow.GetCurrentLevel().horizon1.rotation.y, TEN.Flow.GetCurrentLevel().horizon1.rotation.z) + newRotation = currentRotation + newRotation + end + TEN.Flow.GetCurrentLevel().horizon1.rotation = Rotation(newRotation.x, newRotation.y, newRotation.z) + elseif (type == 1) then + if (relative) then + currentRotation = Vec3(TEN.Flow.GetCurrentLevel().horizon2.rotation.x, TEN.Flow.GetCurrentLevel().horizon2.rotation.y, TEN.Flow.GetCurrentLevel().horizon2.rotation.z) + newRotation = currentRotation + newRotation + end + TEN.Flow.GetCurrentLevel().horizon2.rotation = Rotation(newRotation.x, newRotation.y, newRotation.z) + end + +end + +-- !Name "Set transparency of horizon" +-- !Section "Environment" +-- !Description "Set transparency of horizon." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "Numerical, 15, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" + +LevelFuncs.Engine.Node.SetHorizonRotation = function(type, transparency) + + if (type == 0) then + TEN.Flow.GetCurrentLevel().horizon1.transparency = transparency + elseif (type == 1) then + TEN.Flow.GetCurrentLevel().horizon2.transparency = transparency + end + +end + +-- !Name "Change position of a horizon over specified time" +-- !Section "Environment" +-- !Description "Gradually change position of horizon over specified timespan." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "Boolean, 35, Relative coordinates" "Boolean, 35, Smooth motion" +-- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 65, New position value to define" +-- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 35, Time (in seconds)" + + +LevelFuncs.Engine.Node.ChangeHorizonPositionOverTimespan = function(type, relative, smooth, newPosition, time) + + if (type == 0) then + if (relative) then + newPosition = TEN.Flow.GetCurrentLevel().horizon1.position + newPosition + end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(6, 2, newPosition, time, smooth) end + elseif (type == 1) then + if (relative) then + newPosition = TEN.Flow.GetCurrentLevel().horizon2.position + newPosition + end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(9, 2, newPosition, time, smooth) end + end + +end + +-- !Name "Change rotation of horizon over specified time" +-- !Section "Environment" +-- !Description "Gradually change rotation of a moveable over specified timespan." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "Boolean, 35, Relative coordinates" "Boolean, 35, Smooth motion" +-- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 65, New rotation value to define" +-- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 35, Time (in seconds)" + +LevelFuncs.Engine.Node.ChangeHorizonRotationOverTimespan = function(type, relative, smooth, newRotation, time) + + if (type == 0) then + if (relative) then + currentRotation = Vec3(TEN.Flow.GetCurrentLevel().horizon1.rotation.x, TEN.Flow.GetCurrentLevel().horizon1.rotation.y, TEN.Flow.GetCurrentLevel().horizon1.rotation.z) + newRotation = currentRotation + newRotation + end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(7, 2, newRotation, time, smooth) end + elseif (type == 1) then + if (relative) then + currentRotation = Vec3(TEN.Flow.GetCurrentLevel().horizon2.rotation.x, TEN.Flow.GetCurrentLevel().horizon2.rotation.y, TEN.Flow.GetCurrentLevel().horizon2.rotation.z) + newRotation = currentRotation + newRotation + end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(10, 2, newRotation, time, smooth) end + end +end + +-- !Name "Change transparency of horizon over specified time" +-- !Section "Environment" +-- !Description "Gradually change transparency over specified timespan." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "Numerical, 15, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" +-- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 25, Time (in seconds)" +-- !Arguments "Boolean, 35, Relative coordinates" + + +LevelFuncs.Engine.Node.ChangeHorizonTransparencyOverTimespan = function(type, newTransparency, time, relative) + + if (type == 0) then + if (relative) then + newTransparency = TEN.Flow.GetCurrentLevel().horizon1.transparency + newTransparency + end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, newTransparency, time, smooth) end + elseif (type == 1) then + if (relative) then + newTransparency = TEN.Flow.GetCurrentLevel().horizon2.transparency + newTransparency + end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, newTransparency, time, smooth) end + end + +end + +-- !Name "Set rotation speed of horizon" +-- !Section "Environment" +-- !Description "Stop rotation of horizon." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "NewLine, Vector3, [ -360 | 360 | 2 ], 100, Rotation speed per second" +LevelFuncs.Engine.Node.SetHorizonRotationSpeed = function(type, speed) + + LevelVars.Engine.WeatherData = LevelVars.Engine.WeatherData or {} + + if (type == 0 and TEN.Flow.GetCurrentLevel().horizon1.enabled == true) then + LevelVars.Engine.WeatherData["Horizon1Speed"] = Vec3(speed.x/30, speed.y/30, speed.z/30) + AddCallback(TEN.Logic.CallbackPoint.PRECONTROLPHASE,LevelFuncs.Engine.Node.RotateHorizon1) + elseif (type == 1 and TEN.Flow.GetCurrentLevel().horizon2.enabled == true) then + LevelVars.Engine.WeatherData["Horizon2Speed"] = Vec3(speed.x/30, speed.y/30, speed.z/30) + AddCallback(TEN.Logic.CallbackPoint.PRECONTROLPHASE,LevelFuncs.Engine.Node.RotateHorizon2) + end + +end + +-- !Name "Stop rotation of a horizon" +-- !Section "Environment" +-- !Description "Stop rotation of a horizon." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +LevelFuncs.Engine.Node.StopHorizonRotation = function(type) + + if (type == 0 and TEN.Flow.GetCurrentLevel().horizon1.enabled == true) then + RemoveCallback(TEN.Logic.CallbackPoint.PRECONTROLPHASE, LevelFuncs.Engine.Node.RotateHorizon1) + elseif (type == 1 and TEN.Flow.GetCurrentLevel().horizon2.enabled == true) then + RemoveCallback(TEN.Logic.CallbackPoint.PRECONTROLPHASE, LevelFuncs.Engine.Node.RotateHorizon2) + end + +end + +-- !Ignore +-- RotateHorizons +LevelFuncs.Engine.Node.RotateHorizon1 = function() + + if TEN.Flow.GetCurrentLevel().horizon1.enabled == true and LevelVars.Engine.WeatherData["Horizon1Speed"] then + + local rotation = Vec3(TEN.Flow.GetCurrentLevel().horizon1.rotation.x,TEN.Flow.GetCurrentLevel().horizon1.rotation.y, TEN.Flow.GetCurrentLevel().horizon1.rotation.z) + LevelVars.Engine.WeatherData["Horizon1Speed"] + TEN.Flow.GetCurrentLevel().horizon1.rotation = Rotation(rotation.x, rotation.y, rotation.z) + + end + +end + +-- !Ignore +-- RotateHorizons +LevelFuncs.Engine.Node.RotateHorizon2 = function() + + if TEN.Flow.GetCurrentLevel().horizon2.enabled == true and LevelVars.Engine.WeatherData["Horizon2Speed"] then + + local rotation = Vec3(TEN.Flow.GetCurrentLevel().horizon2.rotation.x,TEN.Flow.GetCurrentLevel().horizon2.rotation.y, TEN.Flow.GetCurrentLevel().horizon2.rotation.z) + LevelVars.Engine.WeatherData["Horizon2Speed"] + TEN.Flow.GetCurrentLevel().horizon2.rotation = Rotation(rotation.x, rotation.y, rotation.z) + + end + end \ No newline at end of file From b31285b73647c29bdacd311bcf3eb66abf2a1b68 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Tue, 11 Mar 2025 13:03:22 -0400 Subject: [PATCH 02/29] Fix duplicate name --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 17f461538..09f95492b 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -80,13 +80,13 @@ LevelFuncs.Engine.Node.ConstructWeatherTimedData = function(dataType, operand, n LevelVars.Engine.WeatherData[dataName].NewValue = newValue LevelVars.Engine.WeatherData[dataName].OldValue = value - local timer = Timer.Create(dataName, 1 / 30, true, false, LevelFuncs.Engine.Node.TransformTimedData, dataName) + local timer = Timer.Create(dataName, 1 / 30, true, false, LevelFuncs.Engine.Node.TransformWeatherTimedData, dataName) timer:Start() end -- !Ignore -- Transform object parameter using previously saved timed transform data -LevelFuncs.Engine.Node.TransformTimedData = function(dataName) +LevelFuncs.Engine.Node.TransformWeatherTimedData = function(dataName) LevelVars.Engine.WeatherData[dataName].Progress = math.min(LevelVars.Engine.WeatherData[dataName].Progress + LevelVars.Engine.WeatherData[dataName].Interval, 1) local factor = LevelVars.Engine.WeatherData[dataName].Smooth and LevelFuncs.Engine.Node.Smoothstep(LevelVars.Engine.WeatherData[dataName].Progress) or LevelVars.Engine.WeatherData[dataName].Progress @@ -599,4 +599,4 @@ LevelFuncs.Engine.Node.RotateHorizon2 = function() end -end \ No newline at end of file +end From 80b84063798f68e313a6c65f137d0080241e859f Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Tue, 11 Mar 2025 13:03:54 -0400 Subject: [PATCH 03/29] typos --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 09f95492b..00a5dab01 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -31,7 +31,7 @@ LevelFuncs.Engine.Node.ConstructWeatherTimedData = function(dataType, operand, n local meteorVelocity = TEN.Flow.GetCurrentLevel().starField.meteorVelocity value = {x1 = starCount, x2 = meteorCount, x3 = meteorDensity, x4 = meteorVelocity} elseif (dataType == 5) then - prefix = "_weaterStrength" + prefix = "_weatherStrength" value = TEN.Flow.GetCurrentLevel().weatherStrength elseif (dataType == 6) then prefix = "_horizon1Position" From b5ce1e6cfd337b6373ab26c9d851b1e997ceecda Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Tue, 11 Mar 2025 18:41:48 -0400 Subject: [PATCH 04/29] Update Environment.lua --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 00a5dab01..3661b8176 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -116,7 +116,7 @@ LevelFuncs.Engine.Node.TransformWeatherTimedData = function(dataName) newValue2 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x2, LevelVars.Engine.WeatherData[dataName].NewValue.x2, factor) newValue3 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x3, LevelVars.Engine.WeatherData[dataName].NewValue.x3, factor) newValue4 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue.x4, LevelVars.Engine.WeatherData[dataName].NewValue.x4, factor) - else + elseif (LevelVars.Engine.WeatherData[dataName].Operand == 4) then newValue1 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.WeatherData[dataName].OldValue, LevelVars.Engine.WeatherData[dataName].NewValue, factor) end From 49425dfe30b1c9b0ab92806095da815171cd4cf9 Mon Sep 17 00:00:00 2001 From: Lwmte <3331699+Lwmte@users.noreply.github.com> Date: Wed, 12 Mar 2025 00:07:55 +0100 Subject: [PATCH 05/29] Update Environment.lua --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 3661b8176..ea6211cbf 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -459,7 +459,7 @@ end -- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" -- !Arguments "Numerical, 15, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" -LevelFuncs.Engine.Node.SetHorizonRotation = function(type, transparency) +LevelFuncs.Engine.Node.SetHorizonTransparency = function(type, transparency) if (type == 0) then TEN.Flow.GetCurrentLevel().horizon1.transparency = transparency From e53e453ff480de4fffe2f7758e7ba95c509a0f03 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Tue, 11 Mar 2025 21:02:50 -0400 Subject: [PATCH 06/29] Add files via upload --- .../TEN Node Catalogs/Environment.lua | 119 +++++++++--------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index ea6211cbf..ba1cf2101 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -2,6 +2,8 @@ local Timer = require("Engine.Timer") -- !Ignore -- Construct timed transform data and start transform + +LevelVars.Engine.WeatherData = {} LevelFuncs.Engine.Node.ConstructWeatherTimedData = function(dataType, operand, newValue, time, smooth) local prefix = nil @@ -32,7 +34,7 @@ LevelFuncs.Engine.Node.ConstructWeatherTimedData = function(dataType, operand, n value = {x1 = starCount, x2 = meteorCount, x3 = meteorDensity, x4 = meteorVelocity} elseif (dataType == 5) then prefix = "_weatherStrength" - value = TEN.Flow.GetCurrentLevel().weatherStrength + value = 0 --TEN.Flow.GetCurrentLevel().weatherStrength elseif (dataType == 6) then prefix = "_horizon1Position" value = TEN.Flow.GetCurrentLevel().horizon1.position @@ -82,6 +84,7 @@ LevelFuncs.Engine.Node.ConstructWeatherTimedData = function(dataType, operand, n local timer = Timer.Create(dataName, 1 / 30, true, false, LevelFuncs.Engine.Node.TransformWeatherTimedData, dataName) timer:Start() + end -- !Ignore @@ -162,13 +165,11 @@ LevelFuncs.Engine.Node.TransformWeatherTimedData = function(dataName) end - -- !Name "If minimum fog distance is..." -- !Section "Environment" -- !Description "Checks current minimum (near) fog distance value in sectors." -- !Conditional "True" -- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 256 ], Minimum fog distance to check" - LevelFuncs.Engine.Node.TestFogMinDistance = function(operator, number) return LevelFuncs.Engine.Node.CompareValue(TEN.Flow.GetCurrentLevel().fog.minDistance, number, operator) end @@ -178,7 +179,6 @@ end -- !Description "Checks current maximum (far) fog distance value in sectors." -- !Conditional "True" -- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 256 ], Maximum fog distance to check" - LevelFuncs.Engine.Node.TestFogMaxDistance = function(operator, number) return LevelFuncs.Engine.Node.CompareValue(TEN.Flow.GetCurrentLevel().fog.maxDistance, number, operator) end @@ -188,7 +188,6 @@ end -- !Description "Checks current fog color." -- !Conditional "True" -- !Arguments "Color, 20, Fog color" - LevelFuncs.Engine.Node.TestFogColor = function(color) local fog = TEN.Flow.GetCurrentLevel().fog return (color.r == fog.color.r and color.g == fog.color.g and color.b == fog.color.b) @@ -198,7 +197,6 @@ end -- !Section "Environment" -- !Description "Sets fog minimum (near) distance to specified value in sectors." -- !Arguments "Numerical, 15, [ 0 | 256 ], Minimum fog distance" - LevelFuncs.Engine.Node.SetFogMinDistance = function(distance) TEN.Flow.GetCurrentLevel().fog.minDistance = distance end @@ -207,7 +205,6 @@ end -- !Section "Environment" -- !Description "Sets fog maximum (far) distance to specified value in sectors." -- !Arguments "Numerical, 15, [ 0 | 256 ], Maximum fog distance" - LevelFuncs.Engine.Node.SetFogMaxDistance = function(distance) TEN.Flow.GetCurrentLevel().fog.maxDistance = distance end @@ -216,7 +213,6 @@ end -- !Section "Environment" -- !Description "Sets fog color to specified." -- !Arguments "Color, 20, Fog color" - LevelFuncs.Engine.Node.SetFogColor = function(color) TEN.Flow.GetCurrentLevel().fog.color = color end @@ -224,8 +220,7 @@ end -- !Name "Change fog color over time" -- !Section "Environment" -- !Description "Changes fog color over specified time." --- !Arguments "NewLine, Color, 20, Fog color" "Numerical, 15, [ 0 | 65535 ], Time in seconds" "35, Boolean, Smooth motion" - +-- !Arguments "NewLine, Color, 20, Fog color" "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" "35, Boolean, Smooth motion" LevelFuncs.Engine.Node.ChangeFogColorOverTime = function(color, time, smooth) do LevelFuncs.Engine.Node.ConstructWeatherTimedData(0, 0, color, time, smooth) end @@ -236,7 +231,6 @@ end -- !Section "Environment" -- !Description "Sets draw distance to specified value in sectors." -- !Arguments "Numerical, 15, [ 4 | 256 | 0 | 1 ], {20}, Maximum draw distance in sectors" - LevelFuncs.Engine.Node.SetDrawDistance = function(distance) TEN.Flow.GetCurrentLevel().farView = distance end @@ -244,8 +238,7 @@ end -- !Name "Add lens flare" -- !Section "Environment" -- !Description "Add a lens flare." --- !Arguments "NewLine, Numerical, 15, [ 0 | 360 ], Pitch" "Numerical, 15, [ 0 | 360 ], Yaw" "Color, 20, Lens flare color" - +-- !Arguments "Numerical, 15, [ 0 | 360 ], Pitch" "Numerical, 15, [ 0 | 360 ], Yaw" "Color, 20, Lens flare color" LevelFuncs.Engine.Node.AddLensFlare = function(pitch, yaw, color) TEN.Flow.GetCurrentLevel().lensFlare = Flow.LensFlare(pitch, yaw, color) @@ -255,8 +248,7 @@ end -- !Name "Change lens flare position over time" -- !Section "Environment" -- !Description "Changes lens flare position over specified time." --- !Arguments "NewLine, Numerical, 15, [ 0 | 360 ], Pitch" "Numerical, 15, [ 0 | 360 ], Yaw" "Numerical, 15, [ 0 | 65535 ], Time in seconds" "35, Boolean, Smooth motion" - +-- !Arguments "NewLine, Numerical, 20, [ 0 | 360 ], Pitch" "Numerical, 20, [ 0 | 360 ], Yaw" "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" "40, Boolean, Smooth motion" LevelFuncs.Engine.Node.ChangeLensFlarePosOverTime = function(pitch, yaw, time, smooth) if TEN.Flow.GetCurrentLevel().lensFlare:GetEnabled() == true then @@ -270,8 +262,7 @@ end -- !Name "Change lens flare color over time" -- !Section "Environment" -- !Description "Changes lens flare color over specified time." --- !Arguments "NewLine, Color, 20, Lens flare color" "Numerical, 15, [ 0 | 65535 ], Time in seconds" - +-- !Arguments "Color, 15, Lens flare color" "Numerical, 15, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" LevelFuncs.Engine.Node.ChangeLensFlareColorOverTime = function(color, time) if TEN.Flow.GetCurrentLevel().lensFlare:GetEnabled() == true then @@ -286,7 +277,6 @@ end -- !Section "Environment" -- !Description "Add a lightning storm to current level." -- !Arguments "Boolean, 15, Storm" - LevelFuncs.Engine.Node.SetStorm = function(storm) TEN.Flow.GetCurrentLevel().storm = storm @@ -296,8 +286,7 @@ end -- !Name "Set weather" -- !Section "Environment" -- !Description "Add a weather to current level." --- !Arguments "NewLine, Enumeration, 25, [ None | Rain | Snow], {0}" "Numerical, 15, [ 0 | 1 | 2 | .1 ], Strength" - +-- !Arguments "Enumeration, 25, [ None | Rain | Snow], {0}" "Numerical, 15, [ 0 | 1 | 2 | .1 ], Strength" LevelFuncs.Engine.Node.SetWeather = function(weather, strength) TEN.Flow.GetCurrentLevel().weather = weather @@ -308,10 +297,9 @@ end -- !Name "Change weather strength over time" -- !Section "Environment" -- !Description "Change weather strength over specified time." --- !Arguments "Numerical, 15, [ 0 | 1 | 1 | .1 ], Strength" --- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 65, Time (in seconds)" +-- !Arguments "NewLine, Numerical, 20, [ 0 | 1 | 2 | .1 ], Strength" +-- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 20, Time (in seconds)" -- !Arguments "30, Boolean, Relative" - LevelFuncs.Engine.Node.ChangeWeatherOverTime = function(newStrength, time, relative) if (relative) then @@ -325,8 +313,7 @@ end -- !Name "Add starfield and meteors" -- !Section "Environment" -- !Description "Add a starfield to current level." --- !Arguments "NewLine, Numerical, 15, [ 0 | 6000 ], Stars count" "Numerical, 15, [ 0 | 100 ], Meteors count" "Numerical, 15, [ 0 | 10 ], Meteors spawn density" "Numerical, 15, [ 0 | 40 ], Meteors velocity" - +-- !Arguments "NewLine, Numerical, 25, [ 0 | 6000 ], Stars count" "Numerical, 25, [ 0 | 100 ], Meteors count" "Numerical, 25, [ 0 | 10 ], Meteors spawn density" "Numerical, 25, [ 0 | 40 ], Meteors velocity" LevelFuncs.Engine.Node.AddStarfield = function(stars, meteors, meteorSpawnDensity, meteorVel) TEN.Flow.GetCurrentLevel().starField.starCount = stars @@ -339,7 +326,7 @@ end -- !Name "Change starfield over time" -- !Section "Environment" -- !Description "Changes stars and meteors over specified time." --- !Arguments "NewLine, Numerical, 15, [ 0 | 6000 ], Stars count" "Numerical, 15, [ 0 | 100 ], Meteors count" "Numerical, 15, [ 0 | 10 ], Meteors spawn density" "Numerical, 15, [ 0 | 40 ], Meteors velocity" "Numerical, 15, [ 0 | 65535 ], Time in seconds" +-- !Arguments "NewLine, Numerical, 20, [ 0 | 6000 ], Stars count" "Numerical, 20, [ 0 | 100 ], Meteors count" "Numerical, 20, [ 0 | 10 ], Meteors spawn density" "Numerical, 20, [ 0 | 40 ], Meteors velocity" "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" LevelFuncs.Engine.Node.ChangeStarfieldDensityOverTime = function(starCount, meteorCount, meteorDensity, meteorVelocity, time) @@ -351,8 +338,7 @@ end -- !Name "Add sky layer" -- !Section "Environment" -- !Description "Add or change sky layer of current level." --- !Arguments "NewLine, Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Skylayer" "Color, 20, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" - +-- !Arguments "Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Skylayer" "Color, 15, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" LevelFuncs.Engine.Node.AddSkyLayer = function(type, color, speed) if (type == 0) then @@ -363,11 +349,10 @@ LevelFuncs.Engine.Node.AddSkyLayer = function(type, color, speed) end --- !Name "Change sky layer over specified time" +-- !Name "Change sky layer over time" -- !Section "Environment" -- !Description "Add or change sky layer 1 of current level." --- !Arguments "NewLine, Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Skylayer" "Color, 20, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" "Numerical, 15, [ 0 | 65535 ], Time in seconds" "35, Boolean, Smooth transition" - +-- !Arguments "NewLine, Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Skylayer" "Color, 15, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" "Numerical, 15, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" "35, Boolean, Smooth transition" LevelFuncs.Engine.Node.ChangeSkyLayerOverTime = function(type, color, speed, time, smooth) local structure = {x1 = color.r, x2 = color.g, x3 = color.b, x4 = speed} @@ -383,10 +368,10 @@ end -- !Name "Add or remove horizon" -- !Section "Environment" -- !Description "Add or remove horizon of current level." --- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Choose moveable slot to create horizon" +-- !Arguments "NewLine, Enumeration, 33, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "WadSlots, 67, {TEN.Objects.ObjID.HORIZON}, Choose moveable slot to create horizon" -- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, Position value to define" -- !Arguments "NewLine, Vector3, [ -360 | 360 | 0 | 1 | 32 ], 100, Rotation value to define" --- !Arguments "NewLine, Numerical, 15, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" "35, Boolean, {true}, Enable" +-- !Arguments "NewLine, Numerical, 34, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" "35, Boolean, {true}, Enable" LevelFuncs.Engine.Node.AddHorizon = function(type, slot, position, rotation, transparency, status) if (type == 0) then @@ -409,7 +394,7 @@ end -- !Name "Set position of horizon" -- !Section "Environment" -- !Description "Set position of horizon." --- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "NewLine, Enumeration, 34, [ Horizon 1 | Horizon 2 ], {0}, Horizon" -- !Arguments "35, Boolean, Relative coordinates" -- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, New position value to define" LevelFuncs.Engine.Node.SetHorizonPosition = function(type, relative, newPosition) @@ -431,10 +416,9 @@ end -- !Name "Set rotation of horizon" -- !Section "Environment" -- !Description "Set position of horizon." --- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "NewLine, Enumeration, 34, [ Horizon 1 | Horizon 2 ], {0}, Horizon" -- !Arguments "35, Boolean, Relative coordinates" -- !Arguments "NewLine, Vector3, [ -360 | 360 | 0 | 1 | 1 ], 100, New rotation value to define" - LevelFuncs.Engine.Node.SetHorizonRotation = function(type, relative, newRotation) if (type == 0) then @@ -456,9 +440,8 @@ end -- !Name "Set transparency of horizon" -- !Section "Environment" -- !Description "Set transparency of horizon." --- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" -- !Arguments "Numerical, 15, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" - LevelFuncs.Engine.Node.SetHorizonTransparency = function(type, transparency) if (type == 0) then @@ -469,15 +452,13 @@ LevelFuncs.Engine.Node.SetHorizonTransparency = function(type, transparency) end --- !Name "Change position of a horizon over specified time" +-- !Name "Change position of a horizon over time" -- !Section "Environment" -- !Description "Gradually change position of horizon over specified timespan." --- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "Boolean, 35, Relative coordinates" "Boolean, 35, Smooth motion" --- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 65, New position value to define" --- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 35, Time (in seconds)" - - -LevelFuncs.Engine.Node.ChangeHorizonPositionOverTimespan = function(type, relative, smooth, newPosition, time) +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, New position value to define" +-- !Arguments "NewLine, Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 34, Time (in seconds)" "Boolean, 35, Relative coordinates" "Boolean, 31, Smooth motion" +LevelFuncs.Engine.Node.ChangeHorizonPositionOverTimespan = function(type, newPosition, time, relative, smooth) if (type == 0) then if (relative) then @@ -493,14 +474,13 @@ LevelFuncs.Engine.Node.ChangeHorizonPositionOverTimespan = function(type, relati end --- !Name "Change rotation of horizon over specified time" +-- !Name "Change rotation of horizon over time" -- !Section "Environment" -- !Description "Gradually change rotation of a moveable over specified timespan." --- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "Boolean, 35, Relative coordinates" "Boolean, 35, Smooth motion" --- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 65, New rotation value to define" --- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 35, Time (in seconds)" - -LevelFuncs.Engine.Node.ChangeHorizonRotationOverTimespan = function(type, relative, smooth, newRotation, time) +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, New rotation value to define" +-- !Arguments "NewLine, Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 34, Time (in seconds)" "Boolean, 35, Relative coordinates" "Boolean, 31, Smooth motion" +LevelFuncs.Engine.Node.ChangeHorizonRotationOverTimespan = function(type, newRotation, time, relative, smooth) if (type == 0) then if (relative) then @@ -517,27 +497,48 @@ LevelFuncs.Engine.Node.ChangeHorizonRotationOverTimespan = function(type, relati end end --- !Name "Change transparency of horizon over specified time" +-- !Name "Change transparency of horizon over time" -- !Section "Environment" -- !Description "Gradually change transparency over specified timespan." -- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" --- !Arguments "Numerical, 15, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" --- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 25, Time (in seconds)" +-- !Arguments "Numerical, 20, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" +-- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 20, Time (in seconds)" -- !Arguments "Boolean, 35, Relative coordinates" - - LevelFuncs.Engine.Node.ChangeHorizonTransparencyOverTimespan = function(type, newTransparency, time, relative) if (type == 0) then if (relative) then newTransparency = TEN.Flow.GetCurrentLevel().horizon1.transparency + newTransparency end - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, newTransparency, time, smooth) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, newTransparency, time, true) end elseif (type == 1) then if (relative) then newTransparency = TEN.Flow.GetCurrentLevel().horizon2.transparency + newTransparency end - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, newTransparency, time, smooth) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, newTransparency, time, true) end + end + +end + +-- !Name "Fade in a new horizon over time" +-- !Section "Environment" +-- !Description "Gradually fade in a horizon in the other slot over specified timespan." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Fade out which horizon" +-- !Arguments "NewLine, WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Fade in which horizon" +-- !Arguments "Numerical, 25 [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" +LevelFuncs.Engine.Node.FadeHorizonTransparencyOverTimespan = function(type, slot, time) + + if (type == 0) then + TEN.Flow.GetCurrentLevel().horizon2.enabled = true + TEN.Flow.GetCurrentLevel().horizon2.transparency = 0 + TEN.Flow.GetCurrentLevel().horizon2.objectID = slot + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 0, time, true) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 1, time, true) end + elseif (type == 1) then + TEN.Flow.GetCurrentLevel().horizon1.transparency = 0 + TEN.Flow.GetCurrentLevel().horizon1.objectID = slot + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 1, time, true) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 0, time, true) end end end @@ -545,7 +546,7 @@ end -- !Name "Set rotation speed of horizon" -- !Section "Environment" -- !Description "Stop rotation of horizon." --- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Arguments "Enumeration, 33, [ Horizon 1 | Horizon 2 ], {0}, Horizon" -- !Arguments "NewLine, Vector3, [ -360 | 360 | 2 ], 100, Rotation speed per second" LevelFuncs.Engine.Node.SetHorizonRotationSpeed = function(type, speed) From b24a17e0d4c20e58efa048ef4e53ee61c05c121d Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Wed, 12 Mar 2025 10:10:26 -0400 Subject: [PATCH 07/29] Add files via upload --- .../TEN Node Catalogs/Environment.lua | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index ba1cf2101..394aff299 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -34,7 +34,7 @@ LevelFuncs.Engine.Node.ConstructWeatherTimedData = function(dataType, operand, n value = {x1 = starCount, x2 = meteorCount, x3 = meteorDensity, x4 = meteorVelocity} elseif (dataType == 5) then prefix = "_weatherStrength" - value = 0 --TEN.Flow.GetCurrentLevel().weatherStrength + value = TEN.Flow.GetCurrentLevel().weatherStrength elseif (dataType == 6) then prefix = "_horizon1Position" value = TEN.Flow.GetCurrentLevel().horizon1.position @@ -520,13 +520,34 @@ LevelFuncs.Engine.Node.ChangeHorizonTransparencyOverTimespan = function(type, ne end +-- !Name "Fade horizons over time" +-- !Section "Environment" +-- !Description "Gradually fade horizons over specified timespan." +-- !Arguments "Numerical, 20, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" +-- !Arguments "Numerical, 20 [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" +LevelFuncs.Engine.Node.FadeHorizonsOverTimespan = function(transparency, time) + + if (TEN.Flow.GetCurrentLevel().horizon2.transparency < TEN.Flow.GetCurrentLevel().horizon1.transparency) then + local newTransparency1 = TEN.Flow.GetCurrentLevel().horizon1.transparency - transparency + local newTransparency2 = TEN.Flow.GetCurrentLevel().horizon2.transparency + transparency + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, newTransparency1, time, true) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, newTransparency2, time, true) end + elseif (TEN.Flow.GetCurrentLevel().horizon1.transparency < TEN.Flow.GetCurrentLevel().horizon2.transparency) then + local newTransparency1 = TEN.Flow.GetCurrentLevel().horizon1.transparency + transparency + local newTransparency2 = TEN.Flow.GetCurrentLevel().horizon2.transparency - transparency + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, newTransparency1, time, true) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, newTransparency2, time, true) end + end + +end + -- !Name "Fade in a new horizon over time" -- !Section "Environment" -- !Description "Gradually fade in a horizon in the other slot over specified timespan." -- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Fade out which horizon" -- !Arguments "NewLine, WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Fade in which horizon" -- !Arguments "Numerical, 25 [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" -LevelFuncs.Engine.Node.FadeHorizonTransparencyOverTimespan = function(type, slot, time) +LevelFuncs.Engine.Node.FadeHorizonFromSlotOverTimespan = function(type, slot, time) if (type == 0) then TEN.Flow.GetCurrentLevel().horizon2.enabled = true @@ -535,6 +556,7 @@ LevelFuncs.Engine.Node.FadeHorizonTransparencyOverTimespan = function(type, slot do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 0, time, true) end do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 1, time, true) end elseif (type == 1) then + TEN.Flow.GetCurrentLevel().horizon1.enabled = true TEN.Flow.GetCurrentLevel().horizon1.transparency = 0 TEN.Flow.GetCurrentLevel().horizon1.objectID = slot do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 1, time, true) end From a257f814fcc9c64f975b4aeec95d10f36b31c2a0 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Wed, 12 Mar 2025 10:13:13 -0400 Subject: [PATCH 08/29] Update Environment.lua --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 394aff299..b7387888a 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -524,7 +524,7 @@ end -- !Section "Environment" -- !Description "Gradually fade horizons over specified timespan." -- !Arguments "Numerical, 20, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" --- !Arguments "Numerical, 20 [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" +-- !Arguments "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" LevelFuncs.Engine.Node.FadeHorizonsOverTimespan = function(transparency, time) if (TEN.Flow.GetCurrentLevel().horizon2.transparency < TEN.Flow.GetCurrentLevel().horizon1.transparency) then From a76bb1ab4d53f77b715b400bb42606227c3df5a7 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Wed, 12 Mar 2025 10:14:22 -0400 Subject: [PATCH 09/29] Update Environment.lua --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index b7387888a..d803d9429 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -541,7 +541,7 @@ LevelFuncs.Engine.Node.FadeHorizonsOverTimespan = function(transparency, time) end --- !Name "Fade in a new horizon over time" +-- !Name "Fade in a new horizon object over time" -- !Section "Environment" -- !Description "Gradually fade in a horizon in the other slot over specified timespan." -- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Fade out which horizon" From 8f895b57d0fe83342f91f33451640f50e834f13a Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Wed, 12 Mar 2025 16:52:07 -0400 Subject: [PATCH 10/29] Update Environment.lua --- .../TEN Node Catalogs/Environment.lua | 42 +++++-------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index d803d9429..e509f7937 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -520,49 +520,27 @@ LevelFuncs.Engine.Node.ChangeHorizonTransparencyOverTimespan = function(type, ne end --- !Name "Fade horizons over time" --- !Section "Environment" --- !Description "Gradually fade horizons over specified timespan." --- !Arguments "Numerical, 20, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" --- !Arguments "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" -LevelFuncs.Engine.Node.FadeHorizonsOverTimespan = function(transparency, time) - - if (TEN.Flow.GetCurrentLevel().horizon2.transparency < TEN.Flow.GetCurrentLevel().horizon1.transparency) then - local newTransparency1 = TEN.Flow.GetCurrentLevel().horizon1.transparency - transparency - local newTransparency2 = TEN.Flow.GetCurrentLevel().horizon2.transparency + transparency - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, newTransparency1, time, true) end - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, newTransparency2, time, true) end - elseif (TEN.Flow.GetCurrentLevel().horizon1.transparency < TEN.Flow.GetCurrentLevel().horizon2.transparency) then - local newTransparency1 = TEN.Flow.GetCurrentLevel().horizon1.transparency + transparency - local newTransparency2 = TEN.Flow.GetCurrentLevel().horizon2.transparency - transparency - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, newTransparency1, time, true) end - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, newTransparency2, time, true) end - end - -end - --- !Name "Fade in a new horizon object over time" +-- !Name "Fade in a new horizon over time" -- !Section "Environment" -- !Description "Gradually fade in a horizon in the other slot over specified timespan." --- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Fade out which horizon" -- !Arguments "NewLine, WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Fade in which horizon" -- !Arguments "Numerical, 25 [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" -LevelFuncs.Engine.Node.FadeHorizonFromSlotOverTimespan = function(type, slot, time) - - if (type == 0) then - TEN.Flow.GetCurrentLevel().horizon2.enabled = true +LevelFuncs.Engine.Node.FadeHorizonFromSlotOverTimespan = function(slot, time) + + if (TEN.Flow.GetCurrentLevel().horizon1.transparency == 1 ) then TEN.Flow.GetCurrentLevel().horizon2.transparency = 0 + TEN.Flow.GetCurrentLevel().horizon2.enabled = true TEN.Flow.GetCurrentLevel().horizon2.objectID = slot do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 0, time, true) end - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 1, time, true) end - elseif (type == 1) then - TEN.Flow.GetCurrentLevel().horizon1.enabled = true + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 1, time, true) end + elseif (TEN.Flow.GetCurrentLevel().horizon2.transparency == 1) then TEN.Flow.GetCurrentLevel().horizon1.transparency = 0 + TEN.Flow.GetCurrentLevel().horizon1.enabled = true TEN.Flow.GetCurrentLevel().horizon1.objectID = slot do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 1, time, true) end - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 0, time, true) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 0, time, true) end end - + end -- !Name "Set rotation speed of horizon" From c0aa3e0d17119e9996faaf6b01ef26685f588f3c Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Wed, 12 Mar 2025 17:21:03 -0400 Subject: [PATCH 11/29] Update Environment.lua --- .../TEN Node Catalogs/Environment.lua | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index e509f7937..88e73b88b 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -365,28 +365,19 @@ LevelFuncs.Engine.Node.ChangeSkyLayerOverTime = function(type, color, speed, tim end --- !Name "Add or remove horizon" +-- !Name "Add a horizon" -- !Section "Environment" --- !Description "Add or remove horizon of current level." --- !Arguments "NewLine, Enumeration, 33, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "WadSlots, 67, {TEN.Objects.ObjID.HORIZON}, Choose moveable slot to create horizon" --- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, Position value to define" --- !Arguments "NewLine, Vector3, [ -360 | 360 | 0 | 1 | 32 ], 100, Rotation value to define" --- !Arguments "NewLine, Numerical, 34, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" "35, Boolean, {true}, Enable" -LevelFuncs.Engine.Node.AddHorizon = function(type, slot, position, rotation, transparency, status) +-- !Description "Add a horizon to the current level." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Choose moveable slot to create horizon" +LevelFuncs.Engine.Node.AddHorizon = function(type, slot) if (type == 0) then - TEN.Flow.GetCurrentLevel().horizon1.enabled = status + TEN.Flow.GetCurrentLevel().horizon1.enabled = true TEN.Flow.GetCurrentLevel().horizon1.objectID = slot - TEN.Flow.GetCurrentLevel().horizon1.position = position - TEN.Flow.GetCurrentLevel().horizon1.rotation = Rotation(rotation.x, rotation.y, rotation.z) - TEN.Flow.GetCurrentLevel().horizon1.transparency = transparency elseif (type == 1) then - TEN.Flow.GetCurrentLevel().horizon2.enabled = status + TEN.Flow.GetCurrentLevel().horizon2.enabled = true TEN.Flow.GetCurrentLevel().horizon2.objectID = slot - TEN.Flow.GetCurrentLevel().horizon2.position = position - TEN.Flow.GetCurrentLevel().horizon2.rotation = Rotation(rotation.x, rotation.y, rotation.z) - TEN.Flow.GetCurrentLevel().horizon2.transparency = transparency end end From d6bd885ad12be0b323472e285b54d59c629052ca Mon Sep 17 00:00:00 2001 From: Lwmte <3331699+Lwmte@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:28:02 +0100 Subject: [PATCH 12/29] Update Environment.lua --- .../TEN Node Catalogs/Environment.lua | 271 ++++++++++++------ 1 file changed, 178 insertions(+), 93 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 88e73b88b..40f42b749 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -169,7 +169,7 @@ end -- !Section "Environment" -- !Description "Checks current minimum (near) fog distance value in sectors." -- !Conditional "True" --- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 256 ], Minimum fog distance to check" +-- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 1024 ], Minimum fog distance to check" LevelFuncs.Engine.Node.TestFogMinDistance = function(operator, number) return LevelFuncs.Engine.Node.CompareValue(TEN.Flow.GetCurrentLevel().fog.minDistance, number, operator) end @@ -178,7 +178,7 @@ end -- !Section "Environment" -- !Description "Checks current maximum (far) fog distance value in sectors." -- !Conditional "True" --- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 256 ], Maximum fog distance to check" +-- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 1024 ], Maximum fog distance to check" LevelFuncs.Engine.Node.TestFogMaxDistance = function(operator, number) return LevelFuncs.Engine.Node.CompareValue(TEN.Flow.GetCurrentLevel().fog.maxDistance, number, operator) end @@ -196,7 +196,7 @@ end -- !Name "Set fog minimum distance" -- !Section "Environment" -- !Description "Sets fog minimum (near) distance to specified value in sectors." --- !Arguments "Numerical, 15, [ 0 | 256 ], Minimum fog distance" +-- !Arguments "Numerical, 15, [ 0 | 1024 ], Minimum fog distance" LevelFuncs.Engine.Node.SetFogMinDistance = function(distance) TEN.Flow.GetCurrentLevel().fog.minDistance = distance end @@ -204,7 +204,7 @@ end -- !Name "Set fog maximum distance" -- !Section "Environment" -- !Description "Sets fog maximum (far) distance to specified value in sectors." --- !Arguments "Numerical, 15, [ 0 | 256 ], Maximum fog distance" +-- !Arguments "Numerical, 15, [ 0 | 1024 ], Maximum fog distance" LevelFuncs.Engine.Node.SetFogMaxDistance = function(distance) TEN.Flow.GetCurrentLevel().fog.maxDistance = distance end @@ -227,34 +227,55 @@ LevelFuncs.Engine.Node.ChangeFogColorOverTime = function(color, time, smooth) end +-- !Name "If draw distance is..." +-- !Section "Environment" +-- !Description "Checks current draw distance value in sectors." +-- !Conditional "True" +-- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 1024 | 0 | 1 ], Draw distance to check" +LevelFuncs.Engine.Node.TestDrawDistance = function(operator, number) + return LevelFuncs.Engine.Node.CompareValue(TEN.Flow.GetCurrentLevel().farView, number, operator) +end + -- !Name "Set draw distance" -- !Section "Environment" --- !Description "Sets draw distance to specified value in sectors." --- !Arguments "Numerical, 15, [ 4 | 256 | 0 | 1 ], {20}, Maximum draw distance in sectors" +-- !Description "Sets draw distance to a specified value (in sectors)." +-- !Arguments "Numerical, 15, [ 4 | 1024 | 0 | 1 ], {20}, Maximum draw distance in sectors" LevelFuncs.Engine.Node.SetDrawDistance = function(distance) TEN.Flow.GetCurrentLevel().farView = distance end --- !Name "Add lens flare" +-- !Name "If lens flare is enabled..." -- !Section "Environment" --- !Description "Add a lens flare." +-- !Description "Checks if lens flare is currently enabled." +-- !Conditional "True" +LevelFuncs.Engine.Node.TestLensFlare = function() + return TEN.Flow.GetCurrentLevel().lensFlare.enabled +end + +-- !Name "Enable lens flare" +-- !Section "Environment" +-- !Description "Enables a lens flare with specified parameters." -- !Arguments "Numerical, 15, [ 0 | 360 ], Pitch" "Numerical, 15, [ 0 | 360 ], Yaw" "Color, 20, Lens flare color" -LevelFuncs.Engine.Node.AddLensFlare = function(pitch, yaw, color) - +LevelFuncs.Engine.Node.EnableLensFlare = function(pitch, yaw, color) TEN.Flow.GetCurrentLevel().lensFlare = Flow.LensFlare(pitch, yaw, color) +end +-- !Name "Disable lens flare" +-- !Section "Environment" +-- !Description "Disables a lens flare." +LevelFuncs.Engine.Node.DisableLensFlare = function(pitch, yaw, color) + TEN.Flow.GetCurrentLevel().lensFlare.enabled = false end -- !Name "Change lens flare position over time" -- !Section "Environment" -- !Description "Changes lens flare position over specified time." --- !Arguments "NewLine, Numerical, 20, [ 0 | 360 ], Pitch" "Numerical, 20, [ 0 | 360 ], Yaw" "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" "40, Boolean, Smooth motion" +-- !Arguments "NewLine, Numerical, 20, [ 0 | 360 ], Pitch" "Numerical, 20, [ 0 | 360 ], Yaw" +-- !Arguments "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" "40, Boolean, Smooth motion" LevelFuncs.Engine.Node.ChangeLensFlarePosOverTime = function(pitch, yaw, time, smooth) if TEN.Flow.GetCurrentLevel().lensFlare:GetEnabled() == true then - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(1, 1, Vec2(pitch, yaw), time, smooth) end - end end @@ -266,38 +287,49 @@ end LevelFuncs.Engine.Node.ChangeLensFlareColorOverTime = function(color, time) if TEN.Flow.GetCurrentLevel().lensFlare:GetEnabled() == true then - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(12, 0, color, time, true) end - end end +-- !Name "If storm is enabled..." +-- !Section "Environment" +-- !Description "Checks if storm is currently enabled." +-- !Conditional "True" +LevelFuncs.Engine.Node.TestStorm = function() + return TEN.Flow.GetCurrentLevel().storm +end + -- !Name "Set storm" -- !Section "Environment" --- !Description "Add a lightning storm to current level." +-- !Description "Enables or disables a lightning storm." -- !Arguments "Boolean, 15, Storm" LevelFuncs.Engine.Node.SetStorm = function(storm) - TEN.Flow.GetCurrentLevel().storm = storm +end +-- !Name "If weather is..." +-- !Section "Environment" +-- !Description "Checks if weather is currently set to a given type." +-- !Conditional "True" +-- !Arguments "Enumeration, 25, [ None | Rain | Snow ] +LevelFuncs.Engine.Node.TestWeather = function(weather) + return TEN.Flow.GetCurrentLevel().weather == weather end -- !Name "Set weather" -- !Section "Environment" --- !Description "Add a weather to current level." --- !Arguments "Enumeration, 25, [ None | Rain | Snow], {0}" "Numerical, 15, [ 0 | 1 | 2 | .1 ], Strength" +-- !Description "Sets weather conditions." +-- !Arguments "Enumeration, 25, [ None | Rain | Snow ], {0}, Weather type" "Numerical, 15, [ 0 | 1 | 2 | 0.1 ], Weather strength" LevelFuncs.Engine.Node.SetWeather = function(weather, strength) - TEN.Flow.GetCurrentLevel().weather = weather TEN.Flow.GetCurrentLevel().weatherStrength = strength - end -- !Name "Change weather strength over time" -- !Section "Environment" --- !Description "Change weather strength over specified time." --- !Arguments "NewLine, Numerical, 20, [ 0 | 1 | 2 | .1 ], Strength" +-- !Description "Changes weather strength over specified time." +-- !Arguments "NewLine, Numerical, 20, [ 0 | 1 | 2 | 0.1 ], Strength" -- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 20, Time (in seconds)" -- !Arguments "30, Boolean, Relative" LevelFuncs.Engine.Node.ChangeWeatherOverTime = function(newStrength, time, relative) @@ -310,11 +342,20 @@ LevelFuncs.Engine.Node.ChangeWeatherOverTime = function(newStrength, time, relat end --- !Name "Add starfield and meteors" +-- !Name "If starfield is visible..." -- !Section "Environment" --- !Description "Add a starfield to current level." --- !Arguments "NewLine, Numerical, 25, [ 0 | 6000 ], Stars count" "Numerical, 25, [ 0 | 100 ], Meteors count" "Numerical, 25, [ 0 | 10 ], Meteors spawn density" "Numerical, 25, [ 0 | 40 ], Meteors velocity" -LevelFuncs.Engine.Node.AddStarfield = function(stars, meteors, meteorSpawnDensity, meteorVel) +-- !Description "Checks if any stars or meteors are currently visible." +-- !Conditional "True" +LevelFuncs.Engine.Node.TestStarField = function(weather) + return TEN.Flow.GetCurrentLevel().starField.starCount > 0 or TEN.Flow.GetCurrentLevel().starField.starCount > 0 +end + +-- !Name "Set starfield" +-- !Section "Environment" +-- !Description "Sets starfield parameters, such as stars and meteors." +-- !Arguments "NewLine, Numerical, 25, [ 0 | 6000 ], Star count" "Numerical, 25, [ 0 | 100 ], Meteor count" +-- !Arguments "Numerical, 25, [ 0 | 10 ], Meteor spawn density" "Numerical, 25, [ 0 | 40 ], Meteor velocity" +LevelFuncs.Engine.Node.SetStarField = function(stars, meteors, meteorSpawnDensity, meteorVel) TEN.Flow.GetCurrentLevel().starField.starCount = stars TEN.Flow.GetCurrentLevel().starField.meteorCount = meteors @@ -326,20 +367,36 @@ end -- !Name "Change starfield over time" -- !Section "Environment" -- !Description "Changes stars and meteors over specified time." --- !Arguments "NewLine, Numerical, 20, [ 0 | 6000 ], Stars count" "Numerical, 20, [ 0 | 100 ], Meteors count" "Numerical, 20, [ 0 | 10 ], Meteors spawn density" "Numerical, 20, [ 0 | 40 ], Meteors velocity" "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" - -LevelFuncs.Engine.Node.ChangeStarfieldDensityOverTime = function(starCount, meteorCount, meteorDensity, meteorVelocity, time) +-- !Arguments "NewLine, Numerical, 20, [ 0 | 6000 ], Stars count" "Numerical, 20, [ 0 | 100 ], Meteors count" +-- !Arguments "Numerical, 20, [ 0 | 10 ], Meteors spawn density" "Numerical, 20, [ 0 | 40 ], Meteors velocity" +-- !Arguments "Numerical, 20, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" +LevelFuncs.Engine.Node.ChangeStarFieldDensityOverTime = function(starCount, meteorCount, meteorDensity, meteorVelocity, time) local structure = {x1 = starCount, x2 = meteorCount, x3 = meteorDensity, x4 = meteorVelocity} do LevelFuncs.Engine.Node.ConstructWeatherTimedData(4, 3, structure, time, true) end end --- !Name "Add sky layer" +-- !Name "If sky layer color is..." +-- !Section "Environment" +-- !Conditional "True" +-- !Description "Checks if specified sky layer is set to a specified color." +-- !Arguments "Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Sky layer" "Color, 15, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" +LevelFuncs.Engine.Node.TestSkyLayer = function(type, color) + + if (type == 0) then + return TEN.Flow.GetCurrentLevel().layer1.color == color + elseif (type == 1) then + return TEN.Flow.GetCurrentLevel().layer2.color == color + end + +end + +-- !Name "Set sky layer" -- !Section "Environment" --- !Description "Add or change sky layer of current level." --- !Arguments "Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Skylayer" "Color, 15, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" -LevelFuncs.Engine.Node.AddSkyLayer = function(type, color, speed) +-- !Description "Sets sky layer parameters." +-- !Arguments "Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Sky layer" "Color, 15, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" +LevelFuncs.Engine.Node.SetSkyLayer = function(type, color, speed) if (type == 0) then TEN.Flow.GetCurrentLevel().layer1 = Flow.SkyLayer.new(color, speed) @@ -351,8 +408,9 @@ end -- !Name "Change sky layer over time" -- !Section "Environment" --- !Description "Add or change sky layer 1 of current level." --- !Arguments "NewLine, Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Skylayer" "Color, 15, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" "Numerical, 15, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" "35, Boolean, Smooth transition" +-- !Description "Changes sky layer parameters over specified time." +-- !Arguments "NewLine, Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Sky layer" "Color, 15, Sky layer color" +-- !Arguments "Numerical, 15, [ -64 | 64 ], Speed" "Numerical, 15, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time in seconds" "35, Boolean, Smooth transition" LevelFuncs.Engine.Node.ChangeSkyLayerOverTime = function(type, color, speed, time, smooth) local structure = {x1 = color.r, x2 = color.g, x3 = color.b, x4 = speed} @@ -365,27 +423,54 @@ LevelFuncs.Engine.Node.ChangeSkyLayerOverTime = function(type, color, speed, tim end --- !Name "Add a horizon" +-- !Name "If horizon is visible..." -- !Section "Environment" --- !Description "Add a horizon to the current level." --- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" "WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Choose moveable slot to create horizon" -LevelFuncs.Engine.Node.AddHorizon = function(type, slot) +-- !Conditional "True" +-- !Description "Checks if specified horizon layer is visible." +-- !Arguments "Enumeration, 25, [ Layer 1 | Layer 2 ], {0}, Horizon layer" +LevelFuncs.Engine.Node.TestHorizonLayer = function(type) if (type == 0) then - TEN.Flow.GetCurrentLevel().horizon1.enabled = true - TEN.Flow.GetCurrentLevel().horizon1.objectID = slot - + return TEN.Flow.GetCurrentLevel().horizon1.enabled elseif (type == 1) then - TEN.Flow.GetCurrentLevel().horizon2.enabled = true - TEN.Flow.GetCurrentLevel().horizon2.objectID = slot + return TEN.Flow.GetCurrentLevel().horizon2.enabled + end + +end + +-- !Name "Enable horizon" +-- !Section "Environment" +-- !Description "Enables specified horizon layer and sets it to use specified object ID." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" +-- !Arguments "NewLine, WadSlots, {TEN.Objects.ObjID.HORIZON}, Choose moveable slot to use as a horizon" +LevelFuncs.Engine.Node.EnableHorizon = function(type, slot) + + if (type == 0) then + TEN.Flow.GetCurrentLevel().horizon1 = Flow.Horizon(slot) + elseif (type == 1) then + TEN.Flow.GetCurrentLevel().horizon2 = Flow.Horizon(slot) end end --- !Name "Set position of horizon" +-- !Name "Disable horizon" -- !Section "Environment" --- !Description "Set position of horizon." --- !Arguments "NewLine, Enumeration, 34, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Description "Disables specified horizon layer." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" +LevelFuncs.Engine.Node.DisableHorizon = function(type) + + if (type == 0) then + TEN.Flow.GetCurrentLevel().horizon1.enabled = false + elseif (type == 1) then + TEN.Flow.GetCurrentLevel().horizon2.enabled = false + end + +end + +-- !Name "Set position of a horizon" +-- !Section "Environment" +-- !Description "Sets position of a specified horizon layer." +-- !Arguments "NewLine, Enumeration, 34, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" -- !Arguments "35, Boolean, Relative coordinates" -- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, New position value to define" LevelFuncs.Engine.Node.SetHorizonPosition = function(type, relative, newPosition) @@ -404,10 +489,10 @@ LevelFuncs.Engine.Node.SetHorizonPosition = function(type, relative, newPosition end --- !Name "Set rotation of horizon" +-- !Name "Set rotation of a horizon" -- !Section "Environment" --- !Description "Set position of horizon." --- !Arguments "NewLine, Enumeration, 34, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Description "Sets rotation of a specified horizon layer." +-- !Arguments "NewLine, Enumeration, 34, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" -- !Arguments "35, Boolean, Relative coordinates" -- !Arguments "NewLine, Vector3, [ -360 | 360 | 0 | 1 | 1 ], 100, New rotation value to define" LevelFuncs.Engine.Node.SetHorizonRotation = function(type, relative, newRotation) @@ -428,10 +513,10 @@ LevelFuncs.Engine.Node.SetHorizonRotation = function(type, relative, newRotation end --- !Name "Set transparency of horizon" +-- !Name "Set transparency of a horizon" -- !Section "Environment" --- !Description "Set transparency of horizon." --- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Description "Sets transparency of a specified horizon layer." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" -- !Arguments "Numerical, 15, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" LevelFuncs.Engine.Node.SetHorizonTransparency = function(type, transparency) @@ -445,8 +530,8 @@ end -- !Name "Change position of a horizon over time" -- !Section "Environment" --- !Description "Gradually change position of horizon over specified timespan." --- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Description "Gradually changes position of a specified horizon layer over specified timespan." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" -- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, New position value to define" -- !Arguments "NewLine, Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 34, Time (in seconds)" "Boolean, 35, Relative coordinates" "Boolean, 31, Smooth motion" LevelFuncs.Engine.Node.ChangeHorizonPositionOverTimespan = function(type, newPosition, time, relative, smooth) @@ -465,10 +550,10 @@ LevelFuncs.Engine.Node.ChangeHorizonPositionOverTimespan = function(type, newPos end --- !Name "Change rotation of horizon over time" +-- !Name "Change rotation of a horizon over time" -- !Section "Environment" --- !Description "Gradually change rotation of a moveable over specified timespan." --- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Description "Gradually changes rotation of a specified horizon layer over specified timespan." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" -- !Arguments "NewLine, Vector3, [ -1000000 | 1000000 | 0 | 1 | 32 ], 100, New rotation value to define" -- !Arguments "NewLine, Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 34, Time (in seconds)" "Boolean, 35, Relative coordinates" "Boolean, 31, Smooth motion" LevelFuncs.Engine.Node.ChangeHorizonRotationOverTimespan = function(type, newRotation, time, relative, smooth) @@ -488,10 +573,10 @@ LevelFuncs.Engine.Node.ChangeHorizonRotationOverTimespan = function(type, newRot end end --- !Name "Change transparency of horizon over time" +-- !Name "Change transparency of a horizon over time" -- !Section "Environment" --- !Description "Gradually change transparency over specified timespan." --- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Description "Gradually changes transparency of a specified horizon layer over specified timespan." +-- !Arguments "NewLine, Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" -- !Arguments "Numerical, 20, [ 0 | 1 | 2 | 0.1 | 1 ], {1} Transparency" -- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 20, Time (in seconds)" -- !Arguments "Boolean, 35, Relative coordinates" @@ -511,34 +596,11 @@ LevelFuncs.Engine.Node.ChangeHorizonTransparencyOverTimespan = function(type, ne end --- !Name "Fade in a new horizon over time" --- !Section "Environment" --- !Description "Gradually fade in a horizon in the other slot over specified timespan." --- !Arguments "NewLine, WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Fade in which horizon" --- !Arguments "Numerical, 25 [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" -LevelFuncs.Engine.Node.FadeHorizonFromSlotOverTimespan = function(slot, time) - - if (TEN.Flow.GetCurrentLevel().horizon1.transparency == 1 ) then - TEN.Flow.GetCurrentLevel().horizon2.transparency = 0 - TEN.Flow.GetCurrentLevel().horizon2.enabled = true - TEN.Flow.GetCurrentLevel().horizon2.objectID = slot - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 0, time, true) end - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 1, time, true) end - elseif (TEN.Flow.GetCurrentLevel().horizon2.transparency == 1) then - TEN.Flow.GetCurrentLevel().horizon1.transparency = 0 - TEN.Flow.GetCurrentLevel().horizon1.enabled = true - TEN.Flow.GetCurrentLevel().horizon1.objectID = slot - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 1, time, true) end - do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 0, time, true) end - end - -end - --- !Name "Set rotation speed of horizon" +-- !Name "Set rotation speed of a horizon" -- !Section "Environment" --- !Description "Stop rotation of horizon." --- !Arguments "Enumeration, 33, [ Horizon 1 | Horizon 2 ], {0}, Horizon" --- !Arguments "NewLine, Vector3, [ -360 | 360 | 2 ], 100, Rotation speed per second" +-- !Description "Sets a constant rotation speed of a specified horizon layer." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" +-- !Arguments "NewLine, Vector3, [ -360 | 360 | 2 ], 100, Rotation speed in degrees per second" LevelFuncs.Engine.Node.SetHorizonRotationSpeed = function(type, speed) LevelVars.Engine.WeatherData = LevelVars.Engine.WeatherData or {} @@ -555,8 +617,8 @@ end -- !Name "Stop rotation of a horizon" -- !Section "Environment" --- !Description "Stop rotation of a horizon." --- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon" +-- !Description "Stops rotation of a horizon." +-- !Arguments "Enumeration, 25, [ Horizon 1 | Horizon 2 ], {0}, Horizon layer" LevelFuncs.Engine.Node.StopHorizonRotation = function(type) if (type == 0 and TEN.Flow.GetCurrentLevel().horizon1.enabled == true) then @@ -567,13 +629,36 @@ LevelFuncs.Engine.Node.StopHorizonRotation = function(type) end +-- !Name "Swap horizon with a crossfade over time" +-- !Section "Environment" +-- !Description "Automatically swaps two horizons with a crossfade over specified timespan." +-- !Arguments "NewLine, WadSlots, 75, {TEN.Objects.ObjID.HORIZON}, Fade in which horizon" +-- !Arguments "Numerical, 25 [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, Time (in seconds)" +LevelFuncs.Engine.Node.FadeHorizonFromSlotOverTimespan = function(slot, time) + + if (TEN.Flow.GetCurrentLevel().horizon1.transparency == 1) then + TEN.Flow.GetCurrentLevel().horizon2.transparency = 0 + TEN.Flow.GetCurrentLevel().horizon2.enabled = true + TEN.Flow.GetCurrentLevel().horizon2.objectID = slot + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 0, time, true) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 1, time, true) end + elseif (TEN.Flow.GetCurrentLevel().horizon2.transparency == 1) then + TEN.Flow.GetCurrentLevel().horizon1.transparency = 0 + TEN.Flow.GetCurrentLevel().horizon1.enabled = true + TEN.Flow.GetCurrentLevel().horizon1.objectID = slot + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 1, time, true) end + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 0, time, true) end + end + +end + -- !Ignore -- RotateHorizons LevelFuncs.Engine.Node.RotateHorizon1 = function() if TEN.Flow.GetCurrentLevel().horizon1.enabled == true and LevelVars.Engine.WeatherData["Horizon1Speed"] then - local rotation = Vec3(TEN.Flow.GetCurrentLevel().horizon1.rotation.x,TEN.Flow.GetCurrentLevel().horizon1.rotation.y, TEN.Flow.GetCurrentLevel().horizon1.rotation.z) + LevelVars.Engine.WeatherData["Horizon1Speed"] + local rotation = Vec3(TEN.Flow.GetCurrentLevel().horizon1.rotation.x, TEN.Flow.GetCurrentLevel().horizon1.rotation.y, TEN.Flow.GetCurrentLevel().horizon1.rotation.z) + LevelVars.Engine.WeatherData["Horizon1Speed"] TEN.Flow.GetCurrentLevel().horizon1.rotation = Rotation(rotation.x, rotation.y, rotation.z) end @@ -586,7 +671,7 @@ LevelFuncs.Engine.Node.RotateHorizon2 = function() if TEN.Flow.GetCurrentLevel().horizon2.enabled == true and LevelVars.Engine.WeatherData["Horizon2Speed"] then - local rotation = Vec3(TEN.Flow.GetCurrentLevel().horizon2.rotation.x,TEN.Flow.GetCurrentLevel().horizon2.rotation.y, TEN.Flow.GetCurrentLevel().horizon2.rotation.z) + LevelVars.Engine.WeatherData["Horizon2Speed"] + local rotation = Vec3(TEN.Flow.GetCurrentLevel().horizon2.rotation.x, TEN.Flow.GetCurrentLevel().horizon2.rotation.y, TEN.Flow.GetCurrentLevel().horizon2.rotation.z) + LevelVars.Engine.WeatherData["Horizon2Speed"] TEN.Flow.GetCurrentLevel().horizon2.rotation = Rotation(rotation.x, rotation.y, rotation.z) end From f4b6ec49829ac534a0c4800099474b42e882d9ad Mon Sep 17 00:00:00 2001 From: Lwmte <3331699+Lwmte@users.noreply.github.com> Date: Thu, 13 Mar 2025 10:36:10 +0100 Subject: [PATCH 13/29] Added a condition to prevent horizon crossfade into the same slot --- .../TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 40f42b749..8193af840 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -637,17 +637,25 @@ end LevelFuncs.Engine.Node.FadeHorizonFromSlotOverTimespan = function(slot, time) if (TEN.Flow.GetCurrentLevel().horizon1.transparency == 1) then + + if (TEN.Flow.GetCurrentLevel().horizon1.objectID == slot) then return end + TEN.Flow.GetCurrentLevel().horizon2.transparency = 0 TEN.Flow.GetCurrentLevel().horizon2.enabled = true TEN.Flow.GetCurrentLevel().horizon2.objectID = slot do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 0, time, true) end do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 1, time, true) end + elseif (TEN.Flow.GetCurrentLevel().horizon2.transparency == 1) then + + if (TEN.Flow.GetCurrentLevel().horizon2.objectID == slot) then return end + TEN.Flow.GetCurrentLevel().horizon1.transparency = 0 TEN.Flow.GetCurrentLevel().horizon1.enabled = true TEN.Flow.GetCurrentLevel().horizon1.objectID = slot do LevelFuncs.Engine.Node.ConstructWeatherTimedData(8, 4, 1, time, true) end do LevelFuncs.Engine.Node.ConstructWeatherTimedData(11, 4, 0, time, true) end + end end From 5f8a0d3a432b64af7f713d5e881e9a4364f0b341 Mon Sep 17 00:00:00 2001 From: Lwmte <3331699+Lwmte@users.noreply.github.com> Date: Thu, 13 Mar 2025 12:36:00 +0100 Subject: [PATCH 14/29] Removed unnecessary args --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 8193af840..cc67b3c2e 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -263,7 +263,7 @@ end -- !Name "Disable lens flare" -- !Section "Environment" -- !Description "Disables a lens flare." -LevelFuncs.Engine.Node.DisableLensFlare = function(pitch, yaw, color) +LevelFuncs.Engine.Node.DisableLensFlare = function() TEN.Flow.GetCurrentLevel().lensFlare.enabled = false end @@ -346,7 +346,7 @@ end -- !Section "Environment" -- !Description "Checks if any stars or meteors are currently visible." -- !Conditional "True" -LevelFuncs.Engine.Node.TestStarField = function(weather) +LevelFuncs.Engine.Node.TestStarField = function() return TEN.Flow.GetCurrentLevel().starField.starCount > 0 or TEN.Flow.GetCurrentLevel().starField.starCount > 0 end From 6469ac66b320fab538195d215732c9737d2c2280 Mon Sep 17 00:00:00 2001 From: Lwmte <3331699+Lwmte@users.noreply.github.com> Date: Thu, 13 Mar 2025 12:37:53 +0100 Subject: [PATCH 15/29] Update Changes.txt --- Installer/Changes.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Installer/Changes.txt b/Installer/Changes.txt index 582dd36c1..db7c26a2d 100644 --- a/Installer/Changes.txt +++ b/Installer/Changes.txt @@ -25,12 +25,13 @@ TombIDE: * Fixed archive creator not including `patches.fpd` for TRNG projects. TEN nodes: - * Added nodes for using keypads. - * Added nodes to create and customize the diary feature. + * Added nodes for weather and environmental conditions, such as horizon, starfield, or fog. * Added nodes for custom bars and enemy health bars. + * Added nodes to create and customize the diary feature. + * Added nodes for using keypads. + * Added nodes to change transparency of moveables and statics. * Added a node for showing ammo counter. * Added a node to hide or show a moveable. - * Added nodes to change transparency of moveables and statics. TEN base WAD: * Added WATERFALL_SPRITES (1378) for use with the Waterfall Emitter object. From 089a3063bf410e1a7d1ba64ec05a8442d1f56719 Mon Sep 17 00:00:00 2001 From: Lwmte <3331699+Lwmte@users.noreply.github.com> Date: Thu, 13 Mar 2025 12:56:13 +0100 Subject: [PATCH 16/29] Fixed two more mistakes --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index cc67b3c2e..22f2941f4 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -347,7 +347,7 @@ end -- !Description "Checks if any stars or meteors are currently visible." -- !Conditional "True" LevelFuncs.Engine.Node.TestStarField = function() - return TEN.Flow.GetCurrentLevel().starField.starCount > 0 or TEN.Flow.GetCurrentLevel().starField.starCount > 0 + return TEN.Flow.GetCurrentLevel().starField.starCount > 0 or TEN.Flow.GetCurrentLevel().starField.meteorCount > 0 end -- !Name "Set starfield" @@ -381,7 +381,7 @@ end -- !Section "Environment" -- !Conditional "True" -- !Description "Checks if specified sky layer is set to a specified color." --- !Arguments "Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Sky layer" "Color, 15, Sky layer color" "Numerical, 15, [ -64 | 64 ], Speed" +-- !Arguments "Enumeration, 20, [ Layer 1 | Layer 2 ], {0}, Sky layer" "Color, 15, Sky layer color" LevelFuncs.Engine.Node.TestSkyLayer = function(type, color) if (type == 0) then From 9c6e6d81842ff65b23d2665d2000d8b7a48221eb Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Sat, 15 Mar 2025 10:48:22 -0400 Subject: [PATCH 17/29] WIP --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 22f2941f4..4b75fa0b7 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -56,6 +56,9 @@ LevelFuncs.Engine.Node.ConstructWeatherTimedData = function(dataType, operand, n elseif (dataType == 12) then prefix = "_lensflareColor" value = TEN.Flow.GetCurrentLevel().lensFlare.color + elseif (dataType == 13) then + prefix = "_fogDistance" + value = Vec2(TEN.Flow.GetCurrentLevel().fog.minDistance, TEN.Flow.GetCurrentLevel().fog.maxDistance) end local dataName = "Weather" .. prefix .. "_transform_data" @@ -156,6 +159,8 @@ LevelFuncs.Engine.Node.TransformWeatherTimedData = function(dataName) TEN.Flow.GetCurrentLevel().horizon2.transparency = newValue1 elseif (LevelVars.Engine.WeatherData[dataName].DataType == 12) then TEN.Flow.GetCurrentLevel().lensFlare.color = Color(newValue1, newValue2, newValue3) + elseif (LevelVars.Engine.WeatherData[dataName].DataType == 13) then + TEN.Flow.GetCurrentLevel().lensFlare.color = Color(newValue1, newValue2, newValue3) end if (LevelVars.Engine.WeatherData[dataName].Progress >= 1) then From 1eccf0fba6bb62afe8424057e0242c03697c6795 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Sat, 15 Mar 2025 11:05:22 -0400 Subject: [PATCH 18/29] Finish Environment node --- .../TEN Node Catalogs/Environment.lua | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 4b75fa0b7..717e8ca03 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -160,7 +160,8 @@ LevelFuncs.Engine.Node.TransformWeatherTimedData = function(dataName) elseif (LevelVars.Engine.WeatherData[dataName].DataType == 12) then TEN.Flow.GetCurrentLevel().lensFlare.color = Color(newValue1, newValue2, newValue3) elseif (LevelVars.Engine.WeatherData[dataName].DataType == 13) then - TEN.Flow.GetCurrentLevel().lensFlare.color = Color(newValue1, newValue2, newValue3) + TEN.Flow.GetCurrentLevel().fog.minDistance = newValue1 + TEN.Flow.GetCurrentLevel().fog.maxDistance = newValue2 end if (LevelVars.Engine.WeatherData[dataName].Progress >= 1) then @@ -232,6 +233,24 @@ LevelFuncs.Engine.Node.ChangeFogColorOverTime = function(color, time, smooth) end +-- !Name "Change fog distance over time" +-- !Section "Environment" +-- !Description "Change fog distance over specified time." +-- !Arguments "Newline, Numerical, 25, [ -1024 | 1024 | 0 | 1 ], {1}, Minimum distance" +-- !Arguments "Numerical, 25, [ -1024 | 1024 | 0 | 1 ], {1}, Maximum distnace" +-- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 25, Time (in seconds)" +-- !Arguments "25, Boolean, Relative" +LevelFuncs.Engine.Node.ChangeFogDistanceOverTime = function(minDistance, maxDistance, time, relative) + + if (relative) then + minDistance = TEN.Flow.GetCurrentLevel().fog.minDistance + minDistance + maxDistance = TEN.Flow.GetCurrentLevel().fog.maxDistance + maxDistance + end + + do LevelFuncs.Engine.Node.ConstructWeatherTimedData(13, 1, TEN.Vec2(minDistance, maxDistance), time, true) end + +end + -- !Name "If draw distance is..." -- !Section "Environment" -- !Description "Checks current draw distance value in sectors." From 5f185567e187163426f73edefeb63ccd5ab03b6d Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Sat, 15 Mar 2025 11:25:44 -0400 Subject: [PATCH 19/29] UpdateNodes --- .../Catalogs/TEN Node Catalogs/Environment.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua index 717e8ca03..a004a624d 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Environment.lua @@ -175,7 +175,7 @@ end -- !Section "Environment" -- !Description "Checks current minimum (near) fog distance value in sectors." -- !Conditional "True" --- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 1024 ], Minimum fog distance to check" +-- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 1024 | 2 | 1 ], Minimum fog distance to check" LevelFuncs.Engine.Node.TestFogMinDistance = function(operator, number) return LevelFuncs.Engine.Node.CompareValue(TEN.Flow.GetCurrentLevel().fog.minDistance, number, operator) end @@ -184,7 +184,7 @@ end -- !Section "Environment" -- !Description "Checks current maximum (far) fog distance value in sectors." -- !Conditional "True" --- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 1024 ], Maximum fog distance to check" +-- !Arguments "CompareOperator, 25, Compare operation" "Numerical, 15, [ 0 | 1024 | 2 | 1 ], Maximum fog distance to check" LevelFuncs.Engine.Node.TestFogMaxDistance = function(operator, number) return LevelFuncs.Engine.Node.CompareValue(TEN.Flow.GetCurrentLevel().fog.maxDistance, number, operator) end @@ -202,7 +202,7 @@ end -- !Name "Set fog minimum distance" -- !Section "Environment" -- !Description "Sets fog minimum (near) distance to specified value in sectors." --- !Arguments "Numerical, 15, [ 0 | 1024 ], Minimum fog distance" +-- !Arguments "Numerical, 15, [ 0 | 1024 | 2 | 1 ], Minimum fog distance" LevelFuncs.Engine.Node.SetFogMinDistance = function(distance) TEN.Flow.GetCurrentLevel().fog.minDistance = distance end @@ -210,7 +210,7 @@ end -- !Name "Set fog maximum distance" -- !Section "Environment" -- !Description "Sets fog maximum (far) distance to specified value in sectors." --- !Arguments "Numerical, 15, [ 0 | 1024 ], Maximum fog distance" +-- !Arguments "Numerical, 15, [ 0 | 1024 | 2 | 1 ], Maximum fog distance" LevelFuncs.Engine.Node.SetFogMaxDistance = function(distance) TEN.Flow.GetCurrentLevel().fog.maxDistance = distance end @@ -236,8 +236,8 @@ end -- !Name "Change fog distance over time" -- !Section "Environment" -- !Description "Change fog distance over specified time." --- !Arguments "Newline, Numerical, 25, [ -1024 | 1024 | 0 | 1 ], {1}, Minimum distance" --- !Arguments "Numerical, 25, [ -1024 | 1024 | 0 | 1 ], {1}, Maximum distnace" +-- !Arguments "Newline, Numerical, 25, [ -1024 | 1024 | 2 | 1 ], {1}, Minimum distance" +-- !Arguments "Numerical, 25, [ -1024 | 1024 | 2 | 1 ], {1}, Maximum distnace" -- !Arguments "Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 25, Time (in seconds)" -- !Arguments "25, Boolean, Relative" LevelFuncs.Engine.Node.ChangeFogDistanceOverTime = function(minDistance, maxDistance, time, relative) From 5c41d2be4c00a3f032911cffdb1fd06275129522 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Sat, 15 Mar 2025 11:46:24 -0400 Subject: [PATCH 20/29] Cleanup Ammo counter nodes layout --- .../TombLib/Catalogs/TEN Node Catalogs/UI.lua | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/UI.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/UI.lua index 5817f6b8c..8ed3339a1 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/UI.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/UI.lua @@ -451,13 +451,13 @@ LevelVars.AmmoCounter = {} -- !Conditional "False" -- !Description "Displays the ammo counter for the weapon in hand." -- !Section "User interface" --- !Arguments "NewLine, Enumeration , 65,[ Counter + ammo name | Use only counter], {1}, Display type" --- !Arguments "Color, 17, {TEN.Color(255,255,255)}, Counter text color" --- !Arguments "Enumeration , 19,[ Left | Center | Right ], Text alignment" --- !Arguments "NewLine, Numerical, 17, [ 0 | 100 | 1 | 0.1 ], {95}, Counter position x" --- !Arguments "Numerical, 17, [ 0 | 100 | 1 | 0.1 ], {5}, Counter position y" --- !Arguments "Numerical, 17, {1}, [ 0 | 9 | 2 | 0.1 ], Scale" --- !Arguments "Enumeration, 49, [ Flat | Shadow | Blinking | Shadow + Blinking ], {1}, Effects" +-- !Arguments "NewLine, Enumeration , 60,[ Counter + ammo name | Use only counter], {1}, Display type" +-- !Arguments "Color, 20, {TEN.Color(255,255,255)}, Text color" +-- !Arguments "Enumeration , 20,[ Left | Center | Right ], Text alignment" +-- !Arguments "NewLine, Numerical, 20, [ 0 | 100 | 1 | 0.1 ], {95}, Text position x" +-- !Arguments "Numerical, 20, [ 0 | 100 | 1 | 0.1 ], {5}, Text position y" +-- !Arguments "Numerical, 20, {1}, [ 0 | 9 | 2 | 0.1 ], Text scale" +-- !Arguments "Enumeration, 40, [ Flat | Shadow | Blinking | Shadow + Blinking ], {1}, Text effects" -- !Arguments "Newline, SpriteSlots, 80, {TEN.Objects.ObjID.CUSTOM_AMMO_GRAPHIC}, Bar sprite sequence object ID" -- !Arguments "Color, 20, {TEN.Color(255,255,255)}, Color of ammo counter sprite" -- !Arguments "Newline, Number, 20, [ -1000 | 1000 | 2 ], {94}, Position X (%)\nRange [-1000 to 1000]\nVisible range [0 to 100]" @@ -465,12 +465,12 @@ LevelVars.AmmoCounter = {} -- !Arguments "Numerical, 20, [ 0 | 360 | 2 ], Rotation\nRange [0 to 360]" -- !Arguments "Numerical, 20, {100}, [ 0 | 1000 | 2 ], {5}, Scale X (%)\nRange [0 to 1000]" -- !Arguments "Numerical, 20, {100}, [ 0 | 1000 | 2 ], {5}, Scale Y (%)\nRange [0 to 1000]" --- !Arguments "NewLine, Enumeration, 35, [ Center | Center Top | Center Bottom | Center Left | Center Right | Top Left | Top Right | Bottom Left | Bottom Right ], {6}, Align mode" --- !Arguments "Enumeration, 22, [ Fit | Fill | Stretch ], Scale mode" --- !Arguments "Enumeration, 28, [ Opaque | Alpha Test | Additive | No Z Test | Subtractive | Wireframe | Exclude | Screen | Lighten | Alphablend ], {9}, Blend mode" +-- !Arguments "NewLine, Enumeration, 34, [ Center | Center Top | Center Bottom | Center Left | Center Right | Top Left | Top Right | Bottom Left | Bottom Right ], {6}, Align mode" +-- !Arguments "Enumeration, 33, [ Fit | Fill | Stretch ], Scale mode" +-- !Arguments "Enumeration, 33, [ Opaque | Alpha Test | Additive | No Z Test | Subtractive | Wireframe | Exclude | Screen | Lighten | Alphablend ], {9}, Blend mode" -- !Arguments "NewLine, Boolean , 40, Show unlimited ammo" -- !Arguments "Boolean , 60, Swap ammo name & counter position" --- !Arguments "Newline, Boolean , 33, {true}, Show sprite" +-- !Arguments "Newline, Boolean , 100, {true}, Show ammo sprites" LevelFuncs.Engine.Node.ShowAmmoCounter = function(displayType, color, alignment, posX, posY, scale, effect, objectIDammo, spriteColor, spritePosX, spritePosY, rot, spriteScaleX, spriteScaleY, alignMode, scaleMode, blendMode, unlimited, swap, sprite) LevelVars.AmmoCounter.DisplayType = displayType From 9656b62f4173d3fb8f864c9341cea21f305687a8 Mon Sep 17 00:00:00 2001 From: Lwmte <3331699+Lwmte@users.noreply.github.com> Date: Sat, 15 Mar 2025 17:44:14 +0100 Subject: [PATCH 21/29] UI node catalog typo fixes --- .../TombLib/Catalogs/TEN Node Catalogs/UI.lua | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/UI.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/UI.lua index 8ed3339a1..301d01a69 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/UI.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/UI.lua @@ -19,7 +19,7 @@ LevelFuncs.Engine.Node.BasicBars = function(barName, startvalue, maxValue, posX, bar.barName = barName bar.startValue = startvalue bar.maxValue = maxValue - bar.objectIdBg = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC + bar.objectIdBg = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS bar.spriteIdBg = 0 bar.colorBg = Color(255,255,255) bar.posBg = TEN.Vec2(posX, posY) @@ -28,7 +28,7 @@ LevelFuncs.Engine.Node.BasicBars = function(barName, startvalue, maxValue, posX, bar.alignModeBg = TEN.View.AlignMode.CENTER_LEFT bar.scaleModeBg = TEN.View.ScaleMode.FIT bar.blendModeBg = TEN.Effects.BlendID.ALPHABLEND - bar.objectIdBar = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC + bar.objectIdBar = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS bar.spriteIdBar = 1 bar.colorBar = colorBar bar.posBar = TEN.Vec2(posX+0.15, posY) @@ -59,7 +59,7 @@ end -- !Arguments "NewLine, String, 50, [ NoMultiline ], Bar name" -- !Arguments "Numerical, [ 0 | 65535 | 2 ], {0}, 25, Start value of bar" -- !Arguments "Numerical, [ 0 | 65535 | 2 ], {1000}, 25, Max value of bar" --- !Arguments "Newline, SpriteSlots, {TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC}, 61, Background sprite sequence object ID" +-- !Arguments "Newline, SpriteSlots, {TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS}, 61, Background sprite sequence object ID" -- !Arguments "Numerical, [ 0 | 9999 | 0 ], {0}, 19, Sprite ID for background in sprite sequence\nRange[0 to 9999]" -- !Arguments "Color, {TEN.Color(255,255,255)}, 20, Color of background sprite" -- !Arguments "Newline, Number, 20, [ -1000 | 1000 | 2 ], Position X (%)\nRange [-1000 to 1000]\nVisible range [0 to 100]" @@ -67,7 +67,7 @@ end -- !Arguments "Numerical, [ 0 | 360 | 2 ], 20, Rotation\nRange [0 to 360]" -- !Arguments "Numerical, [ 0 | 1000 | 2 ], {20}, 20, Scale X (%)\nRange [0 to 1000]" -- !Arguments "Numerical, [ 0 | 1000 | 2 ], {20}, 20, Scale Y (%)\nRange [0 to 1000]" --- !Arguments "Newline, SpriteSlots, {TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC}, 61, Bar sprite sequence object ID" +-- !Arguments "Newline, SpriteSlots, {TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS}, 61, Bar sprite sequence object ID" -- !Arguments "Numerical, [ 0 | 9999 | 0 ], {1}, 19, Sprite ID for bar in sprite sequence\nRange[0 to 9999]" -- !Arguments "Color, {TEN.Color(255,0,0)}, 20, Color of bar sprite" -- !Arguments "Newline, Number, 20, [ -1000 | 1000 | 2 ], Position X (%)\nRange [-1000 to 1000]\nVisible range [0 to 100]" @@ -254,7 +254,7 @@ LevelFuncs.Engine.Node.ConstructEnemiesHPBar = function(posX, posY, colorbar) local enemyBars = {} - enemyBars.objectIdBg = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC + enemyBars.objectIdBg = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS enemyBars.spriteIdBg = 0 enemyBars.colorBg = TEN.Color(255,255,255) enemyBars.posBg = TEN.Vec2(posX, posY) @@ -263,7 +263,7 @@ LevelFuncs.Engine.Node.ConstructEnemiesHPBar = function(posX, posY, colorbar) enemyBars.alignModeBg = TEN.View.AlignMode.CENTER_LEFT enemyBars.scaleModeBg = TEN.View.ScaleMode.FIT enemyBars.blendModeBg = TEN.Effects.BlendID.ALPHABLEND - enemyBars.objectIdBar = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC + enemyBars.objectIdBar = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS enemyBars.spriteIdBar = 1 enemyBars.colorBar = colorbar enemyBars.posBar = TEN.Vec2(posX+.15, posY) @@ -328,7 +328,7 @@ LevelFuncs.Engine.Node.ConstructEnemyBar = function(object, text, textX, textY, local enemyBar = { barName = object, - objectIdBg = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC, + objectIdBg = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS, spriteIdBg = spriteIdBg, colorBg = colorBg, posBg = TEN.Vec2(posXBg, posYBg), @@ -337,7 +337,7 @@ LevelFuncs.Engine.Node.ConstructEnemyBar = function(object, text, textX, textY, alignModeBg = TEN.View.AlignMode.CENTER_LEFT, scaleModeBg = TEN.View.ScaleMode.FIT, blendModeBg = TEN.Effects.BlendID.ALPHABLEND, - objectIdBar = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC, + objectIdBar = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS, spriteIdBar = spriteIdBar, colorBar = colorBar, posBar = TEN.Vec2(posX, posY), @@ -370,7 +370,7 @@ end -- !Arguments "NewLine, Enumeration, 20, [ Health | Air | Sprint ], {0}, Bar Type" -- !Arguments "Boolean, 40, Show stat bar always" -- !Arguments "Boolean, 40, Blink" --- !Arguments "Newline, SpriteSlots, 60, Background sprite sequence object ID, {TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC}" +-- !Arguments "Newline, SpriteSlots, 60, Background sprite sequence object ID, {TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS}" -- !Arguments "Numerical, 20, [ 0 | 9999 | 0 ], Sprite ID for background in sprite sequence\nRange[0 to 9999],{0}" -- !Arguments "Color, 20, {TEN.Color(255,255,255)}, Color of background sprite" -- !Arguments "Newline, Number, 20, [ -1000 | 1000 | 2 ], Position X (%)\nRange [-1000 to 1000]\nVisible range [0 to 100]" @@ -378,7 +378,7 @@ end -- !Arguments "Numerical, 20, [ 0 | 360 | 2 ], Rotation\nRange [0 to 360]" -- !Arguments "Numerical, 20, {100}, [ 0 | 1000 | 2 ], Scale X (%)\nRange [0 to 1000]" -- !Arguments "Numerical, 20, {100}, [ 0 | 1000 | 2 ], Scale Y (%)\nRange [0 to 1000]" --- !Arguments "Newline, SpriteSlots, 60, Bar sprite sequence object ID, {TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC}" +-- !Arguments "Newline, SpriteSlots, 60, Bar sprite sequence object ID, {TEN.Objects.ObjID.CUSTOM_BAR_GRAPHICS}" -- !Arguments "Numerical, 20, [ 0 | 9999 | 0 ], Sprite ID for bar in sprite sequence\nRange[0 to 9999],{1}" -- !Arguments "Color, {TEN.Color(255,0,0)}, 20, Color of bar sprite" -- !Arguments "Newline, Number, 20, [ -1000 | 1000 | 2 ], Position X (%)\nRange [-1000 to 1000]\nVisible range [0 to 100]" @@ -451,14 +451,14 @@ LevelVars.AmmoCounter = {} -- !Conditional "False" -- !Description "Displays the ammo counter for the weapon in hand." -- !Section "User interface" --- !Arguments "NewLine, Enumeration , 60,[ Counter + ammo name | Use only counter], {1}, Display type" +-- !Arguments "NewLine, Enumeration , 60, [ Counter + ammo name | Use only counter ], {1}, Display type" -- !Arguments "Color, 20, {TEN.Color(255,255,255)}, Text color" -- !Arguments "Enumeration , 20,[ Left | Center | Right ], Text alignment" -- !Arguments "NewLine, Numerical, 20, [ 0 | 100 | 1 | 0.1 ], {95}, Text position x" -- !Arguments "Numerical, 20, [ 0 | 100 | 1 | 0.1 ], {5}, Text position y" -- !Arguments "Numerical, 20, {1}, [ 0 | 9 | 2 | 0.1 ], Text scale" -- !Arguments "Enumeration, 40, [ Flat | Shadow | Blinking | Shadow + Blinking ], {1}, Text effects" --- !Arguments "Newline, SpriteSlots, 80, {TEN.Objects.ObjID.CUSTOM_AMMO_GRAPHIC}, Bar sprite sequence object ID" +-- !Arguments "Newline, SpriteSlots, 80, {TEN.Objects.ObjID.CUSTOM_AMMO_GRAPHICS}, Ammo counter sprite sequence object ID" -- !Arguments "Color, 20, {TEN.Color(255,255,255)}, Color of ammo counter sprite" -- !Arguments "Newline, Number, 20, [ -1000 | 1000 | 2 ], {94}, Position X (%)\nRange [-1000 to 1000]\nVisible range [0 to 100]" -- !Arguments "Numerical, 20, [ -1000 | 1000 | 2 ], {5}, Position Y (%)\nRange [-1000 to 1000]\nVisible range [0 to 100]" From 4fde7ae1530edfdd41fa92c2adfb7aeb5d9ca0d4 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Fri, 21 Mar 2025 16:50:54 -0400 Subject: [PATCH 22/29] SimplifyKeypad Nodes --- .../Catalogs/TEN Node Catalogs/Keypad.lua | 76 +------------------ 1 file changed, 3 insertions(+), 73 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua index 73c8de2bb..1bc5c8a13 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua @@ -46,30 +46,8 @@ LevelFuncs.Engine.Node.KeypadTrigger = function(object, triggerer) end local target = GetMoveableByName(object) - local targetRot = target:GetRotation() - local laraRot = Lara:GetRotation() - - if (targetRot.y == 0 and laraRot.y >= -30 and laraRot.y <= 30) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == 90 and laraRot.y >= 60 and laraRot.y <= 120) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == -180 and laraRot.y >= -150 and laraRot.y <= 150) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == -90 and laraRot.y >= -120 and laraRot.y <= -60) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - end - if Lara:GetAnim() == 197 then - KeyClear(ActionID.ACTION) - end + Lara:AlignToMoveable(target) if Lara:GetAnim() == 197 and Lara:GetFrame() >= 22 and Lara:GetFrame() <= 22 then Lara:SetVisible(false) @@ -100,34 +78,8 @@ LevelFuncs.Engine.Node.KeypadVolume = function(object, volumeEvent, eventType) end local target = GetMoveableByName(object) - local targetRot = target:GetRotation() - local laraRot = Lara:GetRotation() - if (targetRot.y == 0 and laraRot.y >= -30 and laraRot.y <= 30) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == 90 and laraRot.y >= 60 and laraRot.y <= 120) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == -180 and laraRot.y >= -150 and laraRot.y <= 150) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == -90 and laraRot.y >= -120 and laraRot.y <= -90) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - end - - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - - if Lara:GetAnim() == 197 then - KeyClear(ActionID.ACTION) - end + Lara:AlignToMoveable(target) if Lara:GetAnim() == 197 and Lara:GetFrame() >= 22 and Lara:GetFrame() <= 22 then Lara:SetVisible(false) @@ -158,30 +110,8 @@ LevelFuncs.Engine.Node.KeypadScript = function(object, funcName, args) end local target = GetMoveableByName(object) - local targetRot = target:GetRotation() - local laraRot = Lara:GetRotation() - if (targetRot.y == 0 and laraRot.y >= -30 and laraRot.y <= 30) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == 90 and laraRot.y >= 60 and laraRot.y <= 120) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == -180 and laraRot.y >= -150 and laraRot.y <= 150) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - elseif (targetRot.y == -90 and laraRot.y >= -120 and laraRot.y <= -90) then - if KeyIsHit(ActionID.ACTION) then - Lara:SetAnim(197) - end - end - - if Lara:GetAnim() == 197 then - KeyClear(ActionID.ACTION) - end + Lara:AlignToMoveable(target) if Lara:GetAnim() == 197 and Lara:GetFrame() >= 22 and Lara:GetFrame() <= 22 then Lara:SetVisible(false) From 263bdd013d3c194e743622f36178f00a31438144 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:44:05 -0400 Subject: [PATCH 23/29] PathNodes --- .../Catalogs/TEN Node Catalogs/Path.lua | 167 ++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 TombLib/TombLib/Catalogs/TEN Node Catalogs/Path.lua diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Path.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Path.lua new file mode 100644 index 000000000..29d070c8f --- /dev/null +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Path.lua @@ -0,0 +1,167 @@ +local Timer = require("Engine.Timer") + +LevelVars.Engine.TransformTimeData = {} +-- !Ignore +-- Construct timed transform data and start transform +LevelFuncs.Engine.Node.ConstructPathTimedData = function(objectName, isStatic, flyby, motionType, startPosition, endPosition, time, rotation, smooth) + + local dataName = objectName .. "path_transform_data" + + if (LevelVars.Engine.TransformTimeData[dataName] ~= nil and Timer.Get(LevelVars.Engine.TransformTimeData[dataName].Name) ~= nil) then + if (Timer.Get(LevelVars.Engine.TransformTimeData[dataName].Name):IsActive()) then + return + else + Timer.Delete(LevelVars.Engine.TransformTimeData[dataName].Name) + LevelVars.Engine.TransformTimeData[dataName] = nil + end + end + + LevelVars.Engine.TransformTimeData = LevelVars.Engine.TransformTimeData or {} + + LevelVars.Engine.TransformTimeData[dataName]= {} + + LevelVars.Engine.TransformTimeData[dataName].Progress = 0 + LevelVars.Engine.TransformTimeData[dataName].Interval = 1 / (time * 30) + LevelVars.Engine.TransformTimeData[dataName].IsStatic = isStatic + LevelVars.Engine.TransformTimeData[dataName].ObjectName = objectName + LevelVars.Engine.TransformTimeData[dataName].Name = dataName + LevelVars.Engine.TransformTimeData[dataName].Flyby = flyby + LevelVars.Engine.TransformTimeData[dataName].MotionType = motionType + LevelVars.Engine.TransformTimeData[dataName].Rotation = rotation + LevelVars.Engine.TransformTimeData[dataName].Smooth = smooth + LevelVars.Engine.TransformTimeData[dataName].NewValue = endPosition + LevelVars.Engine.TransformTimeData[dataName].EndPosition = endPosition + LevelVars.Engine.TransformTimeData[dataName].OldValue = startPosition + LevelVars.Engine.TransformTimeData[dataName].StopAtEnd = false + + local timer = Timer.Create(dataName, 1 / 30, true, false, LevelFuncs.Engine.Node.TransformPathTimedData, dataName) + timer:Start() +end + +-- !Ignore +-- Transform object parameter using previously saved timed transform data +LevelFuncs.Engine.Node.TransformPathTimedData = function(dataName) + + local tolerance = 5e-1 -- 0.5 tolerance. The tolerance to stop the object revolution. It is required in case of smooth rotation. + + if LevelVars.Engine.TransformTimeData[dataName].MotionType == 0 then + + LevelVars.Engine.TransformTimeData[dataName].Progress = math.min(LevelVars.Engine.TransformTimeData[dataName].Progress + LevelVars.Engine.TransformTimeData[dataName].Interval, 1) + + elseif LevelVars.Engine.TransformTimeData[dataName].MotionType == 1 then + + LevelVars.Engine.TransformTimeData[dataName].Progress = (LevelVars.Engine.TransformTimeData[dataName].Progress + LevelVars.Engine.TransformTimeData[dataName].Interval) % 1 + + elseif LevelVars.Engine.TransformTimeData[dataName].MotionType == 2 then + + if LevelVars.Engine.TransformTimeData[dataName].Direction == nil then + LevelVars.Engine.TransformTimeData[dataName].Direction = 1 -- Start forward + end + + LevelVars.Engine.TransformTimeData[dataName].Progress = LevelVars.Engine.TransformTimeData[dataName].Progress + + (LevelVars.Engine.TransformTimeData[dataName].Interval * LevelVars.Engine.TransformTimeData[dataName].Direction) + + if LevelVars.Engine.TransformTimeData[dataName].Progress >= 1 then + LevelVars.Engine.TransformTimeData[dataName].Progress = 1 + LevelVars.Engine.TransformTimeData[dataName].Direction = -1 -- Reverse direction + elseif LevelVars.Engine.TransformTimeData[dataName].Progress <= 0 then + LevelVars.Engine.TransformTimeData[dataName].Progress = 0 + LevelVars.Engine.TransformTimeData[dataName].Direction = 1 -- Forward again + end + + end + + local factor = LevelVars.Engine.TransformTimeData[dataName].Smooth + and LevelFuncs.Engine.Node.Smoothstep(LevelVars.Engine.TransformTimeData[dataName].Progress) + or LevelVars.Engine.TransformTimeData[dataName].Progress + + local newValue1 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.TransformTimeData[dataName].OldValue, LevelVars.Engine.TransformTimeData[dataName].NewValue, factor) + + local object = LevelVars.Engine.TransformTimeData[dataName].IsStatic and TEN.Objects.GetStaticByName(LevelVars.Engine.TransformTimeData[dataName].ObjectName) or TEN.Objects.GetMoveableByName(LevelVars.Engine.TransformTimeData[dataName].ObjectName) + + local flybyPos = View.GetFlybyPosition(LevelVars.Engine.TransformTimeData[dataName].Flyby, newValue1) + object:SetPosition(flybyPos) + + if LevelVars.Engine.TransformTimeData[dataName].Rotation == true then + + local flybyRot = View.GetFlybyRotation(LevelVars.Engine.TransformTimeData[dataName].Flyby, newValue1) + object:SetRotation(flybyRot) + + end + + if LevelVars.Engine.TransformTimeData[dataName].StopAtEnd and math.abs(newValue1 - LevelVars.Engine.TransformTimeData[dataName].EndPosition) < tolerance then + Timer.Delete(LevelVars.Engine.TransformTimeData[dataName].Name) + LevelVars.Engine.TransformTimeData[dataName] = nil + elseif LevelVars.Engine.TransformTimeData[dataName].MotionType == 0 and LevelVars.Engine.TransformTimeData[dataName].Progress >= 1 then + Timer.Delete(LevelVars.Engine.TransformTimeData[dataName].Name) + LevelVars.Engine.TransformTimeData[dataName] = nil + end + +end + +-- !Ignore +--- Delete timed transform data +LevelFuncs.Engine.Node.DeletePathTimedData = function(objectName, endPosition) + local dataName = objectName .. "path_transform_data" + + if LevelVars.Engine.TransformTimeData[dataName] ~= nil and Timer.Get(LevelVars.Engine.TransformTimeData[dataName].Name):IsActive() then + LevelVars.Engine.TransformTimeData[dataName].EndPosition = endPosition + LevelVars.Engine.TransformTimeData[dataName].StopAtEnd = true + end +end + +-- !Name "Translate moveable over flyby path " +-- !Section "Path" +-- !Description "Gradually translate a moveable over flyby path over specified timespan." +-- !Arguments "NewLine, Moveables, 67" "Numerical, 33, [ 0 | 256 ], Flyby sequence index" +-- !Arguments "NewLine, Enumeration, 34, [ One Shot | Loop | Back and Forth], {0}, Motion Type" +-- !Arguments "Numerical, 33, [ 0 | 100 | 2 | 1 ], {0}, Start position" +-- !Arguments "Numerical, 33, [ 0 | 100 | 2 | 1 ], {100}, End position" +-- !Arguments "NewLine, Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 34, Time (in seconds)" +-- !Arguments "Boolean, 33, Set Rotation" +-- !Arguments "33, Boolean, Smooth motion" + +LevelFuncs.Engine.Node.TranslateMoveableOverFlybyTimespan = function(moveableName, flyby, motionType, startPosition, endPosition, time, rotation, smooth) + + -- Wrap another node function call into do/end to prevent wrong parsing + do LevelFuncs.Engine.Node.ConstructPathTimedData(moveableName, false, flyby, motionType, startPosition, endPosition, time, rotation, smooth) end +end + +-- !Name "Stop the translation of a moveable" +-- !Section "Path" +-- !Description "Stop an already active moveable loop." +-- !Arguments "NewLine, Moveables, Moveable to stop translation" +-- !Arguments "NewLine, Numerical, [ 0 | 100 | 2 | 1 ], {0}, 20, End Position. This is the position the moveable will stop." + +LevelFuncs.Engine.Node.StopMoveableOverFlybyPath = function(moveableName, endPosition) + -- Wrap another node function call into do/end to prevent wrong parsing + do LevelFuncs.Engine.Node.DeletePathTimedData(moveableName, endPosition) end +end + +-- !Name "Translate static over flyby path " +-- !Section "Path" +-- !Description "Gradually translate a static over flyby path over specified timespan." +-- !Arguments "NewLine, Statics, 67" "Numerical, 33, [ 0 | 256 ], Flyby sequence index" +-- !Arguments "NewLine, Enumeration, 34, [ One Shot | Loop | Back and Forth], {0}, Motion Type" +-- !Arguments "Numerical, 33, [ 0 | 100 | 2 | 1 ], {0}, Start position" +-- !Arguments "Numerical, 33, [ 0 | 100 | 2 | 1 ], {100}, End position" +-- !Arguments "NewLine, Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 34, Time (in seconds)" +-- !Arguments "Boolean, 33, Set Rotation" +-- !Arguments "33, Boolean, Smooth motion" + +LevelFuncs.Engine.Node.TranslatStaticOverFlybyTimespan = function(moveableName, flyby, motionType, startPosition, endPosition, time, rotation, smooth) + + -- Wrap another node function call into do/end to prevent wrong parsing + do LevelFuncs.Engine.Node.ConstructPathTimedData(moveableName, true, flyby, motionType, startPosition, endPosition, time, rotation, smooth) end +end + +-- !Name "Stop the translation of a static" +-- !Section "Path" +-- !Description "Stop an already active static." +-- !Arguments "NewLine, Statics, Static to stop translation" +-- !Arguments "NewLine, Numerical, [ 0 | 100 | 2 | 1 ], {0}, 20, End Position. This is the position the moveable will stop." + +LevelFuncs.Engine.Node.StopStaticOverFlybyPath = function(moveableName, endPosition) + -- Wrap another node function call into do/end to prevent wrong parsing + do LevelFuncs.Engine.Node.DeletePathTimedData(moveableName, endPosition) end +end \ No newline at end of file From ae652e70d757bfce019a9c6c84d159a832f1baca Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Fri, 21 Mar 2025 16:50:54 -0400 Subject: [PATCH 24/29] SimplifyKeypad Nodes From 03156ec07b0d14a98bb8412d9e585e06dd9663f0 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:48:15 -0400 Subject: [PATCH 25/29] Revert "PathNodes" This reverts commit 263bdd013d3c194e743622f36178f00a31438144. --- .../Catalogs/TEN Node Catalogs/Path.lua | 167 ------------------ 1 file changed, 167 deletions(-) delete mode 100644 TombLib/TombLib/Catalogs/TEN Node Catalogs/Path.lua diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Path.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Path.lua deleted file mode 100644 index 29d070c8f..000000000 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Path.lua +++ /dev/null @@ -1,167 +0,0 @@ -local Timer = require("Engine.Timer") - -LevelVars.Engine.TransformTimeData = {} --- !Ignore --- Construct timed transform data and start transform -LevelFuncs.Engine.Node.ConstructPathTimedData = function(objectName, isStatic, flyby, motionType, startPosition, endPosition, time, rotation, smooth) - - local dataName = objectName .. "path_transform_data" - - if (LevelVars.Engine.TransformTimeData[dataName] ~= nil and Timer.Get(LevelVars.Engine.TransformTimeData[dataName].Name) ~= nil) then - if (Timer.Get(LevelVars.Engine.TransformTimeData[dataName].Name):IsActive()) then - return - else - Timer.Delete(LevelVars.Engine.TransformTimeData[dataName].Name) - LevelVars.Engine.TransformTimeData[dataName] = nil - end - end - - LevelVars.Engine.TransformTimeData = LevelVars.Engine.TransformTimeData or {} - - LevelVars.Engine.TransformTimeData[dataName]= {} - - LevelVars.Engine.TransformTimeData[dataName].Progress = 0 - LevelVars.Engine.TransformTimeData[dataName].Interval = 1 / (time * 30) - LevelVars.Engine.TransformTimeData[dataName].IsStatic = isStatic - LevelVars.Engine.TransformTimeData[dataName].ObjectName = objectName - LevelVars.Engine.TransformTimeData[dataName].Name = dataName - LevelVars.Engine.TransformTimeData[dataName].Flyby = flyby - LevelVars.Engine.TransformTimeData[dataName].MotionType = motionType - LevelVars.Engine.TransformTimeData[dataName].Rotation = rotation - LevelVars.Engine.TransformTimeData[dataName].Smooth = smooth - LevelVars.Engine.TransformTimeData[dataName].NewValue = endPosition - LevelVars.Engine.TransformTimeData[dataName].EndPosition = endPosition - LevelVars.Engine.TransformTimeData[dataName].OldValue = startPosition - LevelVars.Engine.TransformTimeData[dataName].StopAtEnd = false - - local timer = Timer.Create(dataName, 1 / 30, true, false, LevelFuncs.Engine.Node.TransformPathTimedData, dataName) - timer:Start() -end - --- !Ignore --- Transform object parameter using previously saved timed transform data -LevelFuncs.Engine.Node.TransformPathTimedData = function(dataName) - - local tolerance = 5e-1 -- 0.5 tolerance. The tolerance to stop the object revolution. It is required in case of smooth rotation. - - if LevelVars.Engine.TransformTimeData[dataName].MotionType == 0 then - - LevelVars.Engine.TransformTimeData[dataName].Progress = math.min(LevelVars.Engine.TransformTimeData[dataName].Progress + LevelVars.Engine.TransformTimeData[dataName].Interval, 1) - - elseif LevelVars.Engine.TransformTimeData[dataName].MotionType == 1 then - - LevelVars.Engine.TransformTimeData[dataName].Progress = (LevelVars.Engine.TransformTimeData[dataName].Progress + LevelVars.Engine.TransformTimeData[dataName].Interval) % 1 - - elseif LevelVars.Engine.TransformTimeData[dataName].MotionType == 2 then - - if LevelVars.Engine.TransformTimeData[dataName].Direction == nil then - LevelVars.Engine.TransformTimeData[dataName].Direction = 1 -- Start forward - end - - LevelVars.Engine.TransformTimeData[dataName].Progress = LevelVars.Engine.TransformTimeData[dataName].Progress + - (LevelVars.Engine.TransformTimeData[dataName].Interval * LevelVars.Engine.TransformTimeData[dataName].Direction) - - if LevelVars.Engine.TransformTimeData[dataName].Progress >= 1 then - LevelVars.Engine.TransformTimeData[dataName].Progress = 1 - LevelVars.Engine.TransformTimeData[dataName].Direction = -1 -- Reverse direction - elseif LevelVars.Engine.TransformTimeData[dataName].Progress <= 0 then - LevelVars.Engine.TransformTimeData[dataName].Progress = 0 - LevelVars.Engine.TransformTimeData[dataName].Direction = 1 -- Forward again - end - - end - - local factor = LevelVars.Engine.TransformTimeData[dataName].Smooth - and LevelFuncs.Engine.Node.Smoothstep(LevelVars.Engine.TransformTimeData[dataName].Progress) - or LevelVars.Engine.TransformTimeData[dataName].Progress - - local newValue1 = LevelFuncs.Engine.Node.Lerp(LevelVars.Engine.TransformTimeData[dataName].OldValue, LevelVars.Engine.TransformTimeData[dataName].NewValue, factor) - - local object = LevelVars.Engine.TransformTimeData[dataName].IsStatic and TEN.Objects.GetStaticByName(LevelVars.Engine.TransformTimeData[dataName].ObjectName) or TEN.Objects.GetMoveableByName(LevelVars.Engine.TransformTimeData[dataName].ObjectName) - - local flybyPos = View.GetFlybyPosition(LevelVars.Engine.TransformTimeData[dataName].Flyby, newValue1) - object:SetPosition(flybyPos) - - if LevelVars.Engine.TransformTimeData[dataName].Rotation == true then - - local flybyRot = View.GetFlybyRotation(LevelVars.Engine.TransformTimeData[dataName].Flyby, newValue1) - object:SetRotation(flybyRot) - - end - - if LevelVars.Engine.TransformTimeData[dataName].StopAtEnd and math.abs(newValue1 - LevelVars.Engine.TransformTimeData[dataName].EndPosition) < tolerance then - Timer.Delete(LevelVars.Engine.TransformTimeData[dataName].Name) - LevelVars.Engine.TransformTimeData[dataName] = nil - elseif LevelVars.Engine.TransformTimeData[dataName].MotionType == 0 and LevelVars.Engine.TransformTimeData[dataName].Progress >= 1 then - Timer.Delete(LevelVars.Engine.TransformTimeData[dataName].Name) - LevelVars.Engine.TransformTimeData[dataName] = nil - end - -end - --- !Ignore ---- Delete timed transform data -LevelFuncs.Engine.Node.DeletePathTimedData = function(objectName, endPosition) - local dataName = objectName .. "path_transform_data" - - if LevelVars.Engine.TransformTimeData[dataName] ~= nil and Timer.Get(LevelVars.Engine.TransformTimeData[dataName].Name):IsActive() then - LevelVars.Engine.TransformTimeData[dataName].EndPosition = endPosition - LevelVars.Engine.TransformTimeData[dataName].StopAtEnd = true - end -end - --- !Name "Translate moveable over flyby path " --- !Section "Path" --- !Description "Gradually translate a moveable over flyby path over specified timespan." --- !Arguments "NewLine, Moveables, 67" "Numerical, 33, [ 0 | 256 ], Flyby sequence index" --- !Arguments "NewLine, Enumeration, 34, [ One Shot | Loop | Back and Forth], {0}, Motion Type" --- !Arguments "Numerical, 33, [ 0 | 100 | 2 | 1 ], {0}, Start position" --- !Arguments "Numerical, 33, [ 0 | 100 | 2 | 1 ], {100}, End position" --- !Arguments "NewLine, Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 34, Time (in seconds)" --- !Arguments "Boolean, 33, Set Rotation" --- !Arguments "33, Boolean, Smooth motion" - -LevelFuncs.Engine.Node.TranslateMoveableOverFlybyTimespan = function(moveableName, flyby, motionType, startPosition, endPosition, time, rotation, smooth) - - -- Wrap another node function call into do/end to prevent wrong parsing - do LevelFuncs.Engine.Node.ConstructPathTimedData(moveableName, false, flyby, motionType, startPosition, endPosition, time, rotation, smooth) end -end - --- !Name "Stop the translation of a moveable" --- !Section "Path" --- !Description "Stop an already active moveable loop." --- !Arguments "NewLine, Moveables, Moveable to stop translation" --- !Arguments "NewLine, Numerical, [ 0 | 100 | 2 | 1 ], {0}, 20, End Position. This is the position the moveable will stop." - -LevelFuncs.Engine.Node.StopMoveableOverFlybyPath = function(moveableName, endPosition) - -- Wrap another node function call into do/end to prevent wrong parsing - do LevelFuncs.Engine.Node.DeletePathTimedData(moveableName, endPosition) end -end - --- !Name "Translate static over flyby path " --- !Section "Path" --- !Description "Gradually translate a static over flyby path over specified timespan." --- !Arguments "NewLine, Statics, 67" "Numerical, 33, [ 0 | 256 ], Flyby sequence index" --- !Arguments "NewLine, Enumeration, 34, [ One Shot | Loop | Back and Forth], {0}, Motion Type" --- !Arguments "Numerical, 33, [ 0 | 100 | 2 | 1 ], {0}, Start position" --- !Arguments "Numerical, 33, [ 0 | 100 | 2 | 1 ], {100}, End position" --- !Arguments "NewLine, Numerical, [ 0.1 | 65535 | 2 | 0.1 | 1 ], {1}, 34, Time (in seconds)" --- !Arguments "Boolean, 33, Set Rotation" --- !Arguments "33, Boolean, Smooth motion" - -LevelFuncs.Engine.Node.TranslatStaticOverFlybyTimespan = function(moveableName, flyby, motionType, startPosition, endPosition, time, rotation, smooth) - - -- Wrap another node function call into do/end to prevent wrong parsing - do LevelFuncs.Engine.Node.ConstructPathTimedData(moveableName, true, flyby, motionType, startPosition, endPosition, time, rotation, smooth) end -end - --- !Name "Stop the translation of a static" --- !Section "Path" --- !Description "Stop an already active static." --- !Arguments "NewLine, Statics, Static to stop translation" --- !Arguments "NewLine, Numerical, [ 0 | 100 | 2 | 1 ], {0}, 20, End Position. This is the position the moveable will stop." - -LevelFuncs.Engine.Node.StopStaticOverFlybyPath = function(moveableName, endPosition) - -- Wrap another node function call into do/end to prevent wrong parsing - do LevelFuncs.Engine.Node.DeletePathTimedData(moveableName, endPosition) end -end \ No newline at end of file From 917b201ad39204260a26b93c1624805714abeacc Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Sat, 22 Nov 2025 17:34:05 -0500 Subject: [PATCH 26/29] Revised Nodes --- .../Catalogs/TEN Node Catalogs/Keypad.lua | 92 ++++++++----------- 1 file changed, 36 insertions(+), 56 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua index bc495e977..7971c3e22 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua @@ -1,12 +1,5 @@ LevelVars.Engine.Keypad = LevelVars.Engine.Keypad or {} -LevelVars.Engine.ActivatedKeypad = nil - --- !Name "Create a keypad" --- !Section "User interface" --- !Description "Creates a keypad." --- !Arguments "NewLine, 80, Moveables, Keypad Object" --- !Arguments "Numerical, 20, [ 1000 | 9999 ], Pass code" --- !Arguments "NewLine, Volumes, Volume to use for the keypad" +LevelVars.Engine.Keypad.ActivatedKeypad = nil LevelFuncs.Engine.Node.KeypadCreate = function(object, code, volume) @@ -27,19 +20,25 @@ end -- !Name "Run a keypad (triggers)" -- !Section "User interface" -- !Description "Creates a keypad to activate the triggers using Trigger Triggerer." --- !Arguments "NewLine, Moveables, Keypad object" +-- !Arguments "NewLine, 80, Moveables, Keypad Object" +-- !Arguments "Numerical, 20, [ 1000 | 9999 ], Pass code" +-- !Arguments "NewLine, Volumes, Volume to use for the keypad" -- !Arguments "NewLine, Moveables, Trigger Triggerer object to activate" -LevelFuncs.Engine.Node.KeypadTrigger = function(object, triggerer) +LevelFuncs.Engine.Node.KeypadTrigger = function(object, code, volume, triggerer) local dataName = object .. "_KeypadData" + if not LevelVars.Engine.Keypad[dataName] then + LevelFuncs.Engine.Node.KeypadCreate(object, code, volume) + end + if LevelVars.Engine.Keypad[dataName].Status then local triggerer = GetMoveableByName(triggerer) local volume = GetVolumeByName(LevelVars.Engine.Keypad[dataName].Volume) triggerer:Enable() LevelVars.Engine.Keypad[dataName] = nil - LevelVars.Engine.ActivatedKeypad = nil + LevelVars.Engine.Keypad.ActivatedKeypad = nil volume:Disable() end @@ -49,18 +48,24 @@ end -- !Name "Run a keypad (volume event)" -- !Section "User interface" -- !Description "Creates a keypad to run a volume event." --- !Arguments "NewLine, Moveables, Keypad object" +-- !Arguments "NewLine, 80, Moveables, Keypad Object" +-- !Arguments "Numerical, 20, [ 1000 | 9999 ], Pass code" +-- !Arguments "NewLine, Volumes, Volume to use for the keypad" -- !Arguments "NewLine, 65, VolumeEventSets, Target event set" -- !Arguments "VolumeEvents, 35, Event to run" -LevelFuncs.Engine.Node.KeypadVolume = function(object, volumeEvent, eventType) +LevelFuncs.Engine.Node.KeypadVolume = function(object, code, volume, volumeEvent, eventType) local dataName = object .. "_KeypadData" + if not LevelVars.Engine.Keypad[dataName] then + LevelFuncs.Engine.Node.KeypadCreate(object, code, volume) + end + if LevelVars.Engine.Keypad[dataName].Status then local volume = GetVolumeByName(LevelVars.Engine.Keypad[dataName].Volume) LevelVars.Engine.Keypad[dataName] = nil - LevelVars.Engine.ActivatedKeypad = nil + LevelVars.Engine.Keypad.ActivatedKeypad = nil TEN.Logic.HandleEvent(volumeEvent, eventType, Lara) volume:Disable() end @@ -72,17 +77,23 @@ end -- !Name "Run a keypad (script function)" -- !Section "User interface" -- !Description "Creates a keypad to run a script function." --- !Arguments "NewLine, Moveables, Keypad object" +-- !Arguments "NewLine, 80, Moveables, Keypad Object" +-- !Arguments "Numerical, 20, [ 1000 | 9999 ], Pass code" +-- !Arguments "NewLine, Volumes, Volume to use for the keypad" -- !Arguments "NewLine, LuaScript, Target Lua script function" "NewLine, String, Arguments" -LevelFuncs.Engine.Node.KeypadScript = function(object, funcName, args) +LevelFuncs.Engine.Node.KeypadScript = function(object, code, volume, funcName, args) local dataName = object .. "_KeypadData" + + if not LevelVars.Engine.Keypad[dataName] then + LevelFuncs.Engine.Node.KeypadCreate(object, code, volume) + end if LevelVars.Engine.Keypad[dataName].Status then local volume = GetVolumeByName(LevelVars.Engine.Keypad[dataName].Volume) LevelVars.Engine.Keypad[dataName] = nil - LevelVars.Engine.ActivatedKeypad = nil + LevelVars.Engine.Keypad.ActivatedKeypad = nil funcName(table.unpack(LevelFuncs.Engine.Node.SplitString(args, ","))) volume:Disable() end @@ -98,25 +109,20 @@ LevelFuncs.Engine.ActivateKeypad = function(object) Lara:Interact(target) if Lara:GetAnim() == 197 and Lara:GetFrame() >= 22 and Lara:GetFrame() <= 22 then - Lara:SetVisible(false) - View.SetFOV(30) - LevelVars.Engine.ActivatedKeypad = object + LevelVars.Engine.Keypad.ActivatedKeypad = object TEN.Logic.AddCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) - Flow.SetFreezeMode(Flow.FreezeMode.SPECTATOR) + Flow.SetFreezeMode(Flow.FreezeMode.FULL) end end LevelFuncs.Engine.ExitKeypad = function(object, status) - local cameraObject = GetMoveableByName("keypadCam1") local dataName = object .. "_KeypadData" + local keypadObject = TEN.View.DisplayItem.GetItemByName(dataName) LevelVars.Engine.Keypad[dataName].Status = status - View.SetFOV(80) - Lara:SetVisible(true) - ResetObjCamera() - cameraObject:Destroy() + keypadObject:Remove() Flow.SetFreezeMode(Flow.FreezeMode.NONE) TEN.Logic.RemoveCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) @@ -142,36 +148,10 @@ LevelFuncs.Engine.RunKeypad = function() ["Click"] = 644, -- TR2_Click } - local object = LevelVars.Engine.ActivatedKeypad + local object = LevelVars.Engine.Keypad.ActivatedKeypad + local objectSlot = GetMoveableByName(object):GetObjectID() local dataName = object .. "_KeypadData" - local target = GetMoveableByName(object) - local targetPos = target:GetPosition() - local targetRot = target:GetRotation() - local targetRoom = target:GetRoomNumber() - - local offset = 296 - local heightOffset = 618 - local cameraPos = targetPos - - if (targetRot.y == 0) then - cameraPos = Vec3(targetPos.x, targetPos.y-heightOffset, targetPos.z - offset) - elseif (targetRot.y == 90) then - cameraPos = Vec3(targetPos.x- offset, targetPos.y-heightOffset, targetPos.z) - elseif (targetRot.y == 180) then - cameraPos = Vec3(targetPos.x, targetPos.y-heightOffset, targetPos.z + offset) - elseif (targetRot.y == 270) then - cameraPos = Vec3(targetPos.x+ offset, targetPos.y-heightOffset, targetPos.z ) - end - - if not IsNameInUse("keypadCam1") then - Moveable(TEN.Objects.ObjID.CAMERA_TARGET, "keypadCam1", cameraPos, Rotation(0,0,0), targetRoom) - end - - local cameraObject = GetMoveableByName("keypadCam1") - - cameraObject:SetPosition(cameraPos) - cameraObject:SetRoomNumber(targetRoom) - cameraObject:AttachObjCamera(0, target, 0) + local target = TEN.View.DisplayItem(dataName, objectSlot, Vec3(0,2500,1024), Rotation(0,0,0), 4) local keypad = { {1, 2, 3}, @@ -275,7 +255,7 @@ LevelFuncs.Engine.RunKeypad = function() end -- Display entered code with dashes - local controlsText = TEN.Strings.DisplayString(codeWithDashes, TEN.Vec2(TEN.Util.PercentToScreen(57.5, 19.5)), 1.60, TEN.Color(255,255,255), false, {Strings.DisplayStringOption.RIGHT}) + local controlsText = TEN.Strings.DisplayString(codeWithDashes, TEN.Vec2(TEN.Util.PercentToScreen(55, 30)), 1.0, TEN.Color(255,255,255), false, {Strings.DisplayStringOption.RIGHT}) ShowString(controlsText, 1 / 30) end From 9f9364c077f54f8c8637154ba28c50baa4abe724 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Sun, 23 Nov 2025 09:50:37 -0500 Subject: [PATCH 27/29] Fix access violation --- TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua index 7971c3e22..1c9adac65 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua @@ -39,6 +39,7 @@ LevelFuncs.Engine.Node.KeypadTrigger = function(object, code, volume, triggerer) triggerer:Enable() LevelVars.Engine.Keypad[dataName] = nil LevelVars.Engine.Keypad.ActivatedKeypad = nil + TEN.Logic.RemoveCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) volume:Disable() end @@ -66,6 +67,7 @@ LevelFuncs.Engine.Node.KeypadVolume = function(object, code, volume, volumeEvent local volume = GetVolumeByName(LevelVars.Engine.Keypad[dataName].Volume) LevelVars.Engine.Keypad[dataName] = nil LevelVars.Engine.Keypad.ActivatedKeypad = nil + TEN.Logic.RemoveCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) TEN.Logic.HandleEvent(volumeEvent, eventType, Lara) volume:Disable() end @@ -94,6 +96,7 @@ LevelFuncs.Engine.Node.KeypadScript = function(object, code, volume, funcName, a local volume = GetVolumeByName(LevelVars.Engine.Keypad[dataName].Volume) LevelVars.Engine.Keypad[dataName] = nil LevelVars.Engine.Keypad.ActivatedKeypad = nil + TEN.Logic.RemoveCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) funcName(table.unpack(LevelFuncs.Engine.Node.SplitString(args, ","))) volume:Disable() end @@ -124,8 +127,7 @@ LevelFuncs.Engine.ExitKeypad = function(object, status) LevelVars.Engine.Keypad[dataName].Status = status keypadObject:Remove() Flow.SetFreezeMode(Flow.FreezeMode.NONE) - TEN.Logic.RemoveCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) - + end LevelFuncs.Engine.RunKeypad = function() From d87ff4204562f6531485a218c636b7961925ff7d Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Sun, 23 Nov 2025 10:11:57 -0500 Subject: [PATCH 28/29] Add grayscale background logic --- .../Catalogs/TEN Node Catalogs/Keypad.lua | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua index 1c9adac65..2a79f99cb 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua @@ -1,6 +1,9 @@ LevelVars.Engine.Keypad = LevelVars.Engine.Keypad or {} LevelVars.Engine.Keypad.ActivatedKeypad = nil +local inventoryDelay = 0 +local inventoryOpen = false + LevelFuncs.Engine.Node.KeypadCreate = function(object, code, volume) local dataName = object .. "_KeypadData" @@ -113,8 +116,21 @@ LevelFuncs.Engine.ActivateKeypad = function(object) if Lara:GetAnim() == 197 and Lara:GetFrame() >= 22 and Lara:GetFrame() <= 22 then LevelVars.Engine.Keypad.ActivatedKeypad = object - TEN.Logic.AddCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) - Flow.SetFreezeMode(Flow.FreezeMode.FULL) + inventoryOpen = true + end + + if inventoryOpen == true then + inventoryDelay = inventoryDelay + 1 + TEN.View.SetPostProcessMode(View.PostProcessMode.MONOCHROME) + TEN.View.SetPostProcessStrength(1) + TEN.View.SetPostProcessTint(Color(128,128,128,255)) + + if inventoryDelay >= 2 then + TEN.Logic.AddCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) + inventoryOpen = false + inventoryDelay = 0 + Flow.SetFreezeMode(Flow.FreezeMode.FULL) + end end end @@ -132,6 +148,10 @@ end LevelFuncs.Engine.RunKeypad = function() + TEN.View.SetPostProcessMode(View.PostProcessMode.NONE) + TEN.View.SetPostProcessStrength(0) + TEN.View.SetPostProcessTint(Color(255,255,255,255)) + local soundIDs = { ["Clear"] = 983, -- TR5_Keypad_Hash (Cancel) ["Enter"] = 984, -- TR5_Keypad_Asterisk (Confirm) From 028c34aa52f7dd581ee04b6968057c254d86f795 Mon Sep 17 00:00:00 2001 From: TrainWrack <120750885+TrainWrack@users.noreply.github.com> Date: Tue, 16 Dec 2025 20:57:43 -0500 Subject: [PATCH 29/29] Finish Nodes --- .../Catalogs/TEN Node Catalogs/Keypad.lua | 284 ++++++++++++------ 1 file changed, 189 insertions(+), 95 deletions(-) diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua index 2a79f99cb..2c0c308db 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Keypad.lua @@ -3,8 +3,28 @@ LevelVars.Engine.Keypad.ActivatedKeypad = nil local inventoryDelay = 0 local inventoryOpen = false - -LevelFuncs.Engine.Node.KeypadCreate = function(object, code, volume) +local setupComplete = false +local inputMode = false + +local SOUND_MAP = { +["Clear"] = 983, -- TR5_Keypad_Hash (Cancel) +["Enter"] = 984, -- TR5_Keypad_Asterisk (Confirm) +[0] = 985, -- TR5_Keypad_0 +[1] = 986, -- TR5_Keypad_1 +[2] = 987, -- TR5_Keypad_2 +[3] = 988, -- TR5_Keypad_3 +[4] = 989, -- TR5_Keypad_4 +[5] = 990, -- TR5_Keypad_5 +[6] = 991, -- TR5_Keypad_6 +[7] = 992, -- TR5_Keypad_7 +[8] = 993, -- TR5_Keypad_8 +[9] = 994, -- TR5_Keypad_9 +["Failure"] = 995, -- TR5_Keypad_Entry_No +["Success"] = 996, -- TR5_Keypad_Entry_Yes +["Click"] = 644, -- TR2_Click +} + +local function keypadCreate(object, code) local dataName = object .. "_KeypadData" @@ -13,40 +33,99 @@ LevelFuncs.Engine.Node.KeypadCreate = function(object, code, volume) LevelVars.Engine.Keypad[dataName] = {} LevelVars.Engine.Keypad[dataName].Code = LevelVars.Engine.Keypad[dataName].Code or codeS LevelVars.Engine.Keypad[dataName].CodeInput = "" - LevelVars.Engine.Keypad[dataName].Volume = volume LevelVars.Engine.Keypad[dataName].Status = false LevelVars.Engine.Keypad[dataName].CursorX = 1 LevelVars.Engine.Keypad[dataName].CursorY = 1 end +local function closeKeypad(keypadObject) + + local dataName = keypadObject .. "_KeypadData" + + local keypad = GetMoveableByName(keypadObject) + keypad:SetItemFlags(1,0) + LevelVars.Engine.Keypad[dataName] = nil + LevelVars.Engine.Keypad.ActivatedKeypad = nil + +end + +local function activateKeypad(object) + + local keypad = GetMoveableByName(object) + + if keypad:GetItemFlags(0) == 0 then + Lara:Interact(keypad) + end + + if Lara:GetAnim() == 197 and Lara:GetFrame() >= 22 and Lara:GetFrame() <= 22 then + LevelVars.Engine.Keypad.ActivatedKeypad = object + inventoryOpen = true + end + + if inventoryOpen == true then + inventoryDelay = inventoryDelay + 1 + TEN.View.SetPostProcessMode(View.PostProcessMode.MONOCHROME) + TEN.View.SetPostProcessStrength(1) + TEN.View.SetPostProcessTint(Color(128,128,128,255)) + TEN.View.DisplayItem.ResetCamera() + if inventoryDelay >= 2 then + + inventoryOpen = false + inventoryDelay = 0 + setupComplete = true + Flow.SetFreezeMode(Flow.FreezeMode.FULL) + end + end + +end + +local function exitKeypad(object, status) + + local dataName = object .. "_KeypadData" + local keypadObject = TEN.View.DisplayItem.GetItemByName(dataName) + + LevelVars.Engine.Keypad[dataName].Status = status + keypadObject:Remove() + LevelVars.Engine.Keypad.ActivatedKeypad = nil + Flow.SetFreezeMode(Flow.FreezeMode.NONE) + +end + +local function displayInput(object, keypad) + + local dataName = object .. "_KeypadData" + + if inputMode then + local selectedKey = keypad[LevelVars.Engine.Keypad[dataName].CursorY][LevelVars.Engine.Keypad[dataName].CursorX] + LevelVars.Engine.Keypad[dataName].CodeInput = tostring(selectedKey) + end + +end + -- !Name "Run a keypad (triggers)" -- !Section "User interface" -- !Description "Creates a keypad to activate the triggers using Trigger Triggerer." -- !Arguments "NewLine, 80, Moveables, Keypad Object" -- !Arguments "Numerical, 20, [ 1000 | 9999 ], Pass code" --- !Arguments "NewLine, Volumes, Volume to use for the keypad" -- !Arguments "NewLine, Moveables, Trigger Triggerer object to activate" -LevelFuncs.Engine.Node.KeypadTrigger = function(object, code, volume, triggerer) +LevelFuncs.Engine.Node.KeypadTrigger = function(object, code, triggerer) local dataName = object .. "_KeypadData" if not LevelVars.Engine.Keypad[dataName] then - LevelFuncs.Engine.Node.KeypadCreate(object, code, volume) + keypadCreate(object, code) + inputMode = false end if LevelVars.Engine.Keypad[dataName].Status then local triggerer = GetMoveableByName(triggerer) - local volume = GetVolumeByName(LevelVars.Engine.Keypad[dataName].Volume) triggerer:Enable() - LevelVars.Engine.Keypad[dataName] = nil - LevelVars.Engine.Keypad.ActivatedKeypad = nil - TEN.Logic.RemoveCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) - volume:Disable() + closeKeypad(object) end - LevelFuncs.Engine.ActivateKeypad(object) + activateKeypad(object) end -- !Name "Run a keypad (volume event)" @@ -54,28 +133,24 @@ end -- !Description "Creates a keypad to run a volume event." -- !Arguments "NewLine, 80, Moveables, Keypad Object" -- !Arguments "Numerical, 20, [ 1000 | 9999 ], Pass code" --- !Arguments "NewLine, Volumes, Volume to use for the keypad" -- !Arguments "NewLine, 65, VolumeEventSets, Target event set" -- !Arguments "VolumeEvents, 35, Event to run" -LevelFuncs.Engine.Node.KeypadVolume = function(object, code, volume, volumeEvent, eventType) +LevelFuncs.Engine.Node.KeypadVolume = function(object, code, volumeEvent, eventType) local dataName = object .. "_KeypadData" if not LevelVars.Engine.Keypad[dataName] then - LevelFuncs.Engine.Node.KeypadCreate(object, code, volume) + keypadCreate(object, code) + inputMode = false end if LevelVars.Engine.Keypad[dataName].Status then - local volume = GetVolumeByName(LevelVars.Engine.Keypad[dataName].Volume) - LevelVars.Engine.Keypad[dataName] = nil - LevelVars.Engine.Keypad.ActivatedKeypad = nil - TEN.Logic.RemoveCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) TEN.Logic.HandleEvent(volumeEvent, eventType, Lara) - volume:Disable() + closeKeypad(object) end - LevelFuncs.Engine.ActivateKeypad(object) + activateKeypad(object) end @@ -84,91 +159,82 @@ end -- !Description "Creates a keypad to run a script function." -- !Arguments "NewLine, 80, Moveables, Keypad Object" -- !Arguments "Numerical, 20, [ 1000 | 9999 ], Pass code" --- !Arguments "NewLine, Volumes, Volume to use for the keypad" -- !Arguments "NewLine, LuaScript, Target Lua script function" "NewLine, String, Arguments" -LevelFuncs.Engine.Node.KeypadScript = function(object, code, volume, funcName, args) +LevelFuncs.Engine.Node.KeypadScript = function(object, code, funcName, args) local dataName = object .. "_KeypadData" if not LevelVars.Engine.Keypad[dataName] then - LevelFuncs.Engine.Node.KeypadCreate(object, code, volume) + keypadCreate(object, code) + inputMode = false end if LevelVars.Engine.Keypad[dataName].Status then - local volume = GetVolumeByName(LevelVars.Engine.Keypad[dataName].Volume) - LevelVars.Engine.Keypad[dataName] = nil - LevelVars.Engine.Keypad.ActivatedKeypad = nil - TEN.Logic.RemoveCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) funcName(table.unpack(LevelFuncs.Engine.Node.SplitString(args, ","))) - volume:Disable() + closeKeypad(object) end - LevelFuncs.Engine.ActivateKeypad(object) + activateKeypad(object) end -LevelFuncs.Engine.ActivateKeypad = function(object) - - local target = GetMoveableByName(object) +-- !Name "Run a keypad (Numerical Input)" +-- !Section "User interface" +-- !Description "Creates a keypad to input numerical number." +-- !Arguments "NewLine, Moveables, Keypad Object" +LevelFuncs.Engine.Node.KeypadInput = function(object) - Lara:Interact(target) + local dataName = object .. "_KeypadData" - if Lara:GetAnim() == 197 and Lara:GetFrame() >= 22 and Lara:GetFrame() <= 22 then - LevelVars.Engine.Keypad.ActivatedKeypad = object - inventoryOpen = true + if not LevelVars.Engine.Keypad[dataName] then + keypadCreate(object, 1) + inputMode = true end - if inventoryOpen == true then - inventoryDelay = inventoryDelay + 1 - TEN.View.SetPostProcessMode(View.PostProcessMode.MONOCHROME) - TEN.View.SetPostProcessStrength(1) - TEN.View.SetPostProcessTint(Color(128,128,128,255)) - - if inventoryDelay >= 2 then - TEN.Logic.AddCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.RunKeypad) - inventoryOpen = false - inventoryDelay = 0 - Flow.SetFreezeMode(Flow.FreezeMode.FULL) - end - end + activateKeypad(object) end -LevelFuncs.Engine.ExitKeypad = function(object, status) +-- !Name "If Numerical Input from a keypad is..." +-- !Section "User interface" +-- !Conditional "True" +-- !Description "Read a keypad's number." +-- !Arguments "NewLine, Moveables, Keypad Object" +-- !Arguments "NewLine, CompareOperator, 20" +-- !Arguments "Numerical, 20, [ 0 | 9 ], Input to test" +LevelFuncs.Engine.Node.KeypadRead = function(object, operator, value) local dataName = object .. "_KeypadData" - local keypadObject = TEN.View.DisplayItem.GetItemByName(dataName) - LevelVars.Engine.Keypad[dataName].Status = status - keypadObject:Remove() - Flow.SetFreezeMode(Flow.FreezeMode.NONE) + if not LevelVars.Engine.Keypad[dataName] then + return false + end + + if LevelVars.Engine.Keypad[dataName].Status then + LevelVars.Engine.Keypad.ActivatedKeypad = nil + local numericString = LevelVars.Engine.Keypad[dataName].CodeInput:gsub("%-", "") + local numberValue = tonumber(numericString) + LevelVars.Engine.Keypad[dataName].CodeInput = "" + LevelVars.Engine.Keypad[dataName].Status = false + return LevelFuncs.Engine.Node.CompareValue(numberValue, value, operator) + end + end -LevelFuncs.Engine.RunKeypad = function() - - TEN.View.SetPostProcessMode(View.PostProcessMode.NONE) - TEN.View.SetPostProcessStrength(0) - TEN.View.SetPostProcessTint(Color(255,255,255,255)) - - local soundIDs = { - ["Clear"] = 983, -- TR5_Keypad_Hash (Cancel) - ["Enter"] = 984, -- TR5_Keypad_Asterisk (Confirm) - [0] = 985, -- TR5_Keypad_0 - [1] = 986, -- TR5_Keypad_1 - [2] = 987, -- TR5_Keypad_2 - [3] = 988, -- TR5_Keypad_3 - [4] = 989, -- TR5_Keypad_4 - [5] = 990, -- TR5_Keypad_5 - [6] = 991, -- TR5_Keypad_6 - [7] = 992, -- TR5_Keypad_7 - [8] = 993, -- TR5_Keypad_8 - [9] = 994, -- TR5_Keypad_9 - ["Failure"] = 995, -- TR5_Keypad_Entry_No - ["Success"] = 996, -- TR5_Keypad_Entry_Yes - ["Click"] = 644, -- TR2_Click - } +LevelFuncs.Engine.Node.RunKeypad = function() + + if not LevelVars.Engine.Keypad.ActivatedKeypad then + return + end + + if setupComplete then + TEN.View.SetPostProcessMode(View.PostProcessMode.NONE) + TEN.View.SetPostProcessStrength(0) + TEN.View.SetPostProcessTint(Color(255,255,255,255)) + setupComplete = false + end local object = LevelVars.Engine.Keypad.ActivatedKeypad local objectSlot = GetMoveableByName(object):GetObjectID() @@ -196,42 +262,65 @@ LevelFuncs.Engine.RunKeypad = function() if KeyIsHit(ActionID.ACTION) then local selectedKey = keypad[LevelVars.Engine.Keypad[dataName].CursorY][LevelVars.Engine.Keypad[dataName].CursorX] - TEN.Sound.PlaySound(soundIDs[selectedKey]) + TEN.Sound.PlaySound(SOUND_MAP[selectedKey]) if selectedKey == "Clear" then LevelVars.Engine.Keypad[dataName].CodeInput = "" -- Clear the entered code - TEN.Sound.PlaySound(soundIDs["Clear"]) + TEN.Sound.PlaySound(SOUND_MAP["Clear"]) elseif selectedKey == "Enter" then - if LevelVars.Engine.Keypad[dataName].CodeInput == correctCode then - TEN.Sound.PlaySound(soundIDs["Success"]) + if inputMode then + for _, mesh in pairs(meshMappings) do - target:SetMeshVisible(mesh.dark, true) -- Show dark keys - target:SetMeshVisible(mesh.bright, false) -- Hide bright keys + target:SetMeshVisible(mesh.dark, true) + target:SetMeshVisible(mesh.bright, false) end - LevelFuncs.Engine.ExitKeypad(object, true) + exitKeypad(object, true) return else - TEN.Sound.PlaySound(soundIDs["Failure"]) - LevelVars.Engine.Keypad[dataName].CodeInput = "" -- Reset the entered code if incorrect + if LevelVars.Engine.Keypad[dataName].CodeInput == correctCode then + TEN.Sound.PlaySound(SOUND_MAP["Success"]) + for _, mesh in pairs(meshMappings) do + target:SetMeshVisible(mesh.dark, true) -- Show dark keys + target:SetMeshVisible(mesh.bright, false) -- Hide bright keys + end + exitKeypad(object, true) + return + else + TEN.Sound.PlaySound(SOUND_MAP["Failure"]) + LevelVars.Engine.Keypad[dataName].CodeInput = "" -- Reset the entered code if incorrect + end end else - if string.len(LevelVars.Engine.Keypad[dataName].CodeInput) < maxCodeLength then + if string.len(LevelVars.Engine.Keypad[dataName].CodeInput) < maxCodeLength or inputMode then + + if inputMode then + + for _, mesh in pairs(meshMappings) do + target:SetMeshVisible(mesh.dark, true) + target:SetMeshVisible(mesh.bright, false) + end + exitKeypad(object, true) + return + end + LevelVars.Engine.Keypad[dataName].CodeInput = LevelVars.Engine.Keypad[dataName].CodeInput .. tostring(selectedKey) + end end elseif KeyIsHit(ActionID.FORWARD) then LevelVars.Engine.Keypad[dataName].CursorY = LevelVars.Engine.Keypad[dataName].CursorY -1 - TEN.Sound.PlaySound(soundIDs["Click"]) + TEN.Sound.PlaySound(SOUND_MAP["Click"]) elseif KeyIsHit(ActionID.BACK) then LevelVars.Engine.Keypad[dataName].CursorY = LevelVars.Engine.Keypad[dataName].CursorY + 1 - TEN.Sound.PlaySound(soundIDs["Click"]) + TEN.Sound.PlaySound(SOUND_MAP["Click"]) elseif KeyIsHit(ActionID.LEFT) then LevelVars.Engine.Keypad[dataName].CursorX = LevelVars.Engine.Keypad[dataName].CursorX - 1 - TEN.Sound.PlaySound(soundIDs["Click"]) + TEN.Sound.PlaySound(SOUND_MAP["Click"]) elseif KeyIsHit(ActionID.RIGHT) then LevelVars.Engine.Keypad[dataName].CursorX = LevelVars.Engine.Keypad[dataName].CursorX + 1 - TEN.Sound.PlaySound(soundIDs["Click"]) + TEN.Sound.PlaySound(SOUND_MAP["Click"]) + elseif KeyIsHit(ActionID.INVENTORY) then - TEN.Sound.PlaySound(soundIDs["Failure"]) + TEN.Sound.PlaySound(SOUND_MAP["Failure"]) LevelVars.Engine.Keypad[dataName].CodeInput = "" LevelVars.Engine.Keypad[dataName].CursorX = 1 LevelVars.Engine.Keypad[dataName].CursorY = 1 @@ -241,7 +330,7 @@ LevelFuncs.Engine.RunKeypad = function() target:SetMeshVisible(mesh.bright, false) -- Hide bright keys end - LevelFuncs.Engine.ExitKeypad(object, false) + exitKeypad(object, false) return end @@ -251,6 +340,9 @@ LevelFuncs.Engine.RunKeypad = function() -- Clamp cursorY within the total number of rows LevelVars.Engine.Keypad[dataName].CursorY = math.max(1, math.min(LevelVars.Engine.Keypad[dataName].CursorY, 4)) + + --if Keypad is input type show the currently hovering number + displayInput(object, keypad) -- Function to format entered code with dashes local codeWithDashes = LevelVars.Engine.Keypad[dataName].CodeInput or "" @@ -277,7 +369,9 @@ LevelFuncs.Engine.RunKeypad = function() end -- Display entered code with dashes - local controlsText = TEN.Strings.DisplayString(codeWithDashes, TEN.Vec2(TEN.Util.PercentToScreen(55, 30)), 1.0, TEN.Color(255,255,255), false, {Strings.DisplayStringOption.RIGHT}) + local controlsText = TEN.Strings.DisplayString(codeWithDashes, TEN.Vec2(TEN.Util.PercentToScreen(55, 30)), 1.0, TEN.Color(192,192,192), false, {Strings.DisplayStringOption.RIGHT}) ShowString(controlsText, 1 / 30) end + +TEN.Logic.AddCallback(TEN.Logic.CallbackPoint.PREFREEZE, LevelFuncs.Engine.Node.RunKeypad) \ No newline at end of file