Radiation protection support added

This commit is contained in:
number Zero 2016-04-10 17:56:33 +03:00 committed by stujones11
parent ddd7f3786c
commit 9cc2f3db02
33 changed files with 224 additions and 107 deletions

@ -55,3 +55,7 @@ ARMOR_LEVEL_MULTIPLIER = 1
-- eg: ARMOR_HEAL_MULTIPLIER = 0 will disable healing altogether.
ARMOR_HEAL_MULTIPLIER = 1
-- You can use this to increase or decrease overall armor radiation protection,
-- eg: ARMOR_RADIATION_MULTIPLIER = 0 will completely disable radiation protection.
-- Note: patched technic mod is required
ARMOR_RADIATION_MULTIPLIER = 1

@ -6,6 +6,7 @@ ARMOR_DROP = minetest.get_modpath("bones") ~= nil
ARMOR_DESTROY = false
ARMOR_LEVEL_MULTIPLIER = 1
ARMOR_HEAL_MULTIPLIER = 1
ARMOR_RADIATION_MULTIPLIER = 1
ARMOR_MATERIALS = {
wood = "group:wood",
cactus = "default:cactus",
@ -18,8 +19,8 @@ ARMOR_MATERIALS = {
}
ARMOR_FIRE_PROTECT = minetest.get_modpath("ethereal") ~= nil
ARMOR_FIRE_NODES = {
{"default:lava_source", 5, 4},
{"default:lava_flowing", 5, 4},
{"default:lava_source", 5, 8},
{"default:lava_flowing", 5, 8},
{"fire:basic_flame", 3, 4},
{"fire:permanent_flame", 3, 4},
{"ethereal:crystal_spike", 2, 1},
@ -73,6 +74,7 @@ if minetest.get_modpath("inventory_plus") then
.."label[5,1;Level: armor_level]"
.."label[5,1.5;Heal: armor_heal]"
.."label[5,2;Fire: armor_fire]"
.."label[5,2.5;Radiation: armor_radiation]"
.."list[current_player;main;0,4.5;8,4;]"
if minetest.get_modpath("crafting") then
inventory_plus.get_formspec = function(player, page)
@ -95,6 +97,7 @@ elseif minetest.get_modpath("unified_inventory") then
.."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 + 1.0)..";Fire: "..armor.def[name].fire.."]"
.."label[5.0,"..(fy + 1.5)..";Radiation: "..armor.def[name].radiation.."]"
.."listring[current_player;main]"
.."listring[detached:"..name.."_armor;armor]"
return {formspec=formspec}
@ -143,6 +146,7 @@ armor.set_player_armor = function(self, player)
local armor_heal = 0
local armor_fire = 0
local armor_water = 0
local armor_radiation = 0
local state = 0
local items = 0
local elements = {}
@ -171,6 +175,7 @@ armor.set_player_armor = function(self, player)
armor_heal = armor_heal + (def.groups["armor_heal"] or 0)
armor_fire = armor_fire + (def.groups["armor_fire"] or 0)
armor_water = armor_water + (def.groups["armor_water"] or 0)
armor_radiation = armor_radiation + (def.groups["armor_radiation"] or 0)
for kk,vv in ipairs(self.physics) do
local o_value = def.groups["physics_"..vv]
if o_value then
@ -199,6 +204,7 @@ armor.set_player_armor = function(self, player)
end
armor_level = armor_level * ARMOR_LEVEL_MULTIPLIER
armor_heal = armor_heal * ARMOR_HEAL_MULTIPLIER
armor_radiation = armor_radiation * ARMOR_RADIATION_MULTIPLIER
if #textures > 0 then
armor_texture = table.concat(textures, "^")
end
@ -206,6 +212,7 @@ armor.set_player_armor = function(self, player)
if armor_level > 0 then
armor_groups.level = math.floor(armor_level / 20)
armor_groups.fleshy = 100 - armor_level
armor_groups.radiation = 100 - armor_radiation
end
player:set_armor_groups(armor_groups)
player:set_physics_override(physics_o)
@ -220,6 +227,7 @@ armor.set_player_armor = function(self, player)
self.def[name].gravity = physics_o.gravity
self.def[name].fire = armor_fire
self.def[name].water = armor_water
self.def[name].radiation = armor_radiation
self:update_player_visuals(player)
end
@ -260,6 +268,7 @@ armor.get_armor_formspec = function(self, name)
formspec = formspec:gsub("armor_level", armor.def[name].level)
formspec = formspec:gsub("armor_heal", armor.def[name].heal)
formspec = formspec:gsub("armor_fire", armor.def[name].fire)
formspec = formspec:gsub("armor_radiation", armor.def[name].radiation)
return formspec
end
@ -408,6 +417,7 @@ minetest.register_on_joinplayer(function(player)
gravity = 1,
fire = 0,
water = 0,
radiation = 0,
}
armor.textures[name] = {
skin = armor.default_skin..".png",

@ -47,10 +47,18 @@ If you do not want shields then simply remove the shields folder from the modpac
[mod] Technic Armor [technic_armor]
-----------------------------------
Depends: 3d_armor
Depends: 3d_armor, technic_worldgen
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]
-------------------------------------
@ -58,4 +66,3 @@ Requires technic mod to be installed for craft registration.
Depends: 3d_armor
Adds a chest-like armor stand for armor storage and display.

10
hazmat_suit/README.txt Normal file

@ -0,0 +1,10 @@
[mod] Hazmat Suit [hazmat_suit]
===================================
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.
Depends: 3d_armor, technic
Source code by numZero
Textures by HybridDog and numZero

2
hazmat_suit/depends.txt Normal file

@ -0,0 +1,2 @@
3d_armor
technic

@ -0,0 +1 @@
Adds hazmat suit (protects from water, fire and radiation) to 3d_armor.

126
hazmat_suit/init.lua Normal file

@ -0,0 +1,126 @@
local part_count = 4
local level = 35
local heal = 20
local use = 1000
local fire = 4
local water = 1
local radiation = 50
if minetest.get_modpath("shields") then
level = level / 0.9
end
if count == #armor.elements then
level = level / 1.1
end
level = math.floor(level / part_count)
heal = math.floor(heal / part_count)
fire = math.floor(fire / part_count)
radiation = math.floor(radiation / part_count)
minetest.register_craftitem("hazmat_suit:helmet_hazmat", {
description = "Hazmat Helmet",
inventory_image = "hazmat_suit_inv_helmet_hazmat.png",
stack_max = 1,
})
minetest.register_craftitem("hazmat_suit:chestplate_hazmat", {
description = "Hazmat Chestplate",
inventory_image = "hazmat_suit_inv_chestplate_hazmat.png",
stack_max = 1,
})
minetest.register_craftitem("hazmat_suit:sleeve_hazmat", {
description = "Hazmat Sleeve",
inventory_image = "hazmat_suit_inv_sleeve_hazmat.png",
stack_max = 1,
})
minetest.register_craftitem("hazmat_suit:leggings_hazmat", {
description = "Hazmat Leggins",
inventory_image = "hazmat_suit_inv_leggings_hazmat.png",
stack_max = 1,
})
minetest.register_craftitem("hazmat_suit:boots_hazmat", {
description = "Hazmat Boots",
inventory_image = "hazmat_suit_inv_boots_hazmat.png",
stack_max = 1,
})
minetest.register_tool("hazmat_suit:suit_hazmat", {
description = "Hazmat Suit",
inventory_image = "hazmat_suit_inv_suit_hazmat.png",
groups = {
armor_head = level,
armor_torso = level,
armor_legs = level,
armor_feet = level,
armor_heal = heal,
armor_use = use,
armor_fire = fire,
armor_water = water,
armor_radiation = radiation,
},
wear = 0,
})
minetest.register_craft({
output = "hazmat_suit:helmet_hazmat",
recipe = {
{"", "technic:stainless_steel_ingot", ""},
{"technic:stainless_steel_ingot", "default:glass", "technic:stainless_steel_ingot"},
{"technic:rubber", "technic:rubber", "technic:rubber"},
},
})
minetest.register_craft({
output = "hazmat_suit:chestplate_hazmat",
recipe = {
{"technic:lead_ingot", "dye:yellow", "technic:lead_ingot"},
{"technic:stainless_steel_ingot", "technic:lead_ingot", "technic:stainless_steel_ingot"},
{"technic:lead_ingot", "technic:stainless_steel_ingot", "technic:lead_ingot"},
},
})
minetest.register_craft({
output = "hazmat_suit:sleeve_hazmat",
recipe = {
{"technic:rubber", "dye:yellow"},
{"", "technic:stainless_steel_ingot"},
{"", "technic:rubber"},
},
})
minetest.register_craft({
output = "hazmat_suit:leggings_hazmat",
recipe = {
{"technic:rubber", "technic:lead_ingot", "technic:rubber"},
{"technic:stainless_steel_ingot", "technic:rubber", "technic:stainless_steel_ingot"},
{"technic:lead_ingot", "", "technic:lead_ingot"},
},
})
minetest.register_craft({
output = "hazmat_suit:boots_hazmat",
recipe = {
{"", "", ""},
{"technic:rubber", "", "technic:rubber"},
{"technic:stainless_steel_ingot", "", "technic:stainless_steel_ingot"},
},
})
minetest.register_craft({
output = "hazmat_suit:suit_hazmat",
type = "shapeless",
recipe = {
"hazmat_suit:helmet_hazmat",
"hazmat_suit:chestplate_hazmat",
"hazmat_suit:leggings_hazmat",
"hazmat_suit:boots_hazmat",
"hazmat_suit:sleeve_hazmat",
"hazmat_suit:sleeve_hazmat",
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

@ -2,8 +2,8 @@
===================================
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

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

@ -1,101 +1,56 @@
if minetest.get_modpath("technic") then
local stats = {
brass = { name="Brass", armor=1.8, heal=0, use=650 },
cast = { name="Cast Iron", armor=2.5, heal=8, use=200 },
carbon = { name="Carbon Steel", armor=2.7, heal=10, use=100 },
stainless = { name="Stainless Steel", armor=2.7, heal=10, use=75 },
}
local mats = {
brass="technic:brass_ingot",
cast="technic:cast_iron_ingot",
carbon="technic:carbon_steel_ingot",
stainless="technic:stainless_steel_ingot",
lead = { name="Lead", material="technic:lead_ingot", armor=1.6, heal=0, use=500, radiation=80*1.1 },
brass = { name="Brass", material="technic:brass_ingot", armor=1.8, heal=0, use=650, radiation=43 },
cast = { name="Cast Iron", material="technic:cast_iron_ingot", armor=2.5, heal=8, use=200, radiation=40 },
carbon = { name="Carbon Steel", material="technic:carbon_steel_ingot", armor=2.7, heal=10, use=100, radiation=40 },
stainless = { name="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="Tin", armor=1.6, heal=0, use=750 }
stats.silver = { name="Silver", armor=1.8, heal=6, use=650 }
mats.tin = "moreores:tin_ingot"
mats.silver = "moreores:silver_ingot"
end
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},
},
})
stats.tin = { name="Tin", material="moreores:tin_ingot", armor=1.6, heal=0, use=750, radiation=37 }
stats.silver = { name="Silver", material="moreores:silver_ingot", armor=1.8, heal=6, use=650, radiation=53 }
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
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
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB