Giter Site home page Giter Site logo

minetest-mods / 3d_armor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stujones11/minetest-3d_armor

16.0 8.0 39.0 3.41 MB

Visible player armor & wielded items for minetest

License: Other

Lua 88.46% Python 4.72% Shell 2.28% CSS 4.54%
minetest-mod armor wieldview

3d_armor's Introduction

Modpack - 3d Armor

3d_armor screenshot

Table of Contents

[mod] Visible Player Armor [3d_armor]

Minetest Version: 5.0.0 and newer

Game: minetest_game and many derivatives

Depends: default

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 attack.

Armor takes damage when a player is hurt, however, many armor items offer a 'stackable' percentage chance of restoring the lost health points. Overall armor level is boosted by 10% when wearing a full matching set (helmet, chestplate, leggings and boots of the same material)

Fire protection has been added by TenPlus1 and in use when ethereal mod is found and crystal armor has been enabled. each piece of armor offers 1 fire protection, level 1 protects against torches, level 2 against crystal spikes, 3 for fire and 5 protects when in lava.

Compatible with sfinv, inventory plus or unified inventory by enabling the appropriate inventory module, [3d_armor_sfinv], [3d_armor_ip] and [3d_armor_ui] respectively. Also compatible with [smart_inventory] without the need for additional modules.

built in support player skins [skins] by Zeg9 and Player Textures [player_textures] by PilzAdam and [simple_skins] by TenPlus1.

Armor can be configured by adding a file called armor.conf in 3d_armor mod or world directory. see armor.conf.example for all available options.

For mod installation instructions, please visit: http://wiki.minetest.com/wiki/Installing_Mods

The specific "armors as modpack" refactorization allows anyone to enable/disable any armors they want as mods rather than obscure settings of the past. (See #78 for further explanation.)

Currently, the modpack includes:

  • armor_admin
  • armor_bronze
  • armor_cactus
  • armor_crystal
  • armor_diamond
  • armor_gold
  • armor_mithril
  • armor_nether
  • armor_steel
  • armor_wood

as separate armor mods intentionally. All these mods depend on 3d_armor.

API Reference

[mod] Visible Wielded Items [wieldview]

Depends: 3d_armor

Makes hand wielded items visible to other players.

[mod] Shields [shields]

Depends: 3d_armor

Originally a part of 3d_armor, shields have been re-included as an optional extra. If you do not want shields then simply remove the shields folder from the modpack.

[mod] 3d Armor Stand [3d_armor_stand]

Depends: 3d_armor

Adds a chest-like armor stand for armor storage and display.

3d_armor's People

Contributors

antumdeluge avatar bell07 avatar blockmen avatar bremaweb avatar buckaroobanzay avatar codexp avatar cubicmelon avatar dacmot avatar edad-v2 avatar fat115 avatar fluxionary avatar g1ov4 avatar greendirkfried avatar indriapollo avatar megaf avatar naturefreshmilk avatar niklp09 avatar numberzero avatar ogelgames avatar orbea avatar paly2 avatar panquesito7 avatar pilcrow182 avatar randomei avatar sirrobzeroone avatar smalljoker avatar stujones11 avatar tenplus1 avatar thomas--s avatar zweihorn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3d_armor's Issues

3d_armor_ui errors when moreores is enabled

Minetest version 5.7.0 running on Ubuntu 22.04
3d_armor version 2023-02-06
moreores version 2023-02-12 (also tried 2023-01-26)

After starting server receive error:

ERROR[Main]: ModError: Failed to load and run script from /home/minetest/minetestserver/bin/../mods/3d_armor/3d_armor_ui/init.lua:
ERROR[Main]: ...minetestserver/bin/../mods/3d_armor/3d_armor_ui/init.lua:12: attempt to index local 'ui' (a boolean value)
ERROR[Main]: stack traceback:
ERROR[Main]:       ...minetestserver/bin/../mods/3d_armor/3d_armor_ui/init.lua:12: in main chunk

Disabling moreores removes the error and works as expected though of course without the optional dependency.

Request: button to hide worn armor to show off skin

Armor is nice and all, but, sometimes you want the defense of the armor but also want to show off your nice skin to your friends. Well, why not? A button somewhere in the UI that can toggle armor visibility would be a great addition I think.

LICENSE should show current status and year

Please consider updating the LICENSE.md to the current status and team.

Presumably, should read:

Copyright (C) 2013-2022 Stuart Jones - LGPL v2.1

(or you wait until New Year and make it 2023 already. ;)

Maybe there have been additional contributors? Not sure, if the dev team has to or even wants to be listed. This is totaly at your deliberation, but worth to ask.

Server error when receiving damage from mobs API

I'm not sure how to reproduce, but it has been crashing on my server for a while and I have not much idea how to fix it.

2022-08-20 08:25:50: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod '3d_armor' in callback luaentity_Step(): Runtime error from mod '3d_armor' in callback on_punchplayer(): /usr/share/minetest/mods/3d_armor
/3d_armor/api.lua:830: attempt to concatenate local 'element' (a ni
2022-08-20 08:25:50: ERROR[Main]: l value)
2022-08-20 08:25:50: ERROR[Main]: stack traceback:
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/3d_armor/3d_armor/api.lua:830: in function 'get_element'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/3d_armor/3d_armor/api.lua:659: in function 'get_weared_armor_elements'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/3d_armor/3d_armor/api.lua:630: in function 'damage'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/3d_armor/3d_armor/api.lua:605: in function 'punch'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/3d_armor/3d_armor/init.lua:416: in function 'func'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/builtin/profiler/instrumentation.lua:107: in function </usr/share/minetest/builtin/profiler/instrumentation.lua:100>
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/builtin/game/register.lua:429: in function </usr/share/minetest/builtin/game/register.lua:415>
2022-08-20 08:25:50: ERROR[Main]:       [C]: in function 'punch'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/mobs/api.lua:2716: in function 'do_states'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/mobs/api.lua:3544: in function 'func'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/builtin/profiler/instrumentation.lua:107: in function </usr/share/minetest/builtin/profiler/instrumentation.lua:100>
2022-08-20 08:25:50: ERROR[Main]: stack traceback:
2022-08-20 08:25:50: ERROR[Main]:       [C]: in function 'punch'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/mobs/api.lua:2716: in function 'do_states'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/mods/mobs/api.lua:3544: in function 'func'
2022-08-20 08:25:50: ERROR[Main]:       /usr/share/minetest/builtin/profiler/instrumentation.lua:107: in function </usr/share/minetest/builtin/profiler/instrumentation.lua:100>

The server in question is Mercurio hosted at mars.ronoaldo.dev.br port 3000. Using latest version from Content DB.

Torch Fire protect bug

It's been a few weeks, but at some point after an update to 3D Armor from ContentDB, armor stopped protecting the player from torch damage.

name = 3d_armor
title = 3D Armor
description = Visible player armor & wielded items.
release = 16954
author = stu

Minetest 5.7.0 x64 portable

These options exist in the mod's settings:

# Enable fire protection (defaults true if using ethereal mod).
armor_fire_protect (Enable fire protection) bool false

# Enable fire damage from torches (defaults true if using ethereal mod).
armor_fire_protect_torch (Enable fire protection torch damage) bool false

I have tried setting fire damage from torches to both true and false, but with either setting, players still take damage from torches. I have tested in my existing modded world, but was able to recreate this bug in a new world with only the 3D Armor mod.

In addition to losing the ability to turn off this damage, the [English translation?] wording of this setting is ambiguous. The setting for fire protection seems to mean if true, protect from fire and if false, don't protect from fire. The torches setting seems to mean the opposite, in that true doesn't protect and false does protect. I suggest that the wording of these 2 settings be changed so that both states match and the wording is less ambiguous:

# Enable fire protection (defaults true if using ethereal mod. **True means armor protects from fire**).
armor_fire_protect (Enable fire protection) bool false

# Enable fire **protection** from torches (defaults false if using ethereal mod. **True means armor protects from torches**).
armor_fire_protect_torch (Enable **torch damage protection**.) bool true

Also, from a roleplay perspective and reality v.s. game mechanics, it sort of makes sense to take fire damage if you are standing in say fire or lava, but in reality any person standing in the same 1 cubic meter area as a torch would instinctually be able to share that space with a torch while avoiding being so close to burn themselves. If I walked by a torch on the floor or wall of a narrow hallway, I wouldn't even have to think about it to avoid burning myself by the torch as I stood next to it.

Torch damage

Hi,

if I activate armor_fire_protect = true then Torch damage is activated as well.

Could you add a switch to just turn the torch damage off, even is fire protect is activated?

Server crash when player joins

2021-06-26 07:17:44: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'wieldview' in callback environment_Step(): ...netest/worlds/Bananaland_World/worldmods/skinsdb/api.lua:8: attempt to call method 'get_string' (a nil value)
2021-06-26 07:17:44: ERROR[Main]: stack traceback:
2021-06-26 07:17:44: ERROR[Main]: ...netest/worlds/Bananaland_World/worldmods/skinsdb/api.lua:8: in function 'get_player_skin'
2021-06-26 07:17:44: ERROR[Main]: ...etest/worlds/Bananaland_World/worldmods/skinsdb/init.lua:47: in function 'update_player_visuals'
2021-06-26 07:17:44: ERROR[Main]: ...and_World/worldmods/minetest-3d_armor/wieldview/init.lua:64: in function 'update_wielded_item'
2021-06-26 07:17:44: ERROR[Main]: ...and_World/worldmods/minetest-3d_armor/wieldview/init.lua:75: in function 'func'
2021-06-26 07:17:44: ERROR[Main]: /usr/share/minetest/builtin/common/after.lua:20: in function </usr/share/minetest/builtin/common/after.lua:5>
2021-06-26 07:17:44: ERROR[Main]: /usr/share/minetest/builtin/game/register.lua:425: in function </usr/share/minetest/builtin/game/register.lua:409>

armor.config.level_multiplier gets (hard) set down to 0.9 by shields

I noticed a discrepency between what the armor.config.level_multiplier is set to under 3d_armor and what the game reported level as being when you look at the armor_ui inside the game

eg diamond chestplate level should be 20 (fleshy=20), level*armor.config.level_multiplier (default=1). However inside the game when you just wear the chestplate it reports as level 18 with shields enabled

So tracked this back through to Shields which has a block of code:

if minetest.global_exists("armor") and armor.elements then
	table.insert(armor.elements, "shield")
	local mult = armor.config.level_multiplier or 1
	armor.config.level_multiplier = mult * 0.9
end

When enabled the shields multipler of 0.9 overrides the base armor.config.level_multiplier for all armor items not just shields and there is no way to reset it back to 1...well unless you set the setting in armor_3d to 1.111etc. Which is a tough track down to get to root cause lol.

This dosen't quiet seem like the correct behaviour? I'm guessing the intention was to help with balancing? Im not sure?

I'm not sure the armor.config.level_multiplier should be redefined in the shields module but rather leave that out and let people adjust via the base 3d_armor setting "level_multiplier" if they feel they need it?

Took me a fair bit of time to track down what was happening, spotted it in the end using debug were you can clearly see shields suddenly adjust to 0.9 instead of 1 (this overrides for all items later when calulating in game) :

2020-12-13 20:07:43: [Main]: 3d_armor:helmet_admin levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:chestplate_admin levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:leggings_admin levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:boots_admin levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:helmet_wood levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:chestplate_wood levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:leggings_wood levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:boots_wood levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:helmet_cactus levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:chestplate_cactus levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:leggings_cactus levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:boots_cactus levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:helmet_steel levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:chestplate_steel levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:leggings_steel levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:boots_steel levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:helmet_bronze levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:chestplate_bronze levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:leggings_bronze levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:boots_bronze levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:helmet_diamond levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:chestplate_diamond levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:leggings_diamond levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:boots_diamond levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:helmet_gold levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:chestplate_gold levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:leggings_gold levelmulti1: 1
2020-12-13 20:07:43: [Main]: 3d_armor:boots_gold levelmulti1: 1
2020-12-13 20:07:43: [Main]: shields:shield_admin levelmulti1: 0.9
2020-12-13 20:07:43: [Main]: shields:shield_wood levelmulti1: 0.9
2020-12-13 20:07:43: [Main]: shields:shield_enhanced_wood levelmulti1: 0.9
2020-12-13 20:07:43: [Main]: shields:shield_cactus levelmulti1: 0.9
2020-12-13 20:07:43: [Main]: shields:shield_enhanced_cactus levelmulti1: 0.9
2020-12-13 20:07:43: [Main]: shields:shield_steel levelmulti1: 0.9
2020-12-13 20:07:43: [Main]: shields:shield_bronze levelmulti1: 0.9
2020-12-13 20:07:43: [Main]: shields:shield_diamond levelmulti1: 0.9
2020-12-13 20:07:43: [Main]: shields:shield_gold levelmulti1: 0.9

Anyways as Im not sure if this is a bug or by design? Happy to be corrected just seemed like strange behaviour that was not very appaarent to the end user...unless I missed some doco somewhere.

Fix is a two liner

if minetest.global_exists("armor") and armor.elements then
	table.insert(armor.elements, "shield")
end

full set diamond no shields enabled, level= 77 (w/ fullset 10% bonus)
full set diamond plus shields without fix, level= 84.5 (w/ fullset 10% bonus)
full set diamond plus shields with fix, level = 93.5 (w/ fullset 10% bonus)

Add compatibility for [morphinggrid]

I would like to add compatibility for my mod [morphinggrid]. What my mod does is it adds power rangers to Minetest allowing players to morph. The mod provides it's own layer of armor over the 3d_armor armor by using a modified version of the 3d armor character model found here. The idea is that when a player is a power ranger, the armor of [3d_armor] is protected when a player takes a hit. However instead of this, both armors are damaged. The code responsible for not allowing this feature to be possible is found in [3d_armor].

Take a look at line 422-439 in 3d_armor/init.lua
https://github.com/minetest-mods/3d_armor/blob/master/3d_armor/init.lua

My mod uses the same callback (minetest.register_on_player_hpchange) to prevent damage to a player so this is a very simple fix. All that is needed is to prevent the player's armor from being punched if the player is morphed, which can be done AFTER checking if [morphingrid] is installed. I will also be uploading a pull request. My mod can be found here: https://github.com/LandonAConway/powerrangers_modpack & and the specific file located in my mod which is responsible for preventing player damage is found here: https://github.com/LandonAConway/powerrangers_modpack/blob/master/morphinggrid/ranger_armor.lua

Admin armor walkspeed too extreme

I have found that the admin armor makes the walk speed of the character so fast that any game becomes almost unplayable.

Is there a way to reduce this?

[edit] This issue started with the 5.8.0 update. Walk speed went from 4 to around 30-40 while wearing admin armor
[edit 2] I know nothing about coding so any coding advice needs to be eli5 format

Player model is incorrect

The player model is incorrect the body, legs and arms have rectangular pixels instead of square pixels.

set_hp(0) and fall damage runs into armor healing

Sometimes, we want to kill people.

Then we do player:set_hp(0), but if the armor the player wears has some healing properties, we can't kill them.

Repro:

  • use latest MTG, 3d_armor and 5.4.1
  • wear diamond armor
  • do /killme
    => In some cases, you are still alive. Other mods may also have this issue

IMO set_hp(0) should do exactly that: kill the player.

Also, fall damage seems to count against the heal property.

Could you please make it that high fall damage and set_hp(0) does not let anyone live?

Or could you make it that armors can register against what type of damage they help?

For my reference 998

weird language constructs

Your @1 is almost broken!=ยกTu @1 esta a punto de romperse!

This works well for helmet and chestplate, but with boots and pants it should be: "Your boots are almost broken"

In Spanish: "Tus botas estรกn a punto de romperse"

In English it kinda works to use capitals here, but in Spanish and probably also in French, Portuguese and Italian, one would use lower-case. Probably some other languages too.

German is a language that capitalizes names, there it's correct. Here too, it would need to be: "Deine Stiefel sind fast kaputt".
However the rest use singular form ist.

Many languages have their own way, it kinda misses the point of translating when sentences sound so weird.

Suggestion: have a translator string for all items instead of using substitutions.

"Armor not initialized!" when 3d_armor is part of a game

Hi. I'm one of the WhyNot? game maintainers and we've noticed a problem with 3d_armor recently (minetest-whynot/whynot-game#169)

The first player to immediately join a new game (first time only, singleplayer or hosted), the armor tab in the inventory says "Armor not initialized!" Quitting and joining again fixes it, but it's still annoying.

This it not specific to WhyNot. I was able to reproduce it by copying 3d_armor into minetest_game/mods, as well as simply enabling 3d_armor on a new MTG world before joining.

I've tracked it down to the init_player_armor function at

	armor.def[name] = {
		init_time = minetest.get_gametime(),

Where minetest.get_gametime() is probably 0 when you first join a new world.

I found a quick workaround by using minetest.after(1 in init.lua:

minetest.register_on_joinplayer(function(player)
	default.player_set_model(player, "3d_armor_character.b3d")
	local player_name = player:get_player_name()

	minetest.after(0, function()
		-- TODO: Added in 7566ecc - What's the prupose?
		local pplayer = minetest.get_player_by_name(player_name)
		if pplayer and init_player_armor(pplayer) == false then
			pending_players[pplayer] = 0
		end
	end)
end)

but given the TODO comment, I thought maybe this needs some deeper investigation.

[Feature]: Reduce duplicative code around craft recepies

In minetest-whynot/whynot-game#170 (comment)

It seems all code with @section craft has a lot of duplicative behavior shared with (virtually) all armor. The license isn't compatible, but I've seen that Instant Ores does this in a better way, by making a function for this. Edge cases would be best served the way this code is currently written, with abstractions for the most common cases.

(This issue is not blocking that pull request).

A few arguments for this:

  1. Less code is less bugs
  2. Less code is less work to maintain
  3. Less code is less code to update when changes happen.
  4. A lot of this code is actually documentation. It's nearly (if not exactly the same) across all of them, and could be unified to one place.
  5. Edge cases can still be done alongside the conventional function call.
  6. A lot of different armor mods outside of this modpack could make great use of this new API.

Problem:

I don't know where the function would go, or what it would and wouldn't cover.

Requirements

Bug fix and Feature

The latest update with nether armor is great but shouldn't that particular armor have fire protection like the crystal set ??

Also in mod.conf nether isn't spelled correctly.

Armor still damageable in (pvp) protected arear

Reported by bosapara in the forums:

Even in protect, player's armor can be damaged / crashed by another player.
How to reproduce a bug: just punch protected player, his armor will crash more and more.
Checked this bug on Pandora - the same. Tried to fix it, but failed unfortunately.

EDIT: possible fix by the same author (untested, just copy-pasta'd from the forums):

if armor.config.punch_damage == true then
	minetest.register_on_punchplayer(function(player, hitter,
			time_from_last_punch, tool_capabilities)
		local name = player:get_player_name()
		local name2 = hitter:get_player_name()		

		if name and name2 and minetest.is_protected(player:get_pos(), "") then

			return

		elseif name then

			armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
			last_punch_time[name] = minetest.get_gametime()

		end	

	end)
end

Error when using armor:set_player_armor()

I get this error when using the API. 'api.lua:282: bad argument #1 to 'pairs' (table expected, got string)'.

To reproduce this error, download the powerrangers_modpack mod (link here), and type the command '/morph mighty_morphin:red'. Or in the code behind, add armor to the armor inventory, and use armor:set_player_armor().

Does the move to split the armor types break backward compatiblity?

We had frozen 3d_armor in WhyNot? just before the armor types got split.

Before we move to the latest, are you aware of any issues with it? In particular, does it cause any kind of problems with existing worlds?

In the PR, SmallJoker had mentioned a possible issue with existing servers. Would that be a problem if the modpack is part of a game like WhyNot, and the server gets updated and restarted?

Thanks!

armor_type bug

armor.config = {
	init_delay = 2,
	init_times = 10,
	bones_delay = 1,
	update_time = 1,
	drop = minetest.get_modpath("bones") ~= nil,
	destroy = false,
	level_multiplier = 1,
	heal_multiplier = 1,
	material_wood = true,
	material_cactus = true,
	material_steel = true,
	material_bronze = true,
	material_diamond = true,
	material_gold = true,
	material_mithril = true,
	material_crystal = true,
	material_nether = true,
	set_elements = "head torso legs feet shield", --<< SOURCE OF ERROR
	set_multiplier = 1.1,
	water_protect = true,
	fire_protect = minetest.get_modpath("ethereal") ~= nil,
	fire_protect_torch = minetest.get_modpath("ethereal") ~= nil,
	feather_fall = true,
	punch_damage = true,
}
	for loc,item in pairs(worn_armor) do
		local item_mat = string.match(item, "%:.+_(.+)$")
		local worn_key = item_mat or "unknown"
		for k,set_loc in pairs(armor.config.set_elements)do --<< ERROR
			if set_loc == loc then
				if set_worn[worn_key] == nil then
					set_worn[worn_key] = 0
					set_worn[worn_key] = set_worn[worn_key] + 1
				else
					set_worn[worn_key] = set_worn[worn_key] + 1
				end
			end
		end
	end

ERROR:

minetest_R521iugXRE

No armor damage from mobs

No damage to armor from monster attacs.

Test procedure:

  • Install mobs + mobs_monster and hbarmor+hudbars to see armor bar better
  • spawn monster and let them attack you
  • you loose health, but armor it untouched

It looks like there is a local variable "damage" set to false and the never come back to true, because mobs hat no groupcaps:

E.g. oerkki groupcaps:

{
	max_drop_level = 1,
	groupcaps = {
		
	},
	damage_groups = {
		fleshy = 4
	},
	full_punch_interval = 1,
	punch_attack_uses = 0
}

Temporary solution could be to set damage = true when no groupcaps defined?

--- a/3d_armor/api.lua
+++ b/3d_armor/api.lua
@@ -355,7 +355,10 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
                                local level = damage_groups.level or 0
                                local groupcaps = tool_capabilities.groupcaps or {}
                                local uses = 0
-                               damage = false
+                               if #groupcaps > 0 then
+                                       damage = false
+                               end
+                               --damage = false
                                for group, caps in pairs(groupcaps) do
                                        local maxlevel = caps.maxlevel or 0
                                        local diff = maxlevel - level

Circular dependencies because of skinsdb and bakedclay/nether

There are some dependency cycles involving these mods and I think 3d_armor might be the easiest place to fix these, if not I'm happy to file the issue with another mod.

3d_armor -> backedclay -> technic_cnc > technic -> i3 -> 3d_armor -> bakedclay
         -> nether -> riesenpilz -> technic -> i3 -> 3d_armor
                                                  -> skinsdb -> 3d_armor
                                                             -> clothing -> appliances -> technic

3d_armor overrides enable_damage=false

My server has enable_damage=false but when I enable the 3d_armor mod, the player can die of fall damage. Only the specific 3d_armor mod needs to be enabled, no other mods in the 3d_armor pack.

This only happens when the server is on another computer (same LAN). I can not reproduce it in a local singleplayer world. Server and client are Ubuntu 20.04 with default "apt" install of Minetest 5.1.1.

With all other factor kept constant, I bisected the version of 3d_armor and found the following
0.4.0 OK
0.4.4 Players dies

3d_armor_sfinv doesn't check current formspec page

As a result the players inventory is being updated even when the armor tab isn't selected.
This interferes with other inventory mods if they don't work 100% through sfinv callbacks.

This obviously isn't much of an issue when the update is triggered through un/equipping of armor pieces, but the issue is, that the update can also be caused by items being moved into/out of the currently selected hotbar slot.

Customisable Armor Set Setting and armor material groups

Currently the armor set is set as all registered armor_items must be worn to be a valid set to recieve the set bonus. This is intresting when you start adding extra armor_items.

I worked up a test branch which impliments customisable set using the settings screen, branch is here
https://github.com/sirrobzeroone/3d_armor/tree/armor-set-clean-up

In the process of doing the above I noticed the armor material is gathered from the armor item name using a string match. Which works great until the armor item no longer has the material in the name or the material in the correct location in the name. So I added some new armor groups which start armor_m_"material name" eg armor_m_wood=1 for all wood armor items. Unfortunatly I still had to do an string match to get material name but it is now on a group name which I think is an improvement.

I made the change backwards compatible so if an armor item dosen't have a group included of armor_m_ then it will fallback to calulating set and bonus using the old code (I probably need to harden that old code a little).

Summary of changes
~ Setting to configure parts that make up armor set - default = "head torso legs feet shield"
~ Setting to adjust armor set multiplier default = 1.1
~ New material armor groups to indicate what the material the armor is made of
~ New code in api.lua to calculate armor set and multiplier
~ New code to init.lua to feed set string into table
~ Armor and shield registrations updated to include armor_m_"materials"
~ Updates to Readme.MD

I've done testing and not uncovered any issues but thought it best to do a seperate branch and as the changes are fairly significant.

Edit: Initial compare of changes (note I stuffed up the MD formating a few times so readme.MD got 3 fixs after this....):
beb2150

Deny un-equipping armors

Could we get something like can_equip/can_unequip callbacks or some kind of metadata to make things like cursed armors?

Gloves and Gauntlets

Before I roll onto content_db and clutter it up, would it be better if I rolled my glove/gauntlet into the main 3d_Armor baseas a pull request.

I'm thinking similar to shields but unlike shields off by default. Also understand if its better to leave it as a seperate mod as it will add more maintenace overhead for 3d_Armor.

I'm happy with either outcome just wanted to make the offer.

Minetest shutsdown game

Hi,
I can create and play a game for a while and close it but when I try to play the game again Minetest shuts it down with the following message:
AsyncErr: Lua: Runtime error from mod '' in callback on_joinplayer(): (load):1578: attempt to index field 'items_progress' (a nil value)
Stack traceback:
(load):1578: in function 'get_items_fs'
(load):1774: in function 'make_fs'
(load):177: in function: 'func'
/home/USR/.minetest/mods/3d_armor/3d_armor/api.lua:340: in function 'run_callbacks'
/home/USR/.minetest/mods/3d_armor/3d_armor/api.lua:361: in function 'update_player_visuals'
/home/USR/.minetest/mods/3d_armor/3d_armor/api.lua:528: in function 'set_player_armor'
/home/USR/.minetest/mods/3d_armor/3d_armor/init.lua:285: in function 'init_player_armor'
/home/USR/.minetest/mods/3d_armor/3d_armor/init.lua:326: in function <home/USR/.minetest/mods/3d_armor/3d_armor/init.lua:324>
/usr/share/minetest/builtin/common/register.lua:26 in function </usr/share/minetest/builtin/common/register.lua:12>

I did try to disable this mod and load the game however that caused Minetest to shutdown.

[Edit] Currently running Minetest 5.8.0 on Linux Mint 21.2

Disable Visuals?

Is it possible to disable armor visuals on the character? I want the benefit of wearing armor, but don't want it to cover my custom player skins.

The server crashes when the player relogs referring to 3d_armor (again?)

I'm building a Minetest server to play with friends. And while testing the administrative part of the server and the Troll mod, I ran into the problem that when reconnecting the player, the server crashes with a lua error. And judging by the error, this is caused by the 3d_armor (and skinsdb) mod.

Video with error:

minetest_crash.mp4

Error:

AsyncErr: Lua: Runtime error from mod '' in callback environment_Step(): (load):1578: attempt to index field 'items_progress' (a nil value)
stack traceback:
(load):1578: in function 'get_items_fs'
(load):1774: in function 'make_fs'
(load):177: in function 'func'
/home/user/.minetest/mods/3d_armor/3d_armor/api.lua:341: in function 'run_callbacks'
/home/user/.minetest/mods/skinsdb/init.lua:55: in function 'update_player_visuals'
/home/user/.minetest/mods/3d_armor/3d_armor/api.lua:529: in function 'set_player_armor'
/home/user/.minetest/mods/3d_armor/3d_armor/init.lua:291: in function 'init_player_armor'
/home/user/.minetest/mods/3d_armor/3d_armor/init.lua:338: in function 'func'
/usr/share/minetest/builtin/common/after.lua:20: in function </usr/share/minetest/builtin/common/after.lua:5>
/usr/share/minetest/builtin/game/register.lua:446: in function </usr/share/minetest/builtin/game/register.lua:432>

Additional information:

  • OS: Manjaro Linux
  • Minetest version: 5.7.0 - 5.8.0-git

Divide armor wear amongst number of pieces worn

The partial fix for issue #24 exposed that when armor recieves wear, whether you wear 1 piece or 5 pieces the armor pieces all take the same amount of wear/damage.

My suggestion; Is that as you wear more pieces of armor the damage/use is spread as a fraction across all armor pieces. Given that damage/use is already set by the armor piece type this would simply involve dividing the use/damage for that armor piece by the number of armor pieces worn.

I have developed a small change to api.lua>>armor.damage which makes the above change, I have tested this and can't detect any issues - basically replace the current armor.damage starting at ~= line 417 with the below :

armor.damage = function(self, player, index, stack, use)
	local old_stack = ItemStack(stack)	
	local worn_armor = armor:get_weared_armor_elements(player)               -- Addition Start
	local armor_p_cnt = 0
	for k,v in pairs(worn_armor) do
		armor_p_cnt = armor_p_cnt + 1
	end
	use = math.ceil(use/armor_p_cnt)                                         --Addition End	
	minetest.chat_send_all(stack:get_name().." pre_wear: "..stack:get_wear()) -- Added for testing
	stack:add_wear(use)
	minetest.chat_send_all(stack:get_name().." post_wear: "..stack:get_wear()) -- Added for testing
	self:run_callbacks("on_damage", player, index, stack)
	self:set_inventory_stack(player, index, stack)
	if stack:get_count() == 0 then
		self:run_callbacks("on_unequip", player, index, old_stack)
		self:run_callbacks("on_destroy", player, index, old_stack)
		self:set_player_armor(player)
	end
end

Testing and outcomes all as expected - short-hand test cases:

One
Wearing just Wooden Chestplate - Recieved full 2000 use/damage

Two
Wearing Wooden Chestplate and Wooden Boots - Each Recieved 1000 use/damage

Three
Wearing Diamond Chestplate and Wooden Boots - Chestplate 100 use/damage, Boots 1000 use/damage

Four
Full Wooden armor Chest, Boots, Leggings, Helmet - Each recieved 500 use/damage

Five
Wood Helmet, Diamond Chest, Bronze Leggings, Steel Boots:
Helmet 500 use/damage, Chestplate 50 use/damage, Leggings 100 use/damage, boots 200 use/damage.

I did contemplate making Chestplate take a larger proportion (say 2/6 when wearing 5 pieces ie have chestplate count as "2" not 1) but that makes the fix significantly more complex and I thought for an initial enhancement simple might be best? I'm very happy to take suggestions and ideas and code imporvements etc and even roll in that chestplate fix although I was worried ppl might then not wear chestplates.....

forced depens on hunger api

the commit acd8b26 forces dependency of unnecesary hunger mod.. cos it uses reason that is only defined in hunger api..

so it breaks in other cases.. addition of another dependency is not a way

crash

2024-01-14 12:10:27: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'petz' in callback environment_Step(): ....7.0/Minetest_live/bin/../mods/3d_armor/3d_armor/api.lua:723: attempt to index local 'inv' (a nil value)
2024-01-14 12:10:27: ERROR[Main]: stack traceback:
2024-01-14 12:10:27: ERROR[Main]: 	....7.0/Minetest_live/bin/../mods/3d_armor/3d_armor/api.lua:723: in function 'func'
2024-01-14 12:10:27: ERROR[Main]: 	...e/mt/5.7.0/Minetest_live/bin/../builtin/common/after.lua:27: in function <...e/mt/5.7.0/Minetest_live/bin/../builtin/common/after.lua:11>
2024-01-14 12:10:27: ERROR[Main]: 	.../mt/5.7.0/Minetest_live/bin/../builtin/game/register.lua:446: in function <.../mt/5.7.0/Minetest_live/bin/../builtin/game/register.lua:432>

you can't expect a player object to be valid on a different server step.

enhancement request - temporarily disable model/texture changes for specific players

Hi,

I'm trying to create a shapeshifting mod. In short: set the player's model and texture to some available animals from other mods.

Bildschirmfoto 2022-02-11 um 08 29 00

With 3d_armor enabled and wieldview, every change of armor or wielded item breaks the animals texture, as it calls armor:update_player_visuals(player).

Bildschirmfoto 2022-02-11 um 08 29 50

Would it be possible to enhance 3d_armor so that other mods can temporarily disable all texture and model changes?

eg
armor:disable_player(player)
armor:enable_player(player)

Please tag releases

There has been no release since 0.4.14 a bit more than a year ago, while I see there were numerous changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.