Skip to content

Commit

Permalink
Optimized bomb timer and now doesn't consume any cycles if not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Jire committed Jun 22, 2017
1 parent 502d9f3 commit 5f200f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/kotlin/com/charlatano/scripts/BombTimer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ import com.charlatano.settings.ENABLE_BOMB_TIMER
@Volatile var canDefuse = false

fun bombTimer() {
if (!ENABLE_BOMB_TIMER) return

bombPlanted {
val hasKit = false
val bomb = entityByType(EntityType.CPlantedC4)?.entity
if (bomb == null) {
val entityByType = entityByType(EntityType.CPlantedC4)
if (entityByType == null) {
location = ""
return@bombPlanted
}

val bomb = entityByType.entity
canDefuse = bomb.timeLeft() >= if (hasKit) 5 else 10

if (location.isEmpty()) location = bomb.location()
Expand Down

0 comments on commit 5f200f8

Please sign in to comment.