Skip to content

Commit

Permalink
Add setting to disable armor visuals on player model (stujones11#48)
Browse files Browse the repository at this point in the history
* Add setting to disable armor visuals on player model
  • Loading branch information
AntumDeluge committed May 27, 2021
1 parent 371285a commit a0cf12b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 3d_armor/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ armor.update_player_visuals = function(self, player)
self:run_callbacks("on_update", player)
end


-- armor is not visible on player model if enabled
local transparent_armor = minetest.settings:get_bool("armor_transparent", false)

armor.set_player_armor = function(self, player)
local name, armor_inv = self:get_valid_player(player, "[set_player_armor]")
if not name then
Expand Down Expand Up @@ -258,7 +262,9 @@ armor.set_player_armor = function(self, player)
tex = tex:gsub(".png$", "")
local prev = def.preview or tex.."_preview"
prev = prev:gsub(".png$", "")
texture = texture.."^"..tex..".png"
if not transparent_armor then
texture = texture.."^"..tex..".png"
end
preview = preview.."^"..prev..".png"
state = state + stack:get_wear()
count = count + 1
Expand Down
3 changes: 3 additions & 0 deletions settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ armor_punch_damage (Enable damage effects) bool true
# Enable migration of old armor inventories.
armor_migrate_old_inventory (Migrate old armor inventories) bool true

# Don't show armor on character model.
armor_transparent (Transparent armor) bool false


[shields]

Expand Down

0 comments on commit a0cf12b

Please sign in to comment.