From 2d50ef8970d9c51f4dfbcbce9bf879300e2ff715 Mon Sep 17 00:00:00 2001 From: Konst Date: Mon, 8 Jul 2024 18:34:11 +0300 Subject: [PATCH] Reverted time durations counting procedure --- cardinal/constants/constants.go | 1 - cardinal/system/effects_spawner.go | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cardinal/constants/constants.go b/cardinal/constants/constants.go index 262a2cb..e23be95 100644 --- a/cardinal/constants/constants.go +++ b/cardinal/constants/constants.go @@ -3,4 +3,3 @@ package constants import "time" const TickRate = time.Second -const MillisecondsInSecond = 1000 diff --git a/cardinal/system/effects_spawner.go b/cardinal/system/effects_spawner.go index 0e0da46..b609c2a 100644 --- a/cardinal/system/effects_spawner.go +++ b/cardinal/system/effects_spawner.go @@ -1,6 +1,8 @@ package system import ( + "time" + "pkg.world.dev/world-engine/cardinal" "pkg.world.dev/world-engine/cardinal/search/filter" "pkg.world.dev/world-engine/cardinal/types" @@ -39,7 +41,7 @@ func EffectsSpawnerSystem(world cardinal.WorldContext) error { previousEffectAmount := effectComponent.Amount endBuildingTime := effectComponent.BuildingTimeStartedAt + - uint64(effectComponent.BuildingTimeSeconds*constants.MillisecondsInSecond) + uint64(time.Duration(effectComponent.BuildingTimeSeconds)*time.Second/time.Millisecond) if world.Timestamp() < endBuildingTime { return true