info.nut 0100777 0000000 0000000 00000007475 12474603724 007525 0 ustar 00 /*
* This file is part of BusyBee, which is a GameScript for OpenTTD
* Copyright (C) 2014-2015 alberth / andythenorth
*
* BusyBee is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License
*
* BusyBee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BusyBee; If not, see or
* write to the Free Software Foundation, Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA.
*/
SAVEGAME_VERSION <- 2; // Set manually if/when save games break.
MINCOMPATIBLE_SAVEGAME_VERSION <- 2; // cset: bf1430b223d5df73a0c6ba9c996594a77d497cf1
PROGRAM_VERSION <- 5538;
PROGRAM_DATE <- "2015-03-01";
PROGRAM_NAME <- "BusyBee RC2M";
class BusyBeeInfo extends GSInfo {
function GetAuthor() { return "alberth & andythenorth"; }
function GetName() { return "Busy Bee"; } // Old: return PROGRAM_NAME;
function GetDescription() { return "Make connection, transport cargo"; }
function GetVersion() { return PROGRAM_VERSION + SAVEGAME_VERSION * 100000; }
function GetDate() { return PROGRAM_DATE; }
function CreateInstance() { return "BusyBeeClass"; }
function GetShortName() { return "BBEE"; }
function GetAPIVersion() { return "1.5"; }
function GetUrl() { return "http://dev.openttdcoop.org/projects/busy-bee-gs"; }
function MinVersionToLoad() { return MINCOMPATIBLE_SAVEGAME_VERSION; }
function GetSettings();
}
function BusyBeeInfo::GetSettings()
{
GSInfo.AddSetting({name="num_goals",
description="Number of goals for a company",
min_value=1,
max_value=10,
easy_value=5,
medium_value=5,
hard_value=5,
custom_value=5,
flags=GSInfo.CONFIG_NONE});
GSInfo.AddSetting({name="wait_years",
description="Number of years to wait to fulfill a new goal",
min_value=4,
max_value=20,
easy_value=10,
medium_value=5,
hard_value=3,
custom_value=7,
flags=GSInfo.CONFIG_INGAME});
GSInfo.AddSetting({name="pass_weight",
description="Likelihood of selecting passengers as goal",
min_value=1,
max_value=20,
easy_value=1,
medium_value=1,
hard_value=1,
custom_value=1,
flags=GSInfo.CONFIG_INGAME});
GSInfo.AddSetting({name="mail_weight",
description="Likelihood of selecting mail as goal",
min_value=1,
max_value=20,
easy_value=1,
medium_value=1,
hard_value=1,
custom_value=1,
flags=GSInfo.CONFIG_INGAME});
GSInfo.AddSetting({name="town_weight",
description="Likelihood of selecting other town cargoes as goal",
min_value=1,
max_value=20,
easy_value=1,
medium_value=1,
hard_value=1,
custom_value=1,
flags=GSInfo.CONFIG_INGAME});
}
RegisterGS(BusyBeeInfo());
lang/ 0040777 0000000 0000000 00000000000 12716104553 006741 5 ustar 00 lang/afrikaans.txt 0100777 0000000 0000000 00000001252 12474603724 011446 0 ustar 00 ##plural 0
STR_COMPANY_GOAL :Lewer {GOLD}{CARGO_LONG} {ORANGE}aan {STRING}
STR_COMPANY_GOAL_NEWS :Nuwe doel! Lewer {CARGO_LONG} by {STRING} af
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}gedoen
STR_COMPANY_GOAL_WON_NEWS :Doel bereik! {CARGO_LONG} afgelewer by {STRING}
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}jaar{P "" ""} oorblywend
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}maand{P "" e} oorblywend
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}da{P g e} oorblywend
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/catalan.txt 0100777 0000000 0000000 00000001144 12474603724 011112 0 ustar 00 ##plural 0
STR_COMPANY_GOAL :Envia {GOLD}{CARGO_LONG} {ORANGE}a {STRING}
STR_COMPANY_GOAL_NEWS :Nou objectiu! Envia {CARGO_LONG} a {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}fet
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}any{P "" s} restant{P "" s}
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}mes{P "" os} restant{P "" s}
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}di{P a es} restant{P "" s}
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/croatian.txt 0100777 0000000 0000000 00000001262 12474603724 011310 0 ustar 00 ##plural 6
STR_COMPANY_GOAL :Dostavite {GOLD}{CARGO_LONG} {ORANGE}do {STRING}
STR_COMPANY_GOAL_NEWS :Novi cilj! Dostavite {CARGO_LONG} do {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}završeno
STR_COMPANY_GOAL_WON_NEWS :Cilj postignut! {CARGO_LONG} dostavljeno do {STRING}
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}godin{P a e e} ostaje
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}mjesec{P "" a i} ostaje
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}dan{P "" a a} ostaje
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/english.txt 0100777 0000000 0000000 00000001242 12474603724 011137 0 ustar 00 ##plural 0
STR_COMPANY_GOAL :Deliver {GOLD}{CARGO_LONG} {ORANGE}to {STRING}
STR_COMPANY_GOAL_NEWS :New goal! Deliver {CARGO_LONG} to {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}done
STR_COMPANY_GOAL_WON_NEWS :Goal won! {CARGO_LONG} delivered to {STRING}
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}year{P "" s} remaining
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}month{P "" s} remaining
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}day{P "" s} remaining
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/french.txt 0100777 0000000 0000000 00000001303 12474603724 010751 0 ustar 00 ##plural 2
STR_COMPANY_GOAL :Livrer {GOLD}{CARGO_LONG} {ORANGE}à {STRING}
STR_COMPANY_GOAL_NEWS :Nouvelle mission{NBSP}! Livrer {CARGO_LONG} à {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}effectué
STR_COMPANY_GOAL_WON_NEWS :But atteint{NBSP}! {CARGO_LONG} ont atteint {STRING}
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}an{P "" s} restant{P "" s}
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}mois restant{P "" s}
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}jour{P "" s} restant{P "" s}
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/german.txt 0100777 0000000 0000000 00000001310 12474603724 010753 0 ustar 00 ##plural 0
STR_COMPANY_GOAL :Liefere {GOLD}{CARGO_LONG} {ORANGE}nach {STRING}
STR_COMPANY_GOAL_NEWS :Neues Ziel! Liefere {CARGO_LONG} nach {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}erreicht
STR_COMPANY_GOAL_WON_NEWS :Ziel erreicht! {CARGO_LONG} nach {STRING} geliefert
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}Jahr{P "" e} verbleib{P t en}
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}Monat{P "" e} verbleib{P t en}
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}Tag{P "" e} verbleib{P t en}
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/indonesian.txt 0100777 0000000 0000000 00000001226 12474603724 011637 0 ustar 00 ##plural 1
STR_COMPANY_GOAL :Antarkan {GOLD}{CARGO_LONG} {ORANGE}ke {STRING}
STR_COMPANY_GOAL_NEWS :Target baru! Antarkan {CARGO_LONG} ke {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}selesai
STR_COMPANY_GOAL_WON_NEWS :Target tercapai! {CARGO_LONG} diantarkan ke {STRING}
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}tahun tersisa
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}bulan tersisa
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}hari tersisa
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/italian.txt 0100777 0000000 0000000 00000001330 12474603724 011125 0 ustar 00 ##plural 0
STR_COMPANY_GOAL :Consegnare {GOLD}{CARGO_LONG} {ORANGE}a {STRING}
STR_COMPANY_GOAL_NEWS :Nuovo obiettivo! Consegnare {CARGO_LONG} a {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}completato
STR_COMPANY_GOAL_WON_NEWS :Obiettivo raggiunto! Consegna di {CARGO_LONG} effettuata a {STRING}
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}ann{P o i} rimanent{P e i}
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}mes{P e i} rimanent{P e i}
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}giorn{P o i} rimanent{P e i}
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/korean.txt 0100777 0000000 0000000 00000001270 12474603724 010766 0 ustar 00 ##plural 11
STR_COMPANY_GOAL : {GOLD}{CARGO_LONG}을 {ORANGE} {STRING}까지 배달하세요
STR_COMPANY_GOAL_NEWS :새로운 목표! {CARGO_LONG}을 {STRING}로 수송하세요
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}완료됨
STR_COMPANY_GOAL_WON_NEWS :목표 달성! {CARGO_LONG} 만큼 {STRING}으로 배달됨
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}년 남음
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}달 남음
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}일 남음
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/latin.txt 0100777 0000000 0000000 00000001252 12474603724 010616 0 ustar 00 ##plural 0
STR_COMPANY_GOAL :Trade {GOLD}{CARGO_LONG} {ORANGE}ad {STRING}
STR_COMPANY_GOAL_NEWS :Meta nova! Trade {CARGO_LONG} ad {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}tradita
STR_COMPANY_GOAL_WON_NEWS :Vicisti! {CARGO_LONG} tradita est ad {STRING}
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}ann{P us i} reliqu{P us i}
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}mens{P is es} reliqu{P us i}
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}dies reliqu{P us i}
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/spanish.txt 0100777 0000000 0000000 00000001274 12474603724 011160 0 ustar 00 ##plural 0
STR_COMPANY_GOAL :Entrega {GOLD}{CARGO_LONG} {ORANGE}a {STRING}
STR_COMPANY_GOAL_NEWS :¡Nueva meta! Entrega {CARGO_LONG} a {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}hecho
STR_COMPANY_GOAL_WON_NEWS :¡Meta conseguida! {CARGO_LONG} entregado a {STRING}
STR_TIMEOUT_YEARS :{ORANGE}Quedan {GOLD}{NUM} {ORANGE}año{P "" s}
STR_TIMEOUT_MONTHS :{ORANGE}Quedan {GOLD}{NUM} {ORANGE}mes{P "" es}
STR_TIMEOUT_DAYS :{ORANGE}Quedan {GOLD}{NUM} {ORANGE}día{P "" s}
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
lang/swedish.txt 0100777 0000000 0000000 00000001261 12474603724 011155 0 ustar 00 ##plural 0
STR_COMPANY_GOAL :Leverera {GOLD}{CARGO_LONG} {ORANGE}till {STRING}
STR_COMPANY_GOAL_NEWS :Nytt mål! Leverera {CARGO_LONG} till {STRING}
STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}klart
STR_COMPANY_GOAL_WON_NEWS :Mål slutfört! {CARGO_LONG} levererades till {STRING}
STR_TIMEOUT_YEARS :{GOLD}{NUM} {ORANGE}år återstår
STR_TIMEOUT_MONTHS :{GOLD}{NUM} {ORANGE}månad{P "" er} återstår
STR_TIMEOUT_DAYS :{GOLD}{NUM} {ORANGE}dag{P "" ar} återstår
STR_TOWN_NAME :{WHITE}{TOWN}
STR_TOWN_NAME_NEWS :{TOWN}
STR_INDUSTRY_NAME :{YELLOW}{INDUSTRY}
STR_INDUSTRY_NAME_NEWS :{INDUSTRY}
license.txt 0100777 0000000 0000000 00000043103 12715445366 010215 0 ustar 00 GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
main.nut 0100777 0000000 0000000 00000055460 12474603724 007513 0 ustar 00 /*
* This file is part of BusyBee, which is a GameScript for OpenTTD
* Copyright (C) 2014-2015 alberth / andythenorth
*
* BusyBee is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License
*
* BusyBee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BusyBee; If not, see or
* write to the Free Software Foundation, Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA.
*/
require("company.nut");
// Cargo description.
class Cargo
{
index = null; ///< Index of the cargo in the cargo table (#BusyBeeClass.cargoes).
cid = null; ///< Id of the cargo in GRF.
freight = null; ///< Whether the cargo is considered to be freight.
effect = null; ///< Town effect (One of #GSCargo.TownEffect).
weight = null; ///< Likelihood of picking this cargo for making a goal.
constructor(index, cid, freight, effect)
{
this.index = index;
this.cid = cid;
this.freight = freight;
this.effect = effect;
this.weight = this.GetWeight(effect);
}
function GetWeight();
}
// Get the weight of the cargo (probability of selecting it).
// @param effect Town effect of the cargo.
function Cargo::GetWeight(effect)
{
if (effect == GSCargo.TE_PASSENGERS) return GSController.GetSetting("pass_weight");
if (effect == GSCargo.TE_MAIL) return GSController.GetSetting("mail_weight");
if (effect != GSCargo.TE_NONE) return GSController.GetSetting("town_weight");
return 1;
}
// ************************************************************************
// ************************************************************************
class BusyBeeClass extends GSController
{
cargoes = null; ///< Cargoes of the game (index -> 'cid' number, 'freight' boolean, 'effect' on town).
num_cargoes = 0; ///< Number of cargoes in 'this.cargoes'.
sum_weight = 0; ///< Total sum of the weights of the cargoes.
companies = null;
loaded = false;
function Load(version, data);
function Save();
function Start();
}
function BusyBeeClass::Load(version, data)
{
this.loaded = true;
this.Initialize();
foreach (comp_id, loaded_comp_data in data) {
local cdata = CompanyData.LoadCompany(comp_id, loaded_comp_data, this.cargoes);
this.companies[comp_id] = cdata;
}
}
function BusyBeeClass::Save()
{
local result = {};
foreach (comp_id, cdata in this.companies) {
if (cdata == null) continue;
result[comp_id] <- cdata.SaveCompany();
}
return result;
}
// Initialize core data of the script.
function BusyBeeClass::Initialize()
{
if (this.companies != null) return; // Already initialized.
// Examine and store cargo types of the game.
this.cargoes = {};
this.num_cargoes = 0;
this.sum_weight = 0;
for (local cid = 0; cid < 32; cid += 1) {
if (!GSCargo.IsValidCargo(cid)) continue;
local cargo = Cargo(this.num_cargoes, cid, GSCargo.IsFreight(cid), GSCargo.GetTownEffect(cid));
this.cargoes[this.num_cargoes] <- cargo;
this.num_cargoes += 1;
this.sum_weight += cargo.weight;
}
// Construct empty companies.
this.companies = {};
for (local comp_id = GSCompany.COMPANY_FIRST; comp_id <= GSCompany.COMPANY_LAST; comp_id++) {
this.companies[comp_id] <- null;
}
}
// Find cargo sources.
// @param cargo_index Cargo index (index in this.cargoes).
// @return List of resources that produce the requested cargo, list of
// 'ind' or 'town' number, 'prod' produced amount, 'transp' transported amount, and 'loc' location.
function BusyBeeClass::FindSources(cargo_index)
{
local cargo = this.cargoes[cargo_index];
local num_sources = 0;
local sources = {};
if (cargo.freight) {
// For 'freight' cargoes, check the producing industries for sufficient available production.
foreach (ind, _ in GSIndustryList_CargoProducing(cargo.cid)) {
local prod_amount = GSIndustry.GetLastMonthProduction(ind, cargo.cid);
if (prod_amount < 10) continue;
local transp_amount = GSIndustry.GetLastMonthTransported(ind, cargo.cid);
if (prod_amount - transp_amount < 10) continue;
local loc = GSIndustry.GetLocation(ind);
sources[num_sources] <- {ind=ind, prod=prod_amount, transp=transp_amount, loc=loc};
num_sources += 1;
}
}
if (cargo.effect != GSCargo.TE_NONE) {
// For 'town effect' cargoes, check the towns for sufficient available production.
foreach (town, _ in GSTownList()) {
local prod_amount = GSTown.GetLastMonthProduction(town, cargo.cid);
if (prod_amount < 10) continue;
local transp_amount = GSTown.GetLastMonthSupplied(town, cargo.cid);
if (prod_amount - transp_amount < 10) continue;
local loc = GSTown.GetLocation(town);
sources[num_sources] <- {town=town, prod=prod_amount, transp=transp_amount, loc=loc};
num_sources += 1;
}
}
// Dump sources for a cargo.
// GSLog.Info("Sources for " + GSCargo.GetCargoLabel(cargo.cid));
// foreach (_, src in sources) {
// if ("ind" in src) {
// GSLog.Info("Industry " + GSIndustry.GetName(src.ind) + " produces " + src.prod);
// } else {
// GSLog.Info("Town " + GSTown.GetName(src.town) + " produces " + src.prod);
// }
// }
// GSLog.Info("");
return sources;
}
// Find destinations for the cargo.
// @param cargo_index Cargo index (index in this.cargoes).
// @param company Company to inspect.
// @return A list of destinations, tables 'ind' or 'town' id, and a 'loc' location.
function BusyBeeClass::FindDestinations(cargo_index, company)
{
local cargo = this.cargoes[cargo_index];
local num_dests = 0;
local dests = {};
if (cargo.freight) {
// Assume all industries are willing to accept the cargo.
foreach (ind, _ in GSIndustryList_CargoAccepting(cargo.cid)) {
local loc = GSIndustry.GetLocation(ind);
dests[num_dests] <- {ind=ind, loc=loc};
num_dests += 1;
}
}
if (cargo.effect != GSCargo.TE_NONE) {
// Find towns with sufficient rating.
local acceptable_ratings = [
GSTown.TOWN_RATING_MEDIOCRE, GSTown.TOWN_RATING_GOOD,
GSTown.TOWN_RATING_VERY_GOOD, GSTown.TOWN_RATING_EXCELLENT,
GSTown.TOWN_RATING_OUTSTANDING, GSTown.TOWN_RATING_INVALID
];
foreach (town, _ in GSTownList()) {
local rating = GSTown.GetRating(town, company);
if (rating in acceptable_ratings) {
local loc = GSTown.GetLocation(town);
local amount = GSTile.GetCargoAcceptance(loc, cargo.cid, 1, 1, 4);
if (amount > 8) {
dests[num_dests] <- {town=town, loc=loc};
num_dests += 1;
}
}
}
}
// Dump destinations for a cargo.
// GSLog.Info("Destinations for " + GSCargo.GetCargoLabel(cargo.cid));
// foreach (_, dst in dests) {
// if ("ind" in dst) {
// GSLog.Info("Industry " + GSIndustry.GetName(dst.ind) + " accepts");
// } else {
// GSLog.Info("Town " + GSTown.GetName(dst.town) + " accepts");
// }
// }
// GSLog.Info("");
return dests;
}
// Construct a score for the distance
// @param desired Desired distance.
// @param actual Actual distance.
// @return Score for the distance.
function BusyBeeClass::GetDistanceScore(desired, actual)
{
if (actual < desired) return 1000 - 3 * (desired - actual); // Too close gets punished hard.
return 1000 - (actual - desired);
}
// Try to find a challenge for a given cargo and a desired distance.
// @param cargo_index Index in BusyBeeClass.cargoes.
// @param distance Desired distance between source and target.
// @param comp_id Company to find a challenge for.
// @return Best accepting industry to use, or 'null' if no industry-pair found.
function BusyBeeClass::FindChallenge(cargo_index, distance, comp_id)
{
local prods = this.FindSources(cargo_index);
if (prods.len() == 0) return null;
local accepts = this.FindDestinations(cargo_index, comp_id);
if (accepts.len() == 0) return null;
local cdata = this.companies[comp_id];
local cargo = this.cargoes[cargo_index];
local best_score = 0; // Best overall distance.
local best_accept = null; // Best accepting to target.
foreach (_, accept in accepts) {
if (cdata != null && cdata.HasGoal(cargo.cid, accept)) continue; // Prevent duplicates.
local min_prod_distance = distance * 2; // Smallest found distance to the accepting industry.
local prod_score = best_score;
foreach (_, prod in prods) {
local actual_dist = GSTile.GetDistanceManhattanToTile(accept.loc, prod.loc);
if (actual_dist > distance * 2) continue; // Too far away, skip.
if (actual_dist < min_prod_distance) {
min_prod_distance = actual_dist;
prod_score = this.GetDistanceScore(distance, min_prod_distance);
if (min_prod_distance < distance && prod_score < best_score) break;
}
}
if (prod_score > best_score) { // The accepting industry is better than what we have.
prod_score = best_score;
best_accept = accept;
}
}
return best_accept;
}
// Select the next cargo to use for a goal.
// @return The index of the cargo to use in this.cargoes.
function BusyBeeClass::SelectCargo()
{
local remaining = GSBase.RandRange(this.sum_weight);
local cargo_index = 0;
foreach (cargo in this.cargoes) {
if (remaining < cargo.weight) return cargo_index;
remaining -= cargo.weight;
cargo_index += 1;
}
return -1; // Should never be reached.
}
// Try to add a goal for a company.
// @param comp_id Company to find a challenge for.
function BusyBeeClass::CreateChallenge(comp_id)
{
local cdata = this.companies[comp_id];
for (local attempt = 0;attempt < 20; attempt += 1) {
local cargo_index = this.SelectCargo();
if (cargo_index < 0) continue;
local cargo = this.cargoes[cargo_index];
if (cdata.GetNumberOfGoalsForCargo(cargo.cid) > 1) continue; // Already 2 goals for this cargo.
local distance = GSBase.RandRange(200) + 50; // Distance 50 .. 250 tiles.
local accept = FindChallenge(cargo_index, distance, comp_id);
if (accept != null) {
local amount = GSBase.RandRange(100) + 1;
if (amount < 10) {
amount = amount * 25; // 25 .. 225
} else if (amount < 10 + 35) {
amount = 10 * 25 + (amount - 10) * 50; // 250..1950
} else {
amount = 10 * 25 + 35 * 50 + (amount - 10 - 35) * 100; // 2000..7500
}
if (cdata != null) {
cdata.AddActiveGoal(cargo, accept, amount);
local dest_name;
if ("town" in accept) {
dest_name = GSTown.GetName(accept.town);
} else {
dest_name = GSIndustry.GetName(accept.ind);
}
GSLog.Info("Company " + comp_id + ": " + amount + " of " +
GSCargo.GetCargoLabel(cargo.cid) + " to " + dest_name);
break;
}
}
}
}
// Process events that arrived.
// @return Table with 'force_goal' bool to force goal updating.
function BusyBeeClass::ProcessEvents()
{
local force_goal = false;
while (GSEventController.IsEventWaiting()) {
local event = GSEventController.GetNextEvent();
local event_type = event.GetEventType();
if (event_type == GSEvent.ET_COMPANY_NEW) {
local comp_id = GSEventCompanyNew.Convert(event).GetCompanyID();
if (this.companies[comp_id] == null) {
this.companies[comp_id] = CompanyData(comp_id);
GSLog.Info("Created company " + comp_id + " (newly started).");
force_goal = true;
}
} else if (event_type == GSEvent.ET_COMPANY_MERGER) {
local comp_id = GSEventCompanyMerger.Convert(event).GetOldCompanyID();
if (this.companies[comp_id] != null) {
this.companies[comp_id].FinalizeCompany();
this.companies[comp_id] = null;
GSLog.Info("Deleted company " + comp_id + " (due to merging).");
}
} else if (event_type == GSEvent.ET_COMPANY_BANKRUPT) {
local comp_id = GSEventCompanyBankrupt.Convert(event).GetCompanyID();
if (this.companies[comp_id] != null) {
this.companies[comp_id].FinalizeCompany();
this.companies[comp_id] = null;
GSLog.Info("Deleted company " + comp_id + " (no monies anymore).");
}
} else if (event_type == GSEvent.ET_INDUSTRY_CLOSE) {
local ind_id = GSEventIndustryClose.Convert(event).GetIndustryID();
foreach (comp_id, cdata in this.companies) {
if (cdata != null) cdata.IndustryClosed(ind_id);
}
}
}
return {force_goal=force_goal};
}
// Check if new goals should be created.
// @return Table with 'more_goals_needed' boolean, and 'force_monitor' to force updating.
function BusyBeeClass::TryAddNewGoal()
{
local force_monitor=false;
local total_missing = 0; // Total number of missing goals.
local best_comp_id = null;
local comp_id_missing = 0;
foreach (comp_id, cdata in this.companies) {
if (cdata == null) continue;
local missing = cdata.GetMissingGoalCount();
total_missing += missing;
// Find company with most missing goals.
if (missing > comp_id_missing) {
best_comp_id = comp_id;
comp_id_missing = missing;
}
}
if (best_comp_id != null) {
this.CreateChallenge(best_comp_id);
force_monitor = true; // Force updating of the monitor to get the monitoring switched on.
}
return {force_monitor=force_monitor, more_goals_needed=(best_comp_id != null && total_missing > 1)};
}
// Update progress on existing monitored goals, add monitoring for new goals, and drop monitors for removed goals.
// @param old_cmon Monitored deliveries (or 'null' if first call).
// @return Table 'cmon' with the new monitored deliveries, 'finished_goals' boolean when there exist goals that are completed.
function BusyBeeClass::UpdateDeliveries(old_cmon)
{
if (old_cmon == null) { // First run, clear any old monitoring.
GSCargoMonitor.StopAllMonitoring();
old_cmon = {};
}
local cmon = {};
// Collect monitors that are of interest.
foreach (comp_id, cdata in this.companies) {
if (cdata == null) continue;
cdata.AddMonitorElements(cmon);
}
this.FillMonitors(cmon); // Query the monitors for new deliveries.
// Distribute the retrieved data.
local finished = false;
foreach (comp_id, cdata in this.companies) {
if (cdata == null) continue;
if (cdata.UpdateDelivereds(cmon)) finished = true;
}
// Drop obsolete monitors.
this.UpdateCompanyMonitors(old_cmon, cmon);
return {cmon=cmon, finished_goals=finished};
}
// The script data got loaded from file, check it against the game.
function BusyBeeClass::CompaniesPostLoadCheck()
{
// Check companies.
for (local comp_id = GSCompany.COMPANY_FIRST; comp_id <= GSCompany.COMPANY_LAST; comp_id++) {
if (GSCompany.ResolveCompanyID(comp_id) == GSCompany.COMPANY_INVALID) {
if (this.companies[comp_id] != null) {
this.companies[comp_id].FinalizeCompany();
this.companies[comp_id] = null;
GSLog.Info("Deleted company " + comp_id + " (disappeared after loading).");
}
} else {
if (this.companies[comp_id] == null) {
this.companies[comp_id] = CompanyData(comp_id);
GSLog.Info("Created company " + comp_id + " (appeared from nowhere after loading).");
}
}
}
// Check industries used for goals.
foreach (comp_id, cdata in this.companies) {
if (cdata == null) continue;
cdata.GoalsPostLoadCheck();
}
}
function BusyBeeClass::Start()
{
this.Initialize();
this.Sleep(1); // Wait for the game to start.
local cmonitor = null;
if (this.loaded) { // Script data was loaded.
this.CompaniesPostLoadCheck();
cmonitor = {}; // Don't kill existing monitors after loading.
}
// Main event loop.
local new_goal_timeout = 0;
local finished_timeout = 0;
local monitor_timeout = 0;
while (true) {
local result = this.ProcessEvents();
if (result.force_goal) new_goal_timeout = 0;
// Check for having to create new goals.
if (new_goal_timeout <= 0) {
local result = this.TryAddNewGoal();
if (result.force_monitor) monitor_timeout = 0;
if (result.more_goals_needed) {
new_goal_timeout = 1 * 74;
} else {
new_goal_timeout = 30 * 74;
}
}
// Monitoring and updating of company goals. Note that code above may force an update.
if (monitor_timeout <= 0) {
local result = this.UpdateDeliveries(cmonitor);
cmonitor = result.cmon;
if (result.finished_goals) finished_timeout = 0;
monitor_timeout = 15 * 74; // By default, check monitors every 15 days (other processes may force a check earlier).
}
// Check for finished goals, and remove them if they exist.
if (finished_timeout <= 0) {
foreach (comp_id, cdata in this.companies) {
if (cdata == null) continue;
cdata.CheckAndFinishGoals();
}
finished_timeout = 30 * 74; // By default, check for finished goals every 30 days (may be forced by other processes).
}
// local lake_news = GSText(GSText.STR_LAKE_NEWS);
// GSNews.Create(GSNews.NT_GENERAL, lake_news, GSCompany.COMPANY_INVALID);
// GSGoal.Question(1, GSCompany.COMPANY_INVALID, lake_news, GSGoal.QT_INFORMATION, GSGoal.BUTTON_GO);
// Sleep until the next event.
local delay_time = 5 * 74; // Check events every 5 days.
if (delay_time > new_goal_timeout) delay_time = new_goal_timeout;
if (delay_time > monitor_timeout) delay_time = monitor_timeout;
if (delay_time > finished_timeout) delay_time = finished_timeout;
if (delay_time > 0) this.Sleep(delay_time);
new_goal_timeout -= delay_time;
monitor_timeout -= delay_time;
finished_timeout -= delay_time;
// Update timeout of the goals as well.
if (!GSGame.IsPaused()) {
foreach (comp_id, cdata in this.companies) {
if (cdata == null) continue;
cdata.UpdateTimeout(delay_time);
}
}
}
}
// Fill company monitors with monitored amounts.
// @param [inout] cmon Table of 'comp_id' number to 'cargo_id' number to
// 'ind' and/or 'town' to resource indices to 'null'.
function BusyBeeClass::FillMonitors(cmon)
{
foreach (comp_id, mon in cmon) {
foreach (cargo_id, rmon in mon) {
if ("ind" in rmon) {
foreach (ind_id, _ in rmon.ind) {
local amount = GSCargoMonitor.GetIndustryDeliveryAmount(comp_id, cargo_id, ind_id, true);
rmon.ind[ind_id] = amount;
// Dump received amount of cargo of an industry.
// local text = "Industry " + GSIndustry.GetName(ind_id) + " received " + amount +
// " units for company " + comp_id +
// ", cargo " + GSCargo.GetCargoLabel(cargo_id);
// GSLog.Info(text);
}
}
if ("town" in rmon) {
foreach (town_id, _ in rmon.town) {
local amount = GSCargoMonitor.GetTownDeliveryAmount(comp_id, cargo_id, town_id, true);
rmon.town[town_id] = amount;
// Dump received amount of cargo of a town.
// local text = "Town " + GSTown.GetName(town_id) + " received " + amount +
// " units for company " + comp_id +
// ", cargo " + GSCargo.GetCargoLabel(cargo_id);
// GSLog.Info(text);
}
}
}
}
}
function BusyBeeClass::UpdateCompanyMonitors(old_cmon, cmon)
{
foreach (comp_id, old_mon in old_cmon) {
if (comp_id in cmon) {
this.UpdateCargoMonitors(comp_id, old_mon, cmon[comp_id]);
} else {
this.UpdateCargoMonitors(comp_id, old_mon, {});
}
}
}
function BusyBeeClass::UpdateCargoMonitors(comp_id, old_mon, mon)
{
foreach (cargo_id, old_rmon in old_mon) {
if (cargo_id in mon) {
this.UpdateResourceMonitors(comp_id, cargo_id, old_rmon, mon[cargo_id]);
} else {
this.UpdateResourceMonitors(comp_id, cargo_id, old_rmon, {});
}
}
}
function BusyBeeClass::UpdateResourceMonitors(comp_id, cargo_id, old_rmon, rmon)
{
if ("town" in old_rmon) {
if ("town" in rmon) {
this.UpdateTownMonitors(comp_id, cargo_id, old_rmon.town, rmon.town);
} else {
this.UpdateTownMonitors(comp_id, cargo_id, old_rmon.town, {});
}
}
if ("ind" in old_rmon) {
if ("ind" in rmon) {
this.UpdateIndMonitors(comp_id, cargo_id, old_rmon.ind, rmon.ind);
} else {
this.UpdateIndMonitors(comp_id, cargo_id, old_rmon.ind, {});
}
}
}
function BusyBeeClass::UpdateTownMonitors(comp_id, cargo_id, old_tmon, tmon)
{
foreach (town_id, _ in old_tmon) {
if (!(town_id in tmon)) {
GSCargoMonitor.GetTownDeliveryAmount(comp_id, cargo_id, town_id, false);
local text = "Stop monitoring town " + GSTown.GetName(town_id) +
" for company " + comp_id + ", cargo " + GSCargo.GetCargoLabel(cargo_id);
GSLog.Info(text);
}
}
}
function BusyBeeClass::UpdateIndMonitors(comp_id, cargo_id, old_imon, imon)
{
foreach (ind_id, _ in old_imon) {
if (!(ind_id in imon)) {
GSCargoMonitor.GetIndustryDeliveryAmount(comp_id, cargo_id, ind_id, false);
local text = "Stop monitoring industry " + GSIndustry.GetName(ind_id) +
" for company " + comp_id + ", cargo " + GSCargo.GetCargoLabel(cargo_id);
GSLog.Info(text);
}
}
}
readme.txt 0100777 0000000 0000000 00000005074 12474603724 010031 0 ustar 00 ===============
Busy Bee readme
===============
Manual for the really Busy Bees
===============================
- Activate the game script,
- Start new game,
- Pick a goal from the goal window to do,
- Make a connection from a supplier to the given destination for the requested
cargo type,
- Transport the cargo,
- Pick next goal to connect.
Manual for the less Busy Bees
=============================
Busy Bee is a game script for OpenTTD 1.5 or newer.
The script gives a number of goals to achieve (number of goals can be set by a
parameter). It requests a given amount of cargo of a given type to deliver to a
given destination within a time frame. You have to build the transport
connection, and deliver the requested amount. When that is done, the goal is
considered to be fulfilled. It is removed from the list, and a new goal is
created (may take a while) for you to fulfill.
You don't get anything when you fulfill the goal. There is also no penalty for
failing to achieve a goal. The purpose of the timer is to get rid of obsolete
or unreachable goals. Since the timer is reset when new cargo is detected, you
can take as long as you like to complete the goal, as long as you deliver
something regularly.
Features
========
Busy Bee RC2
- Clickable news (with sufficiently new OpenTTD).
- Goal timer gets reset to its original length on delivery of cargo.
- Added options to set the weight of passengers, mail, or town-effect cargoes,
to give them a higher chance of being picked as goal.
Busy Bee RC1
- Initial release
Translations
============
We thank the following people for their contributed translations:
Afrikaans: telanus
Catalan: juanjo
Croatian: Voyager1
French: arikover
German: frosch
Indonesian: UseYourIllusion
Italian: Snail, Voyager1
Korean: kevin
Latin: Supercheese
Spanish: SilverSurferZzZ
Swedish: Zuu
License
=======
Busy Bee
Copyright (C) 2015 andythenorth and alberth
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License version 2 as published by the Free
Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the
Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.