removed redundant clear_entities.lua

This commit is contained in:
hrshtt
2025-08-19 18:14:54 +05:30
parent b72d797dad
commit 5caa34abe6
4 changed files with 11 additions and 84 deletions

View File

@@ -5,7 +5,7 @@ setup_platform() {
ARCH=$(uname -m)
OS=$(uname -s)
if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then
export DOCKER_PLATFORM="linux/arm64"
export DOCKER_PLATFORM="linux/amd64"
else
export DOCKER_PLATFORM="linux/amd64"
fi
@@ -74,7 +74,7 @@ EOF
cat >> docker-compose.yml << EOF
factorio_${i}:
image: factorio
image: factoriotools/factorio:1.1.110
platform: \${DOCKER_PLATFORM:-linux/amd64}
command: /opt/factorio/bin/x64/factorio --start-server-load-scenario ${SCENARIO}
--port 34197 --server-settings /opt/factorio/config/server-settings.json --map-gen-settings
@@ -89,13 +89,6 @@ EOF
cpus: '1'
memory: 1024m
entrypoint: []
environment:
- SAVES=/opt/factorio/saves
- CONFIG=/opt/factorio/config
- MODS=/opt/factorio/mods
- SCENARIOS=/opt/factorio/scenarios
- PORT=34197
- RCON_PORT=27015
ports:
- ${UDP_PORT}:34197/udp
- ${TCP_PORT}:27015/tcp
@@ -103,18 +96,18 @@ EOF
restart: unless-stopped
user: factorio
volumes:
- source: ../scenarios/default_lab_scenario
target: /opt/factorio/scenarios/default_lab_scenario
- source: ../scenarios
target: /opt/factorio/scenarios
type: bind
- source: ../scenarios/open_world
target: /opt/factorio/scenarios/open_world
type: bind
- source: ${MODS_PATH}
target: /opt/factorio/mods
- source: ../docker/config
target: /opt/factorio/config
type: bind
- source: ../../data/_screenshots
target: /opt/factorio/script-output
type: bind
- source: ../../../.fle/saves/0
target: /opt/factorio/saves
type: bind
EOF
done

1
fle/env/instance.py vendored
View File

@@ -690,7 +690,6 @@ class FactorioInstance:
init_scripts = [
"initialise",
"clear_entities",
"alerts",
"util",
"priority_queue",

View File

@@ -1,65 +0,0 @@
global.actions.clear_entities = function(player_index)
local function clear_area_of_entities(player, area, force_filter)
local surface = player.surface
local entities = surface.find_entities_filtered{
area = area,
force = force_filter,
type = {
"accumulator", "ammo-turret", "arithmetic-combinator", "artillery-turret",
"assembling-machine", "beacon", "boiler", "constant-combinator",
"container", "curved-rail", "decider-combinator", "electric-pole",
"electric-turret", "fluid-turret", "furnace", "gate", "generator",
"heat-interface", "heat-pipe", "inserter", "lab", "lamp",
"land-mine", "linked-belt", "linked-container", "loader",
"loader-1x1", "market", "mining-drill", "offshore-pump",
"pipe", "pipe-to-ground", "power-switch", "programmable-speaker",
"pump", "radar", "rail-chain-signal", "rail-signal",
"reactor", "roboport", "rocket-silo", "solar-panel",
"splitter", "storage-tank", "straight-rail", "train-stop",
"transport-belt", "underground-belt", "wall"
}
}
for _, entity in ipairs(entities) do
if entity and entity.valid and entity ~= player then
entity.destroy()
end
end
-- Clear dropped items separately
local dropped_items = surface.find_entities_filtered{
area = area,
name = "item-on-ground"
}
for _, item in ipairs(dropped_items) do
if item and item.valid then
item.destroy()
end
end
end
local function reset_character_inventory(player)
for inventory_id, inventory in pairs(defines.inventory) do
local character_inventory = player.get_inventory(inventory)
if character_inventory then
character_inventory.clear()
end
end
end
-- Main execution
local player = global.agent_characters[player_index]
local area = {
{player.position.x - 1000, player.position.y - 1000},
{player.position.x + 1000, player.position.y + 1000}
}
-- Clear player force entities
clear_area_of_entities(player, area, player.force)
-- Clear neutral force entities
clear_area_of_entities(player, area, "neutral")
reset_character_inventory(player)
player.force.reset()
return 1
end

View File

@@ -1,7 +1,7 @@
from fle.env.tools.init import Init
from fle.env.tools import Tool
class ClearEntities(Init):
class ClearEntities(Tool):
def __init__(self, connection, game_state):
super().__init__(connection, game_state)