Skip to content

Commit

Permalink
Added few output recipe for product block
Browse files Browse the repository at this point in the history
Added few output recipe for product block
Changed disable/hidden recipe in selector panel
Fixed power tab
Fixed minimum speed with modules
  • Loading branch information
Helfima committed Jun 2, 2017
1 parent 96d5798 commit 948927e
Show file tree
Hide file tree
Showing 24 changed files with 666 additions and 957 deletions.
2 changes: 1 addition & 1 deletion controller/Controller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function Controller.methods:parse_event(event, type)
local item2 = string.match(event.element.name,patternItem2,1)
local item3 = string.match(event.element.name,patternItem3,1)
Logging:debug(self:classname(), "parse_event:", event.element.name, action, item, item2, item3)
eventController:send_event(player, event.element, action, item, item2, item3)
eventController:send_event(player, event, action, item, item2, item3)
end
end
end
Expand Down
6 changes: 5 additions & 1 deletion controller/PlayerController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ function PlayerController.methods:getDefaultSettings()
model_filter_beacon_module = true,
other_speed_panel=false,
real_name=false,
filter_show_disable=false,
filter_show_hidden=false
}
end
Expand Down Expand Up @@ -624,7 +625,8 @@ function PlayerController.methods:createFakeRecipe(player, entity, type)
group = entity.group,
subgroup = entity.subgroup,
energy = 1,
enabled = true
enabled = true,
hidden = false
}
if type == "resource" and entity.resource_category ~= nil then
recipe.localised_name = {"entity-name."..entity.name}
Expand Down Expand Up @@ -688,6 +690,7 @@ end
-- @return #LuaEntityPrototype entity prototype
--
function PlayerController.methods:getEntityPrototype(name)
if name == nil then return nil end
return game.entity_prototypes[name]
end

Expand Down Expand Up @@ -1052,6 +1055,7 @@ end
-- @param #string property
--
function PlayerController.methods:getEntityProperty(name, property)
Logging:trace(self:classname(), "getEntityProperty(name, property)", name, property)
local entity = self:getEntityPrototype(name)
if entity ~= nil then
if property == "type" then
Expand Down
64 changes: 32 additions & 32 deletions dialog/Dialog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ end
-- @function [parent=#Dialog] open
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:open(player, element, action, item, item2, item3)
Logging:debug(self:classname(), "open():",player, element, action, item, item2, item3)
function Dialog.methods:open(player, event, action, item, item2, item3)
Logging:debug(self:classname(), "open():", action, item, item2, item3)
local parentPanel = self:getParentPanel(player)
if parentPanel[self:classname()] ~= nil and parentPanel[self:classname()].valid then
local close = self:on_open(player, element, action, item, item2, item3)
local close = self:on_open(player, event, action, item, item2, item3)
--Logging:debug(self:classname() , "must close:",close)
if close then
self:close(player, element, action, item, item2, item3)
self:close(player, event, action, item, item2, item3)
else
self:update(player, element, action, item, item2, item3)
self:update(player, event, action, item, item2, item3)
end

else
Expand All @@ -117,9 +117,9 @@ function Dialog.methods:open(player, element, action, item, item2, item3)
local headerPanel = self:addGuiFrameH(panel, "header-panel", "helmod_frame_resize_row_width")
self:addGuiLabel(headerPanel, "title", caption, "helmod_label_title_frame")

self:on_open(player, element, action, item, item2, item3)
self:after_open(player, element, action, item, item2, item3)
self:update(player, element, action, item, item2, item3)
self:on_open(player, event, action, item, item2, item3)
self:after_open(player, event, action, item, item2, item3)
self:update(player, event, action, item, item2, item3)
end
end

Expand All @@ -129,27 +129,27 @@ end
-- @function [parent=#Dialog] send_event
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:send_event(player, element, action, item, item2, item3)
Logging:debug(self:classname(), "send_event():",player, element, action, item, item2, item3)
function Dialog.methods:send_event(player, event, action, item, item2, item3)
Logging:debug(self:classname(), "send_event():", action, item, item2, item3)
if action == "OPEN" then
self:open(player, element, action, item, item2, item3)
self:open(player, event, action, item, item2, item3)
end

if action == "UPDATE" then
self:update(player, element, action, item, item2, item3)
self:update(player, event, action, item, item2, item3)
end

if action == "CLOSE" then
self:close(player, element, action, item, item2, item3)
self:close(player, event, action, item, item2, item3)
end

self:on_event(player, element, action, item, item2, item3)
self:on_event(player, event, action, item, item2, item3)
end

-------------------------------------------------------------------------------
Expand All @@ -158,13 +158,13 @@ end
-- @function [parent=#Dialog] on_event
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:on_event(player, element, action, item, item2, item3)
function Dialog.methods:on_event(player, event, action, item, item2, item3)
end

-------------------------------------------------------------------------------
Expand All @@ -173,13 +173,13 @@ end
-- @function [parent=#Dialog] on_open
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:on_open(player, element, action, item, item2, item3)
function Dialog.methods:on_open(player, event, action, item, item2, item3)
end

-------------------------------------------------------------------------------
Expand All @@ -188,13 +188,13 @@ end
-- @function [parent=#Dialog] after_open
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:after_open(player, element, action, item, item2, item3)
function Dialog.methods:after_open(player, event, action, item, item2, item3)
end

-------------------------------------------------------------------------------
Expand All @@ -203,14 +203,14 @@ end
-- @function [parent=#Dialog] update
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:update(player, element, action, item, item2, item3)
self:on_update(player, element, action, item, item2, item3)
function Dialog.methods:update(player, event, action, item, item2, item3)
self:on_update(player, event, action, item, item2, item3)
end

-------------------------------------------------------------------------------
Expand All @@ -219,13 +219,13 @@ end
-- @function [parent=#Dialog] on_update
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:on_update(player, element, action, item, item2, item3)
function Dialog.methods:on_update(player, event, action, item, item2, item3)

end

Expand All @@ -235,14 +235,14 @@ end
-- @function [parent=#Dialog] close
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:close(player, element, action, item, item2, item3)
self:on_close(player, element, action, item, item2, item3)
function Dialog.methods:close(player, event, action, item, item2, item3)
self:on_close(player, event, action, item, item2, item3)
local parentPanel = self:getParentPanel(player)
if parentPanel[self:classname()] ~= nil and parentPanel[self:classname()].valid then
parentPanel[self:classname()].destroy()
Expand All @@ -255,13 +255,13 @@ end
-- @function [parent=#Dialog] on_close
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 Dialog.methods:on_close(player, element, action, item, item2, item3)
function Dialog.methods:on_close(player, event, action, item, item2, item3)
end
40 changes: 20 additions & 20 deletions dialog/PinPanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ end
-- @function [parent=#PinPanel] on_open
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 PinPanel.methods:on_open(player, element, action, item, item2, item3)
function PinPanel.methods:on_open(player, event, action, item, item2, item3)
local globalGui = self.player:getGlobalGui(player)
local close = true
if globalGui.pinBlock == nil or globalGui.pinBlock ~= item then
Expand All @@ -63,13 +63,13 @@ end
-- @function [parent=#PinPanel] on_close
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 PinPanel.methods:on_close(player, element, action, item, item2, item3)
function PinPanel.methods:on_close(player, event, action, item, item2, item3)
local globalGui = self.player:getGlobalGui(player)
globalGui.pinBlock = nil
end
Expand Down Expand Up @@ -111,14 +111,14 @@ end
-- @function [parent=#PinPanel] after_open
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 PinPanel.methods:after_open(player, element, action, item, item2, item3)
self:updateHeader(player, element, action, item, item2, item3)
function PinPanel.methods:after_open(player, event, action, item, item2, item3)
self:updateHeader(player, event, action, item, item2, item3)
self:getInfoPanel(player)
end

Expand All @@ -128,14 +128,14 @@ end
-- @function [parent=#PinPanel] on_update
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 PinPanel.methods:on_update(player, element, action, item, item2, item3)
self:updateInfo(player, element, action, item, item2, item3)
function PinPanel.methods:on_update(player, event, action, item, item2, item3)
self:updateInfo(player, event, action, item, item2, item3)
end

-------------------------------------------------------------------------------
Expand All @@ -144,14 +144,14 @@ end
-- @function [parent=#PinPanel] updateInfo
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 PinPanel.methods:updateHeader(player, element, action, item, item2, item3)
Logging:debug(self:classname(), "updateHeader():",player, element, action, item, item2, item3)
function PinPanel.methods:updateHeader(player, event, action, item, item2, item3)
Logging:debug(self:classname(), "updateHeader():", action, item, item2, item3)
local headerPanel = self:getHeaderPanel(player)
local model = self.model:getModel(player)

Expand All @@ -171,14 +171,14 @@ end
-- @function [parent=#PinPanel] updateInfo
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 PinPanel.methods:updateInfo(player, element, action, item, item2, item3)
Logging:debug(self:classname(), "updateInfo():",player, element, action, item, item2, item3)
function PinPanel.methods:updateInfo(player, event, action, item, item2, item3)
Logging:debug(self:classname(), "updateInfo():", action, item, item2, item3)
local infoPanel = self:getInfoPanel(player)
local model = self.model:getModel(player)
local globalGui = self.player:getGlobalGui(player)
Expand Down Expand Up @@ -336,14 +336,14 @@ end
-- @function [parent=#PinPanel] on_event
--
-- @param #LuaPlayer player
-- @param #LuaGuiElement element button
-- @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 PinPanel.methods:on_event(player, element, action, item, item2, item3)
Logging:debug(self:classname(), "on_event():",player, element, action, item, item2, item3)
function PinPanel.methods:on_event(player, event, action, item, item2, item3)
Logging:debug(self:classname(), "on_event():", action, item, item2, item3)
local model = self.model:getModel(player)
local globalSettings = self.player:getGlobal(player, "settings")
local defaultSettings = self.player:getDefaultSettings()
Expand All @@ -352,6 +352,6 @@ function PinPanel.methods:on_event(player, element, action, item, item2, item3)
if action == "change-boolean-settings" then
if globalSettings[item] == nil then globalSettings[item] = defaultSettings[item] end
globalSettings[item] = not(globalSettings[item])
self:updateInfo(player, element, action, globalGui.pinBlock, item2, item3)
self:updateInfo(player, event, action, globalGui.pinBlock, item2, item3)
end
end
Loading

0 comments on commit 948927e

Please sign in to comment.