Added clean-up param

This commit is contained in:
Wincent 2024-09-10 14:33:58 +00:00
parent 06063c8c8a
commit a086fe730a
3 changed files with 20 additions and 6 deletions

View File

@ -217,6 +217,10 @@ void Recorder::ActingDispatch(Entity* actor, const std::vector<Record*>& records
if (concludeRecord) {
if (variables != nullptr) {
variables->Conclude();
if (concludeRecord->cleanUp) {
variables->CleanUp();
}
}
}
@ -1044,11 +1048,17 @@ void Cinema::Recording::ConcludeRecord::Serialize(tinyxml2::XMLDocument& documen
element->SetAttribute("t", m_Delay);
element->SetAttribute("cleanUp", true);
parent->InsertEndChild(element);
}
void Cinema::Recording::ConcludeRecord::Deserialize(tinyxml2::XMLElement* element) {
m_Delay = element->DoubleAttribute("t");
if (element->Attribute("cleanUp")) {
cleanUp = element->BoolAttribute("clean-up");
}
}
Cinema::Recording::VisibilityRecord::VisibilityRecord(bool visible) {

View File

@ -287,6 +287,8 @@ public:
class ConcludeRecord : public Record
{
public:
bool cleanUp = false;
ConcludeRecord() = default;
void Act(Entity* actor) override;

View File

@ -272,14 +272,16 @@ void Cinema::Scene::CheckTicket(Entity* player) {
}
}
if (!IsPlayerInShowingDistance(player)) {
m_HasBeenOutside.emplace(player->GetObjectID());
if (m_ShowingDistance != 0.0f) {
if (!IsPlayerInShowingDistance(player)) {
m_HasBeenOutside.emplace(player->GetObjectID());
return;
}
return;
}
if (m_HasBeenOutside.find(player->GetObjectID()) == m_HasBeenOutside.end()) {
return;
if (m_HasBeenOutside.find(player->GetObjectID()) == m_HasBeenOutside.end()) {
return;
}
}
m_Audience.emplace(player->GetObjectID());