diff --git a/lib/PBot/Plugin/Battleship.pm b/lib/PBot/Plugin/Battleship.pm index 32bb19ef..91dd69dd 100644 --- a/lib/PBot/Plugin/Battleship.pm +++ b/lib/PBot/Plugin/Battleship.pm @@ -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}; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 5305c3fc..bdba3874 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -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 {}