fix(scripts): Gnarled Forest tiki torches lock while in use, cooldown from the animation

The port turned the in-use flag off on a second use instead of refusing it, so a torch could be used again at
once; it now stays in use until the interact animation is done, as L_GF_TORCH does, and the cooldown is that
animation's length (4 seconds when it has none) instead of a flat 4. Check: use a tiki torch twice quickly: the
second use does nothing until the torch is done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 09:18:04 -05:00
parent 8bf01a6c43
commit 826dd9ee59

View File

@@ -16,12 +16,11 @@ void GfTikiTorch::OnStartup(Entity* self) {
} }
void GfTikiTorch::OnUse(Entity* self, Entity* killer) { void GfTikiTorch::OnUse(Entity* self, Entity* killer) {
if (self->GetBoolean(u"isInUse")) { // In use until the interact animation is done, as in L_GF_TORCH (bIsInUse)
self->SetBoolean(u"isInUse", false); if (self->GetBoolean(u"isInUse")) return;
return; self->SetBoolean(u"isInUse", true);
}
RenderComponent::PlayAnimation(self, u"interact"); const auto cooldownTime = RenderComponent::PlayAnimation(self, u"interact");
self->SetI64(u"userID", killer->GetObjectID()); self->SetI64(u"userID", killer->GetObjectID());
for (int i = 0; i < m_numspawn; i++) { for (int i = 0; i < m_numspawn; i++) {
@@ -35,7 +34,8 @@ void GfTikiTorch::OnUse(Entity* self, Entity* killer) {
Loot::DropItem(*killer, lootMsg); Loot::DropItem(*killer, lootMsg);
} }
self->AddTimer("InteractionCooldown", 4); // The interact animation's length, as the live script times it (4 seconds when there is none)
self->AddTimer("InteractionCooldown", cooldownTime > 0.0f ? cooldownTime : 4.0f);
} }
void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) { void GfTikiTorch::OnTimerDone(Entity* self, std::string timerName) {