mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
[3d_armor] Update
- Also fix a script
This commit is contained in:
parent
d854e40ff9
commit
546500db7d
@ -1,7 +1,7 @@
|
|||||||
minetest.register_alias("adminboots","3d_armor:boots_admin")
|
minetest.register_alias("adminboots","3d_armor:boots_admin")
|
||||||
minetest.register_alias("adminhelmet","3d_armor:helmet_admin")
|
minetest.register_alias("adminhelmet","3d_armor:helmet_admin")
|
||||||
minetest.register_alias("adminchestplate","3d_armor:chestplate_admin")
|
minetest.register_alias("adminchestplate","3d_armor:chestplate_admin")
|
||||||
minetest.register_alias("adminlegginss","3d_armor:leggings_admin")
|
minetest.register_alias("adminleggings","3d_armor:leggings_admin")
|
||||||
|
|
||||||
minetest.register_tool("3d_armor:helmet_admin", {
|
minetest.register_tool("3d_armor:helmet_admin", {
|
||||||
description = "Admin Helmet",
|
description = "Admin Helmet",
|
||||||
|
@ -13,6 +13,7 @@ ARMOR_DROP = minetest.get_modpath("bones") ~= nil
|
|||||||
ARMOR_DESTROY = false
|
ARMOR_DESTROY = false
|
||||||
ARMOR_LEVEL_MULTIPLIER = 1
|
ARMOR_LEVEL_MULTIPLIER = 1
|
||||||
ARMOR_HEAL_MULTIPLIER = 1
|
ARMOR_HEAL_MULTIPLIER = 1
|
||||||
|
ARMOR_RADIATION_MULTIPLIER = 1
|
||||||
ARMOR_MATERIALS = {
|
ARMOR_MATERIALS = {
|
||||||
wood = "group:wood",
|
wood = "group:wood",
|
||||||
cactus = "default:cactus",
|
cactus = "default:cactus",
|
||||||
@ -33,8 +34,8 @@ ARMOR_MATERIALS = {
|
|||||||
}
|
}
|
||||||
ARMOR_FIRE_PROTECT = minetest.get_modpath("ethereal") ~= nil
|
ARMOR_FIRE_PROTECT = minetest.get_modpath("ethereal") ~= nil
|
||||||
ARMOR_FIRE_NODES = {
|
ARMOR_FIRE_NODES = {
|
||||||
{"default:lava_source", 5, 4},
|
{"default:lava_source", 5, 8},
|
||||||
{"default:lava_flowing", 5, 4},
|
{"default:lava_flowing", 5, 8},
|
||||||
{"fire:basic_flame", 3, 4},
|
{"fire:basic_flame", 3, 4},
|
||||||
{"fire:permanent_flame", 3, 4},
|
{"fire:permanent_flame", 3, 4},
|
||||||
{"ethereal:crystal_spike", 2, 1},
|
{"ethereal:crystal_spike", 2, 1},
|
||||||
@ -85,6 +86,7 @@ if minetest.get_modpath("inventory_plus") then
|
|||||||
.."label[5,1;Level: armor_level]"
|
.."label[5,1;Level: armor_level]"
|
||||||
.."label[5,1.5;Heal: armor_heal]"
|
.."label[5,1.5;Heal: armor_heal]"
|
||||||
.."label[5,2;Fire: armor_fire]"
|
.."label[5,2;Fire: armor_fire]"
|
||||||
|
.."label[5,2.5;Radiation: armor_radiation]"
|
||||||
.."list[current_player;main;0,4.5;8,4;]"
|
.."list[current_player;main;0,4.5;8,4;]"
|
||||||
if minetest.get_modpath("crafting") then
|
if minetest.get_modpath("crafting") then
|
||||||
inventory_plus.get_formspec = function(player, page)
|
inventory_plus.get_formspec = function(player, page)
|
||||||
@ -109,6 +111,7 @@ elseif minetest.get_modpath("unified_inventory") then
|
|||||||
.."label[5.0,"..(fy + 0.0)..";Level: "..armor.def[name].level.."]"
|
.."label[5.0,"..(fy + 0.0)..";Level: "..armor.def[name].level.."]"
|
||||||
.."label[5.0,"..(fy + 0.5)..";Heal: "..armor.def[name].heal.."]"
|
.."label[5.0,"..(fy + 0.5)..";Heal: "..armor.def[name].heal.."]"
|
||||||
.."label[5.0,"..(fy + 1.0)..";Fire: "..armor.def[name].fire.."]"
|
.."label[5.0,"..(fy + 1.0)..";Fire: "..armor.def[name].fire.."]"
|
||||||
|
.."label[5.0,"..(fy + 1.5)..";Radiation: "..armor.def[name].radiation.."]"
|
||||||
.."listring[current_player;main]"
|
.."listring[current_player;main]"
|
||||||
.."listring[detached:"..name.."_armor;armor]"
|
.."listring[detached:"..name.."_armor;armor]"
|
||||||
return {formspec=formspec}
|
return {formspec=formspec}
|
||||||
@ -157,6 +160,7 @@ armor.set_player_armor = function(self, player)
|
|||||||
local armor_heal = 0
|
local armor_heal = 0
|
||||||
local armor_fire = 0
|
local armor_fire = 0
|
||||||
local armor_water = 0
|
local armor_water = 0
|
||||||
|
local armor_radiation = 0
|
||||||
local state = 0
|
local state = 0
|
||||||
local items = 0
|
local items = 0
|
||||||
local elements = {}
|
local elements = {}
|
||||||
@ -188,10 +192,10 @@ armor.set_player_armor = function(self, player)
|
|||||||
armor_level = armor_level + level
|
armor_level = armor_level + level
|
||||||
state = state + stack:get_wear()
|
state = state + stack:get_wear()
|
||||||
items = items + 1
|
items = items + 1
|
||||||
local heal = def.groups["armor_heal"] or 0
|
armor_heal = armor_heal + (def.groups["armor_heal"] or 0)
|
||||||
armor_heal = armor_heal + heal
|
armor_fire = armor_fire + (def.groups["armor_fire"] or 0)
|
||||||
local fire = def.groups["armor_fire"] or 0
|
armor_water = armor_water + (def.groups["armor_water"] or 0)
|
||||||
armor_fire = armor_fire + fire
|
armor_radiation = armor_radiation + (def.groups["armor_radiation"] or 0)
|
||||||
for kk,vv in ipairs(self.physics) do
|
for kk,vv in ipairs(self.physics) do
|
||||||
local o_value = def.groups["physics_"..vv]
|
local o_value = def.groups["physics_"..vv]
|
||||||
if o_value then
|
if o_value then
|
||||||
@ -224,6 +228,7 @@ armor.set_player_armor = function(self, player)
|
|||||||
end
|
end
|
||||||
armor_level = armor_level * ARMOR_LEVEL_MULTIPLIER
|
armor_level = armor_level * ARMOR_LEVEL_MULTIPLIER
|
||||||
armor_heal = armor_heal * ARMOR_HEAL_MULTIPLIER
|
armor_heal = armor_heal * ARMOR_HEAL_MULTIPLIER
|
||||||
|
armor_radiation = armor_radiation * ARMOR_RADIATION_MULTIPLIER
|
||||||
if #textures > 0 then
|
if #textures > 0 then
|
||||||
armor_texture = table.concat(textures, "^")
|
armor_texture = table.concat(textures, "^")
|
||||||
end
|
end
|
||||||
@ -231,6 +236,7 @@ armor.set_player_armor = function(self, player)
|
|||||||
if armor_level > 0 then
|
if armor_level > 0 then
|
||||||
armor_groups.level = math.floor(armor_level / 20)
|
armor_groups.level = math.floor(armor_level / 20)
|
||||||
armor_groups.fleshy = 100 - armor_level
|
armor_groups.fleshy = 100 - armor_level
|
||||||
|
armor_groups.radiation = 100 - armor_radiation
|
||||||
end
|
end
|
||||||
player:set_armor_groups(armor_groups)
|
player:set_armor_groups(armor_groups)
|
||||||
player:set_physics_override(physics_o)
|
player:set_physics_override(physics_o)
|
||||||
@ -245,6 +251,7 @@ armor.set_player_armor = function(self, player)
|
|||||||
self.def[name].gravity = physics_o.gravity
|
self.def[name].gravity = physics_o.gravity
|
||||||
self.def[name].fire = armor_fire
|
self.def[name].fire = armor_fire
|
||||||
self.def[name].water = armor_water
|
self.def[name].water = armor_water
|
||||||
|
self.def[name].radiation = armor_radiation
|
||||||
self:update_player_visuals(player)
|
self:update_player_visuals(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -288,6 +295,7 @@ armor.get_armor_formspec = function(self, name)
|
|||||||
formspec = formspec:gsub("armor_level", armor.def[name].level)
|
formspec = formspec:gsub("armor_level", armor.def[name].level)
|
||||||
formspec = formspec:gsub("armor_heal", armor.def[name].heal)
|
formspec = formspec:gsub("armor_heal", armor.def[name].heal)
|
||||||
formspec = formspec:gsub("armor_fire", armor.def[name].fire)
|
formspec = formspec:gsub("armor_fire", armor.def[name].fire)
|
||||||
|
formspec = formspec:gsub("armor_radiation", armor.def[name].radiation)
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -483,6 +491,7 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
gravity = 1,
|
gravity = 1,
|
||||||
fire = 0,
|
fire = 0,
|
||||||
water = 0,
|
water = 0,
|
||||||
|
radiation = 0,
|
||||||
}
|
}
|
||||||
armor.textures[name] = {
|
armor.textures[name] = {
|
||||||
skin = armor.default_skin..".png",
|
skin = armor.default_skin..".png",
|
||||||
|
@ -16,10 +16,9 @@ local armor_stand_formspec = "size[8,7]" ..
|
|||||||
|
|
||||||
local elements = {"head", "torso", "legs", "feet"}
|
local elements = {"head", "torso", "legs", "feet"}
|
||||||
|
|
||||||
local function update_entity(pos)
|
local function get_stand_object(pos)
|
||||||
local object = nil
|
local object = nil
|
||||||
local node = minetest.get_node(pos)
|
local objects = minetest.get_objects_inside_radius(pos, 0.5) or {}
|
||||||
local objects = minetest.get_objects_inside_radius(pos, 1) or {}
|
|
||||||
for _, obj in pairs(objects) do
|
for _, obj in pairs(objects) do
|
||||||
local ent = obj:get_luaentity()
|
local ent = obj:get_luaentity()
|
||||||
if ent then
|
if ent then
|
||||||
@ -33,8 +32,14 @@ local function update_entity(pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return object
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update_entity(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local object = get_stand_object(pos)
|
||||||
if object then
|
if object then
|
||||||
if node.name ~= "3d_armor_stand:armor_stand" then
|
if not string.find(node.name, "3d_armor_stand:") then
|
||||||
object:remove()
|
object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -53,8 +58,11 @@ local function update_entity(pos)
|
|||||||
if stack:get_count() == 1 then
|
if stack:get_count() == 1 then
|
||||||
local item = stack:get_name() or ""
|
local item = stack:get_name() or ""
|
||||||
local def = stack:get_definition() or {}
|
local def = stack:get_definition() or {}
|
||||||
local texture = def.texture or item:gsub("%:", "_")
|
local groups = def.groups or {}
|
||||||
table.insert(textures, texture..".png")
|
if groups["armor_"..element] then
|
||||||
|
local texture = def.texture or item:gsub("%:", "_")
|
||||||
|
table.insert(textures, texture..".png")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -76,6 +84,20 @@ local function update_entity(pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function has_locked_armor_stand_privilege(meta, player)
|
||||||
|
local name = ""
|
||||||
|
if player then
|
||||||
|
if minetest.check_player_privs(player, "protection_bypass") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
name = player:get_player_name()
|
||||||
|
end
|
||||||
|
if name ~= meta:get_string("owner") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("3d_armor_stand:armor_stand", {
|
minetest.register_node("3d_armor_stand:armor_stand", {
|
||||||
description = "Armor stand",
|
description = "Armor stand",
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
@ -123,15 +145,107 @@ minetest.register_node("3d_armor_stand:armor_stand", {
|
|||||||
allow_metadata_inventory_move = function(pos)
|
allow_metadata_inventory_move = function(pos)
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_put = function(pos)
|
on_metadata_inventory_put = function(pos)
|
||||||
update_entity(pos)
|
update_entity(pos)
|
||||||
end,
|
end,
|
||||||
on_metadata_inventory_take = function(pos)
|
on_metadata_inventory_take = function(pos)
|
||||||
update_entity(pos)
|
update_entity(pos)
|
||||||
end,
|
end,
|
||||||
after_destruct = function(pos)
|
after_destruct = function(pos)
|
||||||
update_entity(pos)
|
update_entity(pos)
|
||||||
end,
|
end,
|
||||||
|
on_blast = function(pos)
|
||||||
|
local object = get_stand_object(pos)
|
||||||
|
if object then
|
||||||
|
object:remove()
|
||||||
|
end
|
||||||
|
minetest.after(1, function(pos)
|
||||||
|
update_entity(pos)
|
||||||
|
end, pos)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("3d_armor_stand:locked_armor_stand", {
|
||||||
|
description = "Locked Armor stand",
|
||||||
|
drawtype = "mesh",
|
||||||
|
mesh = "3d_armor_stand.obj",
|
||||||
|
tiles = {"default_wood.png", "default_steel_block.png"},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
walkable = false,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5,-0.5,-0.5, 0.5,1.4,0.5}
|
||||||
|
},
|
||||||
|
groups = {choppy=2, oddly_breakable_by_hand=2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", armor_stand_formspec)
|
||||||
|
meta:set_string("infotext", "Armor Stand")
|
||||||
|
meta:set_string("owner", "")
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
for _, element in pairs(elements) do
|
||||||
|
inv:set_size("armor_"..element, 1)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
can_dig = function(pos, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
for _, element in pairs(elements) do
|
||||||
|
if not inv:is_empty("armor_"..element) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
minetest.add_entity(pos, "3d_armor_stand:armor_entity")
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("owner", placer:get_player_name() or "")
|
||||||
|
meta:set_string("infotext", "Armor Stand (owned by " ..
|
||||||
|
meta:get_string("owner") .. ")")
|
||||||
|
end,
|
||||||
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if not has_locked_armor_stand_privilege(meta, player) then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
local def = stack:get_definition() or {}
|
||||||
|
local groups = def.groups or {}
|
||||||
|
if groups[listname] then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if not has_locked_armor_stand_privilege(meta, player) then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return stack:get_count()
|
||||||
|
end,
|
||||||
|
allow_metadata_inventory_move = function(pos)
|
||||||
|
return 0
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_put = function(pos)
|
||||||
|
update_entity(pos)
|
||||||
|
end,
|
||||||
|
on_metadata_inventory_take = function(pos)
|
||||||
|
update_entity(pos)
|
||||||
|
end,
|
||||||
|
after_destruct = function(pos)
|
||||||
|
update_entity(pos)
|
||||||
|
end,
|
||||||
|
on_blast = function(pos)
|
||||||
|
local object = get_stand_object(pos)
|
||||||
|
if object then
|
||||||
|
object:remove()
|
||||||
|
end
|
||||||
|
minetest.after(1, function(pos)
|
||||||
|
update_entity(pos)
|
||||||
|
end, pos)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_entity("3d_armor_stand:armor_entity", {
|
minetest.register_entity("3d_armor_stand:armor_entity", {
|
||||||
@ -141,9 +255,31 @@ minetest.register_entity("3d_armor_stand:armor_entity", {
|
|||||||
visual_size = {x=1, y=1},
|
visual_size = {x=1, y=1},
|
||||||
collisionbox = {-0.1,-0.4,-0.1, 0.1,1.3,0.1},
|
collisionbox = {-0.1,-0.4,-0.1, 0.1,1.3,0.1},
|
||||||
textures = {"3d_armor_trans.png"},
|
textures = {"3d_armor_trans.png"},
|
||||||
|
pos = nil,
|
||||||
|
timer = 0,
|
||||||
on_activate = function(self)
|
on_activate = function(self)
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
update_entity(pos)
|
if pos then
|
||||||
|
self.pos = vector.round(pos)
|
||||||
|
update_entity(pos)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
if not self.pos then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.timer = self.timer + dtime
|
||||||
|
if self.timer > 1 then
|
||||||
|
self.timer = 0
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
if pos then
|
||||||
|
if vector.equals(vector.round(pos), self.pos) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
update_entity(self.pos)
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -156,3 +292,10 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "3d_armor_stand:locked_armor_stand",
|
||||||
|
recipe = {
|
||||||
|
{"3d_armor_stand:armor_stand", "default:steel_ingot"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
@ -47,10 +47,18 @@ If you do not want shields then simply remove the shields folder from the modpac
|
|||||||
[mod] Technic Armor [technic_armor]
|
[mod] Technic Armor [technic_armor]
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
Depends: 3d_armor
|
Depends: 3d_armor, technic_worldgen
|
||||||
|
|
||||||
Adds tin, silver and technic materials to 3d_armor.
|
Adds tin, silver and technic materials to 3d_armor.
|
||||||
Requires technic mod to be installed for craft registration.
|
Requires technic (technic_worldgen at least) mod.
|
||||||
|
|
||||||
|
[mod] Hazmat Suit [hazmat_suit]
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
Depends: 3d_armor, technic
|
||||||
|
|
||||||
|
Adds hazmat suit to 3d_armor. It protects rather well from fire (if enabled in configuration) and radiation, and it has built-in oxygen supply.
|
||||||
|
Requires technic mod.
|
||||||
|
|
||||||
[mod] 3d Armor Stand [3d_armor_stand]
|
[mod] 3d Armor Stand [3d_armor_stand]
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
@ -58,4 +66,3 @@ Requires technic mod to be installed for craft registration.
|
|||||||
Depends: 3d_armor
|
Depends: 3d_armor
|
||||||
|
|
||||||
Adds a chest-like armor stand for armor storage and display.
|
Adds a chest-like armor stand for armor storage and display.
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
===================================
|
===================================
|
||||||
|
|
||||||
Adds tin, silver and technic materials to 3d_armor.
|
Adds tin, silver and technic materials to 3d_armor.
|
||||||
Requires technic mod to be installed for craft registration.
|
Requires technic (technic_worldgen at least) mod.
|
||||||
|
|
||||||
Depends: 3d_armor
|
Depends: 3d_armor, technic_worldgen
|
||||||
|
|
||||||
Source code and textures by poet.nohit
|
Source code and textures by poet.nohit and numzero
|
||||||
|
2
mods/3d_armor/technic_armor/depends.txt
Executable file → Normal file
2
mods/3d_armor/technic_armor/depends.txt
Executable file → Normal file
@ -1 +1,3 @@
|
|||||||
3d_armor
|
3d_armor
|
||||||
|
technic_worldgen
|
||||||
|
moreores?
|
||||||
|
@ -1,99 +1,56 @@
|
|||||||
if minetest.get_modpath("technic") then
|
local stats = {
|
||||||
local stats = {
|
lead = { name="Lead", material="technic:lead_ingot", armor=1.6, heal=0, use=500, radiation=80*1.1 },
|
||||||
brass = { name="Brass", armor=1.8, heal=0, use=650 },
|
brass = { name="Brass", material="technic:brass_ingot", armor=1.8, heal=0, use=650, radiation=43 },
|
||||||
cast = { name="Cast Iron", armor=2.5, heal=0, use=200 },
|
cast = { name="Cast Iron", material="technic:cast_iron_ingot", armor=2.5, heal=8, use=200, radiation=40 },
|
||||||
carbon = { name="Carbon Steel", armor=2.7, heal=0, use=100 },
|
carbon = { name="Carbon Steel", material="technic:carbon_steel_ingot", armor=2.7, heal=10, use=100, radiation=40 },
|
||||||
stainless = { name="Stainless Steel", armor=2.7, heal=0, use=75 },
|
stainless = { name="Stainless Steel", material="technic:stainless_steel_ingot", armor=2.7, heal=10, use=75, radiation=40 },
|
||||||
}
|
}
|
||||||
local mats = {
|
if minetest.get_modpath("moreores") then
|
||||||
brass="technic:brass_ingot",
|
stats.tin = { name="Tin", material="moreores:tin_ingot", armor=1.6, heal=0, use=750, radiation=37 }
|
||||||
cast="technic:cast_iron_ingot",
|
stats.silver = { name="Silver", material="moreores:silver_ingot", armor=1.8, heal=6, use=650, radiation=53 }
|
||||||
carbon="technic:carbon_steel_ingot",
|
|
||||||
stainless="technic:stainless_steel_ingot",
|
|
||||||
}
|
|
||||||
stats.tin = { name="Tin", armor=1.6, heal=0, use=750 }
|
|
||||||
stats.silver = { name="Silver", armor=1.8, heal=0, use=650 }
|
|
||||||
mats.tin = "default:tin_ingot"
|
|
||||||
mats.silver = "default:silver_ingot"
|
|
||||||
|
|
||||||
for k, v in pairs(stats) do
|
|
||||||
minetest.register_tool("technic_armor:helmet_"..k, {
|
|
||||||
description = v.name.." Helmet",
|
|
||||||
inventory_image = "technic_armor_inv_helmet_"..k..".png",
|
|
||||||
groups = {armor_head=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use},
|
|
||||||
wear = 0,
|
|
||||||
})
|
|
||||||
minetest.register_tool("technic_armor:chestplate_"..k, {
|
|
||||||
description = v.name.." Chestplate",
|
|
||||||
inventory_image = "technic_armor_inv_chestplate_"..k..".png",
|
|
||||||
groups = {armor_torso=math.floor(8*v.armor), armor_heal=v.heal, armor_use=v.use},
|
|
||||||
wear = 0,
|
|
||||||
})
|
|
||||||
minetest.register_tool("technic_armor:leggings_"..k, {
|
|
||||||
description = v.name.." Leggings",
|
|
||||||
inventory_image = "technic_armor_inv_leggings_"..k..".png",
|
|
||||||
groups = {armor_legs=math.floor(7*v.armor), armor_heal=v.heal, armor_use=v.use},
|
|
||||||
wear = 0,
|
|
||||||
})
|
|
||||||
minetest.register_tool("technic_armor:boots_"..k, {
|
|
||||||
description = v.name.." Boots",
|
|
||||||
inventory_image = "technic_armor_inv_boots_"..k..".png",
|
|
||||||
groups = {armor_feet=math.floor(4*v.armor), armor_heal=v.heal, armor_use=v.use},
|
|
||||||
wear = 0,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
for k, v in pairs(mats) do
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "technic_armor:helmet_"..k,
|
|
||||||
recipe = {
|
|
||||||
{v, v, v},
|
|
||||||
{v, "", v},
|
|
||||||
{"", "", ""},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "technic_armor:chestplate_"..k,
|
|
||||||
recipe = {
|
|
||||||
{v, "", v},
|
|
||||||
{v, v, v},
|
|
||||||
{v, v, v},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "technic_armor:leggings_"..k,
|
|
||||||
recipe = {
|
|
||||||
{v, v, v},
|
|
||||||
{v, "", v},
|
|
||||||
{v, "", v},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "technic_armor:boots_"..k,
|
|
||||||
recipe = {
|
|
||||||
{v, "", v},
|
|
||||||
{v, "", v},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_modpath("shields") then
|
|
||||||
for k, v in pairs(stats) do
|
|
||||||
minetest.register_tool("technic_armor:shield_"..k, {
|
|
||||||
description = v.name.." Shield",
|
|
||||||
inventory_image = "technic_armor_inv_shield_"..k..".png",
|
|
||||||
groups = {armor_shield=math.floor(5*v.armor), armor_heal=v.heal, armor_use=v.use},
|
|
||||||
wear = 0,
|
|
||||||
})
|
|
||||||
local m = mats[k]
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "technic_armor:shield_"..k,
|
|
||||||
recipe = {
|
|
||||||
{m, m, m},
|
|
||||||
{m, m, m},
|
|
||||||
{"", m, ""},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local parts = {
|
||||||
|
helmet = { place="head", name="Helmet", level=5, radlevel = 0.10, craft={{1,1,1},{1,0,1}} },
|
||||||
|
chestplate = { place="torso", name="Chestplate", level=8, radlevel = 0.35, craft={{1,0,1},{1,1,1},{1,1,1}} },
|
||||||
|
leggings = { place="legs", name="Leggings", level=7, radlevel = 0.15, craft={{1,1,1},{1,0,1},{1,0,1}} },
|
||||||
|
boots = { place="feet", name="Boots", level=4, radlevel = 0.10, craft={{1,0,1},{1,0,1}} },
|
||||||
|
}
|
||||||
|
if minetest.get_modpath("shields") then
|
||||||
|
parts.shield = { place="shield", name="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 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
|
||||||
|
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, {
|
||||||
|
description = 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,
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = partname,
|
||||||
|
recipe = make_recipe(part.craft, {armor.material}),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
# Go to repo root
|
# Go to repo root
|
||||||
mydir="`dirname "$0"`"
|
mydir="`dirname "$0"`"
|
||||||
test -d "$mydir" && cd "$mydir/../../"
|
test -d "$mydir" && cd "$mydir/../../../"
|
||||||
|
|
||||||
# Get all lua file's names
|
# Get all lua file's names
|
||||||
luafiles=$(mucro '.lua'$ -r . -b)
|
luafiles=$(find -type f -name "*.lua")
|
||||||
sed -i 's/[ \t]*$//' $luafiles
|
sed -i 's/[ \t]*$//' $luafiles
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
|
Loading…
Reference in New Issue
Block a user