mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-28 02:39:42 +00:00
Fix scripts not executing on respawn
This commit is contained in:
parent
cad4ba0423
commit
6baa5da6c9
2 changed files with 13 additions and 1 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwphysics/physicssystem.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/localscripts.hpp"
|
||||
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
@ -844,7 +845,12 @@ namespace MWClass
|
|||
if (ptr.getCellRef().hasContentFile())
|
||||
{
|
||||
if (ptr.getRefData().getCount() == 0)
|
||||
{
|
||||
ptr.getRefData().setCount(1);
|
||||
const std::string& script = getScript(ptr);
|
||||
if(!script.empty())
|
||||
MWBase::Environment::get().getWorld()->getLocalScripts().add(script, ptr);
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
||||
ptr.getRefData().setCustomData(nullptr);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "npc.hpp"
|
||||
#include "npc.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
|||
#include "../mwworld/customdata.hpp"
|
||||
#include "../mwphysics/physicssystem.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/localscripts.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
@ -1376,7 +1377,12 @@ namespace MWClass
|
|||
if (ptr.getCellRef().hasContentFile())
|
||||
{
|
||||
if (ptr.getRefData().getCount() == 0)
|
||||
{
|
||||
ptr.getRefData().setCount(1);
|
||||
const std::string& script = getScript(ptr);
|
||||
if (!script.empty())
|
||||
MWBase::Environment::get().getWorld()->getLocalScripts().add(script, ptr);
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getWorld()->removeContainerScripts(ptr);
|
||||
ptr.getRefData().setCustomData(nullptr);
|
||||
|
|
Loading…
Reference in a new issue