From 7ad9965c747f26f5fe2d01440519b93c5d319f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Fri, 20 Feb 2015 13:26:09 +0100 Subject: [PATCH] Updated currently unused scripts. --- data/levels/scripts/deleteObject.lua | 9 +++++---- data/levels/scripts/deleteRandomObject.lua | 11 +++++++---- data/levels/scripts/openDoor1.lua | 19 ++++++++++--------- data/levels/scripts/openDoor1undo.lua | 15 ++++++++------- data/levels/scripts/openDoor2.lua | 19 ++++++++++--------- data/levels/scripts/openDoor2undo.lua | 15 ++++++++------- data/levels/scripts/openDoor3.lua | 19 ++++++++++--------- data/levels/scripts/openDoor3undo.lua | 15 ++++++++------- 8 files changed, 66 insertions(+), 56 deletions(-) diff --git a/data/levels/scripts/deleteObject.lua b/data/levels/scripts/deleteObject.lua index 31fc432..42e1194 100644 --- a/data/levels/scripts/deleteObject.lua +++ b/data/levels/scripts/deleteObject.lua @@ -1,14 +1,15 @@ -if(triggeredDeleteObject == nil) then - triggeredDeleteObject = false +local global = require( "global" ) +if(global.triggeredDeleteObject == nil) then + global.triggeredDeleteObject = false end function trigger(objectToChange) - if(triggeredDeleteObject == false) then + if(global.triggeredDeleteObject == false) then if(not level) then print("No level found in Lua!") return end level:deleteObject(objectToChange) - triggeredDeleteObject = true + global.triggeredDeleteObject = true print("deleteObject") end end diff --git a/data/levels/scripts/deleteRandomObject.lua b/data/levels/scripts/deleteRandomObject.lua index 2fad2a1..161e511 100644 --- a/data/levels/scripts/deleteRandomObject.lua +++ b/data/levels/scripts/deleteRandomObject.lua @@ -1,8 +1,9 @@ -if(triggeredDeleteRandomObject == nil) then - triggeredDeleteRandomObject = false +local global = require( "global" ) +if(global.triggeredDeleteRandomObject == nil) then + global.triggeredDeleteRandomObject = false end function trigger(objectToChange) - if(triggeredDeleteRandomObject == false) then + if(global.triggeredDeleteRandomObject == false) then if(not level) then print("No level found in Lua!") return @@ -10,7 +11,9 @@ function trigger(objectToChange) a = level:getObjectCount() rand = math.random(0, a - 1) level:deleteObject(rand) - triggeredDeleteRandomObject = true + global.triggeredDeleteRandomObject = true print("deleteRandomObject") end end + + diff --git a/data/levels/scripts/openDoor1.lua b/data/levels/scripts/openDoor1.lua index cf53872..694fad6 100644 --- a/data/levels/scripts/openDoor1.lua +++ b/data/levels/scripts/openDoor1.lua @@ -1,18 +1,19 @@ -if(triggeredOpenDoor1 == nil) then - triggeredOpenDoor1 = false +local global = require( "global" ) +if(global.triggeredOpenDoor1 == nil) then + global.triggeredOpenDoor1 = false end function trigger(objectToChange) - if(triggeredOpenDoor1 == false) then + if(global.triggeredOpenDoor1 == false) then if(not level) then print("No level found in Lua!") return end - if(not openDoorCounter) then - openDoorCounter = 0 + if(not global.openDoorCounter) then + global.openDoorCounter = 0 end - openDoorCounter = openDoorCounter + 1 - if (openDoorCounter == 3) then + global.openDoorCounter = global.openDoorCounter + 1 + if (global.openDoorCounter == 3) then local strength = 1 local xPos = 0 local yPos = 0 @@ -20,9 +21,9 @@ function trigger(objectToChange) level:moveObject(objectToChange, strength, xPos, yPos, zPos) print("Opening the door") end - triggeredOpenDoor1undo = false + global.triggeredOpenDoor1undo = false - triggeredOpenDoor1 = true + global.triggeredOpenDoor1 = true print("openDoor1") end end diff --git a/data/levels/scripts/openDoor1undo.lua b/data/levels/scripts/openDoor1undo.lua index a475744..29cb972 100644 --- a/data/levels/scripts/openDoor1undo.lua +++ b/data/levels/scripts/openDoor1undo.lua @@ -1,19 +1,20 @@ -if(triggeredOpenDoor1undo == nil) then - triggeredOpenDoor1undo = false +local global = require( "global" ) +if(global.triggeredOpenDoor1undo == nil) then + global.triggeredOpenDoor1undo = true end function trigger(objectToChange) - if(triggeredOpenDoor1undo == false) then + if(global.triggeredOpenDoor1undo == false) then if(not level) then print("No level found in Lua!") return end - if(triggeredOpenDoor1) then - openDoorCounter = openDoorCounter - 1 - triggeredOpenDoor1 = false + if(global.triggeredOpenDoor1) then + global.openDoorCounter = global.openDoorCounter - 1 + global.triggeredOpenDoor1 = false end - triggeredOpenDoor1undo = true + global.triggeredOpenDoor1undo = true print("openDoor1undo") end end diff --git a/data/levels/scripts/openDoor2.lua b/data/levels/scripts/openDoor2.lua index debaa25..59422e0 100644 --- a/data/levels/scripts/openDoor2.lua +++ b/data/levels/scripts/openDoor2.lua @@ -1,18 +1,19 @@ -if(triggeredOpenDoor2 == nil) then - triggeredOpenDoor2 = false +local global = require( "global" ) +if(global.triggeredOpenDoor2 == nil) then + global.triggeredOpenDoor2 = false end function trigger(objectToChange) - if(triggeredOpenDoor2 == false) then + if(global.triggeredOpenDoor2 == false) then if(not level) then print("No level found in Lua!") return end - if(not openDoorCounter) then - openDoorCounter = 0 + if(not global.openDoorCounter) then + global.openDoorCounter = 0 end - openDoorCounter = openDoorCounter + 1 - if (openDoorCounter == 3) then + global.openDoorCounter = global.openDoorCounter + 1 + if (global.openDoorCounter == 3) then local strength = 1 local xPos = 0 local yPos = 0 @@ -20,9 +21,9 @@ function trigger(objectToChange) level:moveObject(objectToChange, strength, xPos, yPos, zPos) print("Opening the door") end - triggeredOpenDoor2undo = false + global.triggeredOpenDoor2undo = false - triggeredOpenDoor2 = true + global.triggeredOpenDoor2 = true print("openDoor2") end end diff --git a/data/levels/scripts/openDoor2undo.lua b/data/levels/scripts/openDoor2undo.lua index eb7e20d..b03a4eb 100644 --- a/data/levels/scripts/openDoor2undo.lua +++ b/data/levels/scripts/openDoor2undo.lua @@ -1,19 +1,20 @@ -if(triggeredOpenDoor2undo == nil) then - triggeredOpenDoor2undo = false +local global = require( "global" ) +if(global.triggeredOpenDoor2undo == nil) then + global.triggeredOpenDoor2undo = true end function trigger(objectToChange) - if(triggeredOpenDoor2undo == false) then + if(global.triggeredOpenDoor2undo == false) then if(not level) then print("No level found in Lua!") return end - if(triggeredOpenDoor2) then - openDoorCounter = openDoorCounter - 1 - triggeredOpenDoor2 = false + if(global.triggeredOpenDoor2) then + global.openDoorCounter = global.openDoorCounter - 1 + global.triggeredOpenDoor2 = false end - triggeredOpenDoor2undo = true + global.triggeredOpenDoor2undo = true print("openDoor2undo") end end diff --git a/data/levels/scripts/openDoor3.lua b/data/levels/scripts/openDoor3.lua index 94f5544..d11bd7f 100644 --- a/data/levels/scripts/openDoor3.lua +++ b/data/levels/scripts/openDoor3.lua @@ -1,18 +1,19 @@ -if(triggeredOpenDoor3 == nil) then - triggeredOpenDoor3 = false +local global = require( "global" ) +if(global.triggeredOpenDoor3 == nil) then + global.triggeredOpenDoor3 = false end function trigger(objectToChange) - if(triggeredOpenDoor3 == false) then + if(global.triggeredOpenDoor3 == false) then if(not level) then print("No level found in Lua!") return end - if(not openDoorCounter) then - openDoorCounter = 0 + if(not global.openDoorCounter) then + global.openDoorCounter = 0 end - openDoorCounter = openDoorCounter + 1 - if (openDoorCounter == 3) then + global.openDoorCounter = global.openDoorCounter + 1 + if (global.openDoorCounter == 3) then local strength = 1 local xPos = 0 local yPos = 0 @@ -20,9 +21,9 @@ function trigger(objectToChange) level:moveObject(objectToChange, strength, xPos, yPos, zPos) print("Opening the door") end - triggeredOpenDoor3undo = false + global.triggeredOpenDoor3undo = false - triggeredOpenDoor3 = true + global.triggeredOpenDoor3 = true print("openDoor3") end end diff --git a/data/levels/scripts/openDoor3undo.lua b/data/levels/scripts/openDoor3undo.lua index ce66ff7..f5db0cb 100644 --- a/data/levels/scripts/openDoor3undo.lua +++ b/data/levels/scripts/openDoor3undo.lua @@ -1,19 +1,20 @@ -if(triggeredOpenDoor3undo == nil) then - triggeredOpenDoor3undo = false +local global = require( "global" ) +if(global.triggeredOpenDoor3undo == nil) then + global.triggeredOpenDoor3undo = false end function trigger(objectToChange) - if(triggeredOpenDoor3undo == false) then + if(global.triggeredOpenDoor3undo == false) then if(not level) then print("No level found in Lua!") return end - if(triggeredOpenDoor3) then - openDoorCounter = openDoorCounter - 1 - triggeredOpenDoor3 = false + if(global.triggeredOpenDoor3) then + global.openDoorCounter = global.openDoorCounter - 1 + global.triggeredOpenDoor3 = false end - triggeredOpenDoor3undo = true + global.triggeredOpenDoor3undo = true print("openDoor3undo") end end