Suono salto in partita se non esplode

master
Marco 2020-04-10 20:59:36 +02:00
parent 7e1897169c
commit a8da3be957
6 changed files with 56 additions and 2 deletions

View File

@ -3,6 +3,7 @@ arena_lib.arenas = {}
arena_lib.mod_name = minetest.get_current_modname()
dofile(minetest.get_modpath(arena_lib.mod_name) .. "/arena_lib/debug_utilities.lua")
dofile(minetest.get_modpath(arena_lib.mod_name) .. "/arena_lib/input_manager.lua")
dofile(minetest.get_modpath(arena_lib.mod_name) .. "/arena_lib/items.lua")
dofile(minetest.get_modpath(arena_lib.mod_name) .. "/arena_lib/player_manager.lua")
dofile(minetest.get_modpath(arena_lib.mod_name) .. "/arena_lib/signs.lua")
@ -560,6 +561,12 @@ end
function arena_lib.get_players_in_game()
return players_in_game
end
function arena_lib.get_arenaID_by_player(p_name)
return players_in_game[p_name]
end

View File

@ -0,0 +1,29 @@
--Hopefully waiting on https://github.com/minetest/minetest/issues/9626, in the meanwhile..
minetest.register_globalstep(function(dtime)
for pl_name, id in pairs(arena_lib.get_players_in_game()) do
local pl = minetest.get_player_by_name(pl_name)
if pl:get_player_control().aux1 then
arena_lib.on_AUX1_pressed(pl)
end
if pl:get_player_control().jump and pl:get_hp() > 0 then
arena_lib.on_jump(pl)
end
end
end)
function arena_lib.on_AUX1_pressed(pl)
--Override me
end
function arena_lib.on_jump(player)
--Override me
end

View File

@ -10,8 +10,6 @@ minetest.register_on_leaveplayer(function(player)
local p_name = player:get_player_name()
if arena_lib.get_arenaID_by_player(p_name) == nil and arena_lib.get_queueID_by_player(p_name) == nil then return end
minetest.chat_send_player("Zughy", "Vado sul remove player")
arena_lib.remove_player_from_arena(p_name)
end)

View File

@ -32,6 +32,8 @@ function arena_lib.on_start(arena)
end
end
function arena_lib.on_join(p_name, arena_ID)
local arena = arena_lib.arenas[arena_ID]
@ -83,3 +85,21 @@ function arena_lib.on_end(arena, players)
})
end
end
function arena_lib.on_jump(player)
local pos = vector.floor(player:get_pos())
local pos_feet = {x = pos.x, y = pos.y-1, z = pos.z}
if minetest.get_node(pos_feet).name == "air" then return end
local rand = math.math.random(1, 2)
minetest.sound_play("quake_jump"..rand, {
to_player = minetest.get_player_by_name(player),
})
end

BIN
sounds/quake_jump1.ogg Normal file

Binary file not shown.

BIN
sounds/quake_jump2.ogg Normal file

Binary file not shown.