support spectate, remove deprecated functions

init.lua:
removed deprecated:hub_spawn_point, timemode = 2 -> timemode = "decremental", spawn_cage, rem_cage

added:
changelog,
version control: use /sumo version,

support spectate mode, while not requiring updating to the latest version.
master
MisterE123 2021-02-16 14:22:44 -05:00
parent 310a420fe6
commit 2a46cd2e5e
6 changed files with 29 additions and 25 deletions

16
changelog.txt Normal file
View File

@ -0,0 +1,16 @@
changelog
---------------
---------------
02-16-2021
---------------
init.lua:
removed deprecated:hub_spawn_point, timemode = 2 -> timemode = "decremental", spawn_cage, rem_cage
added:
changelog,
version control: use /sumo version,
support spectate mode, while not requiring updating to the latest version.

View File

@ -38,6 +38,10 @@ ChatCmdBuilder.new("sumo", function(cmd)
arena_lib.disable_arena(name, "sumo", arena)
end)
cmd:sub("version", function()
return "the current version of sumo is "..sumo.version
end)
end, {
description = [[
@ -51,6 +55,7 @@ end, {
Other commands:
- remove <arena name>
- disable <arena>
- version
]],
privs = { sumo_admin = true }
})

View File

@ -11,9 +11,8 @@ local player_jump = sumo.player_jump -- when in the minigame, though players can
arena_lib.register_minigame("sumo", {
prefix = "[Sumo] ",
hub_spawn_point = { x = 0, y = 20, z = 0 },
show_minimap = false,
time_mode = 2,
time_mode = "decremental",
join_while_in_progress = false,
keep_inventory = false,
in_game_physics = {

View File

@ -19,29 +19,6 @@ local cage_positions = {
local function spawn_cage(pos)
for _,vect in pairs(cage_positions) do
local n_pos = vector.add(pos,vect)
local node = minetest.get_node(n_pos)
if node.name == 'air' or node.name == "sumo:fullclip" then
minetest.set_node(n_pos, {name="sumo:fullclip"})
end
end
end
local function rem_cage(pos)
for _,vect in pairs(cage_positions) do
local n_pos = vector.add(pos,vect)
local node = minetest.get_node(n_pos)
if node.name == 'sumo:fullclip' then
minetest.set_node(n_pos, {name="air"})
end
end
end
local function send_message(arena,num_str)
@ -205,10 +182,12 @@ minetest.register_on_player_hpchange(function(player, hp_change,reason)
if arena_lib.is_player_in_arena(pl_name, 'sumo') then
local arena = arena_lib.get_arena_by_player(pl_name)
local hp = player:get_hp()
--exclude some unwanted possibilities
if arena.in_celebration then --protect winners from damage
return 0
end
if reason.type ~= "node_damage" then return 0 end
if type(arena_lib.is_player_spectating) == "function" and arena_lib.is_player_spectating(pl_name) then return 0 end -- dont let spectators die, or get the pushstick, only run this if spectate mode is available.
if sumo.invincible[pl_name] then return 0 end --protects players from dying twice in a row
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

View File

@ -1,3 +1,7 @@
--version control (do not change unless you are a developer!)
--------------------------------------
sumo.version = "02.16.2021.1" --read: last changed: mo.day.yr.daily_version
-- speed when in the minigame (players will be a little faster when running)
sumo.player_speed = 2
--------------------------------------

1
test.lua Normal file
View File

@ -0,0 +1 @@
//lua local monsta = minetest.add_entity(minetest.get_player_by_name("MisterE"):get_pos(),"mobs_monster:sand_monster",minetest.serialize({health = 200,nametag="Sandmonster+"})) monsta:set_armor_groups({fleshy=20})