This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/main/library/isGameRunning.inc

32 lines
434 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class main_isGameRunning {
function main_isGameRunning($lib) {
$this->lib = $lib;
}
function run($game) {
$g = config::getGame($game);
if (!$g) {
return false;
}
$lib = $g->getLib();
if ($lib->call('isFinished')) {
return false;
}
$now = time();
foreach ($g->ticks as $td => $tick) {
if ($tick->first <= $now && $tick->definition->public) {
return true;
}
}
return false;
}
}
?>