mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Resolve all Luals warnings
This commit is contained in:
@@ -76,9 +76,12 @@ function Public.add_compilatron(entity, name)
|
||||
end
|
||||
|
||||
Public.compilatrons[name] = entity
|
||||
local message =
|
||||
entity.surface.create_entity
|
||||
{ name = "compi-speech-bubble", text = messages[name][1], position = { 0, 0 }, source = entity }
|
||||
local message = entity.surface.create_entity{
|
||||
name = "compi-speech-bubble",
|
||||
text = messages[name][1],
|
||||
position = { 0, 0 },
|
||||
source = entity,
|
||||
}
|
||||
|
||||
Public.current_messages[name] = { message = message, msg_number = 1 }
|
||||
end
|
||||
|
||||
@@ -56,7 +56,14 @@ if config.decon_area then
|
||||
local items = e.surface.find_entities_filtered{ area = e.area, force = player.force }
|
||||
|
||||
if #items > 250 then
|
||||
print_to_players(true, { "deconlog.decon", player.name, e.surface.name, pos_to_gps_string(e.area.left_top), pos_to_gps_string(e.area.right_bottom), format_number(#items) })
|
||||
print_to_players(true, {
|
||||
"deconlog.decon",
|
||||
player.name,
|
||||
e.surface.localised_name,
|
||||
pos_to_gps_string(e.area.left_top),
|
||||
pos_to_gps_string(e.area.right_bottom),
|
||||
format_number(#items, false),
|
||||
})
|
||||
end
|
||||
|
||||
add_log(get_secs() .. "," .. player.name .. ",decon_area," .. e.surface.name .. "," .. pos_to_string(e.area.left_top) .. "," .. pos_to_string(e.area.right_bottom))
|
||||
|
||||
@@ -15,10 +15,10 @@ local directions = {
|
||||
["SW"] = 0.875,
|
||||
}
|
||||
|
||||
local function Angle(entity)
|
||||
local function get_direction(entity)
|
||||
local angle = math.atan2(entity.position.y, entity.position.x) / math.pi
|
||||
for direction, requiredAngle in pairs(directions) do
|
||||
if angle < requiredAngle then
|
||||
for direction, required_angle in pairs(directions) do
|
||||
if angle < required_angle then
|
||||
return direction
|
||||
end
|
||||
end
|
||||
@@ -45,14 +45,14 @@ local function station_name_changer(event)
|
||||
return
|
||||
end
|
||||
|
||||
local boundingBox = entity.bounding_box
|
||||
local bounding_box = entity.bounding_box
|
||||
-- expanded box for recourse search:
|
||||
local bounding2 = { { boundingBox.left_top.x - 100, boundingBox.left_top.y - 100 }, { boundingBox.right_bottom.x + 100, boundingBox.right_bottom.y + 100 } }
|
||||
local bounding2 = { { bounding_box.left_top.x - 100, bounding_box.left_top.y - 100 }, { bounding_box.right_bottom.x + 100, bounding_box.right_bottom.y + 100 } }
|
||||
-- gets all resources in bounding_box2:
|
||||
local recourses = game.surfaces[1].find_entities_filtered{ area = bounding2, type = "resource" }
|
||||
if #recourses > 0 then -- save cpu time if their are no recourses in bounding_box2
|
||||
local closest_distance
|
||||
local px, py = boundingBox.left_top.x, boundingBox.left_top.y
|
||||
local px, py = bounding_box.left_top.x, bounding_box.left_top.y
|
||||
local recourse_closed
|
||||
|
||||
-- Check which recourse is closest
|
||||
@@ -77,7 +77,7 @@ local function station_name_changer(event)
|
||||
entity.backer_name = config.station_name:gsub("__icon__", "[img=" .. item_type .. "." .. item_name .. "]")
|
||||
:gsub("__item_name__", item_name2)
|
||||
:gsub("__backer_name__", entity.backer_name)
|
||||
:gsub("__direction__", Angle(entity))
|
||||
:gsub("__direction__", get_direction(entity))
|
||||
:gsub("__x__", math.floor(entity.position.x))
|
||||
:gsub("__y__", math.floor(entity.position.y))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user