Merge branch 'master' of github.com:Faerbit/swp

This commit is contained in:
Faerbit 2015-03-06 09:16:37 +01:00
commit f015ec0879
4 changed files with 60 additions and 1 deletions

View File

@ -2,6 +2,10 @@ local global = require( "global" )
if(global.triggeredSCRIPTNAME == nil) then
global.triggeredSCRIPTNAME = false
end
if(global.triggeredSCRIPTNAMEUndo == nil) then
global.triggeredSCRIPTNAMEUndo = false
end
function trigger(objectToChange)
if(global.triggeredSCRIPTNAME == false) then
if(not level) then
@ -15,3 +19,17 @@ function trigger(objectToChange)
print("SCRIPTNAME")
end
end
function triggerUndo(objectToChange)
if(global.triggeredSCRIPTNAMEUndo == false) then
if(not level) then
print("No level found in Lua!")
return
end
--enter the scripts undo code here
global.triggeredSCRIPTNAMEUndo = true
print("SCRIPTNAMEUndo")
end
end

View File

@ -2,12 +2,14 @@ local global = require( "global" )
if(global.triggeredResetPlayer == nil) then
global.triggeredResetPlayer = false
end
function trigger(objectToChange)
if(global.triggeredResetPlayer == false) then
if(not level) then
print("No level found in Lua!")
return
end
if(global.triggeredOpenFirstDoor == true) then
if(global.openedSecondDoor == true) then
if(global.triggeredOpenThirdDoor == true) then
@ -22,7 +24,6 @@ function trigger(objectToChange)
level:resetPlayer()
end
--global.triggeredResetPlayer = true
print("reset player")
end
end

View File

@ -0,0 +1,19 @@
local global = require( "global" )
if(global.triggeredSunStart == nil) then
global.triggeredSunStart = false
end
function trigger(objectToChange)
if(global.triggeredSunStart == false) then
if(not level) then
print("No level found in Lua!")
return
end
local time = os.clock()
global.sunStartTime = time
global.triggeredSunStart = true
print("sunStart")
end
end

View File

@ -0,0 +1,21 @@
local global = require( "global" )
function trigger(objectToChange)
if(global.triggeredSunStart) then
if(not level) then
print("No level found in Lua!")
return
end
local maxTimeDiff = 5
local timeDiff = os.clock()- global.sunStartTime
if(timeDiff > maxTimeDiff)then
timeDiff = maxTimeDiff
end
timeDiff = timeDiff/maxTimeDiff
local x = 1 - 0.3 * timeDiff
local y = 0.7 * timeDiff
local z = timeDiff^0.5 * 0.6 -0.1
level:setSunAngle(x,y,z)
end
end