mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-13 00:45:11 +09:00
Remove asserts the types already cover
The nil check burn down added guards which turned out redundant once the surrounding annotations landed. `_has_handlers` is set to true when the first handler registers, so it is a boolean rather than the literal false it was inferred as. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -291,7 +291,7 @@ function vlayer.remove_item(item_name, count)
|
||||
|
||||
if not config.unlimited_surface_area and item_properties.required_area and item_properties.required_area > 0 then
|
||||
-- Remove from the unallocated storage first
|
||||
remove_unallocated = math.min(count, assert(vlayer_data.storage.unallocated[item_name]))
|
||||
remove_unallocated = math.min(count, vlayer_data.storage.unallocated[item_name])
|
||||
|
||||
if remove_unallocated > 0 then
|
||||
vlayer_data.storage.items[item_name] = vlayer_data.storage.items[item_name] - count
|
||||
|
||||
@@ -381,14 +381,13 @@ local vlayer_gui_control_see = Gui.define("vlayer_gui_control_see")
|
||||
}:style{
|
||||
width = 200,
|
||||
}:on_click(function(def, player, element, event)
|
||||
local target = assert(assert(element.parent)[vlayer_gui_control_type.name]).selected_index
|
||||
local n = assert(assert(element.parent)[vlayer_gui_control_list.name]).selected_index
|
||||
local target = assert(element.parent)[vlayer_gui_control_type.name].selected_index
|
||||
local n = assert(element.parent)[vlayer_gui_control_list.name].selected_index
|
||||
|
||||
if target and vlayer_control_type_list[target] and n > 0 then
|
||||
local i = vlayer.get_interfaces()
|
||||
local entity = i[vlayer_control_type_list[target]][n]
|
||||
if entity and entity.valid then
|
||||
local player = Gui.get_player(event)
|
||||
player.set_controller{ type = defines.controllers.remote, position = entity.position, surface = entity.surface }
|
||||
player.print{ "vlayer.result-interface-location", { "vlayer.control-type-" .. vlayer_control_type_list[target]:gsub("_", "-") }, pos_to_gps_string(entity.position, entity.surface.name) }
|
||||
end
|
||||
@@ -425,8 +424,8 @@ local vlayer_gui_control_remove = Gui.define("vlayer_gui_control_remove")
|
||||
}:style{
|
||||
width = 200,
|
||||
}:on_click(function(def, player, element)
|
||||
local target = assert(assert(element.parent)[vlayer_gui_control_type.name]).selected_index
|
||||
local n = assert(assert(element.parent)[vlayer_gui_control_list.name]).selected_index
|
||||
local target = assert(element.parent)[vlayer_gui_control_type.name].selected_index
|
||||
local n = assert(element.parent)[vlayer_gui_control_list.name].selected_index
|
||||
|
||||
if target and vlayer_control_type_list[target] and n > 0 then
|
||||
local i = vlayer.get_interfaces()
|
||||
|
||||
@@ -294,10 +294,10 @@ local confirm_edit_button = Gui.define("confirm_edit_button")
|
||||
local parent = assert(element.parent)
|
||||
local grandparent = assert(parent.parent)
|
||||
local warp_id = parent.caption --[[@as string]]
|
||||
local name_flow = assert(grandparent["name-" .. warp_id])
|
||||
local icon_flow = assert(grandparent["icon-" .. warp_id])
|
||||
local warp_name = assert(name_flow[warp_textfield.name]).text
|
||||
local warp_icon = assert(icon_flow[warp_icon_editing.name]).elem_value --[[@as SignalID]]
|
||||
local name_flow = grandparent["name-" .. warp_id]
|
||||
local icon_flow = grandparent["icon-" .. warp_id]
|
||||
local warp_name = name_flow[warp_textfield.name].text
|
||||
local warp_icon = icon_flow[warp_icon_editing.name].elem_value --[[@as SignalID]]
|
||||
if warp_icon.type == nil then warp_icon.type = "item" end
|
||||
Warps.set_editing(warp_id, player.name)
|
||||
Warps.update_warp(warp_id, warp_name, warp_icon, player.name)
|
||||
|
||||
Reference in New Issue
Block a user