Merge branch 'LDT_outline_methods' of https://github.com/J-Shep/CorsixTH into J-Shep-LDT_outline_methods

Conflicts:
	.travis.yml
	CorsixTH/Lua/movie_player.lua
This commit is contained in:
Edvin Linge
2015-01-13 20:27:21 +01:00
125 changed files with 462 additions and 0 deletions

View File

@@ -64,6 +64,8 @@ script:
- ${TRAVIS_BUILD_DIR}/scripts/check_trailing_whitespaces.py $TRAVIS_BUILD_DIR
# Check for incorrectly encoded language files.
- python ${TRAVIS_BUILD_DIR}/scripts/check_language_files_not_BOM.py $TRAVIS_BUILD_DIR/CorsixTH/Lua/languages
# Check if there are lua classes with invalid/improper declarations.
- python ${TRAVIS_BUILD_DIR}/scripts/check_lua_classes.py
# Build CorsixTH
- make
# Validate lua files

View File

@@ -33,6 +33,9 @@ local SAVEGAME_VERSION = 100
class "App"
---@type App
local App = _G["App"]
function App:App()
self.command_line = {}
self.config = {}

View File

@@ -29,6 +29,9 @@ local ipairs
--! Layer which handles the Lua-facing side of loading and playing audio.
class "Audio"
---@type Audio
local Audio = _G["Audio"]
function Audio:Audio(app)
self.app = app

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "CallsDispatcher"
---@type CallsDispatcher
local CallsDispatcher = _G["CallsDispatcher"]
local debug = false -- Turn on for debug message
function CallsDispatcher:CallsDispatcher(world, entities)

View File

@@ -23,6 +23,9 @@ SOFTWARE. --]]
-- class "Name"
-- OR
-- class "Name" (SuperclassName)
--
-- ---@type Name
-- local Name = _G["Name"]
--
-- function Name:Name(arguments)
-- self:SuperclassName(arguments) -- required when there is a superclass

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "Command"
---@type Command
local Command = _G["Command"]
function Command:Command(can_undo)
self.can_undo = can_undo
end

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "CommandStack"
---@type CommandStack
local CommandStack = _G["CommandStack"]
function CommandStack:CommandStack()
self.undo_stack = {}
self.redo_stack = {}

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "CompoundCommand" (Command)
---@type CompoundCommand
local CompoundCommand = _G["CompoundCommand"]
function CompoundCommand:CompoundCommand()
self:Command(true)
self.command_list = {}

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "SetMapCellCommand" (Command)
---@type SetMapCellCommand
local SetMapCellCommand = _G["SetMapCellCommand"]
function SetMapCellCommand:SetMapCellCommand(map)
self:Command(true)
self.map = map

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "SetMapCellFlagsCommand" (Command)
---@type SetMapCellFlagsCommand
local SetMapCellFlagsCommand = _G["SetMapCellFlagsCommand"]
function SetMapCellFlagsCommand:SetMapCellFlagsCommand(map)
self:Command(true)
self.map = map

View File

@@ -23,6 +23,9 @@ local TH = require "TH"
--! The (ideally) helpful advisor who pops up from the bottom dialog during a game.
class "UIAdviser" (Window)
---@type UIAdviser
local UIAdviser = _G["UIAdviser"]
function UIAdviser:UIAdviser(ui)
self:Window()

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! The multi-purpose panel for launching dialogs / screens and dynamic information.
class "UIBottomPanel" (Window)
---@type UIBottomPanel
local UIBottomPanel = _G["UIBottomPanel"]
function UIBottomPanel:UIBottomPanel(ui)
self:Window()

View File

@@ -22,6 +22,9 @@ local TH = require "TH"
class "UIBuildRoom" (Window)
---@type UIBuildRoom
local UIBuildRoom = _G["UIBuildRoom"]
function UIBuildRoom:UIBuildRoom(ui)
self:Window()

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Dialog for "Are you sure you want to quit?" and similar yes/no questions.
class "UIConfirmDialog" (Window)
---@type UIConfirmDialog
local UIConfirmDialog = _G["UIConfirmDialog"]
function UIConfirmDialog:UIConfirmDialog(ui, text, callback_ok, callback_cancel)
self:Window()

View File

@@ -26,6 +26,9 @@ dofile "dialogs/place_objects"
class "UIEditRoom" (UIPlaceObjects)
---@type UIEditRoom
local UIEditRoom = _G["UIEditRoom"]
function UIEditRoom:UIEditRoom(ui, room_type)
-- NB: UIEditRoom:onCursorWorldPositionChange is called by the UIPlaceObjects

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Base class for 640x480px dialogs (fullscreen in original game resolution).
class "UIFullscreen" (Window)
---@type UIFullscreen
local UIFullscreen = _G["UIFullscreen"]
function UIFullscreen:UIFullscreen(ui)
self:Window()

View File

@@ -23,6 +23,9 @@ local TH = require "TH"
--! Annual Report fullscreen window shown at the start of each year.
class "UIAnnualReport" (UIFullscreen)
---@type UIAnnualReport
local UIAnnualReport = _G["UIAnnualReport"]
function UIAnnualReport:UIAnnualReport(ui, world)
self:UIFullscreen(ui)

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Bank manager (for loans / insurance companies) and bank statement fullscreen windows.
class "UIBankManager" (UIFullscreen)
---@type UIBankManager
local UIBankManager = _G["UIBankManager"]
function UIBankManager:UIBankManager(ui)
self:UIFullscreen(ui)
local gfx = ui.app.gfx

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Drug Casebook fullscreen window (view disease statistics and set prices).
class "UICasebook" (UIFullscreen)
---@type UICasebook
local UICasebook = _G["UICasebook"]
function UICasebook:UICasebook(ui, disease_selection)
self:UIFullscreen(ui)
local gfx = ui.app.gfx

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "UIFax" (UIFullscreen)
---@type UIFax
local UIFax = _G["UIFax"]
function UIFax:UIFax(ui, icon)
self:UIFullscreen(ui)
local gfx = ui.app.gfx

View File

@@ -22,6 +22,9 @@ SOFTWARE. --]]
--! Charts fullscreen window
class "UIGraphs" (UIFullscreen)
---@type UIGraphs
local UIGraphs = _G["UIGraphs"]
local TH = require "TH"
-- These values are based on the background colours of the pen symbols

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Hospital policy fullscreen window (set staff tiredness and patient cure thresholds, etc.).
class "UIPolicy" (UIFullscreen)
---@type UIPolicy
local UIPolicy = _G["UIPolicy"]
function UIPolicy:UIPolicy(ui, disease_selection)
self:UIFullscreen(ui)
local gfx = ui.app.gfx

View File

@@ -23,6 +23,9 @@ local TH = require "TH"
--! Progress Report fullscreen window (check level goals, competitors and alerts).
class "UIProgressReport" (UIFullscreen)
---@type UIProgressReport
local UIProgressReport = _G["UIProgressReport"]
function UIProgressReport:UIProgressReport(ui)
-- TODO: Refactor this file!
self:UIFullscreen(ui)

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "UIResearch" (UIFullscreen)
---@type UIResearch
local UIResearch = _G["UIResearch"]
local research_categories = {
"cure",
"diagnosis",

View File

@@ -23,6 +23,9 @@ local math_floor = math.floor
--! Staff management screen
class "UIStaffManagement" (UIFullscreen)
---@type UIStaffManagement
local UIStaffManagement = _G["UIStaffManagement"]
function UIStaffManagement:UIStaffManagement(ui, disease_selection)
self:UIFullscreen(ui)
local gfx = ui.app.gfx

View File

@@ -23,6 +23,9 @@ local TH = require "TH"
--! Town map fullscreen window (purchase land, set radiator levels, map overview).
class "UITownMap" (UIFullscreen)
---@type UITownMap
local UITownMap = _G["UITownMap"]
function UITownMap:UITownMap(ui)
self:UIFullscreen(ui)

View File

@@ -25,6 +25,9 @@ local math_floor
--! Dialog for purchasing `Object`s (for the corridor or for rooms).
class "UIFurnishCorridor" (Window)
---@type UIFurnishCorridor
local UIFurnishCorridor = _G["UIFurnishCorridor"]
function UIFurnishCorridor:UIFurnishCorridor(ui, objects, edit_dialog)
self:Window()

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "UIHireStaff" (Window)
---@type UIHireStaff
local UIHireStaff = _G["UIHireStaff"]
function UIHireStaff:UIHireStaff(ui)
self:Window()
self.modal_class = "main"

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Dialog that informs the player of for example what the goals for the level are.
class "UIInformation" (Window)
---@type UIInformation
local UIInformation = _G["UIInformation"]
--! Constructor for the Information Dialog.
--!param text The text to show, held in a table. All elements of the table will be written
-- beneath each other. If instead a table within the table is supplied the texts

View File

@@ -23,6 +23,9 @@ local ipairs
class "UIJukebox" (Window)
---@type UIJukebox
local UIJukebox = _G["UIJukebox"]
function UIJukebox:UIJukebox(app)
self:Window()
self.modal_class = "jukebox"

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "UIMachine" (Window)
---@type UIMachine
local UIMachine = _G["UIMachine"]
function UIMachine:UIMachine(ui, machine, room)
self:Window()

View File

@@ -26,6 +26,9 @@ dofile "commands/compound"
class "UIMapEditor" (Window)
---@type UIMapEditor
local UIMapEditor = _G["UIMapEditor"]
local math_floor
= math.floor

View File

@@ -25,6 +25,9 @@ local TH = require "TH"
--! The ingame menu bar which sits (nominally hidden) at the top of the screen.
class "UIMenuBar" (Window)
---@type UIMenuBar
local UIMenuBar = _G["UIMenuBar"]
function UIMenuBar:UIMenuBar(ui)
self:Window()
@@ -455,6 +458,9 @@ end
class "UIMenu"
---@type UIMenu
local UIMenu = _G["UIMenu"]
function UIMenu:UIMenu()
self.items = {}
self.parent = false

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Small fax notification window which sits on the bottom bar.
class "UIMessage" (Window)
---@type UIMessage
local UIMessage = _G["UIMessage"]
function UIMessage:UIMessage(ui, x, stop_x, onClose, type, message, owner, timeout, default_choice, callback)
self:Window()

View File

@@ -30,6 +30,9 @@ end
--! Individual patient information dialog
class "UIPatient" (Window)
---@type UIPatient
local UIPatient = _G["UIPatient"]
function UIPatient:UIPatient(ui, patient)
self:Window()

View File

@@ -30,6 +30,9 @@ local ATTACH_BLUEPRINT_TO_TILE = false
--! The dialog shown when placing objects.
class "UIPlaceObjects" (Window)
---@type UIPlaceObjects
local UIPlaceObjects = _G["UIPlaceObjects"]
--[[ Constructor for the class.
!param ui (UI) The active ui.
!param object_list (table) a list of tables with objects to place. Keys are "object", "qty" and

View File

@@ -25,6 +25,9 @@ local TH = require "TH"
--! Invisible window which handles placing a `Staff` member in the world.
class "UIPlaceStaff" (Window)
---@type UIPlaceStaff
local UIPlaceStaff = _G["UIPlaceStaff"]
function UIPlaceStaff:UIPlaceStaff(ui, profile, x, y)
self.ui = ui
self.world = ui.app.world

View File

@@ -25,6 +25,9 @@ local math_floor
--! Room / door / reception desk queue visualisation dialog.
class "UIQueue" (Window)
---@type UIQueue
local UIQueue = _G["UIQueue"]
function UIQueue:UIQueue(ui, queue)
self:Window()
@@ -340,6 +343,9 @@ end
class "UIQueuePopup" (Window)
---@type UIQueuePopup
local UIQueuePopup = _G["UIQueuePopup"]
function UIQueuePopup:UIQueuePopup(ui, x, y, patient)
self:Window()
self.esc_closes = true

View File

@@ -23,6 +23,9 @@ SOFTWARE. --]]
--any of the corners.
class "UIResizable" (Window)
---@type UIResizable
local UIResizable = _G["UIResizable"]
local border_offset_x = 9
local border_offset_y = 9
local border_size_x = 40

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Calls Dispatcher Window
class "UICallsDispatcher" (UIResizable)
---@type UICallsDispatcher
local UICallsDispatcher = _G["UICallsDispatcher"]
local col_bg = {
red = 154,
green = 146,

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! A dialog for activating cheats
class "UICheats" (UIResizable)
---@type UICheats
local UICheats = _G["UICheats"]
local col_bg = {
red = 154,
green = 146,

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Customise window used in the main menu and ingame.
class "UICustomise" (UIResizable)
---@type UICustomise
local UICustomise = _G["UICustomise"]
local col_bg = {
red = 154,
green = 146,

View File

@@ -23,6 +23,9 @@ local lfs = require "lfs"
--! A tree node representing a directory in the physical file-system.
class "DirTreeNode" (FileTreeNode)
---@type DirTreeNode
local DirTreeNode = _G["DirTreeNode"]
local pathsep = package.config:sub(1, 1)
function DirTreeNode:DirTreeNode(path)
@@ -53,6 +56,9 @@ end
--! This tree only shows directories and highlights valid TH directories.
class "InstallDirTreeNode" (DirTreeNode)
---@type InstallDirTreeNode
local InstallDirTreeNode = _G["InstallDirTreeNode"]
function InstallDirTreeNode:InstallDirTreeNode(path)
self:FileTreeNode(path)
end
@@ -97,6 +103,9 @@ end
--! Prompter for Theme Hospital install directory
class "UIDirectoryBrowser" (UIResizable)
---@type UIDirectoryBrowser
local UIDirectoryBrowser = _G["UIDirectoryBrowser"]
--! Creates a new directory browser window
--!param ui The active UI to hook into.
--!param mode Whether the dialog has been opened from the main_menu or somewhere else. Currently

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Dropdown "window" used for selection of one item from a list.
class "UIDropdown" (UIResizable)
---@type UIDropdown
local UIDropdown = _G["UIDropdown"]
--! Constructor for the dropdown "window"
--!param ui (UI) The ui the window is created in
--!param parent_window (Window) The window that this dropdown will be attached to

View File

@@ -24,6 +24,9 @@ local lfs = require "lfs"
-- that meets a given file extension criterion.
class "FilteredFileTreeNode" (FileTreeNode)
---@type FilteredFileTreeNode
local FilteredFileTreeNode = _G["FilteredFileTreeNode"]
local pathsep = package.config:sub(1, 1)
function FilteredFileTreeNode:FilteredFileTreeNode(path, filter)
@@ -79,6 +82,9 @@ end
-- their last modification dates.
class "FilteredTreeControl" (TreeControl)
---@type FilteredTreeControl
local FilteredTreeControl = _G["FilteredTreeControl"]
function FilteredTreeControl:FilteredTreeControl(root, x, y, width, height, col_bg, col_fg, has_font, show_dates)
self:TreeControl(root, x, y, width, height, col_bg, col_fg, 14, has_font)
@@ -146,6 +152,9 @@ end
--! A file browser with a scrollbar. Used by load_game and save_game.
class "UIFileBrowser" (UIResizable)
---@type UIFileBrowser
local UIFileBrowser = _G["UIFileBrowser"]
local col_caption = {
red = 174,
green = 166,

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Window where the user can choose a font file.
class "UIChooseFont" (UIFileBrowser)
---@type UIChooseFont
local UIChooseFont = _G["UIChooseFont"]
local pathsep = package.config:sub(1, 1)
local col_textbox = {

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Load Game Window
class "UILoadGame" (UIFileBrowser)
---@type UILoadGame
local UILoadGame = _G["UILoadGame"]
function UILoadGame:UILoadGame(ui, mode)
local treenode = FilteredFileTreeNode(ui.app.savegame_dir, ".sav")
treenode.label = "Saves"

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Save Game Window
class "UISaveGame" (UIFileBrowser)
---@type UISaveGame
local UISaveGame = _G["UISaveGame"]
local pathsep = package.config:sub(1, 1)
local col_textbox = {

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Customise window used in the main menu and ingame.
class "UIFolder" (UIResizable)
---@type UIFolder
local UIFolder = _G["UIFolder"]
local col_bg = {
red = 154,
green = 146,

View File

@@ -24,6 +24,9 @@ _ = nil
--! Interactive Lua Console for ingame debugging.
class "UILuaConsole" (UIResizable)
---@type UILuaConsole
local UILuaConsole = _G["UILuaConsole"]
local col_bg = {
red = 46,
green = 186,

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Class for main menu window.
class "UIMainMenu" (UIResizable)
---@type UIMainMenu
local UIMainMenu = _G["UIMainMenu"]
local col_bg = {
red = 154,
green = 146,

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! A menu list with a scrollbar. Used by load_game, save_game and custom_game.
class "UIMenuList" (UIResizable)
---@type UIMenuList
local UIMenuList = _G["UIMenuList"]
local col_caption = {
red = 174,
green = 166,

View File

@@ -23,6 +23,9 @@ local pathsep = package.config:sub(1, 1)
--! Custom Game Window
class "UICustomGame" (UIMenuList)
---@type UICustomGame
local UICustomGame = _G["UICustomGame"]
function UICustomGame:UICustomGame(ui)
-- Supply the required list of items to UIMenuList

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "UIMakeDebugPatient" (UIMenuList)
---@type UIMakeDebugPatient
local UIMakeDebugPatient = _G["UIMakeDebugPatient"]
function UIMakeDebugPatient:UIMakeDebugPatient(ui)
local items = {}
for _, disease in ipairs(ui.app.diseases) do

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Class for the difficulty choice window.
class "UINewGame" (UIResizable)
---@type UINewGame
local UINewGame = _G["UINewGame"]
local col_bg = {
red = 154,
green = 146,

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Options window used in the main menu and ingame.
class "UIOptions" (UIResizable)
---@type UIOptions
local UIOptions = _G["UIOptions"]
local col_bg = {
red = 154,
green = 146,
@@ -280,6 +283,9 @@ end
--! A custom resolution selection window
class "UIResolution" (UIResizable)
---@type UIResolution
local UIResolution = _G["UIResolution"]
function UIResolution:UIResolution(ui, callback)
self:UIResizable(ui, 200, 140, col_bg)

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Tip of the Day Window
class "UITipOfTheDay" (UIResizable)
---@type UITipOfTheDay
local UITipOfTheDay = _G["UITipOfTheDay"]
local col_bg = {
red = math.random(20, 200),
green = math.random(20, 200),

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Options window used in the main menu and ingame.
class "UIUpdate" (UIResizable)
---@type UIUpdate
local UIUpdate = _G["UIUpdate"]
local col_bg = {
red = 154,
green = 146,

View File

@@ -31,6 +31,9 @@ end
--! Individual staff information dialog
class "UIStaff" (Window)
---@type UIStaff
local UIStaff = _G["UIStaff"]
function UIStaff:changeParcel()
local index = 0
for i, v in ipairs(self.staff.hospital.ownedPlots) do

View File

@@ -24,6 +24,9 @@ local math_floor
--! Dialog for staff member requesting a salaray raise.
class "UIStaffRise" (Window)
---@type UIStaffRise
local UIStaffRise = _G["UIStaffRise"]
function UIStaffRise:UIStaffRise(ui, staff, rise_amount)
self:Window()
local app = ui.app

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Iterface for items within a UI tree control
class "TreeNode"
---@type TreeNode
local TreeNode = _G["TreeNode"]
function TreeNode:TreeNode()
self.is_expanded = false
self.num_visible_descendants = 0
@@ -181,6 +184,9 @@ end
--! A tree node representing a file (or directory) in the physical file-system.
class "FileTreeNode" (TreeNode)
---@type FileTreeNode
local FileTreeNode = _G["FileTreeNode"]
local pathsep = package.config:sub(1, 1)
function FileTreeNode:FileTreeNode(path)
@@ -444,6 +450,9 @@ end
-- multiple root nodes.
class "DummyRootNode" (TreeNode)
---@type DummyRootNode
local DummyRootNode = _G["DummyRootNode"]
--!param roots (array) An array of `TreeNode`s which should be displayed as
-- root nodes.
function DummyRootNode:DummyRootNode(roots)
@@ -474,6 +483,9 @@ end
-- tree of items and select one item from it.
class "TreeControl" (Window)
---@type TreeControl
local TreeControl = _G["TreeControl"]
--!param root (TreeNode) The single root node of the tree (use a `DummyRootNode`
-- here if multiple root nodes are desired).
--!param x (integer) The X-position, in pixels, where the control should start

View File

@@ -22,6 +22,9 @@ SOFTWARE. --]]
--! The timer lasts approximately 100 days, split into 13 segments
class "UIWatch" (Window)
---@type UIWatch
local UIWatch = _G["UIWatch"]
--!param count_type (string) One of: "open_countdown" or "emergency" or "epidemic"
function UIWatch:UIWatch(ui, count_type)
self:Window()

View File

@@ -19,6 +19,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. --]]
class "GrimReaper" (Humanoid)
---@type GrimReaper
local GrimReaper = _G["GrimReaper"]
local TH = require "TH"
function GrimReaper:GrimReaper(...)

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! An `Entity` which occupies a single tile and is capable of moving around the map.
class "Humanoid" (Entity)
---@type Humanoid
local Humanoid = _G["Humanoid"]
local TH = require "TH"
local walk_animations = permanent"humanoid_walk_animations"({})

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--[[ An `Inspector` is called to the hospital after an epidemic to issue a report]]
class "Inspector" (Humanoid)
---@type Inspector
local Inspector = _G["Inspector"]
function Inspector:Inspector(...)
self:Humanoid(...)
self.hover_cursor = TheApp.gfx:loadMainCursor("default")

View File

@@ -23,6 +23,9 @@ local TH = require "TH"
--! An `Object` which needs occasional repair (to prevent explosion).
class "Machine" (Object)
---@type Machine
local Machine = _G["Machine"]
function Machine:Machine(world, object_type, x, y, direction, etc)
self.total_usage = -1 -- Incremented in the constructor of Object.

View File

@@ -23,6 +23,9 @@ local TH = require "TH"
--! An `Entity` which occupies at least a single map tile and does not move.
class "Object" (Entity)
---@type Object
local Object = _G["Object"]
local orient_mirror = {
north = "west",
west = "north",

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! A `Humanoid` who is in the hospital for diagnosis and/or treatment.
class "Patient" (Humanoid)
---@type Patient
local Patient = _G["Patient"]
function Patient:Patient(...)
self:Humanoid(...)
self.hover_cursor = TheApp.gfx:loadMainCursor("patient")

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! A Doctor, Nurse, Receptionist, Handyman, or Surgeon
class "Staff" (Humanoid)
---@type Staff
local Staff = _G["Staff"]
--!param ... Arguments to base class constructor.
function Staff:Staff(...)
self:Humanoid(...)

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! A `Vip` who is in the hospital to evaluate the hospital and produce a report
class "Vip" (Humanoid)
---@type Vip
local Vip = _G["Vip"]
function Vip:Vip(...)
self:Humanoid(...)
self.hover_cursor = TheApp.gfx:loadMainCursor("default")

View File

@@ -21,6 +21,9 @@ SOFTWARE. --]]
--! Abstraction for visible gameplay things which sit somewhere on the map.
class "Entity"
---@type Entity
local Entity = _G["Entity"]
local TH = require "TH"
function Entity:Entity(animation)

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "EntityMap"
---@type EntityMap
local EntityMap = _G["EntityMap"]
--[[ An entity map is a structure is a 2 dimensional structure created from a
game map, it has the same dimensions as the game map which intitalises it.
The purpose of the map is store the location of entities in the map in

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "Epidemic"
---@type Epidemic
local Epidemic = _G["Epidemic"]
--[[Manages the epidemics that occur in hospitals. Generally, any epidemic
logic that happens outside this class will call functions contained here.]]
function Epidemic:Epidemic(hospital, contagious_patient)

View File

@@ -26,6 +26,9 @@ local ISO_FS = require "ISO_FS"
--! Layer for abstracting away differences in file systems
class "FileSystem"
---@type FileSystem
local FileSystem = _G["FileSystem"]
function FileSystem:FileSystem()
end

View File

@@ -23,6 +23,9 @@ dofile "ui"
--! Variant of UI for running games
class "GameUI" (UI)
---@type GameUI
local GameUI = _G["GameUI"]
local TH = require "TH"
local WM = require "sdl".wm
local SDL = require "sdl"

View File

@@ -31,6 +31,9 @@ local assert, string_char, table_concat, unpack, type, pairs, ipairs
-- the other Lua code.
class "Graphics"
---@type Graphics
local Graphics = _G["Graphics"]
local cursors_name = {
default = 1,
clicked = 2,
@@ -500,6 +503,9 @@ end
--! Utility class for setting animation markers and querying animation length.
class "AnimationManager"
---@type AnimationManager
local AnimationManager = _G["AnimationManager"]
function AnimationManager:AnimationManager(anims)
self.anim_length_cache = {}
self.anims = anims

View File

@@ -20,6 +20,9 @@ SOFTWARE. --]]
class "Hospital"
---@type Hospital
local Hospital = _G["Hospital"]
function Hospital:Hospital(world, name)
self.world = world
local level_config = world.map.level_config
@@ -1744,6 +1747,9 @@ end
class "AIHospital" (Hospital)
---@type AIHospital
local AIHospital = _G["AIHospital"]
function AIHospital:AIHospital(competitor, ...)
self:Hospital(...)
if _S.competitor_names[competitor] then

View File

@@ -20,6 +20,10 @@ SOFTWARE. --]]
--! Lua extensions to the C++ THMap class
class "Map"
---@type Map
local Map = _G["Map"]
local pathsep = package.config:sub(1, 1)
local math_floor, tostring, table_concat
= math.floor, tostring, table.concat

View File

@@ -25,6 +25,9 @@ local pathsep = package.config:sub(1, 1)
class "MoviePlayer"
---@type MoviePlayer
local MoviePlayer = _G["MoviePlayer"]
function MoviePlayer:MoviePlayer(app, audio, video)
self.app = app
self.audio = audio

View File

@@ -58,6 +58,9 @@ object.orientations = {
class "AtomAnalyser" (Object)
---@type AtomAnalyser
local AtomAnalyser = _G["AtomAnalyser"]
function AtomAnalyser:AtomAnalyser(...)
self:Object(...)
end

View File

@@ -145,6 +145,9 @@ object.orientations = {
class "Bench" (Object)
---@type Bench
local Bench = _G["Bench"]
function Bench:Bench(...)
self:Object(...)
end

View File

@@ -41,6 +41,9 @@ object.orientations = {
class "SideObject" (Object)
---@type SideObject
local SideObject = _G["SideObject"]
function SideObject:SideObject(...)
self:Object(...)
end

View File

@@ -34,6 +34,9 @@ dofile "queue"
class "Door" (Object)
---@type Door
local Door = _G["Door"]
function Door:Door(...)
self:Object(...)
self.queue = Queue()

View File

@@ -33,6 +33,9 @@ object.supports_creation_for_map = true
class "EntranceDoor" (Object)
---@type EntranceDoor
local EntranceDoor = _G["EntranceDoor"]
function EntranceDoor:EntranceDoor(world, object_type, x, y, direction, etc)
self.is_master = object_type == object
self:Object(world, object_type, x, y, direction, etc)

View File

@@ -32,6 +32,9 @@ object.idle_animations = {
class "SwingDoor" (Door)
---@type SwingDoor
local SwingDoor = _G["SwingDoor"]
function SwingDoor:SwingDoor(world, object_type, x, y, direction, etc)
self.is_master = object_type == object
self:Door(world, object_type, x, y, direction, etc)

View File

@@ -37,6 +37,9 @@ object.orientations = {
--! An `Object` which drops of emergency patients.
class "Helicopter" (Object)
---@type Helicopter
local Helicopter = _G["Helicopter"]
function Helicopter:Helicopter(world, object_type, hospital, direction, etc)
local x, y = hospital:getHeliportPosition()
self:Object(world, object_type, x, y, direction, etc)

View File

@@ -50,6 +50,9 @@ litter_types[4] = 1900
class "Litter" (Entity)
---@type Litter
local Litter = _G["Litter"]
function Litter:Litter(world, object_type, x, y, direction, etc)
local th = TH.animation()
self:Entity(th)

View File

@@ -115,6 +115,10 @@ object.orientations = {
}
class "OperatingTable" (Machine)
---@type OperatingTable
local OperatingTable = _G["OperatingTable"]
OperatingTable:slaveMixinClass()
function OperatingTable:machineUsed(...)

View File

@@ -64,6 +64,10 @@ object.orientations = {
}
class "OperatingSink" (Object)
---@type OperatingSink
local OperatingSink = _G["OperatingSink"]
OperatingSink:slaveMixinClass()
return object

View File

@@ -84,6 +84,9 @@ local days_unreachable = 10
--! An `Object` which needs watering now and then.
class "Plant" (Object)
---@type Plant
local Plant = _G["Plant"]
function Plant:Plant(world, object_type, x, y, direction, etc)
-- It doesn't matter which direction the plant is facing. It will be rotated so that an approaching
-- handyman uses the correct usage animation when appropriate.

View File

@@ -71,6 +71,10 @@ object.orientations = {
}
class "RadiationShield" (Object)
---@type RadiationShield
local RadiationShield = _G["RadiationShield"]
RadiationShield:slaveMixinClass()
return object

View File

@@ -70,6 +70,9 @@ dofile "queue"
class "ReceptionDesk" (Object)
---@type ReceptionDesk
local ReceptionDesk = _G["ReceptionDesk"]
function ReceptionDesk:ReceptionDesk(...)
self:Object(...)
self.queue = Queue()

View File

@@ -39,6 +39,10 @@ object.orientations = {
}
class "SurgeonScreen" (Object)
---@type SurgeonScreen
local SurgeonScreen = _G["SurgeonScreen"]
function SurgeonScreen:SurgeonScreen(...)
self:Object(...)
self.num_green_outfits = 2

View File

@@ -30,6 +30,9 @@ SOFTWARE. --]]
-- a queue via its methods rather than directly.
class "Queue"
---@type Queue
local Queue = _G["Queue"]
function Queue:Queue()
self.reported_size = 0
self.expected = {}

View File

@@ -31,6 +31,9 @@ stored for future use anyway.
--! Manages all things related to research for one hospital.
class "ResearchDepartment"
---@type ResearchDepartment
local ResearchDepartment = _G["ResearchDepartment"]
function ResearchDepartment:ResearchDepartment(hospital)
self.hospital = hospital
self.world = hospital.world

View File

@@ -22,6 +22,9 @@ local TH = require "TH"
class "Room"
---@type Room
local Room = _G["Room"]
function Room:Room(x, y, w, h, id, room_info, world, hospital, door, door2)
self.id = id
self.world = world

View File

@@ -43,6 +43,9 @@ room.handyman_call_sound = "maint015.wav"
class "BloodMachineRoom" (Room)
---@type BloodMachineRoom
local BloodMachineRoom = _G["BloodMachineRoom"]
function BloodMachineRoom:BloodMachineRoom(...)
self:Room(...)
end

View File

@@ -43,6 +43,9 @@ room.handyman_call_sound = "maint010.wav"
class "CardiogramRoom" (Room)
---@type CardiogramRoom
local CardiogramRoom = _G["CardiogramRoom"]
function CardiogramRoom:CardiogramRoom(...)
self:Room(...)
end

View File

@@ -43,6 +43,9 @@ room.handyman_call_sound = "maint012.wav"
class "DecontaminationRoom" (Room)
---@type DecontaminationRoom
local DecontaminationRoom = _G["DecontaminationRoom"]
function DecontaminationRoom:DecontaminationRoom(...)
self:Room(...)
end

View File

@@ -44,6 +44,9 @@ room.handyman_call_sound = "maint006.wav"
class "DNAFixerRoom" (Room)
---@type DNAFixerRoom
local DNAFixerRoom = _G["DNAFixerRoom"]
function DNAFixerRoom:DNAFixerRoom(...)
self:Room(...)
end

Some files were not shown because too many files have changed in this diff Show More