fix: lua script wasn't started when state was running on wolrd load
Dieser Commit ist enthalten in:
Ursprung
a19879159a
Commit
6104827890
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the traintastic source code.
|
* This file is part of the traintastic source code.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019-2021 Reinder Feenstra
|
* Copyright (C) 2019-2022 Reinder Feenstra
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -109,6 +109,14 @@ void Script::addToWorld()
|
|||||||
m_world.luaScripts->addObject(shared_ptr<Script>());
|
m_world.luaScripts->addObject(shared_ptr<Script>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Script::loaded()
|
||||||
|
{
|
||||||
|
IdObject::loaded();
|
||||||
|
|
||||||
|
if(state == LuaScriptState::Running)
|
||||||
|
startSandbox();
|
||||||
|
}
|
||||||
|
|
||||||
void Script::worldEvent(WorldState worldState, WorldEvent worldEvent)
|
void Script::worldEvent(WorldState worldState, WorldEvent worldEvent)
|
||||||
{
|
{
|
||||||
IdObject::worldEvent(worldState, worldEvent);
|
IdObject::worldEvent(worldState, worldEvent);
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the traintastic source code.
|
* This file is part of the traintastic source code.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2019-2021 Reinder Feenstra
|
* Copyright (C) 2019-2022 Reinder Feenstra
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -41,6 +41,7 @@ class Script : public IdObject
|
|||||||
void load(WorldLoader& loader, const nlohmann::json& data) final;
|
void load(WorldLoader& loader, const nlohmann::json& data) final;
|
||||||
void save(WorldSaver& saver, nlohmann::json& data, nlohmann::json& stateData) const final;
|
void save(WorldSaver& saver, nlohmann::json& data, nlohmann::json& stateData) const final;
|
||||||
void addToWorld() final;
|
void addToWorld() final;
|
||||||
|
void loaded() final;
|
||||||
void worldEvent(WorldState worldState, WorldEvent worldEvent) final;
|
void worldEvent(WorldState worldState, WorldEvent worldEvent) final;
|
||||||
|
|
||||||
void updateEnabled();
|
void updateEnabled();
|
||||||
|
|||||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren