Feature: Clearer dyspnea API: 'dyspnea-on' and 'dyspnea-off' events instead of one 'dyspnea' event with value.
parent
58ec0b2382
commit
0b430e3e23
15
init.lua
15
init.lua
|
@ -233,20 +233,18 @@ function minetest_wadsprint.set_stamina(player,stamina_value)
|
||||||
if old_stamina_value >= minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE
|
if old_stamina_value >= minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE
|
||||||
and player.stamina < minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE then
|
and player.stamina < minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE then
|
||||||
minetest_wadsprint.api.events:emit(
|
minetest_wadsprint.api.events:emit(
|
||||||
"dyspnea",
|
"dyspnea-on",
|
||||||
{
|
{
|
||||||
name = "dyspnea",
|
name = "dyspnea-on",
|
||||||
value = true,
|
|
||||||
player = player,
|
player = player,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
elseif old_stamina_value < minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE
|
elseif old_stamina_value < minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE
|
||||||
and player.stamina >= minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE then
|
and player.stamina >= minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE then
|
||||||
minetest_wadsprint.api.events:emit(
|
minetest_wadsprint.api.events:emit(
|
||||||
"dyspnea",
|
"dyspnea-off",
|
||||||
{
|
{
|
||||||
name = "dyspnea",
|
name = "dyspnea-off",
|
||||||
value = false,
|
|
||||||
player = player,
|
player = player,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -275,10 +273,9 @@ function minetest_wadsprint.initialize_player(player_obj)
|
||||||
minetest_wadsprint.initialize_hudbar(player)
|
minetest_wadsprint.initialize_hudbar(player)
|
||||||
if player.stamina < minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE then
|
if player.stamina < minetest_wadsprint.DYSPNEA_THRESHOLD_VALUE then
|
||||||
minetest_wadsprint.api.events:emit(
|
minetest_wadsprint.api.events:emit(
|
||||||
"dyspnea",
|
"dyspnea-on",
|
||||||
{
|
{
|
||||||
name = "dyspnea",
|
name = "dyspnea-on",
|
||||||
value = true,
|
|
||||||
player = player,
|
player = player,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 450 B |
Loading…
Reference in New Issue