Closed SkyBuilder1717 closed 6 months ago
something like this might get you started: https://github.com/mt-mods/spacesuit/blob/master/drowning.lua#L3-L12
local _, armor_inv = armor.get_valid_player(armor, player, "[spacesuit]")
if not armor_inv then
-- inventory not found (somehow?), skip check
return
end
local has_helmet = armor_inv:contains_item("armor", "spacesuit:helmet")
local has_chestplate = armor_inv:contains_item("armor", "spacesuit:chestplate")
local has_pants = armor_inv:contains_item("armor", "spacesuit:pants")
local has_boots = armor_inv:contains_item("armor", "spacesuit:boots")
disclaimer: this is from an older mod, there might be a better way to do this :)
something like this might get you started: https://github.com/mt-mods/spacesuit/blob/master/drowning.lua#L3-L12
local _, armor_inv = armor.get_valid_player(armor, player, "[spacesuit]") if not armor_inv then -- inventory not found (somehow?), skip check return end local has_helmet = armor_inv:contains_item("armor", "spacesuit:helmet") local has_chestplate = armor_inv:contains_item("armor", "spacesuit:chestplate") local has_pants = armor_inv:contains_item("armor", "spacesuit:pants") local has_boots = armor_inv:contains_item("armor", "spacesuit:boots")
disclaimer: this is from an older mod, there might be a better way to do this :)
thanks
how to ger armor of the player? if a player wears a shield in armor, the code will run, do you have any ideas how to realize this?