Potato Patch Utils
A util library for mods created by the Potato Patch
模組介紹 作者原文
Potato-Patch-Utils
A util library for mods created by the Potato Patch with the explicit intent of being used for events run by the group
What functionality does this mod add?
Automatic File Loading
PotatoPatchUtils.load_files(path, blacklist)
Will automatically load all.lua files within the passed in path (will typically be SMODS.current_mod.path)
- path (string) [REQUIRED] - The file path the file loader will start at. Will automatically open folders and load files within them as well
- blacklist (table) - A table of strings of file names that should be ignored on file loading (file extension, i.e..lua must be included)
Developer and Team objects
These objects are used for credits and calculating contexts outside of a traditional game object
PotatoPatchUtils.Team(args)
args is a table of the following values:
- name (string) [REQUIRED] - The name of the Team
- colour (colour/gradient) - The Team name's text fill colour
- loc (string/boolean) - Assigns the Team's display name to a localization key of your choosing from descriptions.PotatoPatch. Will be assigned to 'PotatoPatchTeam_'.. args.name if a boolean is passed
- calculate (function(self, context)) - A traditional calculate function, much like global mod calculate from Steamodded
- credit_rows (table) - How many developer objects to display on each row (credit screen has 2 rows, a table of 1 number will center the row in the page)
- short_credit (boolean) - Setting this to true will change the team credit template text from 'Created by team ' to 'Created by '
PotatoPatchUtils.Team {
name = 'Example Team',
colour = HEX(ffffff),
loc = true, -- Can also be loc = 'k_exampleteam_name' where the string is an arbitrary localization dictionary entry
}
PotatoPatchUtils.Developer(args)
args is a table of the following values:
- name (string) [REQUIRED] - The name of the Developer
- colour (colour/gradient) - The Developer name's text fill colour
- loc (string/boolean) - Assigns the Developer's display name to a localization key of your choosing from descriptions.PotatoPatch. Will be assigned to 'PotatoPatchDev_'.. args.name if a boolean is passed
- calculate (function(self, context)) - A traditional calculate function, much like global mod calculate from Steamodded
- team (string) - The name of the Team the Developer is a part of
- atlas (string) - The key of the atlas your credit art will be pulled from
- pos (table) - A coordinate table for the position of your credit art
- soul_pos (table) - A coordinate table for the position of your credit art's soul sprite
PotatoPatchUtils.Developer {
name = 'doofus',
colour = HEX(000000),
loc = true, -- Can also be loc = 'k_doofus_name' where the string is an arbitrary localization dictionary entry
team = 'Example Team' -- Must match an already existing Team name
atlas = 'modprefix_atlas',
pos = {x = 0, y = 0}
}
Credits
Adding these values to a game object will automatically add Credits to whoever is specified in the object's description box. The format should look something like this: ppu_artist = {'Artist1', 'Artist2'}
If the name of a Developer or Team object are used, the text will use the specified colour of the associated object. For example, if Developer 'Eremel' exists with a colour property and a Joker contains ppu_coder = {'Eremel'}, the text will be coloured in with Eremel's defined colour property
- ppu_artist (table) - The artist(s) of the Game Object
- ppu_coder (table) - The coders(s) of the Game Object
- ppu_team (table) - The team the Game Object was created for
If you wish to add a credit page for each Team present in your mod, add SMODS.current_mod.extra_tabs = PotatoPatchUtils.CREDITS.register_page(SMODS.current_mod) to your mod.
Localization Loading
This feature allows for multiple localization.lua files to be used in one project. This allows for much easier handling of localization files in collaborative efforts
PotatoPatchUtils.LOC.process_loc_text(locPath)
- locPath (string) [REQUIRED] - A string
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。 這類模組需要先安裝社群載入器(包內 readme 通常會提供下載入口)。
下面這些內容需要先安裝,否則該模組不會生效: