Add GitHub workflow (#149)
This commit is contained in:
parent
c0bd9977be
commit
606ba6a1a3
11
.github/workflows/check-release.yml
vendored
Normal file
11
.github/workflows/check-release.yml
vendored
Normal file
@ -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
.luacheckrc
Normal file
18
.luacheckrc
Normal file
@ -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" }
|
@ -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.
|
||||
@ -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)
|
||||
|
4
api.lua
4
api.lua
@ -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
|
||||
|
||||
|
3
bags.lua
3
bags.lua
@ -1,4 +1,4 @@
|
||||
--[[
|
||||
--[[
|
||||
Bags for Minetest
|
||||
|
||||
Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
|
||||
@ -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)
|
||||
|
@ -28,7 +28,6 @@ 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
|
||||
@ -36,7 +35,6 @@ minetest.register_on_joinplayer(function(player)
|
||||
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)
|
||||
|
@ -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]
|
||||
@ -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
|
||||
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user