mirror of
https://github.com/mt-mods/dreambuilder_hotbar.git
synced 2024-10-04 00:23:07 +02:00
Merge pull request #2 from mt-mods/luacheck-and-fixes
add .luacheckrc, workflow and fix some issues
This commit is contained in:
commit
94e5dadab6
17
.github/workflows/luacheck.yml
vendored
Normal file
17
.github/workflows/luacheck.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: luacheck
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- name: apt
|
||||||
|
run: sudo apt-get install -y luarocks
|
||||||
|
- name: luacheck install
|
||||||
|
run: luarocks install --local luacheck
|
||||||
|
- name: luacheck run
|
||||||
|
run: $HOME/.luarocks/bin/luacheck ./
|
15
.luacheckrc
Normal file
15
.luacheckrc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
read_globals = {
|
||||||
|
-- Stdlib
|
||||||
|
string = {fields = {"split"}},
|
||||||
|
table = {fields = {"copy", "getn"}},
|
||||||
|
"VoxelManip",
|
||||||
|
|
||||||
|
-- Minetest
|
||||||
|
"minetest", "DIR_DELIM",
|
||||||
|
"vector", "ItemStack",
|
||||||
|
"dump", "VoxelArea",
|
||||||
|
|
||||||
|
-- Deps
|
||||||
|
"dreambuilder_theme"
|
||||||
|
}
|
12
init.lua
12
init.lua
@ -1,4 +1,8 @@
|
|||||||
local themename = dreambuilder_theme and dreambuilder_theme.name.."_" or ""
|
local themename = ""
|
||||||
|
|
||||||
|
if minetest.global_exists("dreambuilder_theme") then
|
||||||
|
themename = dreambuilder_theme.name.."_"
|
||||||
|
end
|
||||||
|
|
||||||
local player_hotbar_settings = {}
|
local player_hotbar_settings = {}
|
||||||
local f = io.open(minetest.get_worldpath()..DIR_DELIM.."hotbar_settings","r")
|
local f = io.open(minetest.get_worldpath()..DIR_DELIM.."hotbar_settings","r")
|
||||||
@ -32,9 +36,9 @@ local function set_hotbar_size(player, s)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
minetest.after(0.5,function(hotbar_size)
|
minetest.after(0.5,function()
|
||||||
set_hotbar_size(player, tonumber(player_hotbar_settings[player:get_player_name()]) or hotbar_size_default)
|
set_hotbar_size(player, tonumber(player_hotbar_settings[player:get_player_name()]) or hotbar_size_default)
|
||||||
end, hotbar_size)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_chatcommand("hotbar", {
|
minetest.register_chatcommand("hotbar", {
|
||||||
@ -45,7 +49,7 @@ minetest.register_chatcommand("hotbar", {
|
|||||||
player_hotbar_settings[name] = size
|
player_hotbar_settings[name] = size
|
||||||
minetest.chat_send_player(name, "[_] Hotbar size set to " ..size.. ".")
|
minetest.chat_send_player(name, "[_] Hotbar size set to " ..size.. ".")
|
||||||
|
|
||||||
local f = io.open(minetest.get_worldpath()..DIR_DELIM.."hotbar_settings","w")
|
f = io.open(minetest.get_worldpath()..DIR_DELIM.."hotbar_settings","w")
|
||||||
if not f then
|
if not f then
|
||||||
minetest.log("error","Failed to save hotbar settings")
|
minetest.log("error","Failed to save hotbar settings")
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user