From 80df2aac41182e8f6d1e82eb2f466eec6fc29cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Mon, 2 Mar 2015 12:58:34 +0100 Subject: [PATCH] Added lua scripts and triggers for the third door. --- data/levels/Compositions.xml | 2 +- data/levels/Level1.xml | 43 +++++++++++++++++++---- data/levels/scripts/openFirstDoor.lua | 2 +- data/levels/scripts/openThirdDoor.lua | 23 ++++++++++++ data/levels/scripts/openThirdDoorUndo.lua | 23 ++++++++++++ 5 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 data/levels/scripts/openThirdDoor.lua create mode 100644 data/levels/scripts/openThirdDoorUndo.lua diff --git a/data/levels/Compositions.xml b/data/levels/Compositions.xml index 3d3631e..39c046f 100644 --- a/data/levels/Compositions.xml +++ b/data/levels/Compositions.xml @@ -435,7 +435,7 @@ 0.0 0.0 1.5 - 0.0 + 100.0 diff --git a/data/levels/Level1.xml b/data/levels/Level1.xml index c7c6157..f5a3035 100644 --- a/data/levels/Level1.xml +++ b/data/levels/Level1.xml @@ -3671,18 +3671,33 @@ 12.0 - - - 0 - 0 - 0 + openThirdDoor + -161.5 + 21.7 + 67.5 - - - 1.0 + 0.2 + true + 0 + openThirdDoor.lua + 0 + 178 + 0 + + + openThirdDoorUndo + -161.5 + 21.7 + 67.5 + - + - + 0.2 false 0 - - + openThirdDoorUndo.lua 0 - 0 + 178 0 @@ -8571,6 +8586,13 @@ 1 8 221 + + 0 + -81.5 + 25.0 + 4.5 + 100.0 + - 0 @@ -10514,6 +10536,13 @@ 0 178 221 + + 0 + -172.5 + 25.0 + 58.5 + 100.0 + - 0 diff --git a/data/levels/scripts/openFirstDoor.lua b/data/levels/scripts/openFirstDoor.lua index b333b91..0dceaa4 100644 --- a/data/levels/scripts/openFirstDoor.lua +++ b/data/levels/scripts/openFirstDoor.lua @@ -11,7 +11,7 @@ function trigger(objectToChange) local strength = 100 local xPos = 17.5 - local yPos = 35 + local yPos = 33 local zPos = 81.5 level:moveObject(objectToChange, strength, xPos, yPos, zPos) diff --git a/data/levels/scripts/openThirdDoor.lua b/data/levels/scripts/openThirdDoor.lua new file mode 100644 index 0000000..e1776de --- /dev/null +++ b/data/levels/scripts/openThirdDoor.lua @@ -0,0 +1,23 @@ +local global = require( "global" ) +if(global.triggeredOpenThirdDoor == nil) then + global.triggeredOpenThirdDoor = false +end +function trigger(objectToChange) + if(global.triggeredOpenThirdDoor == false) then + if(not level) then + print("No level found in Lua!") + return + end + + local strength = 100 + local xPos = -172.5 + local yPos = 33 + local zPos = 58.5 + level:moveObject(objectToChange, strength, xPos, yPos, zPos) + + global.triggeredOpenThirdDoorUndo = false + + global.triggeredOpenThirdDoor = true + print("openThirdDoor") + end +end diff --git a/data/levels/scripts/openThirdDoorUndo.lua b/data/levels/scripts/openThirdDoorUndo.lua new file mode 100644 index 0000000..f183e34 --- /dev/null +++ b/data/levels/scripts/openThirdDoorUndo.lua @@ -0,0 +1,23 @@ +local global = require( "global" ) +if(global.triggeredOpenThirdDoorUndo == nil) then + global.triggeredOpenThirdDoorUndo = true +end +function trigger(objectToChange) + if(global.triggeredOpenThirdDoorUndo == false) then + if(not level) then + print("No level found in Lua!") + return + end + + local strength = 100 + local xPos = -172.5 + local yPos = 25 + local zPos = 58.5 + level:moveObject(objectToChange, strength, xPos, yPos, zPos) + + global.triggeredOpenThirdDoor = false + + global.triggeredOpenThirdDoorUndo = true + print("openThirdDoorUndo") + end +end