Loading
#openttdcoop - Paste
Archives
Trending
Docs
Login
ABAP
ActionScript
ActionScript 3
Ada
AIMMS3
ALGOL 68
Apache configuration
AppleScript
Apt sources
ARM ASSEMBLER
ASM
ASP
asymptote
Autoconf
Autohotkey
AutoIt
AviSynth
awk
BASCOM AVR
Bash
Basic4GL
BibTeX
BlitzBasic
bnf
Boo
Brainfuck
C
C#
C (LoadRunner)
C (Mac)
C (WinAPI)
C++
C++ (Qt)
C++ (WinAPI)
CAD DCL
CAD Lisp
CFDG
ChaiScript
Chapel
CIL
Clojure
CMake
COBOL
CoffeeScript
ColdFusion
CSS
Cuesheet
D
Dart
DCL
DCPU-16 Assembly
DCS
Delphi
Diff
DIV
DOS
dot
E
ECMAScript
Eiffel
eMail (mbox)
EPC
Erlang
Euphoria
EZT
F#
Falcon
FO (abas-ERP)
Formula One
Fortran
FreeBasic
FreeSWITCH
GADV 4CS
GAMBAS
GDB
genero
Genie
glSlang
GML
GNU/Octave
GNU Gettext
GNU make
Gnuplot
Go
Groovy
GwBasic
Haskell
Haxe
HicEst
HQ9+
HTML
HTML5
Icon
INI
Inno
INTERCAL
Io
ISPF Panel
J
Java
Java(TM) 2 Platform Standard Edition 5.0
Javascript
JCL
jQuery
KiXtart
KLone C
KLone C++
LaTeX
LDIF
Liberty BASIC
Lisp
LLVM Intermediate Representation
Locomotive Basic
Logtalk
LOLcode
Lotus Notes @Formulas
LotusScript
LScript
LSL2
Lua
MagikSF
MapBasic
Matlab M
Microchip Assembler
Microsoft Registry
mIRC Scripting
MMIX
Modula-2
Modula-3
MOS 6502 (6510) ACME Cross Assembler format
MOS 6502 (6510) Kick Assembler format
MOS 6502 (6510) TASM/64TASS 1.46 Assembler format
Motorola 68000 - HiSoft Devpac ST 2 Assembler format
Motorola 68000 Assembler
MXML
MySQL
Nagios
NetRexx
newlisp
nginx
Nimrod
NML NewGRF Meta Language
NSIS
Oberon-2
Objeck Programming Language
Objective-C
OCaml
OCaml (brief)
ooRexx
OpenBSD Packet Filter
OpenOffice.org Basic
Oracle 8 SQL
Oracle 11 SQL
Oxygene
OZ
ParaSail
PARI/GP
Pascal
PCRE
per
Perl
Perl 6
PHP
PHP (brief)
PIC16
Pike
Pixel Bender 1.0
PL/I
PL/SQL
PostgreSQL
PostScript
POVRAY
PowerBuilder
PowerShell
ProFTPd configuration
Progress
Prolog
PROPERTIES
ProvideX
Puppet
PureBasic
Python
Python for S60
q/kdb+
QBasic/QuickBASIC
QML
R / S+
Racket
Rails
RBScript
REBOL
rexx
robots.txt
RPM Specification File
Ruby
Rust
SAS
Scala
Scheme
SciLab
SCL
sdlBasic
Smalltalk
Smarty
SPARK
SPARQL
SQL
Squirrel Script
Squirrel Script with OpenTTD AI/GS
StandardML
StoneScript
SystemVerilog
T-SQL
TCL
Tera Term Macro
Text
thinBasic
TypoScript
Unicon (Unified Extended Dialect of Icon)
Uno Idl
Unreal Script
UPC
Urbi
Vala
vb.net
VBScript
Vedit macro language
Verilog
VHDL
Vim Script
Visual Basic
Visual Fox Pro
Visual Prolog
Whitespace
Whois (RPSL format)
Winbatch
X++
XBasic
XML
Xorg configuration
YAML
ZiLOG Z80 Assembler
ZXBasic
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d8fe4fa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.project diff --git a/company.nut b/company.nut index 58e8d45..63634a9 100644 --- a/company.nut +++ b/company.nut @@ -25,7 +25,11 @@ class CompanyGoal { delivered_amount = 0; // Amount delivered so far. goal_id = null; // Number of the goal in OpenTTD goal window. timeout = null; // Timeout in ticks before the goal becomes obsolete. - + reward = 0; // reward for reached goal (makes this come closer to subsidies) + subsidyfactor = GSController.GetSetting("subsidy_factor") * 20; + rewardfactor_town = GSController.GetSetting("rewardfactor_town"); + rewardfactor_ind = GSController.GetSetting("rewardfactor_ind"); + displayed_string = null; displayed_count = null; @@ -38,6 +42,7 @@ class CompanyGoal { this.cargo = cargo; this.accept = accept; this.wanted_amount = wanted_amount; + this.reward = this.wanted_amount * subsidyfactor; // estimated factor, better would be a random value this.ResetTimeout(); // Construct goal if a company id was provided. @@ -48,17 +53,23 @@ class CompanyGoal { destination_string = GSText(GSText.STR_TOWN_NAME, destination); destination_string_news = GSText(GSText.STR_TOWN_NAME_NEWS, destination); goal_type = GSGoal.GT_TOWN; + this.reward = this.reward * rewardfactor_town; } else { destination = accept.ind; destination_string = GSText(GSText.STR_INDUSTRY_NAME, destination); destination_string_news = GSText(GSText.STR_INDUSTRY_NAME_NEWS, destination); goal_type = GSGoal.GT_INDUSTRY; + this.reward = this.reward * rewardfactor_ind; + } + local goal_text, goal_news_text; + if (this.reward > 0) { + goal_text = GSText(GSText.STR_COMPANY_GOAL_REWARD, cargo.cid, this.wanted_amount, destination_string, this.reward); + goal_news_text = GSText(GSText.STR_COMPANY_GOAL_REWARD_NEWS, cargo.cid, this.wanted_amount, destination_string_news, this.reward); + } else { + goal_text = GSText(GSText.STR_COMPANY_GOAL, cargo.cid, this.wanted_amount, destination_string); + goal_news_text = GSText(GSText.STR_COMPANY_GOAL_NEWS, cargo.cid, this.wanted_amount, destination_string_news); } - local goal_text = GSText(GSText.STR_COMPANY_GOAL, cargo.cid, - this.wanted_amount, destination_string); this.goal_id = GSGoal.New(comp_id, goal_text, goal_type, destination); - local goal_news_text = GSText(GSText.STR_COMPANY_GOAL_NEWS, cargo.cid, - this.wanted_amount, destination_string_news); this.PublishNews(goal_news_text, comp_id); } } @@ -90,7 +101,7 @@ function CompanyGoal::ResetTimeout() function CompanyGoal::SaveGoal() { return {cid=this.cargo.cid, accept=this.accept, wanted=this.wanted_amount, - delivered=this.delivered_amount, goal=this.goal_id, timeout=this.timeout}; + delivered=this.delivered_amount, goal=this.goal_id, timeout=this.timeout, reward=this.reward}; } // Load an existing goal. @@ -106,6 +117,7 @@ function CompanyGoal::LoadGoal(loaded_data, cargoes) goal.delivered_amount = loaded_data.delivered; goal.goal_id = loaded_data.goal; goal.timeout = loaded_data.timeout; + goal.reward = loaded_data.reward; return goal; } } @@ -151,8 +163,12 @@ function CompanyGoal::UpdateDelivered(mon, comp_id) } else { destination_string_news = GSText(GSText.STR_INDUSTRY_NAME_NEWS, this.accept.ind); } - local goal_won_news = GSText(GSText.STR_COMPANY_GOAL_WON_NEWS, cargo.cid, - this.wanted_amount, destination_string_news); + local goal_won_news; + if (this.reward > 0) { + goal_won_news = GSText(GSText.STR_COMPANY_GOAL_REWARD_WON_NEWS, cargo.cid, this.wanted_amount, destination_string_news, this.reward); + } else { + goal_won_news = GSText(GSText.STR_COMPANY_GOAL_WON_NEWS, cargo.cid, this.wanted_amount, destination_string_news); + } this.PublishNews(goal_won_news, comp_id); } else { perc = 100 * this.delivered_amount / this.wanted_amount; @@ -512,7 +528,8 @@ function CompanyData::CheckAndFinishGoals() if (goal == null) continue; if (goal.CheckFinished()) { goal.FinalizeGoal(); - this.active_goals[num] = null; + GSCompany.ChangeBankBalance(this.comp_id, goal.reward, 0); + this.active_goals[num] = null; } } } diff --git a/info.nut b/info.nut index ffd048e..10d6640 100644 --- a/info.nut +++ b/info.nut @@ -21,13 +21,13 @@ 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"; +PROGRAM_DATE <- "2015-06-12"; +PROGRAM_NAME <- "BusyBee RC2M with reward"; 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 GetAuthor() { return "alberth & andythenorth, reward by jottyfan"; } + function GetName() { return "Busy Bee Reward"; } // Old: return PROGRAM_NAME; + function GetDescription() { return "Make connection, transport cargo, recieve reward"; } function GetVersion() { return PROGRAM_VERSION + SAVEGAME_VERSION * 100000; } function GetDate() { return PROGRAM_DATE; } function CreateInstance() { return "BusyBeeClass"; } @@ -85,6 +85,36 @@ function BusyBeeInfo::GetSettings() hard_value=1, custom_value=1, flags=GSInfo.CONFIG_INGAME}); + GSInfo.AddSetting({name="subsidy_factor", + description="Factor to be multiplied with cargo amount as reward", + min_value=0, + max_value=4, + easy_value=3, + medium_value=2, + hard_value=1, + custom_value=0, + step_size=0.5, + flags=GSInfo.CONFIG_INGAME}); + GSInfo.AddSetting({name="rewardfactor_town", + description="Extra factor to be multiplied with reward for towns", + min_value=0, + max_value=2, + easy_value=2, + medium_value=1, + hard_value=0, + custom_value=0, + step_size=0.1, + flags=GSInfo.CONFIG_INGAME}); + GSInfo.AddSetting({name="rewardfactor_ind", + description="Extra factor to be multiplied with reward for industries", + min_value=0, + max_value=2, + easy_value=2, + medium_value=1, + hard_value=0, + custom_value=0, + step_size=0.1, + flags=GSInfo.CONFIG_INGAME}); } RegisterGS(BusyBeeInfo()); diff --git a/lang/english.txt b/lang/english.txt index c9e3eeb..ca6602d 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -1,8 +1,11 @@ ##plural 0 -STR_COMPANY_GOAL :Deliver {GOLD}{CARGO_LONG} {ORANGE}to {STRING} +STR_COMPANY_GOAL_REWARD :Deliver {GOLD}{CARGO_LONG} {ORANGE}to {STRING}{ORANGE} for {WHITE}{STRING}{CURRENCY_LONG} +STR_COMPANY_GOAL :Deliver {GOLD}{CARGO_LONG} {ORANGE}to {STRING}{ORANGE} +STR_COMPANY_GOAL_REWARD_NEWS:New goal! Deliver {CARGO_LONG} to {STRING} for {STRING}{CURRENCY_LONG} STR_COMPANY_GOAL_NEWS :New goal! Deliver {CARGO_LONG} to {STRING} STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}done +STR_COMPANY_GOAL_REWARD_WON_NEWS:Goal won! {CARGO_LONG} delivered to {STRING} and earned {STRING}{CURRENCY_LONG} 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 diff --git a/lang/german.txt b/lang/german.txt index 546806d..cd9d61a 100644 --- a/lang/german.txt +++ b/lang/german.txt @@ -1,8 +1,11 @@ ##plural 0 -STR_COMPANY_GOAL :Liefere {GOLD}{CARGO_LONG} {ORANGE}nach {STRING} +STR_COMPANY_GOAL_REWARD :Lieferung von {GOLD}{CARGO_LONG} {ORANGE}nach {STRING}{ORANGE} bringt {WHITE}{STRING}{CURRENCY_LONG} {ORANGE}ein +STR_COMPANY_GOAL :Lieferung von {GOLD}{CARGO_LONG} {ORANGE}nach {STRING}{GOLD} +STR_COMPANY_GOAL_REWARD_NEWS:Neues Ziel! Liefere {CARGO_LONG} nach {STRING} für {STRING}{CURRENCY_LONG} STR_COMPANY_GOAL_NEWS :Neues Ziel! Liefere {CARGO_LONG} nach {STRING} STR_PROGRESS :{YELLOW}{NUM}% {ORANGE}erreicht +STR_COMPANY_GOAL_REWARD_WON_NEWS:Ziel erreicht! {CARGO_LONG} nach {STRING} geliefert und {STRING}{CURRENCY_LONG} kassiert 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}
Mark as private
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
forever