Compare commits

...

12 Commits

Author SHA1 Message Date
PICCORO Lenz McKAY 69bea89abb optimize textures of thos stupid developers, later mckayshiour will change it 2023-01-11 22:31:06 -04:00
David Leal e85417b180
Use the correct branch name 2023-01-10 00:13:38 -06:00
OgelGames 64c39ef239 remove unnecessary wear value 2021-10-10 21:20:22 +11:00
OgelGames 2a44879f1a optimize textures 2021-10-10 15:51:41 +11:00
OgelGames c83d07419c rework mod
* register armor using `armor:register_armor` (fixes #4)
* improve code readability
* make `technic_worldgen` optional
* add screenshot
* update readme and mod.conf
* remove integration test (unnecessary for a simple mod)
* remove other unnecessary files
2021-10-09 18:30:11 +11:00
David Leal ee9e651ba3
Merge pull request #2 from mt-mods/add_integration_test
Add Integration Test
2020-11-05 12:55:58 -06:00
BuckarooBanzay 688c822137 clone 3d_armor mod for integration test 2020-11-05 13:35:29 +01:00
BuckarooBanzay 2eb77818c1 make script executable 2020-11-05 07:17:44 +01:00
David Leal f9348593aa
Add Integration Test 2020-11-04 18:40:50 -06:00
David Leal 388f1c2853
Various changes and improvements (#1)
* Use mod.conf for (soft) dependencies and description.
* Deletes deprecated `depends.txt` and `description.txt`.
* Add GitHub workflow to LuaCheck the code
* Fix minor LuaCheck warnings
2020-11-04 17:17:45 +01:00
BuckarooBanzay 513569cd42 add luacheckrs stub 2020-09-02 17:55:53 +02:00
BuckarooBanzay 46d1ead160 use translator from 3d_armor
related: https://github.com/minetest-mods/3d_armor/pull/12
2020-08-31 08:04:07 +02:00
117 changed files with 158 additions and 112 deletions

13
.github/workflows/luacheck.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: luacheck
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- 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 ./

10
.gitignore vendored
View File

@ -1,10 +0,0 @@
## Generic ignorable patterns and files
*~
.*.swp
*bak*
tags
*.vim
## Eclipse project files & directories
.project
.settings

4
.luacheckrc Normal file
View File

@ -0,0 +1,4 @@
globals = {
"armor",
"minetest",
}

View File

@ -1,7 +1,4 @@
[mod] Technic Armor [technic_armor]
===================================
License Source Code: Copyright (C) 2013-2018 Stuart Jones - LGPL v2.1
License Textures: poet.nohit and numberZero - 2015-2018 WTFPL
License Textures: poet-nohit and numberZero - 2015-2018 WTFPL

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# Technic Armor [technic_armor]
[![luacheck](https://github.com/mt-mods/technic_armor/workflows/luacheck/badge.svg)](https://github.com/mt-mods/technic_armor/actions)
Adds armor made from lead, brass, cast iron, carbon steel, stainless steel, tin and silver.
![](screenshot.png?raw=true)
Textures by @poet-nohit and @numberZero

View File

@ -1,9 +0,0 @@
[mod] Technic Armor [technic_armor]
===================================
Adds tin, silver and technic materials to 3d_armor.
Requires technic (technic_worldgen at least) mod.
Depends: 3d_armor, technic_worldgen
Textures by poet.nohit and numberZero

View File

@ -1,3 +0,0 @@
3d_armor
technic_worldgen?
moreores?

View File

@ -1 +0,0 @@
Adds tin, silver and technic materials to 3d_armor.

171
init.lua
View File

@ -1,66 +1,149 @@
-- support for i18n
local S = armor_i18n.gettext
local F = armor_i18n.fgettext
if not minetest.get_modpath("technic_worldgen") then
minetest.log("warning", S("technic_armor: Mod loaded but unused."))
return
-- Use 3d_armor translator to take advantage of existing translations for armor parts
local S = minetest.get_translator("3d_armor")
local materials = {}
if minetest.get_modpath("technic_worldgen") then
materials.lead = {
name = S("Lead"),
craft_item = "technic:lead_ingot",
armor = 1.6,
heal = 0,
use = 500,
radiation = 88
}
materials.brass = {
name = S("Brass"),
craft_item = "technic:brass_ingot",
armor = 1.8,
heal = 0,
use = 650,
radiation = 43
}
materials.cast = {
name = S("Cast Iron"),
craft_item = "technic:cast_iron_ingot",
armor = 2.5,
heal = 8,
use = 200,
radiation = 40
}
materials.carbon = {
name = S("Carbon Steel"),
craft_item = "technic:carbon_steel_ingot",
armor = 2.7,
heal = 10,
use = 100,
radiation = 40
}
materials.stainless = {
name = S("Stainless Steel"),
craft_item = "technic:stainless_steel_ingot",
armor = 2.7,
heal = 10,
use = 75,
radiation = 40
}
end
local tin_ingot
if minetest.registered_items["default:tin_ingot"] then
tin_ingot = "default:tin_ingot"
end
local stats = {
lead = { name=S("Lead"), material="technic:lead_ingot", armor=1.6, heal=0, use=500, radiation=80*1.1 },
brass = { name=S("Brass"), material="technic:brass_ingot", armor=1.8, heal=0, use=650, radiation=43 },
cast = { name=S("Cast Iron"), material="technic:cast_iron_ingot", armor=2.5, heal=8, use=200, radiation=40 },
carbon = { name=S("Carbon Steel"), material="technic:carbon_steel_ingot", armor=2.7, heal=10, use=100, radiation=40 },
stainless = { name=S("Stainless Steel"), material="technic:stainless_steel_ingot", armor=2.7, heal=10, use=75, radiation=40 },
}
if minetest.get_modpath("moreores") then
stats.tin = { name=S("Tin"), material="moreores:tin_ingot", armor=1.6, heal=0, use=750, radiation=37 }
stats.silver = { name=S("Silver"), material="moreores:silver_ingot", armor=1.8, heal=6, use=650, radiation=53 }
tin_ingot = "moreores:tin_ingot"
materials.silver = {
name = S("Silver"),
craft_item = "moreores:silver_ingot",
armor = 1.8,
heal = 6,
use = 650,
radiation = 53
}
end
if tin_ingot then
materials.tin = {
name = S("Tin"),
craft_item = tin_ingot,
armor = 1.6,
heal = 0,
use = 750,
radiation = 37
}
end
local parts = {
helmet = { place="head", name=S("Helmet"), level=5, radlevel = 0.10, craft={{1,1,1},{1,0,1}} },
chestplate = { place="torso", name=S("Chestplate"), level=8, radlevel = 0.35, craft={{1,0,1},{1,1,1},{1,1,1}} },
leggings = { place="legs", name=S("Leggings"), level=7, radlevel = 0.15, craft={{1,1,1},{1,0,1},{1,0,1}} },
boots = { place="feet", name=S("Boots"), level=4, radlevel = 0.10, craft={{1,0,1},{1,0,1}} },
helmet = {
name = S("Helmet"),
place = "head",
level = 5,
radlevel = 0.10,
craft = {{1, 1, 1}, {1, 0, 1}}
},
chestplate = {
name = S("Chestplate"),
place = "torso",
level = 8,
radlevel = 0.35,
craft = {{1, 0, 1}, {1, 1, 1}, {1, 1, 1}}
},
leggings = {
name = S("Leggings"),
place = "legs",
level = 7,
radlevel = 0.15,
craft = {{1, 1, 1}, {1, 0, 1}, {1, 0, 1}}
},
boots = {
name = S("Boots"),
place = "feet",
level = 4,
radlevel = 0.10,
craft = {{1, 0, 1}, {1, 0, 1}}
}
}
if minetest.get_modpath("shields") then
parts.shield = { place="shield", name=S("Shield"), level=5, radlevel=0.00, craft={{1,1,1},{1,1,1},{0,1,0}} }
parts.shield = {
name = S("Shield"),
place = "shield",
level = 5,
radlevel = 0.00,
craft = {{1, 1, 1}, {1, 1, 1}, {0, 1, 0}}
}
end
-- Makes a craft recipe based on a template
-- template is a recipe-like table but indices are used instead of actual item names:
-- 0 means nothing, everything else is treated as an index in the materials table
local function make_recipe(template, materials)
local function make_recipe(template, material)
local recipe = {}
for j, trow in ipairs(template) do
local rrow = {}
for i, tcell in ipairs(trow) do
if tcell == 0 then
rrow[i] = ""
else
rrow[i] = materials[tcell]
end
for i, row in ipairs(template) do
recipe[i] = {}
for j, item in ipairs(row) do
recipe[i][j] = item == 0 and "" or material
end
recipe[j] = rrow
end
return recipe
end
for key, armor in pairs(stats) do
for partkey, part in pairs(parts) do
local partname = "technic_armor:"..partkey.."_"..key
minetest.register_tool(partname, {
-- Translators: @1 stands for material and @2 for part of the armor, so that you could use a conjunction if in your language part name comes first then material (e.g. in french 'Silver Boots' is translated in 'Bottes en argent' by using '@2 en @1' as translated string)
description = S("@1 @2", armor.name, part.name),
inventory_image = "technic_armor_inv_"..partkey.."_"..key..".png",
groups = {["armor_"..part.place]=math.floor(part.level*armor.armor), armor_heal=armor.heal, armor_use=armor.use, armor_radiation=math.floor(part.radlevel*armor.radiation)},
wear = 0,
for material, m in pairs(materials) do
for part, p in pairs(parts) do
local name = "technic_armor:"..part.."_"..material
armor:register_armor(name, {
description = S("@1 @2", m.name, p.name),
inventory_image = "technic_armor_inv_"..part.."_"..material..".png",
groups = {
["armor_"..p.place] = math.floor(p.level * m.armor),
armor_heal = m.heal,
armor_use = m.use,
armor_radiation = math.floor(p.radlevel * m.radiation)
}
})
minetest.register_craft({
output = partname,
recipe = make_recipe(part.craft, {armor.material}),
output = name,
recipe = make_recipe(p.craft, m.craft_item),
})
end
end

4
mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = technic_armor
description = Adds armor made from lead, brass, cast iron, carbon steel, stainless steel, tin and silver
depends = 3d_armor
optional_depends = default, moreores, technic_worldgen

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -1,41 +0,0 @@
technic_armor/textures/technic_armor_helmet_brass.png:head
technic_armor/textures/technic_armor_chestplate_brass.png:torso
technic_armor/textures/technic_armor_leggings_brass.png:legs
technic_armor/textures/technic_armor_boots_brass.png:feet
technic_armor/textures/technic_armor_shield_brass.png:shield
technic_armor/textures/technic_armor_helmet_cast.png:head
technic_armor/textures/technic_armor_chestplate_cast.png:torso
technic_armor/textures/technic_armor_leggings_cast.png:legs
technic_armor/textures/technic_armor_boots_cast.png:feet
technic_armor/textures/technic_armor_shield_cast.png:shield
technic_armor/textures/technic_armor_helmet_stainless.png:head
technic_armor/textures/technic_armor_chestplate_stainless.png:torso
technic_armor/textures/technic_armor_leggings_stainless.png:legs
technic_armor/textures/technic_armor_boots_stainless.png:feet
technic_armor/textures/technic_armor_shield_stainless.png:shield
technic_armor/textures/technic_armor_helmet_tin.png:head
technic_armor/textures/technic_armor_chestplate_tin.png:torso
technic_armor/textures/technic_armor_leggings_tin.png:legs
technic_armor/textures/technic_armor_boots_tin.png:feet
technic_armor/textures/technic_armor_shield_tin.png:shield
technic_armor/textures/technic_armor_helmet_lead.png:head
technic_armor/textures/technic_armor_chestplate_lead.png:torso
technic_armor/textures/technic_armor_leggings_lead.png:legs
technic_armor/textures/technic_armor_boots_lead.png:feet
technic_armor/textures/technic_armor_shield_lead.png:shield
technic_armor/textures/technic_armor_helmet_carbon.png:head
technic_armor/textures/technic_armor_chestplate_carbon.png:torso
technic_armor/textures/technic_armor_leggings_carbon.png:legs
technic_armor/textures/technic_armor_boots_carbon.png:feet
technic_armor/textures/technic_armor_shield_carbon.png:shield
technic_armor/textures/technic_armor_helmet_silver.png:head
technic_armor/textures/technic_armor_chestplate_silver.png:torso
technic_armor/textures/technic_armor_leggings_silver.png:legs
technic_armor/textures/technic_armor_boots_silver.png:feet
technic_armor/textures/technic_armor_shield_silver.png:shield

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 399 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 B

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 B

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 709 B

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 496 B

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 701 B

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 647 B

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 B

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 732 B

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 706 B

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 743 B

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 252 B

Some files were not shown because too many files have changed in this diff Show More