Increase physics_speed on leather and blackmithril armors

And fix crash if player is wearing these armors when joining session.
This commit is contained in:
bri cassa 2025-04-20 13:27:54 +02:00
parent 9198fefb82
commit c9a7bb70f1

View File

@ -32,6 +32,7 @@ end
local mod_hbsprint = minetest.get_modpath("hbsprint") ~= nil local mod_hbsprint = minetest.get_modpath("hbsprint") ~= nil
local function change_stamina_max(player, value) local function change_stamina_max(player, value)
if mod_hbsprint then if mod_hbsprint then
core.after(0.5, function()
local new_max = value + hb.get_hudtable("stamina").hudstate[player:get_player_name()].max local new_max = value + hb.get_hudtable("stamina").hudstate[player:get_player_name()].max
local val = player:get_meta():get_float("hbsprint:stamina") local val = player:get_meta():get_float("hbsprint:stamina")
if val > new_max then if val > new_max then
@ -41,6 +42,7 @@ local function change_stamina_max(player, value)
hb.unhide_hudbar(player, "stamina") hb.unhide_hudbar(player, "stamina")
hb.change_hudbar(player, "stamina", nil, new_max) hb.change_hudbar(player, "stamina", nil, new_max)
end end
end)
end end
end end
@ -79,7 +81,7 @@ if armor.materials.reinforcedleather then
armor:register_armor(":3d_armor:helmet_reinforcedleather", { armor:register_armor(":3d_armor:helmet_reinforcedleather", {
description = S("Reinforced Leather Helmet (@1)", S("Hunter")), description = S("Reinforced Leather Helmet (@1)", S("Hunter")),
inventory_image = "3d_armor_inv_helmet_reinforcedleather.png", inventory_image = "3d_armor_inv_helmet_reinforcedleather.png",
groups = {armor_head=1, armor_use=40, physics_speed=0.02, physics_gravity=-0.02}, groups = {armor_head=1, armor_use=40, physics_speed=0.4, physics_gravity=-0.02},
armor_groups = {fleshy=6}, armor_groups = {fleshy=6},
damage_groups = {cracky=2, snappy=1, choppy=1, level=2}, damage_groups = {cracky=2, snappy=1, choppy=1, level=2},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
@ -94,7 +96,7 @@ if armor.materials.reinforcedleather then
armor:register_armor(":3d_armor:chestplate_reinforcedleather", { armor:register_armor(":3d_armor:chestplate_reinforcedleather", {
description = S("Reinforced Leather Chestplate (@1)", S("Hunter")), description = S("Reinforced Leather Chestplate (@1)", S("Hunter")),
inventory_image = "3d_armor_inv_chestplate_reinforcedleather.png", inventory_image = "3d_armor_inv_chestplate_reinforcedleather.png",
groups = {armor_torso = 1, armor_use = 40, physics_speed=0.08, physics_gravity=-0.08}, groups = {armor_torso = 1, armor_use = 40, physics_speed=1.6, physics_gravity=-0.08},
armor_groups = {fleshy=11}, armor_groups = {fleshy=11},
damage_groups = {cracky=2, snappy=1, choppy=1, level=2}, damage_groups = {cracky=2, snappy=1, choppy=1, level=2},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
@ -110,7 +112,7 @@ if armor.materials.reinforcedleather then
armor:register_armor(":3d_armor:leggings_reinforcedleather", { armor:register_armor(":3d_armor:leggings_reinforcedleather", {
description = S("Reinforced Leather Leggings (@1)", S("Hunter")), description = S("Reinforced Leather Leggings (@1)", S("Hunter")),
inventory_image = "3d_armor_inv_leggings_reinforcedleather.png", inventory_image = "3d_armor_inv_leggings_reinforcedleather.png",
groups = {armor_legs = 1, armor_use = 40, physics_speed=0.06, physics_gravity=-0.06}, groups = {armor_legs = 1, armor_use = 40, physics_speed=1.2, physics_gravity=-0.06},
armor_groups = {fleshy=11}, armor_groups = {fleshy=11},
damage_groups = {cracky=2, snappy=1, choppy=1, level=2}, damage_groups = {cracky=2, snappy=1, choppy=1, level=2},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
@ -125,7 +127,7 @@ if armor.materials.reinforcedleather then
armor:register_armor(":3d_armor:boots_reinforcedleather", { armor:register_armor(":3d_armor:boots_reinforcedleather", {
description = S("Reinforced Leather Boots (@1)", S("Hunter")), description = S("Reinforced Leather Boots (@1)", S("Hunter")),
inventory_image = "3d_armor_inv_boots_reinforcedleather.png", inventory_image = "3d_armor_inv_boots_reinforcedleather.png",
groups = {armor_feet = 1, armor_use = 40, physics_speed=0.02, physics_gravity=-0.02}, groups = {armor_feet = 1, armor_use = 40, physics_speed=0.4, physics_gravity=-0.02},
armor_groups = {fleshy=6}, armor_groups = {fleshy=6},
damage_groups = {cracky=2, snappy=1, choppy=1, level=3}, damage_groups = {cracky=2, snappy=1, choppy=1, level=3},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
@ -159,7 +161,7 @@ if armor.materials.hardenedleather then
armor:register_armor(":3d_armor:helmet_hardenedleather", { armor:register_armor(":3d_armor:helmet_hardenedleather", {
description = S("Hardened Leather Helmet (@1)", S("Hunter")), description = S("Hardened Leather Helmet (@1)", S("Hunter")),
inventory_image = "3d_armor_inv_helmet_hardenedleather.png", inventory_image = "3d_armor_inv_helmet_hardenedleather.png",
groups = {armor_head = 1, armor_use = 250, physics_speed=0.01, physics_gravity=-0.01}, groups = {armor_head = 1, armor_use = 250, physics_speed=0.2, physics_gravity=-0.01},
armor_groups = {fleshy=5}, armor_groups = {fleshy=5},
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2}, damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
@ -174,7 +176,7 @@ if armor.materials.hardenedleather then
armor:register_armor(":3d_armor:chestplate_hardenedleather", { armor:register_armor(":3d_armor:chestplate_hardenedleather", {
description = S("Hardened Leather Chestplate (@1)", S("Hunter")), description = S("Hardened Leather Chestplate (@1)", S("Hunter")),
inventory_image = "3d_armor_inv_chestplate_hardenedleather.png", inventory_image = "3d_armor_inv_chestplate_hardenedleather.png",
groups = {armor_torso = 1, armor_use = 250, physics_speed=0.04, physics_gravity=-0.04}, groups = {armor_torso = 1, armor_use = 250, physics_speed=0.8, physics_gravity=-0.04},
armor_groups = {fleshy=8}, armor_groups = {fleshy=8},
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2}, damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
@ -189,7 +191,7 @@ if armor.materials.hardenedleather then
armor:register_armor(":3d_armor:leggings_hardenedleather", { armor:register_armor(":3d_armor:leggings_hardenedleather", {
description = S("Hardened Leather Leggings (@1)", S("Hunter")), description = S("Hardened Leather Leggings (@1)", S("Hunter")),
inventory_image = "3d_armor_inv_leggings_hardenedleather.png", inventory_image = "3d_armor_inv_leggings_hardenedleather.png",
groups = {armor_legs = 1, armor_use = 250, physics_speed=0.03, physics_gravity=-0.03}, groups = {armor_legs = 1, armor_use = 250, physics_speed=0.6, physics_gravity=-0.03},
armor_groups = {fleshy=8}, armor_groups = {fleshy=8},
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2}, damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
@ -204,7 +206,7 @@ if armor.materials.hardenedleather then
armor:register_armor(":3d_armor:boots_hardenedleather", { armor:register_armor(":3d_armor:boots_hardenedleather", {
description = S("Hardened Leather Boots (@1)", S("Hunter")), description = S("Hardened Leather Boots (@1)", S("Hunter")),
inventory_image = "3d_armor_inv_boots_hardenedleather.png", inventory_image = "3d_armor_inv_boots_hardenedleather.png",
groups = {armor_feet = 1, armor_use = 250, physics_speed=0.01, physics_gravity=-0.01}, groups = {armor_feet = 1, armor_use = 250, physics_speed=0.2, physics_gravity=-0.01},
armor_groups = {fleshy=5}, armor_groups = {fleshy=5},
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2}, damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
@ -238,14 +240,16 @@ if armor.materials.blackmithril then
armor:register_armor(":3d_armor:helmet_blackmithril", { armor:register_armor(":3d_armor:helmet_blackmithril", {
description = S("Black Mithril Helmet (@1)", S("Warrior")), description = S("Black Mithril Helmet (@1)", S("Warrior")),
inventory_image = "3d_armor_inv_helmet_blackmithril.png", inventory_image = "3d_armor_inv_helmet_blackmithril.png",
groups = {armor_head = 1, armor_heal = 15, armor_use = 40}, groups = {armor_head = 1, armor_heal = 15, physics_speed=0.2, armor_use = 40},
armor_groups = {fleshy=16}, armor_groups = {fleshy=16},
damage_groups = {cracky=2, snappy=1, level=3}, damage_groups = {cracky=2, snappy=1, level=3},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
change_hp_max(player, 1) change_hp_max(player, 1)
change_stamina_max(player, 1)
end, end,
on_unequip = function(player, index, stack) on_unequip = function(player, index, stack)
change_hp_max(player, -1) change_hp_max(player, -1)
change_stamina_max(player, -1)
end, end,
}) })
@ -253,14 +257,16 @@ if armor.materials.blackmithril then
armor:register_armor(":3d_armor:chestplate_blackmithril", { armor:register_armor(":3d_armor:chestplate_blackmithril", {
description = S("Black Mithril Chestplate (@1)", S("Warrior")), description = S("Black Mithril Chestplate (@1)", S("Warrior")),
inventory_image = "3d_armor_inv_chestplate_blackmithril.png", inventory_image = "3d_armor_inv_chestplate_blackmithril.png",
groups = {armor_torso = 1, armor_heal = 15, armor_use = 40}, groups = {armor_torso = 1, armor_heal = 15, physics_speed=0.8, armor_use = 40},
armor_groups = {fleshy=22}, armor_groups = {fleshy=22},
damage_groups = {cracky=2, snappy=1, level=3}, damage_groups = {cracky=2, snappy=1, level=3},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
change_hp_max(player, 5) change_hp_max(player, 5)
change_stamina_max(player, 4)
end, end,
on_unequip = function(player, index, stack) on_unequip = function(player, index, stack)
change_hp_max(player, -5) change_hp_max(player, -5)
change_stamina_max(player, -4)
end, end,
}) })
@ -268,14 +274,16 @@ if armor.materials.blackmithril then
armor:register_armor(":3d_armor:leggings_blackmithril", { armor:register_armor(":3d_armor:leggings_blackmithril", {
description = S("Black Mithril Leggings (@1)", S("Warrior")), description = S("Black Mithril Leggings (@1)", S("Warrior")),
inventory_image = "3d_armor_inv_leggings_blackmithril.png", inventory_image = "3d_armor_inv_leggings_blackmithril.png",
groups = {armor_legs = 1, armor_heal = 15, armor_use = 40}, groups = {armor_legs = 1, armor_heal = 15, physics_speed = 0.6, armor_use = 40},
armor_groups = {fleshy=22}, armor_groups = {fleshy=22},
damage_groups = {cracky=2, snappy=1, level=3}, damage_groups = {cracky=2, snappy=1, level=3},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
change_hp_max(player, 3) change_hp_max(player, 3)
change_stamina_max(player, 3)
end, end,
on_unequip = function(player, index, stack) on_unequip = function(player, index, stack)
change_hp_max(player, -3) change_hp_max(player, -3)
change_stamina_max(player, -3)
end, end,
}) })
@ -283,14 +291,16 @@ if armor.materials.blackmithril then
armor:register_armor(":3d_armor:boots_blackmithril", { armor:register_armor(":3d_armor:boots_blackmithril", {
description = S("Black Mithril Boots (@1)", S("Warrior")), description = S("Black Mithril Boots (@1)", S("Warrior")),
inventory_image = "3d_armor_inv_boots_blackmithril.png", inventory_image = "3d_armor_inv_boots_blackmithril.png",
groups = {armor_feet = 1, armor_heal = 15, armor_use = 40}, groups = {armor_feet = 1, armor_heal = 15, physics_speed = 0.2, armor_use = 40},
armor_groups = {fleshy=16}, armor_groups = {fleshy=16},
damage_groups = {cracky=2, snappy=1, level=3}, damage_groups = {cracky=2, snappy=1, level=3},
on_equip = function(player, index, stack) on_equip = function(player, index, stack)
change_hp_max(player, 1) change_hp_max(player, 1)
change_stamina_max(player, 1)
end, end,
on_unequip = function(player, index, stack) on_unequip = function(player, index, stack)
change_hp_max(player, -1) change_hp_max(player, -1)
change_stamina_max(player, -1)
end, end,
}) })