Add player lives : 3 , configurable
parent
7970b2df5e
commit
f14a574777
35
README.md
35
README.md
|
@ -8,4 +8,37 @@ Contributors: Zughy, MisterE
|
|||
|
||||
Schematics for arenas can be found here:
|
||||
|
||||
https://notabug.org/MisterE123/sumo_arenas
|
||||
https://notabug.org/MisterE123/sumo_arenas
|
||||
|
||||
|
||||
Sumo mod by MisterE for use with arena_lib (minigame_lib) You should be familiar with how to set up arena_lib arenas.
|
||||
|
||||
Code snippets from https://gitlab.com/zughy-friends-minetest/arena_lib/-/blob/master/DOCS.md and from Zughy's minigames
|
||||
|
||||
|
||||
to set up an arena, create a confined space that floats in the air, with lava or other damage blocks beneath. Set the spawners on the platform. You can use mesecons to make the board more interesting.
|
||||
|
||||
In this game, each player gets a tool that pushes other players... the goal is to knock all other players off and be the last one standing. Each player has 3 lives
|
||||
|
||||
|
||||
Basic setup:
|
||||
|
||||
1) type /sumo create <arena_name>
|
||||
2) type /sumo edit <arena_name>
|
||||
3) use the editor to place a minigame sign, assign it to your minigame.
|
||||
4) while in the editor, move to where your arena will be.
|
||||
5) Make your arena. There should be some type of platform, with a lava pool underneath to kill players that fall off.
|
||||
6) using the editor tools, mark player spawner locations. Protect the arena.
|
||||
7) exit the editor mode
|
||||
8) type /minigamesettings sumo
|
||||
9) change the hub spawnpoint to be next to the signs.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
2
init.lua
2
init.lua
|
@ -27,6 +27,7 @@ local player_jump = sumo.player_jump -- when in the minigame, though players can
|
|||
},
|
||||
|
||||
disabled_damage_types = {"punch","fall","set_hp"},
|
||||
properties = {lives = 3,},
|
||||
temp_properties = {
|
||||
speed = player_speed,
|
||||
jump = player_jump,
|
||||
|
@ -36,6 +37,7 @@ local player_jump = sumo.player_jump -- when in the minigame, though players can
|
|||
run_start_time = 0.0,
|
||||
running = false,
|
||||
run_timeout = 3, --players can't run for 3 sec after match start
|
||||
lives = 3,
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ arena_lib.on_load("sumo", function(arena)
|
|||
minetest.chat_send_player(pl_name,message)
|
||||
message = minetest.colorize('Red', '[Aux1 (e)]: ')..minetest.colorize('Green', 'Run! Watch out for cooldown.')
|
||||
minetest.chat_send_player(pl_name,message)
|
||||
arena.players[pl_name].lives = arena.lives
|
||||
|
||||
end
|
||||
--countdown timer, give item at appropriate time
|
||||
|
@ -138,8 +139,22 @@ minetest.register_on_player_hpchange(function(player, hp_change)
|
|||
return 0
|
||||
end
|
||||
if hp + hp_change <= 0 then --dont ever kill players, but if a damage *would* kill them, then eliminate them, and set their health back to normal
|
||||
arena_lib.HUD_hide('hotbar', pl_name)
|
||||
arena_lib.remove_player_from_arena(pl_name, 1)
|
||||
|
||||
|
||||
arena.players[pl_name].lives = arena.players[pl_name].lives - 1
|
||||
if arena.players[pl_name].lives == 0 then
|
||||
arena_lib.remove_player_from_arena(pl_name, 1)
|
||||
arena_lib.HUD_hide('hotbar', pl_name)
|
||||
else
|
||||
arena_lib.HUD_send_msg("title", pl_name,'You Died! Lives: '.. arena.players[pl_name].lives , 2,nil,0xFF1100)
|
||||
local sp_pos = arena_lib.get_random_spawner(arena)
|
||||
minetest.sound_play('sumo_elim', {
|
||||
to_player = pl_name,
|
||||
gain = 2.0,
|
||||
})
|
||||
player:move_to(sp_pos, false)
|
||||
|
||||
end
|
||||
player:set_hp(20)
|
||||
return 0
|
||||
else
|
||||
|
@ -169,10 +184,22 @@ end)
|
|||
|
||||
|
||||
arena_lib.on_death('sumo', function(arena, p_name, reason)
|
||||
arena_lib.HUD_hide('hotbar', p_name)
|
||||
if not arena.in_celebration then
|
||||
|
||||
arena.players[p_name].lives = arena.players[p_name].lives - 1
|
||||
if arena.players[p_name].lives == 0 then
|
||||
arena_lib.remove_player_from_arena(p_name, 1)
|
||||
arena_lib.HUD_hide('hotbar', p_name)
|
||||
else
|
||||
arena_lib.HUD_send_msg("title", p_name,'You Died! Lives: '.. arena.players[p_name].lives , 2,nil,0xFF1100)
|
||||
local sp_pos = arena_lib.get_random_spawner(arena)
|
||||
local player = minetest.get_player_by_name(p_name)
|
||||
minetest.sound_play('sumo_elim', {
|
||||
to_player = p_name,
|
||||
gain = 2.0,
|
||||
})
|
||||
if player then
|
||||
player:move_to(sp_pos, false)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ Code snippets from https://gitlab.com/zughy-friends-minetest/arena_lib/-/blob/ma
|
|||
|
||||
to set up an arena, create a confined space that floats in the air, with lava or other damage blocks beneath. Set the spawners on the platform. You can use mesecons to make the board more interesting.
|
||||
|
||||
In this game, each player gets a tool that pushes other players... the goal is to knock all other players off and be the last one standing.
|
||||
In this game, each player gets a tool that pushes other players... the goal is to knock all other players off and be the last one standing. Each player has 3 lives
|
||||
|
||||
|
||||
Basic setup:
|
||||
|
|
Loading…
Reference in New Issue