Skip to content

Commit

Permalink
Actually correctly flip splitters like we said we do. Somehow in opti…
Browse files Browse the repository at this point in the history
…mizing the original code I completely forgot

+  to actually implement this.

Also, 0.2.1
  • Loading branch information
dewiniaid committed Apr 25, 2018
1 parent 2dc3231 commit 28d455f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ discussion page, and messages posted there will likely be ignored.**


## Changelog
### 0.2.1 (2018-04-24)
* Actually correctly flip splitters like we said we do. Somehow in optimizing the original code I completely forgot
to actually implement this.

### 0.2.0 (2018-04-23)
* Added and reworked the blueprint flipping and turning functionality in the Blueprint Flipper and Turner mod,
including a fix to priority splitters.
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 0.2.1
Date: 23. 04. 2018
Bugfixes:
- Actually flip splitter priorities upon mirroring like we said we would.

---------------------------------------------------------------------------------------------------
Version: 0.2.0
Date: 23. 04. 2018
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "BlueprintExtensions",
"version": "0.2.0",
"version": "0.2.1",
"title": "Blueprint Extensions",
"author": "Dewin",
"contact": "https://github.com/dewiniaid/BlueprintExtensions",
Expand Down
23 changes: 22 additions & 1 deletion modules/flip.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Flip = {
enabled = true,
translations = {
v = {
axis = 'y',
Expand Down Expand Up @@ -34,11 +35,15 @@ Flip = {
[4] = 1,
},
}
},
sides = {
left = 'right',
right = 'left'
}
}

function Flip.setup_gui(player)
local show = (not game.active_mods["Blueprint_Flip_Turn"]) and player.mod_settings["BlueprintExtensions_show-buttons"].value
local show = (Flip.enabled and player.mod_settings["BlueprintExtensions_show-buttons"].value)
local top = player.gui.top

if show and not top["BPEX_Flow"] then
Expand All @@ -52,9 +57,15 @@ end


function Flip.check_for_other_mods()
-- if game.active_mods["PickerExtended"] then
-- game.print("[Blueprint Extensions] Picker Extended is installed. Disabling our version of blueprint flipping.")
-- Flip.enabled = false
if game.active_mods["Blueprint_Flip_Turn"] then
game.print("[Blueprint Extensions] Blueprint Flipper and Turner is installed. Disabling our version of blueprint flipping.")
game.print("Blueprint Extensions now includes some improved functionality when flipping blueprints, such as correctly flipping splitter priorities. To enable this functionality, disable Blueprint Flipper and Turner.")
Flip.enabled = false
else
Flip.enabled = true
end
end

Expand Down Expand Up @@ -106,6 +117,14 @@ function Flip.flip(player_index, translate)
if ent.pickup_position ~= nil then
ent.pickup_position[axis] = -ent.pickup_position[axis]
end

if Flip.sides[ent.input_priority] then
ent.input_priority = Flip.sides[ent.input_priority]
end
if Flip.sides[ent.output_priority] then
ent.output_priority = Flip.sides[ent.output_priority]
end

end
bp.set_blueprint_entities(ents)
end
Expand All @@ -126,6 +145,8 @@ end


script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
Flip.check_for_other_mods()

if game.active_mods["Blueprint_Flip_Turn"] then return end

if event.setting_type == "runtime-per-user" and event.setting == "BlueprintExtensions_show-buttons" then
Expand Down

0 comments on commit 28d455f

Please sign in to comment.