Add option for vlayer on space platforms (#365)

* Update vlayer.lua

* Update vlayer.lua

* Update vlayer.lua
This commit is contained in:
2025-01-25 00:43:03 +09:00
committed by GitHub
parent 4ebb6275bb
commit d002eeaf54
2 changed files with 10 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ return {
unlimited_capacity = false, --- @setting unlimited_capacity When true the vlayer has an unlimited energy capacity, accumulators are not required unlimited_capacity = false, --- @setting unlimited_capacity When true the vlayer has an unlimited energy capacity, accumulators are not required
unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required unlimited_surface_area = false, --- @setting unlimited_surface_area When true the vlayer has an unlimited surface area, landfill is not required
modded_auto_downgrade = false, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered modded_auto_downgrade = false, --- @setting modded_auto_downgrade When true modded items will be converted into their base game equivalent, original items can not be recovered
power_on_space = false, --- @setting power_on_space When true allow on spaceship
mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below mimic_surface = "nauvis", --- @setting mimic_surface Surface name/index the vlayer will copy its settings from, use nil to use the settings below
surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details surface = { --- @setting surface When mimic_surface is nil these settings will be used instead, see LuaSurface for details

View File

@@ -81,10 +81,16 @@ Selection.on_selection(SelectionConvertArea, function(event)
return nil return nil
end end
local entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force }
local frame = Gui.get_left_element(player, vlayer_container) local frame = Gui.get_left_element(player, vlayer_container)
local disp = frame.container["vlayer_st_2"].disp.table local disp = frame.container["vlayer_st_2"].disp.table
local target = vlayer_control_type_list[disp[vlayer_gui_control_type.name].selected_index] local target = vlayer_control_type_list[disp[vlayer_gui_control_type.name].selected_index]
local entities
if config.power_on_space and event.surface and event.surface.platform and target == "energy" then
entities = event.surface.find_entities_filtered{ area = area, name = "constant-combinator", force = player.force }
else
entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force }
end
if #entities == 0 then if #entities == 0 then
player.print{ "vlayer.steel-chest-detect" } player.print{ "vlayer.steel-chest-detect" }
@@ -100,9 +106,9 @@ Selection.on_selection(SelectionConvertArea, function(event)
local e = entities[1] local e = entities[1]
local e_pos = { x = string.format("%.1f", e.position.x), y = string.format("%.1f", e.position.y) } local e_pos = { x = string.format("%.1f", e.position.x), y = string.format("%.1f", e.position.y) }
local e_circ = {} -- e.circuit_connected_entities --- TODO use new circuit api local e_circ = nil -- e.get_wire_connectors{ or_create = false }
if not e.get_inventory(defines.inventory.chest).is_empty() then if e.name and e.name == "steel-chest" and (not e.get_inventory(defines.inventory.chest).is_empty()) then
player.print{ "vlayer.steel-chest-empty" } player.print{ "vlayer.steel-chest-empty" }
return nil return nil
end end