Skip to content

Commit

Permalink
Fixed recipe selector filter
Browse files Browse the repository at this point in the history
  Bugfixes:
    - Fixed recipe selector filter
    - Fixed changelog
  • Loading branch information
Helfima committed Apr 7, 2019
1 parent 44f050a commit 36dcad7
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 84 deletions.
102 changes: 54 additions & 48 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,118 +1,124 @@
---------------------------------------------------------------------------------------------------
Version: 0.8.8
Date: 07. 04. 2019
Bugfixes:
- Fixed recipe selector filter
- Fixed changelog
---------------------------------------------------------------------------------------------------
Version: 0.8.7
Date: 30. 03. 2019
Features:
- Added changelog
- Added changelog
Changes:
- MP Perform 50% fast
- MP Perform 50% fast
Bugfixes:
- Fixed index menu
- Fixed index menu
---------------------------------------------------------------------------------------------------
Version: 0.8.6
Bugfixes:
- Fixed pin panel
- Fixed remember current production block
- Fixed event Computing by Factory
- Fixed height data section
- Fixed pin panel
- Fixed remember current production block
- Fixed event Computing by Factory
- Fixed height data section
---------------------------------------------------------------------------------------------------
Version: 0.8.5
Bugfixes:
- Fixed MP desync
- Fixed error pin panel
- Fixed MP desync
- Fixed error pin panel
---------------------------------------------------------------------------------------------------
Version: 0.8.4
Changes:
- Changed UI
- Changed UI
Bugfixes:
- Fixed MP desync
- Fixed production line list size
- Fixed MP desync
- Fixed production line list size
---------------------------------------------------------------------------------------------------
Version: 0.8.3
Bugfixes:
- Fixed speed belt
- Fixed selector filter
- Fixed speed belt
- Fixed selector filter
---------------------------------------------------------------------------------------------------
Version: 0.8.2
Bugfixes:
- fixed file name required
- fixed file name required
---------------------------------------------------------------------------------------------------
Version: 0.8.1
Changes:
- Upgrade factorio v0.17
- removed mining power
- Upgrade factorio v0.17
- removed mining power
Bugfixes:
- fixed some panel style
- fixed some panel style
---------------------------------------------------------------------------------------------------
Version: 0.7.11
Bugfixes:
- Fixed error in product edition
- Fixed error in product edition
---------------------------------------------------------------------------------------------------
Version: 0.7.10
Changes:
- Added flare stack/clarifier consumption recipes
- Added flare stack/clarifier consumption recipes
Bugfixes:
- Fixed show assembly for recipe
- Fixed product name for resource recipe
- Fixed close panel when change location
- Fixed show assembly for recipe
- Fixed product name for resource recipe
- Fixed close panel when change location
---------------------------------------------------------------------------------------------------
Version: 0.7.9
Changes:
- Added support for multiple identical products in recipes
- Added support for fluid and coal consuption in mining recipes
- Added support for multiple identical products in recipes
- Added support for fluid and coal consuption in mining recipes
---------------------------------------------------------------------------------------------------
Version: 0.7.8
Changes:
- Removed display size choose
- Added auto display sizing with scale
- Removed display size choose
- Added auto display sizing with scale
Bugfixes:
- Fixed LuaElectricEnergySourcePrototype::effectivity Removal
- Fixed LuaElectricEnergySourcePrototype::effectivity Removal
---------------------------------------------------------------------------------------------------
Version: 0.7.7
Features:
- Added Rules for production machine list
- Added Rules for production machine list
Bugfixes:
- Fixed Not Multiplayer Compatible
- Fixed module limitation
- Fixed Not Multiplayer Compatible
- Fixed module limitation
---------------------------------------------------------------------------------------------------
Version: 0.7.6
Bugfixes:
- Fixed event on checkbox
- Fixed event on checkbox
---------------------------------------------------------------------------------------------------
Version: 0.7.5
Changes:
- Completed french help
- Added auto update for pin panel
- Completed french help
- Added auto update for pin panel
Bugfixes:
- Fixed count container with base time
- Fixed count container with base time
---------------------------------------------------------------------------------------------------
Version: 0.7.4
Features:
- Added belt container
- Added tool for product edition
- Added partial french help
- Added belt container
- Added tool for product edition
- Added partial french help
Bugfixes:
- Fixed desync (tooltip cache)
- Fixed desync (tooltip cache)
---------------------------------------------------------------------------------------------------
Version: 0.7.3
Features:
- Added command
- Added close hotkey
- Added command
- Added close hotkey
Changes:
- Changed compute model
- Removed remote control
- Changed compute model
- Removed remote control
Bugfixes:
- Fixed recipe prototype
- Fixed recipe prototype
---------------------------------------------------------------------------------------------------
Version: 0.7.2
Features:
- Added matrix solver block (optional)
- Added matrix solver block (optional)
---------------------------------------------------------------------------------------------------
Version: 0.7.1
Features:
- Added administration tab
- Added administration tab
Changes:
- Updated UI
- Updated UI
---------------------------------------------------------------------------------------------------
Version: 0.7.0
Changes:
- Fixed for v0.16
- Fixed for v0.16
16 changes: 7 additions & 9 deletions controller/Controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ function Controller.parseEvent()
nextEvent = nil
Event.state = Event.STATE_CONTINUE
Event.force_refresh = true
Event.prepare = false
end
Logging:debug(Controller.classname, "event state", Event.state)
if(Event.state == Event.STATE_RELEASE) then
Expand All @@ -302,14 +303,6 @@ function Controller.parseEvent()
end
end
end
-- if Controller.isOpened() and (rawlen(Controller.getDialogPanel().children) == 0 or Controller.getView("HMProductLineEdition"):isOpened() or Controller.getView("HMProductBlockEdition"):isOpened()) then
-- local globalGui = Player.getGlobalGui()
-- if globalGui.currentTab == "HMProductionBlockTab" then
-- Controller.sendEvent(nil, "HMProductBlockEdition", "OPEN", Event.item1, Event.item2, Event.item3)
-- else
-- Controller.sendEvent(nil, "HMProductLineEdition", "OPEN", Event.item1, Event.item2, Event.item3)
-- end
-- end
end
end)
if not(ok) then
Expand All @@ -332,7 +325,9 @@ end
--
function Controller.sendEvent(event, classname, action, item, item2, item3)
Logging:debug(Controller.classname, "send_event(event, classname, action, item, item2, item3)", classname, action, item, item2, item3)
Controller.onEvent(event, action, item, item2, item3)
if Event.prepare == false then
Controller.onEvent(event, action, item, item2, item3)
end
if views ~= nil and views[classname] then
if action == "CLOSE" then
views[classname]:close(true)
Expand All @@ -342,6 +337,7 @@ function Controller.sendEvent(event, classname, action, item, item2, item3)
if string.find(classname, "Pin") then form_loop = {"pin"} end

if Event.prepare == false then
Logging:debug(Controller.classname, "===== prepare", game.tick)
if action == "OPEN" then
if string.find(classname, "Edition") or string.find(classname, "Selector") or string.find(classname, "Settings") or string.find(classname, "Help") or string.find(classname, "Download") then
ui.dialog = classname
Expand Down Expand Up @@ -398,6 +394,7 @@ function Controller.sendEvent(event, classname, action, item, item2, item3)
end
end

Logging:debug(Controller.classname, "===== open and update", game.tick)
for _,locate in pairs(form_loop) do
local form_name = ui[locate]
if form_name ~= nil then
Expand Down Expand Up @@ -431,6 +428,7 @@ end
function Controller.createEvent(event, classname, action, item, item2, item3)
Logging:debug(Controller.classname, "createEvent(event, classname, action, item, item2, item3)", classname, action, item, item2, item3)
nextEvent = {name=classname, action=action, item1=item, item2=item2, item3=item3}
Event.force_refresh = true
end

-------------------------------------------------------------------------------
Expand Down
18 changes: 17 additions & 1 deletion core/Form.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function Form.methods:open(event, action, item, item2, item3)
if parentPanel[self:classname()] == nil then
Logging:debug(self:classname(), "parentPanel.clear()")
parentPanel.clear()
self:onOpen(event, action, item, item2, item3)
--self:onOpen(event, action, item, item2, item3)
self:afterOpen(event, action, item, item2, item3)
end
end
Expand All @@ -128,6 +128,7 @@ end
function Form.methods:beforeEvent(event, action, item, item2, item3)
local parentPanel = self:getParentPanel()
if parentPanel[self:classname()] ~= nil and parentPanel[self:classname()].valid then
local close1 = self:onBeforeEvent(event, action, item, item2, item3)
local close = self:onOpen(event, action, item, item2, item3)
Logging:debug(self:classname() , "must close:",close)
if close and action == "OPEN" then
Expand All @@ -136,6 +137,21 @@ function Form.methods:beforeEvent(event, action, item, item2, item3)
end
end

-------------------------------------------------------------------------------
-- On before event
--
-- @function [parent=#Form] onBeforeEvent
--
-- @param #LuaEvent event
-- @param #string action action name
-- @param #string item first item name
-- @param #string item2 second item name
-- @param #string item3 third item name
--
function Form.methods:onBeforeEvent(event, action, item, item2, item3)
return false
end

-------------------------------------------------------------------------------
-- On event
--
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": "helmod",
"version": "0.8.7",
"version": "0.8.8",
"title": "Helmod: assistant for planning your base.",
"author": "Helfima",
"contact": "Helfima",
Expand Down
45 changes: 21 additions & 24 deletions selector/AbstractSelector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,43 +188,40 @@ function AbstractSelector.methods:getItemListPanel()
end

-------------------------------------------------------------------------------
-- On open
-- On before event
--
-- @function [parent=#AbstractSelector] onOpen
-- @function [parent=#AbstractSelector] onBeforeEvent
--
-- @param #LuaEvent event
-- @param #string action action name
-- @param #string item first item name
-- @param #string item2 second item name
-- @param #string item3 third item name
--
-- @return #boolean if true the next call close dialog
--
function AbstractSelector.methods:onOpen(event, action, item, item2, item3)
Logging:debug(self:classname(), "onOpen():", action, item, item2, item3)
function AbstractSelector.methods:onBeforeEvent(event, action, item, item2, item3)
Logging:debug(self:classname(), "onBeforeEvent():", action, item, item2, item3)
local player_gui = Player.getGlobalGui()
local close = action == "OPEN"
local close = true
filter_prototype_product = true

if action == "OPEN" then

This comment has been minimized.

Copy link
@Octoshape

Octoshape Apr 23, 2019

The removal of this if condition broke the recipe selector filter. When clicking "Apply" on the filter, the search just vanishes.

local globalPlayer = Player.getGlobal()
if item3 ~= nil then
filter_prototype = item3:lower():gsub("[-]"," ")
else
filter_prototype = nil
end
if event ~= nil and event.button ~= nil and event.button == defines.mouse_button_type.right then
filter_prototype_product = false
end
if item ~= nil and item2 ~= nil then
Logging:debug(self:classname(), "guiElementLast", player_gui.guiElementLast, close)
if player_gui.guiElementLast ~= item..item2 then
close = false
end
player_gui.guiElementLast = item..item2
Logging:debug(self:classname(), "guiElementLast", player_gui.guiElementLast, close)
local globalPlayer = Player.getGlobal()
if item3 ~= nil then
filter_prototype = item3:lower():gsub("[-]"," ")
else
filter_prototype = nil
end
if event ~= nil and event.button ~= nil and event.button == defines.mouse_button_type.right then
filter_prototype_product = false
end
if item ~= nil and item2 ~= nil then
Logging:debug(self:classname(), "guiElementLast", player_gui.guiElementLast, close)
if player_gui.guiElementLast ~= item..item2 then
close = false
end
player_gui.guiElementLast = item..item2
Logging:debug(self:classname(), "guiElementLast", player_gui.guiElementLast, close)
end
--Logging:debug(Controller.classname, "filter_prototype", filter_prototype)
-- close si nouvel appel
return close
end
Expand Down
2 changes: 1 addition & 1 deletion selector/RecipeSelector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function RecipeSelector.methods:updateGroups(item, item2, item3)
local list_group = {}
local list_subgroup = {}
local list_prototype = {}

--Logging:debug(Controller.classname, "filter_prototype", self:getFilter())
firstGroup = nil
for key, recipe in pairs(Player.getRecipes()) do
self:appendGroups(recipe, "recipe", list_group, list_subgroup, list_prototype)
Expand Down

0 comments on commit 36dcad7

Please sign in to comment.