2019-12-22 20:04:07 +00:00
|
|
|
#include "Runtime/World/CScriptMemoryRelay.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/CRelayTracker.hpp"
|
|
|
|
#include "Runtime/CStateManager.hpp"
|
|
|
|
|
2019-09-21 13:07:13 +00:00
|
|
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
2016-05-18 03:57:43 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2016-05-18 03:57:43 +00:00
|
|
|
|
2019-07-17 02:10:57 +00:00
|
|
|
CScriptMemoryRelay::CScriptMemoryRelay(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool defaultActive,
|
2017-08-29 13:17:52 +00:00
|
|
|
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) {}
|
2016-05-18 03:57:43 +00:00
|
|
|
|
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) {
|
2020-05-07 17:05:21 +00:00
|
|
|
if (x34_26_ignoreMessages) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return;
|
2020-05-07 17:05:21 +00:00
|
|
|
}
|
2016-07-25 06:24:57 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (msg == EScriptObjectMessage::Deactivate) {
|
|
|
|
stateMgr.GetRelayTracker()->RemoveRelay(xc_editorId);
|
|
|
|
return;
|
|
|
|
} else if (msg == EScriptObjectMessage::Activate) {
|
|
|
|
stateMgr.GetRelayTracker()->AddRelay(xc_editorId);
|
2020-05-07 17:05:21 +00:00
|
|
|
if (!x34_25_skipSendActive) {
|
2018-12-08 05:30:43 +00:00
|
|
|
SendScriptMsgs(EScriptObjectState::Active, stateMgr, EScriptObjectMessage::None);
|
2020-05-07 17:05:21 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
|
2016-05-18 03:57:43 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|