mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Refactor some of the Guis from the legacy plugin (#399)
* Fix bugs in core and add default args to Gui defs * Refactor production Gui * Refactor landfill blueprint button * Fix more bugs in core * Consistent naming of new guis * Refactor module inserter gui * Refactor surveillance gui * Add shorthand for data from arguments * Make element names consistent * Add types * Change how table rows work * Refactor player stats gui * Refactor quick actions gui * Refactor research milestones gui * Refactor player bonus gui * Refactor science production gui * Refactor autofill gui * Cleanup use of aligned flow * Rename "Gui.element" to "Gui.define" * Rename Gui types * Rename property_from_arg * Add guide for making guis * Add full reference document * Add condensed reference * Apply style guide to refactored guis * Bug fixes
This commit is contained in:
@@ -15,8 +15,13 @@ local planet = {
|
||||
["aquilo"] = "ammoniacal-ocean"
|
||||
}
|
||||
|
||||
--- @class ExpCommand_Waterfill.commands
|
||||
local commands = {}
|
||||
|
||||
--- Toggle player selection mode for artillery
|
||||
Commands.new("waterfill", { "exp-commands_waterfill.description" })
|
||||
--- @class ExpCommands_Waterfill.commands.waterfill: ExpCommand
|
||||
--- @overload fun(player: LuaPlayer)
|
||||
commands.waterfill = Commands.new("waterfill", { "exp-commands_waterfill.description" })
|
||||
:register(function(player)
|
||||
if Selection.is_selecting(player, SelectionName) then
|
||||
Selection.stop(player)
|
||||
@@ -26,13 +31,13 @@ Commands.new("waterfill", { "exp-commands_waterfill.description" })
|
||||
local item_count_craft = math.min(math.floor(player.get_item_count("explosives") / 10), player.get_item_count("barrel"), player.get_item_count("grenade"))
|
||||
local item_count_total = item_count_cliff + item_count_craft
|
||||
if item_count_total == 0 then
|
||||
return player.print{ "exp-commands_waterfill.requires-explosives" }
|
||||
return Commands.status.error{ "exp-commands_waterfill.requires-explosives" }
|
||||
else
|
||||
Selection.start(player, SelectionName)
|
||||
return player.print{ "exp-commands_waterfill.enter" }
|
||||
return Commands.status.success{ "exp-commands_waterfill.enter" }
|
||||
end
|
||||
end
|
||||
end)
|
||||
end) --[[ @as any ]]
|
||||
|
||||
--- When an area is selected to be converted to water
|
||||
Selection.on_selection(SelectionName, function(event)
|
||||
@@ -116,3 +121,7 @@ Selection.on_selection(SelectionName, function(event)
|
||||
player.print({ "exp-commands_waterfill.complete", tile_count }, Commands.print_settings.default)
|
||||
end
|
||||
end)
|
||||
|
||||
return {
|
||||
commands = commands,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user