-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added functionality for changing fillType in GUI
- Loading branch information
scfmod
committed
Jan 3, 2022
1 parent
b2e57e6
commit 1bb908e
Showing
5 changed files
with
104 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
---@class TerraFarmFillTypes | ||
TerraFarmFillTypes = {} | ||
|
||
TerraFarmFillTypes.SUPPORTED_TYPES_LIST = { | ||
'STONE', | ||
'DIRT', | ||
'ASPHALT', | ||
'COAL', | ||
'TAILINGS', | ||
'CONCRETE', | ||
'LIMESTONE', | ||
'GRAVEL', | ||
'SAND', | ||
'IRON', | ||
'PAYDIRT', | ||
'CEMENT', | ||
'RIVERSAND', | ||
'RIVERSANDP', | ||
'STONEPOWDER', | ||
'CLAY', | ||
} | ||
|
||
-- For GUI | ||
---@type table<number, string> | ||
TerraFarmFillTypes.TYPES_LIST = {} | ||
|
||
-- For GUI | ||
---@type table<string, number> | ||
TerraFarmFillTypes.NAME_TO_INDEX = {} | ||
|
||
-- For GUI | ||
---@type table<string, string> | ||
TerraFarmFillTypes.TITLE_TO_NAME = {} | ||
|
||
|
||
function TerraFarmFillTypes:init() | ||
for _, name in pairs(self.SUPPORTED_TYPES_LIST) do | ||
self:add(name) | ||
end | ||
end | ||
|
||
function TerraFarmFillTypes:add(name) | ||
local fillType = g_fillTypeManager.nameToFillType[name] | ||
if fillType then | ||
local title = string.lower(name):gsub("^%l", string.upper) | ||
|
||
table.insert(self.TYPES_LIST, title) | ||
self.NAME_TO_INDEX[name] = #self.TYPES_LIST | ||
self.TITLE_TO_NAME[title] = name | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters