mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-17 01:19:31 +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 PBot::Imports;
|
||||||
|
|
||||||
use Time::Duration;
|
use Time::Duration;
|
||||||
|
use Time::HiRes qw/time/;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
# some colors for IRC messages
|
# some colors for IRC messages
|
||||||
@ -422,6 +423,7 @@ sub cmd_battleship($self, $context) {
|
|||||||
$msg = "/msg $channel $nick aims somewhere else.";
|
$msg = "/msg $channel $nick aims somewhere else.";
|
||||||
}
|
}
|
||||||
$player->{location} = $arguments;
|
$player->{location} = $arguments;
|
||||||
|
$player->{time} = time;
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1448,7 +1450,7 @@ sub state_move($self, $state) {
|
|||||||
sub state_attack($self, $state) {
|
sub state_attack($self, $state) {
|
||||||
my $trans = 'next';
|
my $trans = 'next';
|
||||||
|
|
||||||
foreach my $player (@{$state->{players}}) {
|
foreach my $player (sort { $a->{time} <=> $b->{time} } $state->{players}->@*) {
|
||||||
# skip removed players
|
# skip removed players
|
||||||
next if $player->{removed};
|
next if $player->{removed};
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ use PBot::Imports;
|
|||||||
# These are set by the /misc/update_version script
|
# These are set by the /misc/update_version script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 4798,
|
BUILD_REVISION => 4799,
|
||||||
BUILD_DATE => "2024-10-04",
|
BUILD_DATE => "2024-10-05",
|
||||||
};
|
};
|
||||||
|
|
||||||
sub initialize {}
|
sub initialize {}
|
||||||
|
Loading…
Reference in New Issue
Block a user