mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Quick fix for player physical position
This commit is contained in:
@@ -60,6 +60,7 @@ local elem_filter = {
|
||||
}
|
||||
|
||||
local function clear_module(player, area, machine)
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
for _, entity in pairs(player.surface.find_entities_filtered{ area = area, name = machine, force = player.force }) do
|
||||
for _, r in pairs(player.surface.find_entities_filtered{ position = entity.position, name = "item-request-proxy", force = player.force }) do
|
||||
if r then
|
||||
@@ -84,6 +85,7 @@ local function clear_module(player, area, machine)
|
||||
end
|
||||
|
||||
local function apply_module(player, area, machine, modules)
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
for _, entity in pairs(player.surface.find_entities_filtered{ area = area, name = machine, force = player.force }) do
|
||||
local m_current_recipe
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ local add_player_base =
|
||||
local selected_player = game.players[selected_player_name]
|
||||
if event.button == defines.mouse_button_type.left then
|
||||
-- LMB will open the map to the selected player
|
||||
local position = selected_player.position
|
||||
local position = selected_player.physical_position
|
||||
event.player.zoom_to_world(position, 1.75)
|
||||
else
|
||||
-- RMB will toggle the settings
|
||||
|
||||
@@ -129,6 +129,7 @@ end)
|
||||
Event.on_nth_tick(60, function()
|
||||
for _, player in pairs(game.connected_players) do
|
||||
local frame = Gui.get_left_element(player, production_container)
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
local stat = player.force.get_item_production_statistics(player.surface)
|
||||
local precision_value = precision[frame.container["production_st"].disp.table["production_0_e"].selected_index]
|
||||
local table = frame.container["production_st"].disp.table
|
||||
|
||||
@@ -52,7 +52,7 @@ local cctv_location =
|
||||
}:style{
|
||||
width = 48,
|
||||
}:on_click(function(player, element, _)
|
||||
element.parent.parent.parent.cctv_display.position = player.position
|
||||
element.parent.parent.parent.cctv_display.position = player.physical_position
|
||||
end)
|
||||
|
||||
local zoom_in =
|
||||
@@ -163,7 +163,7 @@ Event.add(defines.events.on_tick, function(_)
|
||||
|
||||
if selected_index ~= 0 then
|
||||
selected_index = current_camera_set.buttons.table[cctv_player.name].items[selected_index]
|
||||
current_camera_set["cctv_display"].position = game.players[selected_index].position
|
||||
current_camera_set["cctv_display"].position = game.players[selected_index].physical_position
|
||||
current_camera_set["cctv_display"].surface_index = game.players[selected_index].surface_index
|
||||
else
|
||||
current_camera_set["cctv_display"].position = { x = 0, y = 0 }
|
||||
|
||||
@@ -80,7 +80,7 @@ Selection.on_selection(SelectionConvertArea, function(event)
|
||||
return nil
|
||||
end
|
||||
|
||||
local entities = player.surface.find_entities_filtered{ area = area, name = "steel-chest", force = player.force }
|
||||
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 disp = frame.container["vlayer_st_2"].disp.table
|
||||
local target = vlayer_control_type_list[disp[vlayer_gui_control_type.name].selected_index]
|
||||
@@ -114,16 +114,16 @@ Selection.on_selection(SelectionConvertArea, function(event)
|
||||
e.destroy()
|
||||
|
||||
if target == "energy" then
|
||||
if not vlayer.create_energy_interface(player.surface, e_pos, player) then
|
||||
if not vlayer.create_energy_interface(event.surface, e_pos, player) then
|
||||
player.print{ "vlayer.result-unable", { "vlayer.control-type-energy" }, { "vlayer.result-space" } }
|
||||
return nil
|
||||
end
|
||||
elseif target == "circuit" then
|
||||
vlayer.create_circuit_interface(player.surface, e_pos, e_circ, player)
|
||||
vlayer.create_circuit_interface(event.surface, e_pos, e_circ, player)
|
||||
elseif target == "storage_input" then
|
||||
vlayer.create_input_interface(player.surface, e_pos, e_circ, player)
|
||||
vlayer.create_input_interface(event.surface, e_pos, e_circ, player)
|
||||
elseif target == "storage_output" then
|
||||
vlayer.create_output_interface(player.surface, e_pos, e_circ, player)
|
||||
vlayer.create_output_interface(event.surface, e_pos, e_circ, player)
|
||||
end
|
||||
|
||||
game.print{ "vlayer.interface-result", player.name, pos_to_gps_string(e_pos), { "vlayer.result-build" }, { "vlayer.control-type-" .. target:gsub("_", "-") } }
|
||||
|
||||
@@ -89,9 +89,10 @@ local add_new_warp =
|
||||
:style(Styles.sprite22)
|
||||
:on_click(function(player, _)
|
||||
-- Add the new warp
|
||||
if player.controller_type ~= defines.controllers.character then return end
|
||||
local force_name = player.force.name
|
||||
local surface = player.surface
|
||||
local position = player.position
|
||||
local surface = player.physical_surface
|
||||
local position = player.physical_position
|
||||
|
||||
-- Check if the warp is too close to water
|
||||
local water_tiles = surface.find_tiles_filtered{ collision_mask = "water-tile", radius = config.standard_proximity_radius + 1, position = position }
|
||||
@@ -783,7 +784,7 @@ Event.on_nth_tick(math.floor(60 / config.update_smoothing), function()
|
||||
local closest_distance = nil
|
||||
if #warp_ids > 0 then
|
||||
local surface = player.surface
|
||||
local pos = player.position
|
||||
local pos = player.physical_position
|
||||
local px, py = pos.x, pos.y
|
||||
|
||||
-- Loop over each warp
|
||||
|
||||
Reference in New Issue
Block a user