3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-22 18:52:40 +01:00

Plugin/Battleship: perform attacks in command-order instead of player-order

This commit is contained in:
Pragmatic Software 2024-10-05 14:19:05 -07:00
parent 646a7f8e7f
commit a2b5162290
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 5 additions and 3 deletions

View File

@ -30,6 +30,7 @@ use parent 'PBot::Plugin::Base';
use PBot::Imports;
use Time::Duration;
use Time::HiRes qw/time/;
use Data::Dumper;
# some colors for IRC messages
@ -422,6 +423,7 @@ sub cmd_battleship($self, $context) {
$msg = "/msg $channel $nick aims somewhere else.";
}
$player->{location} = $arguments;
$player->{time} = time;
return $msg;
}
@ -1448,7 +1450,7 @@ sub state_move($self, $state) {
sub state_attack($self, $state) {
my $trans = 'next';
foreach my $player (@{$state->{players}}) {
foreach my $player (sort { $a->{time} <=> $b->{time} } $state->{players}->@*) {
# skip removed players
next if $player->{removed};

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4798,
BUILD_DATE => "2024-10-04",
BUILD_REVISION => 4799,
BUILD_DATE => "2024-10-05",
};
sub initialize {}