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:
@@ -58,7 +58,27 @@ function Commands.get_disabled_commands()
|
||||
return table.get_keys(disabled_commands)
|
||||
end
|
||||
|
||||
--- If a command has the flag "admin_only" then only admins can use the command#
|
||||
--- If a command has the flag "character_only" then the command can only be used outside of remote view
|
||||
authorities.character_only =
|
||||
add(function(player, command)
|
||||
if command.flags.character_only and player.controller_type ~= defines.controllers.character then
|
||||
return deny{ "exp-commands-permissions.character-only" }
|
||||
else
|
||||
return allow()
|
||||
end
|
||||
end)
|
||||
|
||||
--- If a command has the flag "remote_only" then the command can only be used inside of remote view
|
||||
authorities.remote_only =
|
||||
add(function(player, command)
|
||||
if command.flags.character_only and player.controller_type ~= defines.controllers.remote then
|
||||
return deny{ "exp-commands-permissions.remote-only" }
|
||||
else
|
||||
return allow()
|
||||
end
|
||||
end)
|
||||
|
||||
--- If a command has the flag "admin_only" then only admins can use the command
|
||||
authorities.admin_only =
|
||||
add(function(player, command)
|
||||
if command.flags.admin_only and not player.admin then
|
||||
|
||||
@@ -30,6 +30,8 @@ surface=Invalid Surface Name.
|
||||
color=Invalid Color Name.
|
||||
|
||||
[exp-commands-permissions]
|
||||
character-only=This command can not be used in remote view.
|
||||
remote-only=This command can only be used in remote view.
|
||||
admin-only=This command is for game admins only.
|
||||
system-only=This command can not be ran by players.
|
||||
disabled=This command is currently disabled.
|
||||
|
||||
@@ -38,8 +38,8 @@ end
|
||||
|
||||
-- teleports one player to another
|
||||
local function teleport(from_player, to_player)
|
||||
local surface = to_player.surface
|
||||
local position = surface.find_non_colliding_position("character", to_player.position, 32, 1)
|
||||
local surface = to_player.physical_surface
|
||||
local position = surface.find_non_colliding_position("character", to_player.physical_position, 32, 1)
|
||||
if not position then return false end -- return false if no new position
|
||||
if from_player.driving then from_player.driving = false end -- kicks a player out a vehicle if in one
|
||||
from_player.teleport(position, surface)
|
||||
|
||||
@@ -12,13 +12,13 @@ Event.add(defines.events.on_player_created, function(event)
|
||||
player.force.friendly_fire = config.friendly_fire
|
||||
game.map_settings.enemy_expansion.enabled = config.enemy_expansion
|
||||
local r = config.chart_radius
|
||||
local p = player.position
|
||||
player.force.chart(player.surface, { { p.x - r, p.y - r }, { p.x + r, p.y + r } })
|
||||
local p = player.physical_position
|
||||
player.force.chart(player.physical_surface, { { p.x - r, p.y - r }, { p.x + r, p.y + r } })
|
||||
end
|
||||
-- spawn items
|
||||
for item, callback in pairs(items) do
|
||||
if type(callback) == "function" then
|
||||
local stats = player.force.get_item_production_statistics(player.surface)
|
||||
local stats = player.force.get_item_production_statistics(player.physical_surface)
|
||||
local made = stats.get_input_count(item)
|
||||
local success, count = pcall(callback, made, stats.get_input_count, player)
|
||||
count = math.floor(count)
|
||||
|
||||
@@ -27,7 +27,7 @@ local function create_map_tag(death)
|
||||
local time = map_tag_time_format(death.time_of_death)
|
||||
message = message .. " at " .. time
|
||||
end
|
||||
death.tag = player.force.add_chart_tag(player.surface, {
|
||||
death.tag = player.force.add_chart_tag(player.physical_surface, {
|
||||
position = death.position,
|
||||
icon = config.map_icon,
|
||||
text = message,
|
||||
@@ -65,7 +65,7 @@ end
|
||||
--- @param event EventData.on_player_died
|
||||
Event.add(defines.events.on_player_died, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
local corpse = player.surface.find_entity("character-corpse", player.position)
|
||||
local corpse = player.surface.find_entity("character-corpse", player.physical_position)
|
||||
if not corpse or not corpse.valid then return end
|
||||
if config.use_chests_as_bodies then
|
||||
local inventory = assert(corpse.get_inventory(defines.inventory.character_corpse))
|
||||
@@ -83,7 +83,7 @@ Event.add(defines.events.on_player_died, function(event)
|
||||
local death = {
|
||||
player_name = player.name,
|
||||
time_of_death = event.tick,
|
||||
position = player.position,
|
||||
position = player.physical_position,
|
||||
corpse = corpse,
|
||||
}
|
||||
if config.show_map_markers then
|
||||
|
||||
@@ -98,7 +98,7 @@ if config.fired_rocket then
|
||||
return
|
||||
end
|
||||
if item.name == "rocket" then
|
||||
add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.position) .. "," .. pos_to_string(player.shooting_state.position))
|
||||
add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -117,7 +117,7 @@ if config.fired_explosive_rocket then
|
||||
return
|
||||
end
|
||||
if item.name == "explosive-rocket" then
|
||||
add_log(get_secs() .. "," .. player.name .. ",shot-explosive-rocket," .. pos_to_string(player.position) .. "," .. pos_to_string(player.shooting_state.position))
|
||||
add_log(get_secs() .. "," .. player.name .. ",shot-explosive-rocket," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position))
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -138,7 +138,7 @@ if config.fired_nuke then
|
||||
end
|
||||
|
||||
if item.name == "atomic-bomb" then
|
||||
add_log(get_secs() .. "," .. player.name .. ",shot-nuke," .. pos_to_string(player.position) .. "," .. pos_to_string(player.shooting_state.position))
|
||||
add_log(get_secs() .. "," .. player.name .. ",shot-nuke," .. pos_to_string(player.physical_position) .. "," .. pos_to_string(player.shooting_state.position))
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -13,6 +13,7 @@ Commands.new_command("lawnmower", "Clean up biter corpse, decoratives and nuclea
|
||||
:register(function(player, range)
|
||||
local tile_to_do = {}
|
||||
|
||||
-- Intentionally left as player.position to allow use in remote view
|
||||
player.surface.destroy_decoratives{ position = player.position, radius = range }
|
||||
|
||||
local entities = player.surface.find_entities_filtered{ position = player.position, radius = range, type = "corpse" }
|
||||
|
||||
@@ -27,7 +27,7 @@ local function check_items(player, type)
|
||||
|
||||
ExpUtil.move_items_to_surface{
|
||||
items = items,
|
||||
surface = player.surface,
|
||||
surface = game.planets.nauvis.surface,
|
||||
allow_creation = true,
|
||||
name = "iron-chest",
|
||||
}
|
||||
|
||||
@@ -75,8 +75,9 @@ end
|
||||
-- When the player changes position the tile will have a chance to downgrade, debug check is here
|
||||
Event.add(defines.events.on_player_changed_position, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
local surface = player.surface
|
||||
local position = player.position
|
||||
if player.controller_type ~= defines.controllers.character then return end
|
||||
local surface = player.physical_surface
|
||||
local position = player.physical_position
|
||||
local strength = get_tile_strength(surface, position)
|
||||
if not strength then return end
|
||||
if get_probability(strength) > math.random() then
|
||||
|
||||
@@ -222,7 +222,7 @@ Event.add(defines.events.on_player_created, function(event)
|
||||
if event.player_index ~= 1 then return end
|
||||
local player = game.players[event.player_index]
|
||||
local p = { x = 0, y = 0 }
|
||||
local s = player.surface
|
||||
local s = player.physical_surface
|
||||
get_spawn_force()
|
||||
spawn_area(s, p)
|
||||
if config.pattern.enabled then spawn_pattern(s, p) end
|
||||
|
||||
@@ -9,6 +9,7 @@ local Selection = require("modules.exp_legacy.modules.control.selection") --- @d
|
||||
local SelectionArtyArea = "ArtyArea"
|
||||
|
||||
local function location_break(player, pos)
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
if player.force.is_chunk_charted(player.surface, { x = math.floor(pos.left_top.x / 32), y = math.floor(pos.left_top.y / 32) }) then
|
||||
return true
|
||||
elseif player.force.is_chunk_charted(player.surface, { x = math.floor(pos.left_top.x / 32), y = math.floor(pos.right_bottom.y / 32) }) then
|
||||
|
||||
@@ -36,6 +36,7 @@ Commands.new_command("toggle-always-day", { "expcom-cheat.description-day" }, "T
|
||||
:set_flag("admin_only")
|
||||
:add_param("surface", true, "surface")
|
||||
:set_defaults{ surface = function(player)
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
return player.surface
|
||||
end }
|
||||
:register(function(player, surface)
|
||||
|
||||
@@ -21,7 +21,7 @@ Commands.new_command("clear-inventory", { "expcom-clr-inv.description" }, "Clear
|
||||
|
||||
ExpUtil.transfer_inventory_to_surface{
|
||||
inventory = inventory,
|
||||
surface = player.surface,
|
||||
surface = game.planets.nauvis.surface,
|
||||
name = "iron-chest",
|
||||
allow_creation = true,
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ Commands.new_command("remove-biters", { "expcom-enemy.description-remove" }, "Re
|
||||
:set_flag("admin_only")
|
||||
:add_param("surface", true, "surface")
|
||||
:set_defaults{ surface = function(player)
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
return player.surface
|
||||
end }
|
||||
:register(function(_, surface)
|
||||
|
||||
@@ -13,7 +13,7 @@ Commands.new_command("find-on-map", { "expcom-find.description" }, "Find a playe
|
||||
:add_param("player", false, "player-online")
|
||||
:add_alias("find", "zoom-to")
|
||||
:register(function(player, action_player)
|
||||
local position = action_player.position
|
||||
local position = action_player.physical_position
|
||||
player.zoom_to_world(position, 1.75)
|
||||
return Commands.success -- prevents command complete message from showing
|
||||
end)
|
||||
|
||||
@@ -13,7 +13,7 @@ Storage.register(homes, function(tbl)
|
||||
end)
|
||||
|
||||
local function teleport(player, position)
|
||||
local surface = player.surface
|
||||
local surface = player.physical_surface
|
||||
local pos = surface.find_non_colliding_position("character", position, 32, 1)
|
||||
if not position then return false end
|
||||
if player.driving then player.driving = false end -- kicks a player out a vehicle if in one
|
||||
@@ -36,7 +36,7 @@ Commands.new_command("home", { "expcom-home.description-home" }, "Teleports you
|
||||
if not home or not home[1] then
|
||||
return Commands.error{ "expcom-home.no-home" }
|
||||
end
|
||||
local rtn = floor_pos(player.position)
|
||||
local rtn = floor_pos(player.physical_position)
|
||||
teleport(player, home[1])
|
||||
home[2] = rtn
|
||||
Commands.print{ "expcom-home.return-set", rtn.x, rtn.y }
|
||||
@@ -51,7 +51,7 @@ Commands.new_command("home-set", { "expcom-home.description-home-set" }, "Sets y
|
||||
home = {}
|
||||
homes[player.index] = home
|
||||
end
|
||||
local pos = floor_pos(player.position)
|
||||
local pos = floor_pos(player.physical_position)
|
||||
home[1] = pos
|
||||
Commands.print{ "expcom-home.home-set", pos.x, pos.y }
|
||||
end)
|
||||
@@ -76,7 +76,7 @@ Commands.new_command("return", { "expcom-home.description-return" }, "Teleports
|
||||
if not home or not home[2] then
|
||||
return Commands.error{ "expcom-home.no-return" }
|
||||
end
|
||||
local rtn = floor_pos(player.position)
|
||||
local rtn = floor_pos(player.physical_position)
|
||||
teleport(player, home[2])
|
||||
home[2] = rtn
|
||||
Commands.print{ "expcom-home.return-set", rtn.x, rtn.y }
|
||||
|
||||
@@ -16,5 +16,5 @@ Commands.new_command("last-location", { "expcom-lastlocation.description" }, "Se
|
||||
:add_param("player", false, "player")
|
||||
:register(function(_, action_player)
|
||||
local action_player_name_color = format_player_name(action_player)
|
||||
return Commands.success{ "expcom-lastlocation.response", action_player_name_color, string.format("%.1f", action_player.position.x), string.format("%.1f", action_player.position.y) }
|
||||
return Commands.success{ "expcom-lastlocation.response", action_player_name_color, string.format("%.1f", action_player.physical_position.x), string.format("%.1f", action_player.physical_position.y) }
|
||||
end)
|
||||
|
||||
@@ -11,6 +11,7 @@ Commands.new_command("pollution-clear", { "expcom-pol.description-clr" }, "Clear
|
||||
:add_alias("pol-clr")
|
||||
:add_param("surface", true, "surface")
|
||||
:set_defaults{ surface = function(player)
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
return player.surface
|
||||
end }
|
||||
:register(function(player, surface)
|
||||
|
||||
@@ -177,6 +177,7 @@ end)
|
||||
Event.add(Selection.events.on_player_selection_start, function(event)
|
||||
if event.selection ~= SelectionProtectEntity and event.selection ~= SelectionProtectArea then return end
|
||||
local player = game.players[event.player_index]
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
local surface = player.surface
|
||||
renders[player.index] = {}
|
||||
-- Show protected entities
|
||||
|
||||
@@ -17,7 +17,9 @@ Commands.new_command("repair", { "expcom-repair.description" }, "Repairs entitie
|
||||
local revive_count = 0
|
||||
local heal_count = 0
|
||||
local range2 = range ^ 2
|
||||
-- Intentionally left as player.surface to allow use in remote view
|
||||
local surface = player.surface
|
||||
-- Intentionally left as player.position to allow use in remote view
|
||||
local center = player.position
|
||||
local area = { { x = center.x - range, y = center.y - range }, { x = center.x + range, y = center.y + range } }
|
||||
if config.allow_ghost_revive then
|
||||
|
||||
@@ -11,6 +11,7 @@ Commands.new_command("clear-item-on-ground", { "expcom-surface-clearing.descript
|
||||
:add_param("range", false, "integer-range", 1, 1000)
|
||||
:register(function(player, range)
|
||||
local items = {} --- @type LuaItemStack[]
|
||||
-- Intentionally left as player.position to allow use in remote view
|
||||
local entities = player.surface.find_entities_filtered{ position = player.position, radius = range, name = "item-on-ground" }
|
||||
for _, e in pairs(entities) do
|
||||
if e.stack then
|
||||
@@ -31,6 +32,7 @@ Commands.new_command("clear-item-on-ground", { "expcom-surface-clearing.descript
|
||||
Commands.new_command("clear-blueprint", { "expcom-surface-clearing.description-cb" }, "Clear Blueprint")
|
||||
:add_param("range", false, "integer-range", 1, 1000)
|
||||
:register(function(player, range)
|
||||
-- Intentionally left as player.position to allow use in remote view
|
||||
for _, e in pairs(player.surface.find_entities_filtered{ position = player.position, radius = range, type = "entity-ghost" }) do
|
||||
e.destroy()
|
||||
end
|
||||
|
||||
@@ -7,8 +7,8 @@ local Commands = require("modules.exp_legacy.expcore.commands") --- @dep expcore
|
||||
require("modules.exp_legacy.config.expcore.command_general_parse")
|
||||
|
||||
local function teleport(from_player, to_player)
|
||||
local surface = to_player.surface
|
||||
local position = surface.find_non_colliding_position("character", to_player.position, 32, 1)
|
||||
local surface = to_player.physical_surface
|
||||
local position = surface.find_non_colliding_position("character", to_player.physical_position, 32, 1)
|
||||
|
||||
-- return false if no new position
|
||||
if not position then
|
||||
|
||||
@@ -41,7 +41,7 @@ Selection.on_selection(SelectionConvertArea, function(event)
|
||||
return
|
||||
end
|
||||
|
||||
local entities = player.surface.find_entities_filtered{ area = area, name = "steel-chest" }
|
||||
local entities = event.surface.find_entities_filtered{ area = area, name = "steel-chest" }
|
||||
|
||||
if #entities == 0 then
|
||||
player.print("No steel chest found")
|
||||
@@ -60,6 +60,7 @@ Selection.on_selection(SelectionConvertArea, function(event)
|
||||
for _, entity in pairs(entities) do
|
||||
if clf_exp >= 1 then
|
||||
if entity.get_inventory(defines.inventory.chest).is_empty() then
|
||||
-- Intentionally left as player.position to allow use in report view
|
||||
if (math.floor(player.position.x) ~= math.floor(entity.position.x)) or (math.floor(player.position.y) ~= math.floor(entity.position.y)) then
|
||||
table.insert(tiles_to_make, { name = "water-mud", position = entity.position })
|
||||
entity.destroy()
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
@usage-- Making a new spawn warp
|
||||
local player = game.player
|
||||
local force = player.force
|
||||
local spawn_id = Warps.add_warp(force.name, player.surface, player.position, player.name, 'Spawn')
|
||||
local spawn_id = Warps.add_warp(force.name, player.physical_surface, player.physical_position, player.name, 'Spawn')
|
||||
|
||||
Warps.set_spawn_warp(spawn_id, force)
|
||||
Warps.make_warp_tag(spawn_id)
|
||||
@@ -14,7 +14,7 @@ Warps.make_warp_tag(spawn_id)
|
||||
@usage-- Making a new warp with a warp area
|
||||
local player = game.player
|
||||
local force = player.force
|
||||
local warp_id = Warps.add_warp(force.name, player.surface, player.position, player.name)
|
||||
local warp_id = Warps.add_warp(force.name, player.physical_surface, player.physical_position, player.name)
|
||||
|
||||
Warps.make_warp_area(warp_id)
|
||||
Warps.make_warp_tag(warp_id)
|
||||
@@ -313,7 +313,7 @@ end
|
||||
|
||||
@usage-- Adding a new warp for your force at your position
|
||||
local player = game.player
|
||||
local warp_id = Warps.add_warp(player.force.name, player.surface, player.position, player.name)
|
||||
local warp_id = Warps.add_warp(player.force.name, player.physical_surface, player.physical_position, player.name)
|
||||
|
||||
]]
|
||||
function Warps.add_warp(force_name, surface, position, player_name, warp_name)
|
||||
|
||||
@@ -45,7 +45,10 @@ Event.add(defines.events.on_player_created, function(event)
|
||||
util.insert_safe(player, global.created_items)
|
||||
|
||||
local r = global.chart_distance or 200
|
||||
player.force.chart(player.surface, { { player.position.x - r, player.position.y - r }, { player.position.x + r, player.position.y + r } })
|
||||
player.force.chart(player.physical_surface, {
|
||||
{ player.physical_position.x - r, player.physical_position.y - r },
|
||||
{ player.physical_position.x + r, player.physical_position.y + r }
|
||||
})
|
||||
|
||||
if not global.skip_intro then
|
||||
if game.is_multiplayer() then
|
||||
|
||||
@@ -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