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/CorsixTH/Lua/room.lua b/CorsixTH/Lua/room.lua index b3eeb21..c56b8e7 100644 --- a/CorsixTH/Lua/room.lua +++ b/CorsixTH/Lua/room.lua @@ -66,6 +66,9 @@ function Room:initRoom(x, y, w, h, door, door2) self.humanoids_enroute = {--[[a set rather than a list]]} end +--! Get the tile next to the door. +--!param inside (bool) If set, get the tile inside the room, else get the tile outside. +--!return x,y (tile coordniates) of the tile next to the door. function Room:getEntranceXY(inside) local door = self.door local x, y = door.tile_x, door.tile_y @@ -79,6 +82,8 @@ function Room:getEntranceXY(inside) return x, y end +--! Construct an 'walk' action to the tile next to the door, just outside the room. +--!return Action to move to the tile just outside the room. function Room:createLeaveAction() local x, y = self:getEntranceXY(false) return { @@ -116,6 +121,8 @@ function Room:createEnterAction(humanoid_entering, callback) is_entering = humanoid_entering and self or true} end +--! Get a patient in the room. +--!return A patient (humanoid) if there is a patient, nil otherwise. function Room:getPatient() for humanoid in pairs(self.humanoids) do if class.is(humanoid, Patient) then @@ -124,6 +131,8 @@ function Room:getPatient() end end +--! Count the number of patients in the room. +--!return Number of patients in the room. function Room:getPatientCount() local count = 0 for humanoid in pairs(self.humanoids) do @@ -257,13 +266,18 @@ function Room:testStaffCriteria(criteria, extra_humanoid) end end -local no_staff = {} +local no_staff = {} -- Constant denoting 'no staff at all' in a room. + +--! Get the type and number of maximum staff for the room. +--!return (table) Type and number of maximum staff. function Room:getMaximumStaffCriteria() -- Some rooms have dynamic criteria (i.e. dependent upon the number of items -- in the room), so this method is provided for such rooms to override it. return self.room_info.maximum_staff or self.room_info.required_staff or no_staff end +--! Get the type and number of required staff for the room. +--!return (table) Type and number of required staff. function Room:getRequiredStaffCriteria() return self.room_info.required_staff or no_staff end @@ -407,17 +421,23 @@ function Room:createDealtWithPatientCallback(humanoid) self.waiting_staff_member = humanoid end --- Returns the current staff member. Can be overriden in rooms with multiples staff members to return the desired one. +--! Get the current staff member. +-- Can be overridden in rooms with multiples staff members to return the desired one. +--!return (staff) The current staff member. function Room:getStaffMember() return self.staff_member end +--! Set the current staff member. +--!param staff (staff) Staff member to denote as current staff. function Room:setStaffMember(staff) self.staff_member = staff end +--! Does the given staff member fit in the room? -- Returns false if the room is already full of staff or if the given member of staff cannot help out. -- Otherwise returns true. +--!return (bool) True if the staff member can work in the room, else False. function Room:staffFitsInRoom(staff) local criteria = self:getMaximumStaffCriteria() if self:testStaffCriteria(criteria) or not self:testStaffCriteria(criteria, staff) then @@ -595,6 +615,9 @@ end local tile_factor = 10 -- how many tiles further are we willing to walk for 1 person fewer in the queue local readiness_bonus = 50 -- how many tiles further are we willing to walk if the room has all the required staff + +--! Score function to decide how desire-full a room is for a patient. +--!return (int) The score, lower is better. function Room:getUsageScore() local queue = self.door.queue local score = queue:patientSize() + self:getPatientCount() - self.maximum_patients @@ -716,6 +739,7 @@ function Room:tryToFindNearbyPatients() end end +--! Explode the room. function Room:crashRoom() self.door:closeDoor() if self.door2 then @@ -877,6 +901,7 @@ function Room:makeHumanoidDressIfNecessaryAndThenLeave(humanoid) end end +--! Deactivate the room from the world. function Room:deactivate() self.is_active = false -- So that no more patients go to it. self.world:notifyRoomRemoved(self)
Mark as private
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
forever