Added a reset for the second moveable box.
This commit is contained in:
parent
9a4cb335a0
commit
5778696d29
@ -4782,18 +4782,19 @@
|
|||||||
<idBlue>2</idBlue>
|
<idBlue>2</idBlue>
|
||||||
<typeID>240</typeID>
|
<typeID>240</typeID>
|
||||||
<trigger>
|
<trigger>
|
||||||
<name>-</name>
|
<name>resetBox</name>
|
||||||
|
<undo>false</undo>
|
||||||
<xPosition>0</xPosition>
|
<xPosition>0</xPosition>
|
||||||
<yPosition>0</yPosition>
|
<yPosition>-100000</yPosition>
|
||||||
<zPosition>0</zPosition>
|
<zPosition>0</zPosition>
|
||||||
<targetIdGreen>-</targetIdGreen>
|
<targetIdGreen>-</targetIdGreen>
|
||||||
<targetIdBlue>-</targetIdBlue>
|
<targetIdBlue>-</targetIdBlue>
|
||||||
<distance>1.0</distance>
|
<distance>100015</distance>
|
||||||
<isBiggerThan>false</isBiggerThan>
|
<isBiggerThan>false</isBiggerThan>
|
||||||
<objectNum>0</objectNum>
|
<objectNum>0</objectNum>
|
||||||
<luaScript>-</luaScript>
|
<luaScript>resetBox.lua</luaScript>
|
||||||
<toChangeIdGreen>0</toChangeIdGreen>
|
<toChangeIdGreen>0</toChangeIdGreen>
|
||||||
<toChangeIdBlue>0</toChangeIdBlue>
|
<toChangeIdBlue>2</toChangeIdBlue>
|
||||||
<toChangeObjNum>0</toChangeObjNum>
|
<toChangeObjNum>0</toChangeObjNum>
|
||||||
</trigger>
|
</trigger>
|
||||||
</composition>
|
</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("resetPlayer", &Level::resetPlayer)
|
||||||
.addFunction("movePlayer", &Level::movePlayer)
|
.addFunction("movePlayer", &Level::movePlayer)
|
||||||
.addFunction("setSunDirection", &Level::setSunDirection)
|
.addFunction("setSunDirection", &Level::setSunDirection)
|
||||||
|
.addFunction("forceMove", &Level::forceMove)
|
||||||
.endClass();
|
.endClass();
|
||||||
//Push the level to Lua as a global variable
|
//Push the level to Lua as a global variable
|
||||||
luabridge::push(luaState, this);
|
luabridge::push(luaState, this);
|
||||||
@ -272,3 +273,8 @@ Terrain* Level::getTerrain() {
|
|||||||
Skydome* Level::getSkydome() {
|
Skydome* Level::getSkydome() {
|
||||||
return &skydome;
|
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);
|
||||||
|
}
|
||||||
|
1
level.hh
1
level.hh
@ -61,6 +61,7 @@ class Level {
|
|||||||
void resetPlayer();
|
void resetPlayer();
|
||||||
void movePlayer(float xPosition, float yPosition, float zPosition);
|
void movePlayer(float xPosition, float yPosition, float zPosition);
|
||||||
void setPlayerIndex(int index);
|
void setPlayerIndex(int index);
|
||||||
|
void forceMove(float x, float y, float z, unsigned indice);
|
||||||
private:
|
private:
|
||||||
lua_State* luaState=nullptr;
|
lua_State* luaState=nullptr;
|
||||||
std::vector<Object*> objects;
|
std::vector<Object*> objects;
|
||||||
|
Loading…
Reference in New Issue
Block a user