mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-12 16:35:11 +09:00
Fix issue with MapPosition.energy
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
"$comment-library": "clusterio is outside this repo, set CLUSTERIO to your checkout. The factorio typedefs come from .luarc.json, which the factoriomod-debug extension manages",
|
"$comment-library": "clusterio is outside this repo, set CLUSTERIO to your checkout. The factorio typedefs come from .luarc.json, which the factoriomod-debug extension manages",
|
||||||
"library": [ "$CLUSTERIO/packages/host" ],
|
"library": [ "$CLUSTERIO/packages/host" ],
|
||||||
"ignoreDir": [ ".github", "web", "dist", "factorio" ],
|
"ignoreDir": [ ".github", "web", "dist", "factorio" ],
|
||||||
"ignoreGlobs": [ "**/node_modules/**", "**/dist/**" ],
|
"ignoreGlobs": [ "**/node_modules/**", "**/dist/**", "**/campaigns/**" ],
|
||||||
"moduleMap": [
|
"moduleMap": [
|
||||||
{ "pattern": "^([^.]+)\\.module\\.module_exports$", "replace": "modules.$1" },
|
{ "pattern": "^([^.]+)\\.module\\.module_exports$", "replace": "modules.$1" },
|
||||||
{ "pattern": "^([^.]+)\\.module\\.(.+)$", "replace": "modules.$1.$2" }
|
{ "pattern": "^([^.]+)\\.module\\.(.+)$", "replace": "modules.$1.$2" }
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ local function vlayer_gui_list_refresh(player)
|
|||||||
|
|
||||||
for i = 1, vlayer.get_interface_counts()[vlayer_control_type_list[target]], 1 do
|
for i = 1, vlayer.get_interface_counts()[vlayer_control_type_list[target]], 1 do
|
||||||
local entity = assert(interface[i])
|
local entity = assert(interface[i])
|
||||||
local entity_position = entity.position --[[@as MapPosition.struct]]
|
local entity_position = entity.position
|
||||||
table.insert(full_list, i .. " X " .. entity_position.x .. " Y " .. entity_position.y)
|
table.insert(full_list, i .. " X " .. entity_position.x .. " Y " .. entity_position.y)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -799,7 +799,7 @@ Event.on_nth_tick(math.floor(60 / config.update_smoothing), function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Check if the player is within range
|
-- Check if the player is within range
|
||||||
local warp_pos = warp.position --[[@as MapPosition.struct]]
|
local warp_pos = warp.position
|
||||||
if warp.surface == surface then
|
if warp.surface == surface then
|
||||||
local dx, dy = px - warp_pos.x, py - warp_pos.y
|
local dx, dy = px - warp_pos.x, py - warp_pos.y
|
||||||
local dist = (dx * dx) + (dy * dy)
|
local dist = (dx * dx) + (dy * dy)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ SelectArea:on_selection(function(event)
|
|||||||
for _, entity in ipairs(entities) do
|
for _, entity in ipairs(entities) do
|
||||||
local skip = false
|
local skip = false
|
||||||
|
|
||||||
local entity_position = entity.position --[[@as MapPosition.struct]]
|
local entity_position = entity.position
|
||||||
for _, pos in ipairs(hits) do
|
for _, pos in ipairs(hits) do
|
||||||
local x = abs(entity_position.x - pos.x)
|
local x = abs(entity_position.x - pos.x)
|
||||||
local y = abs(entity_position.y - pos.y)
|
local y = abs(entity_position.y - pos.y)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ local function show_protected_entity(player, entity)
|
|||||||
if renders[player.index][key] then return end
|
if renders[player.index][key] then return end
|
||||||
local selection_box = entity.selection_box --[[@as ExpUtil_AABB.Box]]
|
local selection_box = entity.selection_box --[[@as ExpUtil_AABB.Box]]
|
||||||
local rb = selection_box.right_bottom
|
local rb = selection_box.right_bottom
|
||||||
local position = entity.position --[[@as MapPosition.struct]]
|
local position = entity.position
|
||||||
renders[player.index][key] = rendering.draw_sprite{
|
renders[player.index][key] = rendering.draw_sprite{
|
||||||
sprite = "utility/notification",
|
sprite = "utility/notification",
|
||||||
target = entity,
|
target = entity,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ local function on_entity_damaged(event)
|
|||||||
|
|
||||||
-- Outputs the message as floating text
|
-- Outputs the message as floating text
|
||||||
if message then
|
if message then
|
||||||
local entity_position = entity.position --[[@as MapPosition.struct]]
|
local entity_position = entity.position
|
||||||
local entity_radius = max(1, entity.get_radius())
|
local entity_radius = max(1, entity.get_radius())
|
||||||
local offset = (random() - 0.5) * entity_radius * config.damage_location_variance
|
local offset = (random() - 0.5) * entity_radius * config.damage_location_variance
|
||||||
local position = { x = entity_position.x + offset, y = entity_position.y - entity_radius }
|
local position = { x = entity_position.x + offset, y = entity_position.y - entity_radius }
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ local function on_player_changed_position(event)
|
|||||||
if player.controller_type ~= defines.controllers.character then return end
|
if player.controller_type ~= defines.controllers.character then return end
|
||||||
|
|
||||||
local surface = player.physical_surface
|
local surface = player.physical_surface
|
||||||
local position = player.physical_position --[[@as MapPosition.struct]]
|
local position = player.physical_position
|
||||||
local strength = get_tile_strength(surface, position)
|
local strength = get_tile_strength(surface, position)
|
||||||
if not strength then return end
|
if not strength then return end
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ local function try_deconstruct_output_chest(entity)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Get all adjacent mining drills and inserters
|
-- Get all adjacent mining drills and inserters
|
||||||
local target_position = target.position --[[@as MapPosition.struct]]
|
local target_position = target.position
|
||||||
local entities = target.surface.find_entities_filtered{
|
local entities = target.surface.find_entities_filtered{
|
||||||
type = { "mining-drill", "inserter" },
|
type = { "mining-drill", "inserter" },
|
||||||
to_be_deconstructed = false,
|
to_be_deconstructed = false,
|
||||||
@@ -160,7 +160,7 @@ local function try_deconstruct_miner(entity)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Build pipes if the miner used fluid
|
-- Build pipes if the miner used fluid
|
||||||
local position = entity.position --[[@as MapPosition.struct]]
|
local position = entity.position
|
||||||
local create_entity_position = { x = position.x, y = position.y }
|
local create_entity_position = { x = position.x, y = position.y }
|
||||||
local create_entity_param = { name = "entity-ghost", inner_name = "pipe", force = entity.force, position = create_entity_position }
|
local create_entity_param = { name = "entity-ghost", inner_name = "pipe", force = entity.force, position = create_entity_position }
|
||||||
local create_entity = surface.create_entity
|
local create_entity = surface.create_entity
|
||||||
@@ -247,7 +247,7 @@ local function on_resource_depleted(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Find all mining drills within the area
|
-- Find all mining drills within the area
|
||||||
local position = resource.position --[[@as MapPosition.struct]]
|
local position = resource.position
|
||||||
local drills = resource.surface.find_entities_filtered{
|
local drills = resource.surface.find_entities_filtered{
|
||||||
type = "mining-drill",
|
type = "mining-drill",
|
||||||
area = {
|
area = {
|
||||||
@@ -259,7 +259,7 @@ local function on_resource_depleted(event)
|
|||||||
-- Check which could have reached this resource
|
-- Check which could have reached this resource
|
||||||
for _, drill in pairs(drills) do
|
for _, drill in pairs(drills) do
|
||||||
local radius = drill.prototype.mining_drill_radius
|
local radius = drill.prototype.mining_drill_radius
|
||||||
local drill_position = drill.position --[[@as MapPosition.struct]]
|
local drill_position = drill.position
|
||||||
local dx = math.abs(drill_position.x - position.x)
|
local dx = math.abs(drill_position.x - position.x)
|
||||||
local dy = math.abs(drill_position.y - position.y)
|
local dy = math.abs(drill_position.y - position.y)
|
||||||
if dx <= radius and dy <= radius then
|
if dx <= radius and dy <= radius then
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ Elements.production_table = Gui.define("production_stats/production_table")
|
|||||||
:track_all_elements()
|
:track_all_elements()
|
||||||
:draw(function(def, parent)
|
:draw(function(def, parent)
|
||||||
local scroll_table = Gui.elements.scroll_table(parent, 304, 4)
|
local scroll_table = Gui.elements.scroll_table(parent, 304, 4)
|
||||||
local display_alignments = scroll_table.style.column_alignments
|
local display_alignments = assert(scroll_table.style.column_alignments)
|
||||||
for i = 2, 4 do
|
for i = 2, 4 do
|
||||||
display_alignments[i] = "right"
|
display_alignments[i] = "right"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function FlyingText.create_above_entity(options)
|
|||||||
local entity = assert(options.target_entity, "A target entity is required")
|
local entity = assert(options.target_entity, "A target entity is required")
|
||||||
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
|
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
|
||||||
local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y
|
local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y
|
||||||
local position = entity.position --[[@as MapPosition.struct]]
|
local position = entity.position
|
||||||
local offset = options.offset or { x = 0, y = 0 }
|
local offset = options.offset or { x = 0, y = 0 }
|
||||||
|
|
||||||
options.position = {
|
options.position = {
|
||||||
@@ -66,7 +66,7 @@ function FlyingText.create_above_player(options)
|
|||||||
local entity = player.character; if not entity then return end
|
local entity = player.character; if not entity then return end
|
||||||
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
|
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
|
||||||
local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y
|
local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y
|
||||||
local position = entity.position --[[@as MapPosition.struct]]
|
local position = entity.position
|
||||||
local offset = options.offset or { x = 0, y = 0 }
|
local offset = options.offset or { x = 0, y = 0 }
|
||||||
|
|
||||||
options.position = {
|
options.position = {
|
||||||
@@ -88,7 +88,7 @@ function FlyingText.create_as_player(options)
|
|||||||
local entity = player.character; if not entity then return end
|
local entity = player.character; if not entity then return end
|
||||||
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
|
local bounding_box = entity.bounding_box --[[@as ExpUtil_AABB.Box]]
|
||||||
local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y
|
local size_y = bounding_box.left_top.y - bounding_box.right_bottom.y
|
||||||
local position = entity.position --[[@as MapPosition.struct]]
|
local position = entity.position
|
||||||
local offset = options.offset or { x = 0, y = 0 }
|
local offset = options.offset or { x = 0, y = 0 }
|
||||||
|
|
||||||
options.color = player.chat_color
|
options.color = player.chat_color
|
||||||
|
|||||||
Reference in New Issue
Block a user