README.txt 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. [mod] Visible Player Armor [3d_armor]
  2. =====================================
  3. Depends: default
  4. Recommends: sfinv, unified_inventory or smart_inventory (use only one to avoid conflicts)
  5. Supports: player_monoids and armor_monoid
  6. Adds craftable armor that is visible to other players. Each armor item worn contributes to
  7. a player's armor group level making them less vulnerable to weapons.
  8. Armor takes damage when a player is hurt but also offers a percentage chance of healing.
  9. Overall level is boosted by 10% when wearing a full matching set.
  10. Fire protection added by TenPlus1 when using crystal armor if Ethereal mod active, level 1
  11. protects against torches, level 2 for crystal spike, level 3 for fire, level 5 for lava.
  12. Armor Configuration
  13. -------------------
  14. Override the following default settings by adding them to your minetest.conf file.
  15. -- Set false to disable individual armor materials.
  16. armor_material_wood = true
  17. armor_material_cactus = true
  18. armor_material_steel = true
  19. armor_material_bronze = true
  20. armor_material_diamond = true
  21. armor_material_gold = true
  22. armor_material_mithril = true
  23. armor_material_crystal = true
  24. -- Increase this if you get initialization glitches when a player first joins.
  25. armor_init_delay = 2
  26. -- Number of initialization attempts.
  27. -- Use in conjunction with armor_init_delay if initialization problems persist.
  28. armor_init_times = 10
  29. -- Increase this if armor is not getting into bones due to server lag.
  30. armor_bones_delay = 1
  31. -- How often player armor items are updated.
  32. armor_update_time = 1
  33. -- Drop armor when a player dies.
  34. -- Uses bones mod if present, otherwise items are dropped around the player.
  35. armor_drop = true
  36. -- Pulverise armor when a player dies, overrides armor_drop.
  37. armor_destroy = false
  38. -- You can use this to increase or decrease overall armor effectiveness,
  39. -- eg: level_multiplier = 0.5 will reduce armor level by half.
  40. armor_level_multiplier = 1
  41. -- You can use this to increase or decrease overall armor healing,
  42. -- eg: armor_heal_multiplier = 0 will disable healing altogether.
  43. armor_heal_multiplier = 1
  44. -- Enable water protection (periodically restores breath when activated)
  45. armor_water_protect = true
  46. -- Enable fire protection (defaults true if using ethereal mod)
  47. armor_fire_protect = false
  48. -- Enable punch damage effects.
  49. armor_punch_damage = true
  50. -- Enable migration of old armor inventories
  51. armor_migrate_old_inventory = true
  52. API
  53. ---
  54. Armor Registration:
  55. armor:register_armor(name, def)
  56. Wrapper function for `minetest.register_tool`, while registering armor as
  57. a tool item is still supported, this may be deprecated in future so new code
  58. should use this method.
  59. Additional fields supported by 3d_armor:
  60. texture = <filename>
  61. preview = <filename>
  62. armor_groups = <table>
  63. damage_groups = <table>
  64. reciprocate_damage = <bool>
  65. on_equip = <function>
  66. on_unequip = <function>
  67. on_destroy = <function>
  68. on_damage = <function>
  69. on_punched = <function>
  70. armor:register_armor_group(group, base)
  71. Example:
  72. armor:register_armor_group("radiation", 100)
  73. armor:register_armor("mod_name:speed_boots", {
  74. description = "Speed Boots",
  75. inventory_image = "mod_name_speed_boots_inv.png",
  76. texture = "mod_name_speed_boots.png",
  77. preview = "mod_name_speed_boots_preview.png",
  78. groups = {armor_feet=1, armor_use=500, physics_speed=1.2, flammable=1},
  79. armor_groups = {fleshy=10, radiation=10},
  80. damage_groups = {cracky=3, snappy=3, choppy=3, crumbly=3, level=1},
  81. reciprocate_damage = true,
  82. on_destroy = function(player, index, stack)
  83. local pos = player:get_pos()
  84. if pos then
  85. minetest.sound_play({
  86. name = "mod_name_break_sound",
  87. pos = pos,
  88. gain = 0.5,
  89. })
  90. end
  91. end,
  92. })
  93. See armor.lua, technic_armor and shields mods for more examples.
  94. Default groups:
  95. Elements: armor_head, armor_torso, armor_legs, armor_feet
  96. Attributes: armor_heal, armor_fire, armor_water
  97. Physics: physics_jump, physics_speed, physics_gravity
  98. Durability: armor_use, flammable
  99. Notes:
  100. Elements may be modified by dependent mods, eg shields adds armor_shield.
  101. Attributes and physics values are 'stackable', durability is determined
  102. by the level of armor_use, total uses == approx (65535/armor_use), non-fleshy
  103. damage groups need to be defined in the tool/weapon used against the player.
  104. Reciprocal tool damage will be done only by the first armor inventory item
  105. with `reciprocate_damage = true`
  106. Armor Functions:
  107. armor:set_player_armor(player)
  108. Primarily an internal function but can be called externally to apply any
  109. changes that might not otherwise get handled.
  110. armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
  111. Used to apply damage to all equipped armor based on the damage groups of
  112. each individual item.`hitter`, `time_from_last_punch` and `tool_capabilities`
  113. are optional but should be valid if included.
  114. armor:damage(player, index, stack, use)
  115. Adds wear to a single armor itemstack, triggers `on_damage` callbacks and
  116. updates the necessary inventories. Also handles item destruction callbacks
  117. and so should NOT be called from `on_unequip` to avoid an infinite loop.
  118. Item Callbacks:
  119. on_equip = func(player, index, stack)
  120. on_unequip = func(player, index, stack)
  121. on_destroy = func(player, index, stack)
  122. on_damage = func(player, index, stack)
  123. on_punched = func(player, hitter, time_from_last_punch, tool_capabilities)
  124. Notes:
  125. `on_punched` is called every time a player is punched or takes damage, `hitter`,
  126. `time_from_last_punch` and `tool_capabilities` can be `nil` and will be in the
  127. case of fall damage, etc. When fire protection is enabled, hitter == "fire"
  128. in the event of fire damage. Return `false` to override armor damage effects.
  129. When armor is destroyed `stack` will contain a copy of the previous stack.
  130. Global Callbacks:
  131. armor:register_on_update(func(player))
  132. armor:register_on_equip(func(player, index, stack))
  133. armor:register_on_unequip(func(player, index, stack))
  134. armor:register_on_destroy(func(player, index, stack))
  135. Global Callback Example:
  136. armor:register_on_update(function(player)
  137. print(player:get_player_name().." armor updated!")
  138. end)