metaforce/Runtime/World/CScriptMemoryRelay.cpp

40 lines
1.2 KiB
C++
Raw Normal View History

#include "Runtime/World/CScriptMemoryRelay.hpp"
#include "Runtime/CScriptMailbox.hpp"
#include "Runtime/CStateManager.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
2021-04-10 08:42:06 +00:00
namespace metaforce {
2021-06-07 19:29:18 +00:00
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info,
bool defaultActive, bool skipSendActive, bool ignoreMessages)
2018-12-08 05:30:43 +00:00
: CEntity(uid, info, true, name)
2019-07-17 02:10:57 +00:00
, x34_24_defaultActive(defaultActive)
2018-12-08 05:30:43 +00:00
, x34_25_skipSendActive(skipSendActive)
, x34_26_ignoreMessages(ignoreMessages) {}
2018-12-08 05:30:43 +00:00
void CScriptMemoryRelay::Accept(IVisitor& visitor) { visitor.Visit(this); }
2017-01-15 03:07:01 +00:00
2018-12-08 05:30:43 +00:00
void CScriptMemoryRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) {
if (x34_26_ignoreMessages) {
2018-12-08 05:30:43 +00:00
return;
}
2018-12-08 05:30:43 +00:00
if (msg == EScriptObjectMessage::Deactivate) {
stateMgr.GetMailbox()->RemoveMsg(xc_editorId);
2018-12-08 05:30:43 +00:00
return;
} else if (msg == EScriptObjectMessage::Activate) {
stateMgr.GetMailbox()->AddMsg(xc_editorId);
if (!x34_25_skipSendActive) {
2018-12-08 05:30:43 +00:00
SendScriptMsgs(EScriptObjectState::Active, stateMgr, EScriptObjectMessage::None);
}
2018-12-08 05:30:43 +00:00
return;
}
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
}
2018-12-08 05:30:43 +00:00
2021-04-10 08:42:06 +00:00
} // namespace metaforce