3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Spinach: make tock duration customizable (todo: use Settings metadata instead)

This commit is contained in:
Pragmatic Software 2020-01-19 02:35:33 -08:00
parent d14ab77764
commit 0308806ac0

View File

@ -78,6 +78,7 @@ sub initialize {
$self->{choosecategory_max_count} = 4; $self->{choosecategory_max_count} = 4;
$self->{picktruth_max_count} = 4; $self->{picktruth_max_count} = 4;
$self->{tock_duration} = 30;
} }
sub unload { sub unload {
@ -1732,7 +1733,7 @@ sub choosecategory {
if ($state->{first_tock}) { if ($state->{first_tock}) {
$tock = 3; $tock = 3;
} else { } else {
$tock = 15; $tock = $self->{tock_duration};
} }
if ($state->{ticks} % $tock == 0) { if ($state->{ticks} % $tock == 0) {
@ -1766,8 +1767,8 @@ sub choosecategory {
$warning = ''; $warning = '';
} }
my $remaining = 15 * $state->{max_count}; my $remaining = $self->{tock_duration} * $state->{max_count};
$remaining -= 15 * ($state->{counter} - 1); $remaining -= $self->{tock_duration} * ($state->{counter} - 1);
$remaining = "(" . (concise duration $remaining) . " remaining)"; $remaining = "(" . (concise duration $remaining) . " remaining)";
$self->send_message($self->{channel}, "$name: $warning$remaining Choose a category via `/msg me c <number>`:$color{reset}"); $self->send_message($self->{channel}, "$name: $warning$remaining Choose a category via `/msg me c <number>`:$color{reset}");
@ -1882,7 +1883,7 @@ sub getlies {
if ($state->{first_tock}) { if ($state->{first_tock}) {
$tock = 3; $tock = 3;
} else { } else {
$tock = 15; $tock = $self->{tock_duration};
} }
my @nolies; my @nolies;
@ -1969,8 +1970,8 @@ sub getlies {
$warning = ''; $warning = '';
} }
my $remaining = 15 * $state->{max_count}; my $remaining = $self->{tock_duration} * $state->{max_count};
$remaining -= 15 * ($state->{counter} - 1); $remaining -= $self->{tock_duration} * ($state->{counter} - 1);
$remaining = "(" . (concise duration $remaining) . " remaining)"; $remaining = "(" . (concise duration $remaining) . " remaining)";
$self->send_message($self->{channel}, "$players: $warning$remaining Submit your lie now via `/msg me lie <your lie>`!"); $self->send_message($self->{channel}, "$players: $warning$remaining Submit your lie now via `/msg me lie <your lie>`!");
@ -1986,7 +1987,7 @@ sub findtruth {
if ($state->{first_tock}) { if ($state->{first_tock}) {
$tock = 3; $tock = 3;
} else { } else {
$tock = 15; $tock = $self->{tock_duration};
} }
my @notruth; my @notruth;
@ -2081,8 +2082,8 @@ sub findtruth {
$warning = ''; $warning = '';
} }
my $remaining = 15 * $state->{max_count}; my $remaining = $self->{tock_duration} * $state->{max_count};
$remaining -= 15 * ($state->{counter} - 1); $remaining -= $self->{tock_duration} * ($state->{counter} - 1);
$remaining = "(" . (concise duration $remaining) . " remaining)"; $remaining = "(" . (concise duration $remaining) . " remaining)";
$self->send_message($self->{channel}, "$players: $warning$remaining Find the truth now via `/msg me c <number>`!$color{reset}"); $self->send_message($self->{channel}, "$players: $warning$remaining Find the truth now via `/msg me c <number>`!$color{reset}");
@ -2426,7 +2427,7 @@ sub getplayers {
my $tock; my $tock;
if ($state->{first_tock}) { if ($state->{first_tock}) {
$tock = 15; $tock = $self->{tock_duration};
} else { } else {
$tock = 300; $tock = 300;
} }