Skip to content

Commit d300414

Browse files
committed
Update for Factorio 0.17
1 parent 9ccf5ad commit d300414

File tree

13 files changed

+102
-225
lines changed

13 files changed

+102
-225
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ discussion page, and messages posted there will likely be ignored.**
4343

4444
## Changelog
4545

46+
### 0.3.0 (2019-02-26)
47+
* Update for Factorio 0.17
48+
* Overhaul buttons for blueprint flipping to a more sane implementation.
49+
4650
### 0.2.5 (2018-10-18)
4751
* If [GDIW](https://mods.factorio.com/mod/GDIW) is installed, mirror recipes when mirroring blueprints.
4852

changelog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---------------------------------------------------------------------------------------------------
2+
Version: 0.3.0
3+
Date: 26. 02. 2019
4+
Changes:
5+
- Update for Factorio 0.17
6+
- Overhaul buttons for blueprint flipping to a more sane implementation.
7+
18
---------------------------------------------------------------------------------------------------
29
Version: 0.2.5
310
Date: 18. 10. 2018

control.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local Util = require('util')
22
require('modules/snap')
33
require('modules/updater')
4-
local Flip = require('modules/flip')
4+
Flip = require('modules/flip')
55
require('modules/wireswap')
66
require('modules/rotate')
77

data.lua

Lines changed: 17 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -2,98 +2,22 @@ require 'prototypes/inputs'
22
require 'prototypes/items'
33
require 'prototypes/style'
44

5-
-- Add keybindings
6-
data:extend({
7-
{
8-
type = "custom-input",
9-
name = "BlueprintExtensions_flip-h",
10-
key_sequence = "SHIFT + x",
11-
order = 'a-a'
12-
},
13-
{
14-
type = "custom-input",
15-
name = "BlueprintExtensions_flip-v",
16-
key_sequence = "SHIFT + v",
17-
order = 'a-b'
18-
},
19-
{
20-
type = "custom-input",
21-
name = "BlueprintExtensions_snap-n",
22-
key_sequence = "PAD 8",
23-
order = 'd-a',
24-
},
25-
{
26-
type = "custom-input",
27-
name = "BlueprintExtensions_snap-e",
28-
key_sequence = "PAD 6",
29-
order = 'd-b',
30-
},
31-
{
32-
type = "custom-input",
33-
name = "BlueprintExtensions_snap-s",
34-
key_sequence = "PAD 2",
35-
order = 'd-c',
36-
},
37-
{
38-
type = "custom-input",
39-
name = "BlueprintExtensions_snap-w",
40-
key_sequence = "PAD 4",
41-
order = 'd-d',
42-
},
435

44-
{
45-
type = "custom-input",
46-
name = "BlueprintExtensions_snap-nw",
47-
key_sequence = "PAD 7",
48-
order = 'e-a',
49-
},
50-
{
51-
type = "custom-input",
52-
name = "BlueprintExtensions_snap-ne",
53-
key_sequence = "PAD 9",
54-
order = 'e-b',
55-
},
56-
{
57-
type = "custom-input",
58-
name = "BlueprintExtensions_snap-sw",
59-
key_sequence = "PAD 1",
60-
order = 'e-c',
61-
},
62-
{
63-
type = "custom-input",
64-
name = "BlueprintExtensions_snap-se",
65-
key_sequence = "PAD 3",
66-
order = 'e-d',
67-
},
68-
{
69-
type = "custom-input",
70-
name = "BlueprintExtensions_snap-center",
71-
key_sequence = "PAD 5",
72-
order = 'f-a',
73-
},
74-
{
75-
type = "custom-input",
76-
name = "BlueprintExtensions_clone-blueprint",
77-
key_sequence = "SHIFT + U",
78-
order = 'g-a',
79-
},
6+
--[[
807
81-
{
82-
type = "selection-tool",
83-
name = "BlueprintExtensions_cloned-blueprint",
84-
icon = "__BlueprintExtensions__/graphics/icons/cloned-blueprint.png",
85-
icon_size = 32,
86-
flags = { "goes-to-quickbar" },
87-
subgroup = "tool",
88-
order = "c[automated-construction]-a[blueprint]-no-picker",
89-
stack_size = 1,
90-
stackable = false,
91-
selection_color = { r = 0, g = 1, b = 0 },
92-
alt_selection_color = { r = 0, g = 1, b = 0 },
93-
selection_mode = { "blueprint" },
94-
alt_selection_mode = { "blueprint" },
95-
selection_cursor_box_type = "copy",
96-
alt_selection_cursor_box_type = "copy",
97-
show_in_library = false
98-
},
99-
})
8+
function gui_init(player)
9+
local flow = mod_gui.get_button_flow(player)
10+
if not flow.upgrade_planner_config_button then
11+
local button = flow.add
12+
{
13+
type = "sprite-button",
14+
name = "upgrade_planner_config_button",
15+
style = mod_gui.button_style,
16+
sprite = "item/upgrade-builder",
17+
tooltip = {"upgrade-planner.button-tooltip"}
18+
}
19+
button.style.visible = true
20+
end
21+
end
22+
23+
]]

graphics/gui2.pdn

12.9 KB
Binary file not shown.

graphics/gui2.png

3.78 KB
Loading

info.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "BlueprintExtensions",
3-
"version": "0.2.5",
3+
"version": "0.3.0",
44
"title": "Blueprint Extensions",
55
"author": "Dewin",
66
"contact": "https://github.com/dewiniaid/BlueprintExtensions",
77
"homepage": "https://github.com/dewiniaid/BlueprintExensions",
8-
"factorio_version": "0.16",
9-
"dependencies": ["base >= 0.16", "? GDIW"],
8+
"factorio_version": "0.17",
9+
"dependencies": ["base >= 0.17", "? GDIW"],
1010
"description": "Adds tools for updating and placing blueprints."
1111
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
for index, player in pairs(game.players) do
2+
if player.gui.top.BPEX_Flow then
3+
player.gui.top.BPEX_Flow.destroy()
4+
end
5+
end

modules/flip.lua

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
local Util = require('util')
2+
require("mod-gui")
3+
24

35
local Flip = {
46
enabled = true,
@@ -46,15 +48,41 @@ local Flip = {
4648

4749
function Flip.setup_gui(player)
4850
local show = (Flip.enabled and player.mod_settings["BlueprintExtensions_show-buttons"].value)
49-
local top = player.gui.top
50-
51-
if show and not top["BPEX_Flow"] then
52-
local flow = top.add{type = "flow", name = "BPEX_Flow", direction = 'horizontal'}
53-
flow.add{type = "button", name = "BPEX_Flip_H", style = "BPEX_Button_H"}
54-
flow.add{type = "button", name = "BPEX_Flip_V", style = "BPEX_Button_V"}
55-
elseif not show and top["BPEX_Flow"] then
56-
top["BPEX_Flow"].destroy()
51+
local flow = mod_gui.get_button_flow(player)
52+
53+
if show and not flow.BPEX_Flip_H then
54+
local button
55+
button = flow.add {
56+
name = "BPEX_Flip_H",
57+
type = "sprite-button",
58+
style = mod_gui.button_style,
59+
sprite = "BPEX_Flip_H",
60+
tooltip = { "controls.BlueprintExtensions_flip-h" }
61+
}
62+
button.visible = true
63+
print(serpent.block(button))
64+
button = flow.add {
65+
name = "BPEX_Flip_V",
66+
type = "sprite-button",
67+
style = mod_gui.button_style,
68+
sprite = "BPEX_Flip_V",
69+
tooltip = { "controls.BlueprintExtensions_flip-v" }
70+
}
71+
button.visible = true
72+
elseif not show then
73+
flow.BPEX_Flip_H.destroy()
74+
flow.BPEX_Flip_V.destroy()
5775
end
76+
--
77+
-- local top = player.gui.top
78+
--
79+
-- if show and not top["BPEX_Flow"] then
80+
-- local flow = top.add{type = "flow", name = "BPEX_Flow", direction = 'horizontal'}
81+
-- flow.add{type = "button", name = "BPEX_Flip_H", style = "BPEX_Button_H"}
82+
-- flow.add{type = "button", name = "BPEX_Flip_V", style = "BPEX_Button_V"}
83+
-- elseif not show and top["BPEX_Flow"] then
84+
-- top["BPEX_Flow"].destroy()
85+
-- end
5886
end
5987

6088

modules/rotate.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function Rotate.rotate(player_index)
2020
if not (bp and bp.is_blueprint_setup()) then
2121
return
2222
end
23-
local mult = { x = -1, y = 1 }
2423

2524
local ents
2625

@@ -34,3 +33,4 @@ end
3433

3534
script.on_event("BlueprintExtensions_rotate-clockwise", function(event) return Rotate.rotate(event.player_index) end)
3635
return Rotate
36+

0 commit comments

Comments
 (0)