Compare commits
1 Commits
code-quali
...
imgbot
Author | SHA1 | Date | |
---|---|---|---|
8c35451f12 |
14
.github/workflows/integration-test.yml
vendored
@ -1,14 +0,0 @@
|
|||||||
name: integration-test
|
|
||||||
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
|
||||||
- name: integration-test
|
|
||||||
run: ./integration-test.sh
|
|
17
.github/workflows/luacheck.yml
vendored
@ -1,17 +0,0 @@
|
|||||||
name: luacheck
|
|
||||||
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- 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 ./
|
|
34
.luacheckrc
@ -1,34 +0,0 @@
|
|||||||
|
|
||||||
unused_args = false
|
|
||||||
|
|
||||||
globals = {
|
|
||||||
"wieldview",
|
|
||||||
"armor",
|
|
||||||
"armor_i18n",
|
|
||||||
"inventory_plus"
|
|
||||||
}
|
|
||||||
|
|
||||||
read_globals = {
|
|
||||||
-- Stdlib
|
|
||||||
string = {fields = {"split"}},
|
|
||||||
table = {fields = {"copy", "getn"}},
|
|
||||||
|
|
||||||
-- Minetest
|
|
||||||
"vector", "ItemStack",
|
|
||||||
"dump", "VoxelArea",
|
|
||||||
|
|
||||||
-- deps
|
|
||||||
"default",
|
|
||||||
"minetest",
|
|
||||||
"unified_inventory",
|
|
||||||
"intllib",
|
|
||||||
"wardrobe",
|
|
||||||
"player_monoids",
|
|
||||||
"armor_monoid",
|
|
||||||
"sfinv",
|
|
||||||
"ARMOR_MATERIALS",
|
|
||||||
"ARMOR_FIRE_NODES",
|
|
||||||
"pova",
|
|
||||||
"skins",
|
|
||||||
"u_skins"
|
|
||||||
}
|
|
@ -185,6 +185,7 @@ armor.set_player_armor = function(self, player)
|
|||||||
local material = {count=1}
|
local material = {count=1}
|
||||||
local preview = armor:get_preview(name)
|
local preview = armor:get_preview(name)
|
||||||
local texture = "3d_armor_trans.png"
|
local texture = "3d_armor_trans.png"
|
||||||
|
local textures = {}
|
||||||
local physics = {}
|
local physics = {}
|
||||||
local attributes = {}
|
local attributes = {}
|
||||||
local levels = {}
|
local levels = {}
|
||||||
@ -323,8 +324,8 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
|
|||||||
local list = armor_inv:get_list("armor")
|
local list = armor_inv:get_list("armor")
|
||||||
for i, stack in pairs(list) do
|
for i, stack in pairs(list) do
|
||||||
if stack:get_count() == 1 then
|
if stack:get_count() == 1 then
|
||||||
local itemname = stack:get_name()
|
local name = stack:get_name()
|
||||||
local use = minetest.get_item_group(itemname, "armor_use") or 0
|
local use = minetest.get_item_group(name, "armor_use") or 0
|
||||||
local damage = use > 0
|
local damage = use > 0
|
||||||
local def = stack:get_definition() or {}
|
local def = stack:get_definition() or {}
|
||||||
if type(def.on_punched) == "function" then
|
if type(def.on_punched) == "function" then
|
||||||
@ -372,7 +373,7 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if damage == true and hitter == "fire" then
|
if damage == true and hitter == "fire" then
|
||||||
damage = minetest.get_item_group(itemname, "flammable") > 0
|
damage = minetest.get_item_group(name, "flammable") > 0
|
||||||
end
|
end
|
||||||
if damage == true then
|
if damage == true then
|
||||||
self:damage(player, i, stack, use)
|
self:damage(player, i, stack, use)
|
||||||
|
@ -15,23 +15,19 @@ local F = minetest.formspec_escape
|
|||||||
|
|
||||||
dofile(modpath.."/api.lua")
|
dofile(modpath.."/api.lua")
|
||||||
|
|
||||||
-- integration test
|
|
||||||
if minetest.settings:get_bool("enable_3d_armor_integration_test") then
|
|
||||||
dofile(modpath.."/integration_test.lua")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Legacy Config Support
|
-- Legacy Config Support
|
||||||
|
|
||||||
local input = io.open(modpath.."/armor.conf", "r")
|
local input = io.open(modpath.."/armor.conf", "r")
|
||||||
if input then
|
if input then
|
||||||
dofile(modpath.."/armor.conf")
|
dofile(modpath.."/armor.conf")
|
||||||
input:close()
|
input:close()
|
||||||
|
input = nil
|
||||||
end
|
end
|
||||||
input = io.open(worldpath.."/armor.conf", "r")
|
input = io.open(worldpath.."/armor.conf", "r")
|
||||||
if input then
|
if input then
|
||||||
dofile(worldpath.."/armor.conf")
|
dofile(worldpath.."/armor.conf")
|
||||||
input:close()
|
input:close()
|
||||||
|
input = nil
|
||||||
end
|
end
|
||||||
for name, _ in pairs(armor.config) do
|
for name, _ in pairs(armor.config) do
|
||||||
local global = "ARMOR_"..name:upper()
|
local global = "ARMOR_"..name:upper()
|
||||||
@ -173,9 +169,9 @@ local function validate_armor_inventory(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function init_player_armor(initplayer)
|
local function init_player_armor(player)
|
||||||
local name = initplayer:get_player_name()
|
local name = player:get_player_name()
|
||||||
local pos = initplayer:get_pos()
|
local pos = player:get_pos()
|
||||||
if not name or not pos then
|
if not name or not pos then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -218,20 +214,20 @@ local function init_player_armor(initplayer)
|
|||||||
end,
|
end,
|
||||||
}, name)
|
}, name)
|
||||||
armor_inv:set_size("armor", 6)
|
armor_inv:set_size("armor", 6)
|
||||||
if not armor:load_armor_inventory(initplayer) and armor.migrate_old_inventory then
|
if not armor:load_armor_inventory(player) and armor.migrate_old_inventory then
|
||||||
local player_inv = initplayer:get_inventory()
|
local player_inv = player:get_inventory()
|
||||||
player_inv:set_size("armor", 6)
|
player_inv:set_size("armor", 6)
|
||||||
for i=1, 6 do
|
for i=1, 6 do
|
||||||
local stack = player_inv:get_stack("armor", i)
|
local stack = player_inv:get_stack("armor", i)
|
||||||
armor_inv:set_stack("armor", i, stack)
|
armor_inv:set_stack("armor", i, stack)
|
||||||
end
|
end
|
||||||
armor:save_armor_inventory(initplayer)
|
armor:save_armor_inventory(player)
|
||||||
player_inv:set_size("armor", 0)
|
player_inv:set_size("armor", 0)
|
||||||
end
|
end
|
||||||
for i=1, 6 do
|
for i=1, 6 do
|
||||||
local stack = armor_inv:get_stack("armor", i)
|
local stack = armor_inv:get_stack("armor", i)
|
||||||
if stack:get_count() > 0 then
|
if stack:get_count() > 0 then
|
||||||
armor:run_callbacks("on_equip", initplayer, i, stack)
|
armor:run_callbacks("on_equip", player, i, stack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
armor.def[name] = {
|
armor.def[name] = {
|
||||||
@ -267,7 +263,7 @@ local function init_player_armor(initplayer)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
armor:set_player_armor(initplayer)
|
armor:set_player_armor(player)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -295,31 +291,24 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
if not name then
|
if not name then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local player_name = player:get_player_name()
|
|
||||||
for field, _ in pairs(fields) do
|
for field, _ in pairs(fields) do
|
||||||
if string.find(field, "skins_set") then
|
if string.find(field, "skins_set") then
|
||||||
minetest.after(0, function()
|
minetest.after(0, function(player)
|
||||||
local pplayer = minetest.get_player_by_name(player_name)
|
|
||||||
if player then
|
|
||||||
local skin = armor:get_player_skin(name)
|
local skin = armor:get_player_skin(name)
|
||||||
armor.textures[name].skin = skin
|
armor.textures[name].skin = skin
|
||||||
armor:set_player_armor(pplayer)
|
armor:set_player_armor(player)
|
||||||
end
|
end, player)
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
default.player_set_model(player, "3d_armor_character.b3d")
|
default.player_set_model(player, "3d_armor_character.b3d")
|
||||||
local player_name = player:get_player_name()
|
minetest.after(0, function(player)
|
||||||
|
if init_player_armor(player) == false then
|
||||||
minetest.after(0, function()
|
pending_players[player] = 0
|
||||||
local pplayer = minetest.get_player_by_name(player_name)
|
|
||||||
if pplayer and init_player_armor(pplayer) == false then
|
|
||||||
pending_players[pplayer] = 0
|
|
||||||
end
|
end
|
||||||
end)
|
end, player)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
minetest.log("warning", "[TEST] integration-test enabled!")
|
|
||||||
|
|
||||||
minetest.register_on_mods_loaded(function()
|
|
||||||
minetest.after(1, function()
|
|
||||||
|
|
||||||
local data = minetest.write_json({ success = true }, true);
|
|
||||||
local file = io.open(minetest.get_worldpath().."/integration_test.json", "w" );
|
|
||||||
if file then
|
|
||||||
file:write(data)
|
|
||||||
file:close()
|
|
||||||
end
|
|
||||||
|
|
||||||
file = io.open(minetest.get_worldpath().."/registered_nodes.txt", "w" );
|
|
||||||
if file then
|
|
||||||
for name in pairs(minetest.registered_nodes) do
|
|
||||||
file:write(name .. '\n')
|
|
||||||
end
|
|
||||||
file:close()
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.log("warning", "[TEST] integration tests done!")
|
|
||||||
minetest.request_shutdown("success")
|
|
||||||
end)
|
|
||||||
end)
|
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 383 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 383 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 383 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 407 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 369 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 366 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 504 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 444 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 514 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 446 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 499 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 453 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 476 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 468 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 464 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 476 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 476 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 495 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 368 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 399 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 415 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 409 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 438 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 434 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 438 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 438 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 426 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 392 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 389 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 392 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 392 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 389 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 389 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 400 B |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 373 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 408 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 423 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 420 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 415 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 425 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 385 B |