From a12d818cdb3ac7bebb8bf016748af261390f886e Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 23 Aug 2016 21:32:56 +0200 Subject: [PATCH] Revert "Merge pull request #11 from TheAIBot/master" This reverts commit 3252eefcfcdc06ae897ba49895664085782a3c31. --- clusterio_0.0.2/control.lua | 72 ++++++-------------- clusterio_0.0.2/data.lua | 83 +----------------------- clusterio_0.0.2/graphics/icons/none.png | Bin 227 -> 0 bytes 3 files changed, 22 insertions(+), 133 deletions(-) delete mode 100644 clusterio_0.0.2/graphics/icons/none.png diff --git a/clusterio_0.0.2/control.lua b/clusterio_0.0.2/control.lua index 22f10871..994ccf7a 100644 --- a/clusterio_0.0.2/control.lua +++ b/clusterio_0.0.2/control.lua @@ -8,39 +8,23 @@ function OnBuiltEntity(event) local entity = event.created_entity --only add entities that are not ghosts if entity.type ~= "entity-ghost" then - - end -end - -function AddAllEntitiesOfName(name) - for k, surface in pairs(game.surfaces) do - AddEntities(surface.find_entities_filtered({["name"] = name})) - end -end - -function AddEntities(entities) - for k, entity in pairs(entities) do - AddEntity(entity) - end -end - -function AddEntity(entity) - if entity.name == INPUT_CHEST_NAME then - global.inputChests = global.inputChests or {} - --add the chests to a lists if these chests so they can be interated over - global.inputChests[HashPosition(entity.position)] = entity - elseif entity.name == OUTPUT_CHEST_NAME then - global.outputChests = global.outputChests or {} - --add the chests to a lists if these chests so they can be interated over - global.outputChests[HashPosition(entity.position)] = entity - elseif entity.name == INPUT_TANK_NAME then - global.inputTanks = global.inputTanks or {} - --add the chests to a lists if these chests so they can be interated over - global.inputTanks[HashPosition(entity.position)] = entity - elseif entity.name == OUTPUT_TANK_NAME then - global.outputTanks = global.outputTanks or {} - --add the chests to a lists if these chests so they can be interated over - global.outputTanks[HashPosition(entity.position)] = entity + if entity.name == INPUT_CHEST_NAME then + global.inputChests = global.inputChests or {} + --add the chests to a lists if these chests so they can be interated over + global.inputChests[HashPosition(entity.position)] = entity + elseif entity.name == OUTPUT_CHEST_NAME then + global.outputChests = global.outputChests or {} + --add the chests to a lists if these chests so they can be interated over + global.outputChests[HashPosition(entity.position)] = entity + elseif entity.name == INPUT_TANK_NAME then + global.inputTanks = global.inputTanks or {} + --add the chests to a lists if these chests so they can be interated over + global.inputTanks[HashPosition(entity.position)] = entity + elseif entity.name == OUTPUT_TANK_NAME then + global.outputTanks = global.outputTanks or {} + --add the chests to a lists if these chests so they can be interated over + global.outputTanks[HashPosition(entity.position)] = entity + end end end @@ -82,8 +66,9 @@ script.on_event(defines.events.on_preplayer_mined_item, function(event) end) + + script.on_event(defines.events.on_tick, function(event) - global.inputChests = global.inputChests or {} global.outputChests = global.outputChests or {} global.inputTanks = global.inputTanks or {} @@ -93,23 +78,6 @@ script.on_event(defines.events.on_tick, function(event) local todo = game.tick % UPATE_RATE - if global.previousPlayerCount == nil or global.previousPlayerCount ~= #game.players then - global.outputList = {} - global.inputList = {} - global.itemStorage = {} - - global.inputChests = {} - global.outputChests = {} - global.inputTanks = {} - global.outputTanks = {} - - AddAllEntitiesOfName(INPUT_CHEST_NAME) - AddAllEntitiesOfName(OUTPUT_CHEST_NAME) - AddAllEntitiesOfName(INPUT_TANK_NAME) - AddAllEntitiesOfName(OUTPUT_TANK_NAME) - print("reset") - end - if todo == 0 then HandleInputChests() elseif todo == 1 then @@ -123,8 +91,6 @@ script.on_event(defines.events.on_tick, function(event) elseif todo == 5 then ExportOutputList() end - - global.previousPlayerCount = global.previousPlayerCount or #game.players end) function HandleInputChests() diff --git a/clusterio_0.0.2/data.lua b/clusterio_0.0.2/data.lua index ee2163af..45134a36 100644 --- a/clusterio_0.0.2/data.lua +++ b/clusterio_0.0.2/data.lua @@ -20,7 +20,7 @@ function MakeLogisticEntity(entity, name, pictureFilename, pictureTablePath, ico entity.icon = iconPath or entity.icon -- add the entity to a technology so it can be unlocked - --local wasAddedToTech = AddEntityToTech("construction-robotics", name) + local wasAddedToTech = AddEntityToTech("construction-robotics", name) data:extend( { @@ -34,7 +34,7 @@ function MakeLogisticEntity(entity, name, pictureFilename, pictureTablePath, ico --shouldn't be enabled to begin with. --but if the recipe isn't attached to a tech then it should --be enabled to begin with because otherwise the player can never use the item ingame - enabled = true, + enabled = not wasAddedToTech, ingredients = { {"steel-chest", 1}, @@ -55,7 +55,6 @@ function MakeLogisticEntity(entity, name, pictureFilename, pictureTablePath, ico stack_size = 50 } }) - return entity end --adds a recipe to a tech and returns true or if that fails returns false @@ -84,87 +83,11 @@ MakeLogisticEntity(table.deepcopy(data.raw["logistic-container"]["logistic-chest MakeLogisticEntity(table.deepcopy(data.raw["container"]["iron-chest"]), INPUT_CHEST_NAME, INPUT_CHEST_PICTURE_PATH, { "picture" }, INPUT_CHEST_ICON_PATH) --make tanks ---MakeLogisticEntity(table.deepcopy(data.raw["storage-tank"]["storage-tank"]), OUTPUT_TANK_NAME, OUTPUT_TANK_PICTURE_PATH, { "pictures", "picture", "sheet" }, OUTPUT_TANK_ICON_PATH) +MakeLogisticEntity(table.deepcopy(data.raw["storage-tank"]["storage-tank"]), OUTPUT_TANK_NAME, OUTPUT_TANK_PICTURE_PATH, { "pictures", "picture", "sheet" }, OUTPUT_TANK_ICON_PATH) MakeLogisticEntity(table.deepcopy(data.raw["storage-tank"]["storage-tank"]), INPUT_TANK_NAME, INPUT_TANK_PICTURE_PATH, { "pictures", "picture", "sheet" }, INPUT_TANK_ICON_PATH) -data:extend( -{ - { - type = "recipe-category", - name = "crafting-fluids" - } -}) -local fluidCreator = MakeLogisticEntity(table.deepcopy(data.raw["assembling-machine"]["assembling-machine-3"]), OUTPUT_TANK_NAME, OUTPUT_TANK_PICTURE_PATH, { "animation" }, OUTPUT_TANK_ICON_PATH) -fluidCreator.fluid_boxes = -{ - { - production_type = "output", - pipe_picture = assembler3pipepictures(), - pipe_covers = pipecoverspictures(), - base_area = 250, - base_level = 1, - pipe_connections = - { - { - type="output", position = {0, 2} - }, - { - type="output", position = {0, -2} - }, - { - type="output", position = {2, 0} - }, - { - type="output", position = {-2, 0} - }, - } - }, - off_when_no_fluid_recipe = false -} -fluidCreator.crafting_categories = {"crafting-fluids"} ---fluidCreator.energy_source = nil -fluidCreator.energy_usage = "1kW" -fluidCreator.ingredient_count = 1 -fluidCreator.module_specification.module_slots = 0 - -for k,v in pairs(data.raw.fluid) do - data:extend( - { - { - type = "recipe", - name = v.name, - icon = v.icon, - category = "crafting-fluids", - energy_required = 1, - subgroup = "barrel", - order = "b[fill-crude-oil-barrel]", - enabled = true, - ingredients = - { - {type="item", name="none", amount=1} - }, - results= - { - {type="fluid", name=v.name, amount=-1} - } - } - }) -end - -data:extend( -{ - { - type = "item", - name = "none", - icon = "__clusterio__/graphics/icons/none.png", - flags = { "goes-to-quickbar" }, - subgroup = "intermediate-product", - order = "c[other]-a[power-switch]", - stack_size= 1, - } -}) diff --git a/clusterio_0.0.2/graphics/icons/none.png b/clusterio_0.0.2/graphics/icons/none.png deleted file mode 100644 index 67c44794f42288a265000d5c791fbd33533f3c08..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!pj3%#L`iUdT1k0gQ7S_~VrE{6o}X)oLYc9i zsh**M!Iz?iKvhAWE{-7)?nh53GBOzOux$Kg{?}NbhFNiEZoHxQ8KKQbbV#H&SAPim WvTO_Yubn{C89ZJ6T-G@yGywn(9!O9C