Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More correct handling of tags in the game Rust #716

Draft
wants to merge 9 commits into
base: v3
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Code style...
  • Loading branch information
rostov114 authored Oct 17, 2023
commit d94b53f7304e193834dd1b69fbf2683b13d53161
12 changes: 7 additions & 5 deletions src/GameQ/Protocols/Rust.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Rust extends Source
* @type string
*/
protected $name_long = "Rust";

/**
* Processing of server tags and more correct indication of the current number of players and the maximum number of players
*
Expand Down Expand Up @@ -158,10 +158,12 @@ protected function processDetails(Buffer $buffer)
}
}

foreach (['cp' => 'num_players', 'mp' => 'max_players'] as $keyword => $key) {
if (isset($results['server.keywords'][$keyword])) {
$results[$key] = intval($results['server.keywords'][$keyword]);
}
if (isset($results['server.keywords']['cp'])) {
$results['num_players'] = intval($results['server.keywords']['cp']);
}

if (isset($results['server.keywords']['mp'])) {
$results['max_players'] = intval($results['server.keywords']['mp']);
}
}
}
Expand Down
Loading