Added a reset for the second moveable box.
This commit is contained in:
parent
9a4cb335a0
commit
5778696d29
@ -4782,18 +4782,19 @@
|
||||
<idBlue>2</idBlue>
|
||||
<typeID>240</typeID>
|
||||
<trigger>
|
||||
<name>-</name>
|
||||
<name>resetBox</name>
|
||||
<undo>false</undo>
|
||||
<xPosition>0</xPosition>
|
||||
<yPosition>0</yPosition>
|
||||
<yPosition>-100000</yPosition>
|
||||
<zPosition>0</zPosition>
|
||||
<targetIdGreen>-</targetIdGreen>
|
||||
<targetIdBlue>-</targetIdBlue>
|
||||
<distance>1.0</distance>
|
||||
<distance>100015</distance>
|
||||
<isBiggerThan>false</isBiggerThan>
|
||||
<objectNum>0</objectNum>
|
||||
<luaScript>-</luaScript>
|
||||
<luaScript>resetBox.lua</luaScript>
|
||||
<toChangeIdGreen>0</toChangeIdGreen>
|
||||
<toChangeIdBlue>0</toChangeIdBlue>
|
||||
<toChangeIdBlue>2</toChangeIdBlue>
|
||||
<toChangeObjNum>0</toChangeObjNum>
|
||||
</trigger>
|
||||
</composition>
|
||||
|
19
data/levels/scripts/resetBox.lua
Normal file
19
data/levels/scripts/resetBox.lua
Normal file
@ -0,0 +1,19 @@
|
||||
local global = require( "global" )
|
||||
if(global.triggeredResetBox == nil) then
|
||||
global.triggeredResetBox = false
|
||||
end
|
||||
|
||||
function trigger(objectToChange)
|
||||
if(global.triggeredResetBox == false) then
|
||||
if(not level) then
|
||||
print("No level found in Lua!")
|
||||
return
|
||||
end
|
||||
local x = -101.5
|
||||
local y = 22.5
|
||||
local z =8.5
|
||||
level:forceMove(x, y, z, objectToChange)
|
||||
|
||||
print("reset box")
|
||||
end
|
||||
end
|
6
level.cc
6
level.cc
@ -41,6 +41,7 @@ void Level::load() {
|
||||
.addFunction("resetPlayer", &Level::resetPlayer)
|
||||
.addFunction("movePlayer", &Level::movePlayer)
|
||||
.addFunction("setSunDirection", &Level::setSunDirection)
|
||||
.addFunction("forceMove", &Level::forceMove)
|
||||
.endClass();
|
||||
//Push the level to Lua as a global variable
|
||||
luabridge::push(luaState, this);
|
||||
@ -272,3 +273,8 @@ Terrain* Level::getTerrain() {
|
||||
Skydome* Level::getSkydome() {
|
||||
return &skydome;
|
||||
}
|
||||
|
||||
void Level::forceMove(float x, float y, float z, unsigned indice){
|
||||
glm::vec3 position = glm::vec3(x,y,z);
|
||||
physics.forceMove(position, indice);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user