obstacle checkpoint callback improved

This commit is contained in:
Steffen Schröder 2013-12-16 08:38:11 +01:00
parent 96e6717493
commit 5504b098ba

View File

@ -144,17 +144,16 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
* @param array $callback * @param array $callback
*/ */
public function callback_OnCheckpoint(array $callback) { public function callback_OnCheckpoint(array $callback) {
// TODO: check back with trackmania callback format
return;
$data = json_decode($callback[1]); $data = json_decode($callback[1]);
$player = $this->maniaControl->playerManager->getPlayer($data->Player->Login); $player = $this->maniaControl->playerManager->getPlayer($data->Player->Login);
if (!$player) { if (!$player) {
return; return;
} }
$time = $data->Run->Time; $time = $data->Run->Time;
// Trigger Trackmania player finish callback // Trigger Trackmania player checkpoint callback
$finishCallback = array($player->pid, $player->login, $time); // TODO: Checkpoint index (5th element)
$finishCallback = array(CallbackManager::CB_TM_PLAYERCHECKPOINT, $finishCallback); $checkpointCallback = array($player->pid, $player->login, $time, 0, 0);
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERCHECKPOINT, $finishCallback); $checkpointCallback = array(CallbackManager::CB_TM_PLAYERCHECKPOINT, $checkpointCallback);
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERCHECKPOINT, $checkpointCallback);
} }
} }