mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
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:
@@ -16,12 +16,11 @@ void GfTikiTorch::OnStartup(Entity* self) {
|
||||
}
|
||||
|
||||
void GfTikiTorch::OnUse(Entity* self, Entity* killer) {
|
||||
if (self->GetBoolean(u"isInUse")) {
|
||||
self->SetBoolean(u"isInUse", false);
|
||||
return;
|
||||
}
|
||||
// In use until the interact animation is done, as in L_GF_TORCH (bIsInUse)
|
||||
if (self->GetBoolean(u"isInUse")) 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());
|
||||
|
||||
for (int i = 0; i < m_numspawn; i++) {
|
||||
@@ -35,7 +34,8 @@ void GfTikiTorch::OnUse(Entity* self, Entity* killer) {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user