Skip to content

Commit a32c1dc

Browse files
authored
Merge pull request #4 from factorio-item-browser/develop
Version 1.1.0
2 parents 69f84cb + 0963703 commit a32c1dc

File tree

73 files changed

+752
-219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+752
-219
lines changed

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/docker export-ignore
2+
/test export-ignore
3+
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/.travis.yml export-ignore
7+
/docker-compose.yml export-ignore
8+
/phpunit.xml export-ignore

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: php
2+
3+
matrix:
4+
fast_finish: true
5+
include:
6+
- php: 7.2
7+
8+
install:
9+
- composer update --no-interaction
10+
11+
script:
12+
# - vendor/bin/phpunit --coverage-clover=coverage.xml
13+
- vendor/bin/phpcs -np --colors
14+
15+
#after_success:
16+
# - bash <(curl -s https://codecov.io/bash)
17+

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
## 1.1.0 - 2018-07-20
4+
5+
### Added
6+
7+
- Export of crafting category for recipes.
8+
- Export of machine data.
9+
10+
### Fixed
11+
12+
- Icon tint color possibly using a range of 0-255 instead of 0-1.
13+
- Using not the original size of the icons.
14+
15+
## 1.0.0 - 2018-05-13
16+
17+
- Initial release of the export.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Factorio Item Browser - Export
22

3+
[![Latest Stable Version](https://poser.pugx.org/factorio-item-browser/export/v/stable)](https://packagist.org/packages/factorio-item-browser/export) [![License](https://poser.pugx.org/factorio-item-browser/export/license)](https://packagist.org/packages/factorio-item-browser/export) [![Build Status](https://travis-ci.org/factorio-item-browser/export.svg?branch=master)](https://travis-ci.org/factorio-item-browser/export) [![codecov](https://codecov.io/gh/factorio-item-browser/export/branch/master/graph/badge.svg)](https://codecov.io/gh/factorio-item-browser/export)
4+
35
This project is the exporting part of the Factorio Item Browser, generating all the needed data to be imported into the
46
database.
5-
6-
*TBC*

composer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
"require": {
1616
"php": "^7.2",
1717
"bluepsyduck/common": "^1.0",
18-
"factorio-item-browser/export-data": "^1.1",
18+
"factorio-item-browser/export-data": "^1.2",
1919
"zendframework/zend-config-aggregator": "^1.0",
2020
"zendframework/zend-i18n": "^2.7",
2121
"zendframework/zend-servicemanager": "^3.3",
2222
"zfcampus/zf-console": "^1.3"
2323
},
24+
"require-dev": {
25+
"squizlabs/php_codesniffer": "^3.3"
26+
},
2427
"autoload": {
2528
"psr-4": {
2629
"FactorioItemBrowser\\Export\\": "src"
@@ -29,9 +32,14 @@
2932
"scripts": {
3033
"install-factorio": "bin/install-factorio.sh",
3134
"run": "@php bin/cli.php",
35+
"phpcbf": "phpcbf -p --colors",
36+
"phpcs": "phpcs -p --colors",
3237
"post-autoload-dump": [
3338
"mkdir -p data/cache data/export factorio/instances",
3439
"chmod 0777 data/cache data/export factorio/instances factorio/mods/Dump_1.0.0"
40+
],
41+
"test": [
42+
"@phpcs"
3543
]
3644
}
3745
}

composer.lock

Lines changed: 75 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/autoload/dependencies.global.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
Merger\IconMerger::class => InvokableFactory::class,
3636
Merger\ItemMerger::class => InvokableFactory::class,
37+
Merger\MachineMerger::class => InvokableFactory::class,
3738
Merger\MergerManager::class => Merger\MergerManagerFactory::class,
3839
Merger\RecipeMerger::class => InvokableFactory::class,
3940

@@ -44,11 +45,13 @@
4445

4546
Parser\IconParser::class => Parser\AbstractParserFactory::class,
4647
Parser\ItemParser::class => Parser\AbstractParserFactory::class,
48+
Parser\MachineParser::class => Parser\AbstractParserFactory::class,
4749
Parser\ParserManager::class => Parser\ParserManagerFactory::class,
4850
Parser\RecipeParser::class => Parser\AbstractParserFactory::class,
4951

5052
Reducer\IconReducer::class => InvokableFactory::class,
5153
Reducer\ItemReducer::class => InvokableFactory::class,
54+
Reducer\MachineReducer::class => InvokableFactory::class,
5255
Reducer\RecipeReducer::class => InvokableFactory::class,
5356
Reducer\ReducerManager::class => Reducer\ReducerManagerFactory::class,
5457

config/autoload/export.global.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
'numberOfInstances' => 4
2828
],
2929
'name' => 'Factorio Item Browser Export',
30-
'version' => '1.0.0'
30+
'version' => '1.1.0'
3131
];

factorio/mods/Dump_1.0.0/control.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ script.on_init(function()
2020
dumper.dump('FLUIDS', dump)
2121

2222

23+
dump = {}
24+
for _, machine in pairs(game.entity_prototypes) do
25+
if (machine.valid and (machine.crafting_categories ~= nil)) then
26+
-- Only allow the player called "player" and ignore all other pseudo-players
27+
if (machine.type ~= 'player' or machine.name == 'player') then
28+
local preparedMachine = dumper.prepareMachinePrototype(machine)
29+
dump[machine.name] = preparedMachine
30+
end
31+
end
32+
end
33+
dumper.dump('MACHINES', dump)
34+
35+
2336
dump = {}
2437
game.difficulty_settings.recipe_difficulty = defines.difficulty_settings.recipe_difficulty.normal
2538
for _, recipe in pairs(game.recipe_prototypes) do
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
local dumper = require 'dumper'
2-
local dump = {}
2+
local dumpIcons = {}
3+
local dumpFluidBoxes = {}
34

4-
local function searchPrototypes(items)
5-
if (type(items) == 'table') then
6-
for _, item in pairs(items) do
7-
if item.type ~= nil and item.name ~= nil then
8-
local icons = dumper.prepareIcon(item)
9-
if (icons ~= nil) then
10-
dump[icons.type .. '|' .. icons.name] = icons;
5+
-- Recursively searches for any prototypes to be dumped.
6+
-- @param {table} prototypes
7+
local function searchPrototypes(prototypes)
8+
if (type(prototypes) == 'table') then
9+
for _, prototype in pairs(prototypes) do
10+
if prototype.type ~= nil and prototype.name ~= nil then
11+
local icons = dumper.prepareIcon(prototype)
12+
local fluidBoxes = dumper.prepareFluidBoxes(prototype)
13+
if icons ~= nil then
14+
dumpIcons[icons.type .. '|' .. icons.name] = icons;
15+
end
16+
if fluidBoxes ~= nil then
17+
dumpFluidBoxes[fluidBoxes.type .. '|' .. fluidBoxes.name] = fluidBoxes;
1118
end
1219
else
13-
searchPrototypes(item)
20+
searchPrototypes(prototype)
1421
end
1522
end
1623
end
1724
end
1825

1926
searchPrototypes(data.raw)
20-
dumper.dump('ICONS', dump)
27+
dumper.dump('ICONS', dumpIcons)
28+
dumper.dump('FLUID_BOXES', dumpFluidBoxes)

0 commit comments

Comments
 (0)