#include "GfCampfire.h" #include "RenderComponent.h" #include "SkillComponent.h" #include "MissionComponent.h" #include "RenderComponent.h" #include "EntityManager.h" #include "eReplicaComponentType.h" void GfCampfire::OnStartup(Entity* self) { self->SetI32(u"counter", static_cast(0)); self->SetProximityRadius(2.0f, "placeholder"); self->SetBoolean(u"isBurning", true); auto render = self->GetComponent(); if (render == nullptr) return; render->PlayEffect(295, u"running", "Burn"); } void GfCampfire::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { if (args == "physicsReady") { auto render = self->GetComponent(); render->PlayEffect(295, u"running", "Burn"); } } void GfCampfire::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) { auto skill = self->GetComponent(); if (self->GetBoolean(u"isBurning")) { if (status == "ENTER") { if (entering->GetCharacter()) { int32_t counter = self->GetI32(u"counter"); counter = counter + 1; self->SetI32(u"counter", counter); if (counter == 1) { skill->CalculateBehavior(m_skillCastId, 115, entering->GetObjectID()); self->AddTimer("TimeBetweenCast", FIRE_COOLDOWN); //self->SetVar("target", entering->GetObjectID()); auto missionComponet = entering->GetComponent(); if (missionComponet != nullptr) { missionComponet->ForceProgress(440, 658, 1); } } } } else { int32_t counter = self->GetI32(u"counter"); if (counter > 0) { counter = counter - 1; self->SetI32(u"counter", counter); if (counter == 0) { self->CancelAllTimers(); } } } } } void GfCampfire::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) { if (message == "waterspray" && self->GetVar(u"isBurning")) { auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("Burn"); renderComponent->PlayEffect(295, u"idle", "Off"); self->SetVar(u"isBurning", false); self->AddTimer("FireRestart", 37); } } } void GfCampfire::OnTimerDone(Entity* self, std::string timerName) { if (timerName == "TimeBetweenCast") { /* self->AddTimer("TimeBetweenCast", FIRE_COOLDOWN); const auto targetId = self->GetVar("target"); auto* entering = EntityManager::Instance()->GetEntity(targetId); if (entering == nullptr) { } */ } else if (timerName == "FireRestart" && !self->GetVar(u"isBurning")) { auto renderComponent = self->GetComponent(); if (renderComponent != nullptr) { renderComponent->StopEffect("Off"); renderComponent->PlayEffect(295, u"running", "Burn"); self->SetVar(u"isBurning", true); } } }