Compare commits
	
		
			16 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 8c35451f12 | ||
|  | f3ad7ec6f1 | ||
|  | fccd4d8b15 | ||
|  | e5b2cf3a34 | ||
|  | d2608351f6 | ||
|  | a05eae3782 | ||
|  | 2ac90f8d19 | ||
|  | 47ecef46f7 | ||
|  | 1d22612664 | ||
|  | 3fe7dd2249 | ||
|  | be9579a365 | ||
|  | 18320e96b9 | ||
|  | 99471d3aa0 | ||
|  | b6283f3f0f | ||
|  | 7e2d9426d1 | ||
|  | 813a88f3a1 | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						| @@ -4,6 +4,7 @@ | ||||
| *bak* | ||||
| tags | ||||
| *.vim | ||||
| armor.conf | ||||
|  | ||||
| ## Eclipse project files & directories | ||||
| .project | ||||
|   | ||||
| @@ -1,9 +1,26 @@ | ||||
| [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 | ||||
|   | ||||
| @@ -32,11 +32,11 @@ armor_material_mithril = true | ||||
| armor_material_crystal = true | ||||
|  | ||||
| -- Increase this if you get initialization glitches when a player first joins. | ||||
| armor_init_delay = 1 | ||||
| armor_init_delay = 2 | ||||
|  | ||||
| -- Number of initialization attempts. | ||||
| -- Use in conjunction with armor_init_delay if initialization problems persist. | ||||
| armor_init_times = 1 | ||||
| armor_init_times = 10 | ||||
|  | ||||
| -- Increase this if armor is not getting into bones due to server lag. | ||||
| armor_bones_delay = 1 | ||||
| @@ -111,7 +111,7 @@ armor:register_armor("mod_name:speed_boots", { | ||||
| 	damage_groups = {cracky=3, snappy=3, choppy=3, crumbly=3, level=1}, | ||||
| 	reciprocate_damage = true, | ||||
| 	on_destroy = function(player, index, stack) | ||||
| 		local pos = player:getpos() | ||||
| 		local pos = player:get_pos() | ||||
| 		if pos then | ||||
| 			minetest.sound_play({ | ||||
| 				name = "mod_name_break_sound", | ||||
|   | ||||
| @@ -74,7 +74,7 @@ armor = { | ||||
| 		on_destroy = {}, | ||||
| 	}, | ||||
| 	migrate_old_inventory = true, | ||||
| 	version = "0.4.12", | ||||
| 	version = "0.4.13", | ||||
| } | ||||
|  | ||||
| armor.config = { | ||||
| @@ -279,6 +279,11 @@ armor.set_player_armor = function(self, player) | ||||
| 	if use_armor_monoid then | ||||
| 		armor_monoid.monoid:add_change(player, change, "3d_armor:armor") | ||||
| 	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) | ||||
| 	end | ||||
| 	if use_player_monoids then | ||||
|   | ||||
| @@ -1,37 +0,0 @@ | ||||
| -- Armor Configuration (defaults) | ||||
|  | ||||
| -- Increase this if you get initialization glitches when a player first joins. | ||||
| ARMOR_INIT_DELAY = 3 | ||||
|  | ||||
| -- Number of initialization attempts. | ||||
| -- Use in conjunction with ARMOR_INIT_DELAY if initialization problems persist. | ||||
| ARMOR_INIT_TIMES = 3 | ||||
|  | ||||
| -- Increase this if armor is not getting into bones due to server lag. | ||||
| ARMOR_BONES_DELAY = 3 | ||||
|  | ||||
| -- 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 also use this file to execute arbitary lua code | ||||
| -- eg: Dumb the armor down if using Simple Mobs | ||||
| --if minetest.get_modpath("mobs") then | ||||
| --	ARMOR_LEVEL_MULTIPLIER = 1 | ||||
| --	ARMOR_HEAL_MULTIPLIER = 0 | ||||
| --end | ||||
|  | ||||
| @@ -99,17 +99,27 @@ armor.formspec = armor.formspec.. | ||||
| if armor.config.fire_protect then | ||||
| 	armor.formspec = armor.formspec.."label[5,2;"..F(S("Fire"))..":  armor_attr_fire]" | ||||
| 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) | ||||
| 	local name = player:get_player_name() | ||||
| 	local def = stack:get_definition() | ||||
| 	if name and def and def.description then | ||||
| 		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) | ||||
|  | ||||
| local function validate_armor_inventory(player) | ||||
| 	-- Workaround for detached inventory swap exploit | ||||
| 	local _, inv = armor:get_valid_player(player, "[validate_armor_inventory]") | ||||
| 	local pos = player:get_pos() | ||||
| 	if not inv then | ||||
| 		return | ||||
| 	end | ||||
| @@ -140,6 +150,7 @@ local function validate_armor_inventory(player) | ||||
| 				elements[element] = true; | ||||
| 			else | ||||
| 				inv:remove_item("armor", stack) | ||||
| 				minetest.item_drop(stack, player, pos) | ||||
| 				-- The following code returns invalid items to the player's main | ||||
| 				-- inventory but could open up the possibity for a hacked client | ||||
| 				-- to receive items back they never really had. I am not certain | ||||
| @@ -160,7 +171,7 @@ end | ||||
|  | ||||
| local function init_player_armor(player) | ||||
| 	local name = player:get_player_name() | ||||
| 	local pos = player:getpos() | ||||
| 	local pos = player:get_pos() | ||||
| 	if not name or not pos then | ||||
| 		return false | ||||
| 	end | ||||
| @@ -326,12 +337,12 @@ if armor.config.drop == true or armor.config.destroy == true then | ||||
| 		end | ||||
| 		armor:save_armor_inventory(player) | ||||
| 		armor:set_player_armor(player) | ||||
| 		local pos = player:getpos() | ||||
| 		local pos = player:get_pos() | ||||
| 		if pos and armor.config.destroy == false then | ||||
| 			minetest.after(armor.config.bones_delay, function() | ||||
| 				local meta = nil | ||||
| 				local maxp = vector.add(pos, 8) | ||||
| 				local minp = vector.subtract(pos, 8) | ||||
| 				local maxp = vector.add(pos, 16) | ||||
| 				local minp = vector.subtract(pos, 16) | ||||
| 				local bones = minetest.find_nodes_in_area(minp, maxp, {"bones:bones"}) | ||||
| 				for _, p in pairs(bones) do | ||||
| 					local m = minetest.get_meta(p) | ||||
| @@ -427,7 +438,7 @@ if armor.config.water_protect == true or armor.config.fire_protect == true then | ||||
| 		end | ||||
| 		for _,player in pairs(minetest.get_connected_players()) do | ||||
| 			local name = player:get_player_name() | ||||
| 			local pos = player:getpos() | ||||
| 			local pos = player:get_pos() | ||||
| 			local hp = player:get_hp() | ||||
| 			if not name or not pos or not hp then | ||||
| 				return | ||||
| @@ -467,5 +478,3 @@ if armor.config.water_protect == true or armor.config.fire_protect == true then | ||||
| 		armor.timer = 0 | ||||
| 	end) | ||||
| end | ||||
|  | ||||
| minetest.log("action", "[3d_armor] loaded.") | ||||
|   | ||||
| Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 408 B | 
| Before Width: | Height: | Size: 548 B After Width: | Height: | Size: 383 B | 
| Before Width: | Height: | Size: 937 B After Width: | Height: | Size: 399 B | 
| Before Width: | Height: | Size: 602 B After Width: | Height: | Size: 369 B | 
| Before Width: | Height: | Size: 903 B After Width: | Height: | Size: 404 B | 
| Before Width: | Height: | Size: 821 B After Width: | Height: | Size: 376 B | 
| Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 408 B | 
| Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 383 B | 
| Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 408 B | 
| Before Width: | Height: | Size: 872 B After Width: | Height: | Size: 383 B | 
| Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 399 B | 
| Before Width: | Height: | Size: 779 B After Width: | Height: | Size: 369 B | 
| Before Width: | Height: | Size: 854 B After Width: | Height: | Size: 407 B | 
| Before Width: | Height: | Size: 530 B After Width: | Height: | Size: 382 B | 
| Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 393 B | 
| Before Width: | Height: | Size: 783 B After Width: | Height: | Size: 369 B | 
| Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 377 B | 
| Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 366 B | 
| Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 516 B | 
| Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 446 B | 
| Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 500 B | 
| Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 441 B | 
| Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 504 B | 
| Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 444 B | 
| Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 516 B | 
| Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 446 B | 
| Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 524 B | 
| Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 446 B | 
| Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 508 B | 
| Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 444 B | 
| Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 514 B | 
| Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 446 B | 
| Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 499 B | 
| Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 440 B | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 453 B | 
| Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 437 B | 
| Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 476 B | 
| Before Width: | Height: | Size: 869 B After Width: | Height: | Size: 386 B | 
| Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 468 B | 
| Before Width: | Height: | Size: 796 B After Width: | Height: | Size: 382 B | 
| Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 464 B | 
| Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 358 B | 
| Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 476 B | 
| Before Width: | Height: | Size: 834 B After Width: | Height: | Size: 386 B | 
| Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 476 B | 
| Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 386 B | 
| Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 491 B | 
| Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 382 B | 
| Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 474 B | 
| Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 382 B | 
| Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 495 B | 
| Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 386 B | 
| Before Width: | Height: | Size: 932 B After Width: | Height: | Size: 462 B | 
| Before Width: | Height: | Size: 471 B After Width: | Height: | Size: 368 B | 
| Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 408 B | 
| Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 406 B | 
| Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 399 B | 
| Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 408 B | 
| Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 408 B | 
| Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 406 B | 
| Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 415 B | 
| Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 409 B | 
| Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 410 B | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 440 B | 
| Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 438 B | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 434 B | 
| Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 440 B | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 440 B | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 438 B | 
| Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 433 B | 
| Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 438 B | 
| Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 426 B | 
| Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 392 B | 
| Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 389 B | 
| Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 386 B | 
| Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 392 B | 
| Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 392 B | 
| Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 389 B | 
| Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 389 B | 
| Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 400 B | 
| Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 373 B | 
| Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 410 B | 
| Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 420 B | 
| Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 408 B | 
| Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 410 B | 
| Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 410 B | 
| Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 420 B | 
| Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 423 B | 
| Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 420 B | 
| Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 415 B | 
| Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 425 B | 
| Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 394 B |