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:
parent
646a7f8e7f
commit
a2b5162290
@ -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};
|
||||
|
||||
|
@ -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 {}
|
||||
|
Loading…
Reference in New Issue
Block a user