Skip to content

Commit

Permalink
Add GitHub workflow (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Panquesito7 committed Mar 25, 2020
1 parent c0bd997 commit 606ba6a
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 11 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
on: [push, pull_request]
name: Check & Release
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: lint
uses: Roang-zero1/factorio-mod-luacheck@master
with:
luacheckrc_url: https://raw.githubusercontent.com/minetest-mods/unified_inventory/master/.luacheckrc
18 changes: 18 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
unused_args = false
allow_defined_top = true
max_line_length = 999

globals = {
"unified_inventory",
}

read_globals = {
string = {fields = {"split", "trim"}},
table = {fields = {"copy", "getn"}},

"minetest", "vector",
"ItemStack", "datastorage",
}

files["callbacks.lua"].ignore = { "player", "draw_lite_mode" }
files["bags.lua"].ignore = { "player" }
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unified Inventory

[![](https://github.com/minetest-mods/unified_inventory/workflows/Check%20&%20Release/badge.svg)](https://github.com/minetest-mods/unified_inventory/actions)

![Screenshot](screenshot.png)

Unified Inventory replaces the default survival and creative inventory.
Expand All @@ -24,7 +26,6 @@ Unified Inventory replaces the default survival and creative inventory.

* Minetest 5.0.0+


# Licenses

Copyright (C) 2012-2014 Maciej Kasatkin (RealBadAngel)
Expand Down
4 changes: 2 additions & 2 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ minetest.after(0.01, function()
table.insert(unified_inventory.items_list, name)
local all_names = rev_aliases[name] or {}
table.insert(all_names, name)
for _, name in ipairs(all_names) do
local recipes = minetest.get_all_craft_recipes(name)
for _, player_name in ipairs(all_names) do
local recipes = minetest.get_all_craft_recipes(player_name)
if recipes then
for _, recipe in ipairs(recipes) do

Expand Down
3 changes: 1 addition & 2 deletions bags.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--[[
--[[
Bags for Minetest
Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
Expand Down Expand Up @@ -166,7 +166,6 @@ local function load_bags_metadata(player, bags_inv)
end

minetest.register_on_joinplayer(function(player)
local player_inv = player:get_inventory()
local player_name = player:get_player_name()
local bags_inv = minetest.create_detached_inventory(player_name .. "_bags",{
on_put = function(inv, listname, index, stack, player)
Expand Down
2 changes: 0 additions & 2 deletions callbacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ minetest.register_on_joinplayer(function(player)
-- Refill slot
local refill = minetest.create_detached_inventory(player_name.."refill", {
allow_put = function(inv, listname, index, stack, player)
local player_name = player:get_player_name()
if unified_inventory.is_creative(player_name) then
return stack:get_count()
else
return 0
end
end,
on_put = function(inv, listname, index, stack, player)
local player_name = player:get_player_name()
local handle_refill = (minetest.registered_items[stack:get_name()] or {}).on_refill or default_refill
stack = handle_refill(stack)
inv:set_stack(listname, index, stack)
Expand Down
5 changes: 2 additions & 3 deletions internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,10 @@ function unified_inventory.get_formspec(player, page)
else
local dir = unified_inventory.active_search_direction[player_name]
local list_index = unified_inventory.current_index[player_name]
local page = math.floor(list_index / (ui_peruser.items_per_page) + 1)
local page2 = math.floor(list_index / (ui_peruser.items_per_page) + 1)
local pagemax = math.floor(
(#unified_inventory.filtered_items_list[player_name] - 1)
/ (ui_peruser.items_per_page) + 1)
local item = {}
for y = 0, ui_peruser.pagerows - 1 do
for x = 0, ui_peruser.pagecols - 1 do
local name = unified_inventory.filtered_items_list[player_name][list_index]
Expand Down Expand Up @@ -254,7 +253,7 @@ function unified_inventory.get_formspec(player, page)
end
end
formspec[n] = "label[8.2,"..ui_peruser.form_header_y..";"..F(S("Page")) .. ": "
.. S("@1 of @2",page,pagemax).."]"
.. S("@1 of @2",page2,pagemax).."]"
end
n= n+1

Expand Down
2 changes: 1 addition & 1 deletion item_names.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Based on 4itemnames mod by 4aiman

local item_names = {} -- [player_name] = { hud, dtime, itemname }
local item_names = {} -- [player_name] = { hud, dtime, itemname }
local dlimit = 3 -- HUD element will be hidden after this many seconds
local air_hud_mod = minetest.get_modpath("4air")
local hud_mod = minetest.get_modpath("hud")
Expand Down

0 comments on commit 606ba6a

Please sign in to comment.