diff --git a/mods/ITEMS/minetest-3d_armor/3d_armor/README.txt b/mods/ITEMS/minetest-3d_armor/3d_armor/README.txt index 224f81c9c2..8f44f37500 100644 --- a/mods/ITEMS/minetest-3d_armor/3d_armor/README.txt +++ b/mods/ITEMS/minetest-3d_armor/3d_armor/README.txt @@ -1,24 +1,11 @@ [mod] Visible Player Armor [3d_armor] ===================================== - -Depends: default - -Recommends: inventory_plus or unified_inventory (use only one) +MineClone 2 edition +------------------------------------- Adds craftable armor that is visible to other players. Each armor item worn contributes to -a player's armor group level making them less vulnerable to weapons. +a player's armor group level making them less vulnerable to some forms of damage. -Armor takes damage when a player is hurt but also offers a percentage chance of healing. -Overall level is boosted by 10% when wearing a full matching set. - -Fire protection added by TenPlus1 when using crystal armor if Ethereal mod active, level 1 -protects against torches, level 2 for crystal spike, level 3 for fire, level 5 for lava. - -Configuration -------------- - -Armor can be configured by adding a file called armor.conf in 3d_armor mod and/or world directory. -see armor.conf.example for all available options. - -Note: worldpath config settings override any settings made in the mod's directory. +Armor takes damage when a player is hurt. +This mod is based on 3D Armor mod by stu. diff --git a/mods/ITEMS/minetest-3d_armor/3d_armor/armor.conf b/mods/ITEMS/minetest-3d_armor/3d_armor/armor.conf deleted file mode 100644 index 3d22006f50..0000000000 --- a/mods/ITEMS/minetest-3d_armor/3d_armor/armor.conf +++ /dev/null @@ -1,23 +0,0 @@ --- Armor Configuration -ARMOR_MATERIALS = { - leather = "mcl_mobitems:leather", - iron = "mcl_core:iron_ingot", - chain = nil, - gold = "mcl_core:gold_ingot", - diamond = "mcl_core:diamond", -} - -ARMOR_FIRE_PROTECT = false - -ARMOR_FIRE_NODES = { - {"default:lava_source", 5, 4}, - {"default:lava_flowing", 5, 4}, - {"mcl_fire:fire", 3, 4}, - {"mcl_fire:eternal_fire", 3, 4}, -} - --- Armor drop/destroy disabled. Armor dropping is handled in mcl_death -ARMOR_DROP = false -ARMOR_DESTROY = false -ARMOR_HEAL_MULTIPLIER = 0 -ARMOR_RADIATION_MULTIPLIER = 0 diff --git a/mods/ITEMS/minetest-3d_armor/3d_armor/armor.conf.example b/mods/ITEMS/minetest-3d_armor/3d_armor/armor.conf.example deleted file mode 100644 index 75e072d9f8..0000000000 --- a/mods/ITEMS/minetest-3d_armor/3d_armor/armor.conf.example +++ /dev/null @@ -1,61 +0,0 @@ --- Armor Configuration (defaults) - --- You can remove any unwanted armor materials from this table. --- Note that existing armor that is removed will show up as an unknown item. -ARMOR_MATERIALS = { - wood = "group:wood", - cactus = "default:cactus", - steel = "default:steel_ingot", - bronze = "default:bronze_ingot", - diamond = "default:diamond", - gold = "default:gold_ingot", - mithril = "moreores:mithril_ingot", - crystal = "ethereal:crystal_ingot", -} - --- Enable fire protection (defaults true if using ethereal mod) -ARMOR_FIRE_PROTECT = false - --- Fire protection nodes, (name, protection level, damage) -ARMOR_FIRE_NODES = { - {"default:lava_source", 5, 4}, - {"default:lava_flowing", 5, 4}, - {"fire:basic_flame", 3, 4}, - {"fire:permanent_flame", 3, 4}, - {"ethereal:crystal_spike", 2, 1}, - {"ethereal:fire_flower", 2, 1}, - {"default:torch", 1, 1}, -} - --- Increase this if you get initialization glitches when a player first joins. -ARMOR_INIT_DELAY = 1 - --- Number of initialization attempts. --- Use in conjunction with ARMOR_INIT_DELAY if initialization problems persist. -ARMOR_INIT_TIMES = 1 - --- Increase this if armor is not getting into bones due to server lag. -ARMOR_BONES_DELAY = 1 - --- How often player armor/wield items are updated. -ARMOR_UPDATE_TIME = 1 - --- Drop armor when a player dies. --- Uses bones mod if present, otherwise items are dropped around the player. -ARMOR_DROP = true - --- Pulverise armor when a player dies, overrides ARMOR_DROP. -ARMOR_DESTROY = false - --- You can use this to increase or decrease overall armor effectiveness, --- eg: ARMOR_LEVEL_MULTIPLIER = 0.5 will reduce armor level by half. -ARMOR_LEVEL_MULTIPLIER = 1 - --- You can use this to increase or decrease overall armor healing, --- 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 diff --git a/mods/ITEMS/minetest-3d_armor/3d_armor/armor.lua b/mods/ITEMS/minetest-3d_armor/3d_armor/armor.lua index adfb029192..11f6441d2e 100644 --- a/mods/ITEMS/minetest-3d_armor/3d_armor/armor.lua +++ b/mods/ITEMS/minetest-3d_armor/3d_armor/armor.lua @@ -1,55 +1,10 @@ -ARMOR_INIT_DELAY = 1 -ARMOR_INIT_TIMES = 1 -ARMOR_BONES_DELAY = 1 -ARMOR_UPDATE_TIME = 1 -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 = "mcl_core:cactus", - iron = "mcl_core:iron_ingot", - bronze = "mcl_core:bronze_ingot", - diamond = "mcl_core:diamond", - gold = "mcl_core:gold_ingot", - mithril = "moreores:mithril_ingot", - crystal = "ethereal:crystal_ingot", -} -ARMOR_FIRE_PROTECT = minetest.get_modpath("ethereal") ~= nil -ARMOR_FIRE_NODES = { - {"mcl_core:lava_source", 5, 8}, - {"mcl_core:lava_flowing", 5, 8}, - {"fire:basic_flame", 3, 4}, - {"fire:permanent_flame", 3, 4}, - {"ethereal:crystal_spike", 2, 1}, - {"ethereal:fire_flower", 2, 1}, - {"mcl_torches:torch", 1, 1}, -} +local ARMOR_INIT_DELAY = 1 +local ARMOR_INIT_TIMES = 1 +local ARMOR_BONES_DELAY = 1 local skin_mod = nil local modpath = minetest.get_modpath(minetest.get_current_modname()) -local worldpath = minetest.get_worldpath() -local input = io.open(modpath.."/armor.conf", "r") -if input then - dofile(modpath.."/armor.conf") - input:close() - input = nil -end -input = io.open(worldpath.."/armor.conf", "r") -if input then - dofile(worldpath.."/armor.conf") - input:close() - input = nil -end -if not minetest.get_modpath("moreores") then - ARMOR_MATERIALS.mithril = nil -end -if not minetest.get_modpath("ethereal") then - ARMOR_MATERIALS.crystal = nil -end armor = { timer = 0, @@ -104,9 +59,6 @@ armor.set_player_armor = function(self, player) local armor_texture = "blank.png" local armor_level = 0 local mcl_armor_points = 0 - local armor_fire = 0 - local armor_water = 0 - local armor_radiation = 0 local items = 0 local elements = {} local textures = {} @@ -131,9 +83,6 @@ armor.set_player_armor = function(self, player) armor_level = armor_level + level items = items + 1 mcl_armor_points = mcl_armor_points + (def.groups["mcl_armor_points"] 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 @@ -160,20 +109,15 @@ armor.set_player_armor = function(self, player) if material.type and material.count == #self.elements then armor_level = armor_level * 1.1 end - armor_level = armor_level * ARMOR_LEVEL_MULTIPLIER - mcl_armor_points = mcl_armor_points * ARMOR_HEAL_MULTIPLIER - armor_radiation = armor_radiation * ARMOR_RADIATION_MULTIPLIER if #textures > 0 then armor_texture = table.concat(textures, "^") end local armor_groups = player:get_armor_groups() armor_groups.fleshy = 100 armor_groups.level = nil - armor_groups.radiation = nil 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) -- Physics override intentionally removed because of possible conflicts @@ -185,9 +129,6 @@ armor.set_player_armor = function(self, player) self.def[name].jump = physics_o.jump self.def[name].speed = physics_o.speed 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 @@ -247,8 +188,6 @@ armor.get_armor_formspec = function(self, name) formspec = formspec:gsub("armor_preview", armor.textures[name].preview) formspec = formspec:gsub("armor_level", armor.def[name].level) formspec = formspec:gsub("mcl_armor_points", 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 @@ -390,9 +329,6 @@ minetest.register_on_joinplayer(function(player) jump = 1, speed = 1, gravity = 1, - fire = 0, - water = 0, - radiation = 0, } armor.textures[name] = { skin = armor.default_skin..".png", @@ -445,60 +381,6 @@ minetest.register_on_joinplayer(function(player) end end) -if ARMOR_DROP == true or ARMOR_DESTROY == true then - armor.drop_armor = function(pos, stack) - local obj = minetest.add_item(pos, stack) - if obj then - obj:set_velocity({x=math.random(-1, 1), y=5, z=math.random(-1, 1)}) - end - end - minetest.register_on_dieplayer(function(player) - local name, player_inv, armor_inv, pos = armor:get_valid_player(player, "[on_dieplayer]") - if not name then - return - end - local drop = {} - for i=1, player_inv:get_size("armor") do - local stack = armor_inv:get_stack("armor", i) - if stack:get_count() > 0 then - table.insert(drop, stack) - armor_inv:set_stack("armor", i, nil) - player_inv:set_stack("armor", i, nil) - end - end - armor:set_player_armor(player) - if ARMOR_DESTROY == false then - minetest.after(ARMOR_BONES_DELAY, function(pos, drop) - local node = minetest.get_node(vector.round(pos)) - if node then - if node.name ~= "bones:bones" then - pos.y = pos.y+1 - node = minetest.get_node(vector.round(pos)) - if node.name ~= "bones:bones" then - minetest.log("warning", "Failed to add armor to bones node.") - return - end - end - local meta = minetest.get_meta(vector.round(pos)) - local owner = meta:get_string("owner") - local inv = meta:get_inventory() - for _,stack in ipairs(drop) do - if name == owner and inv:room_for_item("main", stack) then - inv:add_item("main", stack) - else - armor.drop_armor(pos, stack) - end - end - else - for _,stack in ipairs(drop) do - armor.drop_armor(pos, stack) - end - end - end, pos, drop) - end - end) -end - minetest.register_on_player_hpchange(function(player, hp_change, reason) local name, player_inv, armor_inv = armor:get_valid_player(player, "[on_hpchange]") if name and hp_change < 0 then @@ -554,53 +436,3 @@ minetest.register_on_player_hpchange(function(player, hp_change, reason) return hp_change end, true) --- Fire Protection and water breating, added by TenPlus1 - -if ARMOR_FIRE_PROTECT == true then - -- override hot nodes so they do not hurt player anywhere but mod - for _, row in pairs(ARMOR_FIRE_NODES) do - if minetest.registered_nodes[row[1]] then - minetest.override_item(row[1], {damage_per_second = 0}) - end - end -else - print ("[3d_armor] Fire Nodes disabled") -end - -minetest.register_globalstep(function(dtime) - armor.timer = armor.timer + dtime - if armor.timer < ARMOR_UPDATE_TIME then - return - end - for _,player in pairs(minetest.get_connected_players()) do - local name = player:get_player_name() - local pos = player:get_pos() - local hp = player:get_hp() - -- water breathing - if name and armor.def[name].water > 0 then - if player:get_breath() < 10 then - player:set_breath(10) - end - end - -- fire protection - if ARMOR_FIRE_PROTECT == true - and name and pos and hp then - pos.y = pos.y + 1.4 -- head level - local node_head = minetest.get_node(pos).name - pos.y = pos.y - 1.2 -- feet level - local node_feet = minetest.get_node(pos).name - -- is player inside a hot node? - for _, row in pairs(ARMOR_FIRE_NODES) do - -- check fire protection, if not enough then get hurt - if row[1] == node_head or row[1] == node_feet then - if hp > 0 and armor.def[name].fire < row[2] then - hp = hp - row[3] * ARMOR_UPDATE_TIME - player:set_hp(hp) - break - end - end - end - end - end - armor.timer = 0 -end)