Compare commits
9 Commits
version-0.
...
armorswap
Author | SHA1 | Date | |
---|---|---|---|
b2ae7f9c8b | |||
33738dcff8 | |||
f3ad7ec6f1 | |||
fccd4d8b15 | |||
e5b2cf3a34 | |||
d2608351f6 | |||
a05eae3782 | |||
2ac90f8d19 | |||
47ecef46f7 |
@ -1,9 +1,26 @@
|
|||||||
[mod] 3d Armor [3d_armor]
|
[mod] 3d Armor [3d_armor]
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
License Source Code: (C) 2012-2017 Stuart Jones - LGPL v2.1
|
License Source Code
|
||||||
|
-------------------
|
||||||
|
|
||||||
License Textures: Copyright (C) 2017 davidthecreator - CC-BY-SA 3.0
|
Copyright (C) 2012-2019 stujones11, Stuart Jones <stujones111@gmail.com>
|
||||||
|
|
||||||
https://github.com/daviddoesminetest/3d-armors-new-textures
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
License Textures
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Copyright (C) 2017-2019 davidthecreator - CC-BY-SA 3.0
|
||||||
|
@ -279,6 +279,11 @@ armor.set_player_armor = function(self, player)
|
|||||||
if use_armor_monoid then
|
if use_armor_monoid then
|
||||||
armor_monoid.monoid:add_change(player, change, "3d_armor:armor")
|
armor_monoid.monoid:add_change(player, change, "3d_armor:armor")
|
||||||
else
|
else
|
||||||
|
-- Preserve immortal group (damage disabled for player)
|
||||||
|
local immortal = player:get_armor_groups().immortal
|
||||||
|
if immortal and immortal ~= 0 then
|
||||||
|
groups.immortal = 1
|
||||||
|
end
|
||||||
player:set_armor_groups(groups)
|
player:set_armor_groups(groups)
|
||||||
end
|
end
|
||||||
if use_player_monoids then
|
if use_player_monoids then
|
||||||
|
@ -99,17 +99,27 @@ armor.formspec = armor.formspec..
|
|||||||
if armor.config.fire_protect then
|
if armor.config.fire_protect then
|
||||||
armor.formspec = armor.formspec.."label[5,2;"..F(S("Fire"))..": armor_attr_fire]"
|
armor.formspec = armor.formspec.."label[5,2;"..F(S("Fire"))..": armor_attr_fire]"
|
||||||
end
|
end
|
||||||
|
armor:register_on_damage(function(player, index, stack)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local def = stack:get_definition()
|
||||||
|
if name and def and def.description and stack:get_wear() > 60100 then
|
||||||
|
minetest.chat_send_player(name, S("Your @1 is almost broken!", def.description))
|
||||||
|
minetest.sound_play("default_tool_breaks", {to_player = name, gain = 2.0})
|
||||||
|
end
|
||||||
|
end)
|
||||||
armor:register_on_destroy(function(player, index, stack)
|
armor:register_on_destroy(function(player, index, stack)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local def = stack:get_definition()
|
local def = stack:get_definition()
|
||||||
if name and def and def.description then
|
if name and def and def.description then
|
||||||
minetest.chat_send_player(name, S("Your @1 got destroyed!", def.description))
|
minetest.chat_send_player(name, S("Your @1 got destroyed!", def.description))
|
||||||
|
minetest.sound_play("default_tool_breaks", {to_player = name, gain = 2.0})
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function validate_armor_inventory(player)
|
local function validate_armor_inventory(player)
|
||||||
-- Workaround for detached inventory swap exploit
|
-- Workaround for detached inventory swap exploit
|
||||||
local _, inv = armor:get_valid_player(player, "[validate_armor_inventory]")
|
local _, inv = armor:get_valid_player(player, "[validate_armor_inventory]")
|
||||||
|
local pos = player:get_pos()
|
||||||
if not inv then
|
if not inv then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -140,6 +150,7 @@ local function validate_armor_inventory(player)
|
|||||||
elements[element] = true;
|
elements[element] = true;
|
||||||
else
|
else
|
||||||
inv:remove_item("armor", stack)
|
inv:remove_item("armor", stack)
|
||||||
|
minetest.item_drop(stack, player, pos)
|
||||||
-- The following code returns invalid items to the player's main
|
-- The following code returns invalid items to the player's main
|
||||||
-- inventory but could open up the possibity for a hacked client
|
-- inventory but could open up the possibity for a hacked client
|
||||||
-- to receive items back they never really had. I am not certain
|
-- to receive items back they never really had. I am not certain
|
||||||
@ -330,8 +341,8 @@ if armor.config.drop == true or armor.config.destroy == true then
|
|||||||
if pos and armor.config.destroy == false then
|
if pos and armor.config.destroy == false then
|
||||||
minetest.after(armor.config.bones_delay, function()
|
minetest.after(armor.config.bones_delay, function()
|
||||||
local meta = nil
|
local meta = nil
|
||||||
local maxp = vector.add(pos, 8)
|
local maxp = vector.add(pos, 16)
|
||||||
local minp = vector.subtract(pos, 8)
|
local minp = vector.subtract(pos, 16)
|
||||||
local bones = minetest.find_nodes_in_area(minp, maxp, {"bones:bones"})
|
local bones = minetest.find_nodes_in_area(minp, maxp, {"bones:bones"})
|
||||||
for _, p in pairs(bones) do
|
for _, p in pairs(bones) do
|
||||||
local m = minetest.get_meta(p)
|
local m = minetest.get_meta(p)
|
||||||
|
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 391 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 361 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 493 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 399 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 431 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 478 B After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 473 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 398 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 430 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 398 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 398 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 420 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 366 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 413 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 381 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 449 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 364 B After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 3.0 KiB |