disable damage

This commit is contained in:
Zughy 2020-12-19 12:11:50 +01:00
parent 95b4bb8078
commit cca3142bea

View File

@ -25,13 +25,13 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
if pointed_thing == nil then return end
if pointed_thing.type == 'object' then
if minetest.is_player(pointed_thing.ref) == true then
local dir = user:get_look_dir()
local keys = user:get_player_control()
local swap = false
local hitted_pos = pointed_thing.ref:get_pos()
local hitter_pos = user:get_pos()
if keys.sneak and vector.distance(hitted_pos,hitter_pos) < 3 then
if keys.sneak and vector.distance(hitted_pos,hitter_pos) < 3 then
swap = true
user:move_to(hitted_pos, true)
pointed_thing.ref:move_to(hitter_pos, true)
@ -53,10 +53,10 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
})
end
end
end
end
end,
on_drop = function() end,
on_place = function(itemstack, placer, pointed_thing)
@ -69,7 +69,7 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
local old_time = imeta:get_int('old_time')
local current_time = minetest.get_gametime()
if old_time == 0 or old_time == nil then
first_use = true
first_use = true
end
if first_use or current_time > old_time + stick_vault_timeout then
local lookvect = placer:get_look_dir()
@ -85,7 +85,7 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
max_hear_distance = 10,
gain = 10.0,
})
imeta:set_int('old_time', current_time)
return itemstack
end
@ -101,10 +101,10 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
paramtype = "light",
sunlight_propagates = true,
walkable = false,
pointable = true,
diggable = true,
buildable_to = false,
walkable = false,
pointable = true,
diggable = true,
buildable_to = false,
drop = "",
damage_per_second = 40,
groups = {oddly_breakable_by_hand = 1},
@ -155,7 +155,7 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
groups = {water = 3, liquid = 3, cools_lava = 1},
sounds = default.node_sound_water_defaults(),
})
minetest.register_node("sumo:player_killer_water_flowing", {
description = "Sumo Arena Player Killer Water Flowing",
drawtype = "flowingliquid",
@ -223,13 +223,11 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
sneak = false,
},
--disabled_damage_types = {'punch'},
disabled_damage_types = {"punch"},
player_properties = {
player_properties = {
},
})
@ -238,26 +236,17 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
arena_lib.on_load("sumo", function(arena)
local item = ItemStack("sumo:pushstick")
for pl_name, stats in pairs(arena.players) do
local player = minetest.get_player_by_name(pl_name)
player:get_inventory():set_stack("main", 1, item)
end
end)
minetest.register_on_player_hpchange(function(player, hp_change, reason)
if arena_lib.is_player_in_arena(player:get_player_name(), 'sumo') and reason.type ~= 'node_damage' and reason.type ~= 'set_hp' then
--the only types of damage allowed in the arena are node_damage and set_hp
return 0
else
return hp_change
end
end, true)
end)
arena_lib.on_time_tick('sumo', function(arena)
return
end)
--if the game times out
@ -266,7 +255,7 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
for p_name, p_stats in pairs(arena.players) do
table.insert(winner_names, p_name)
end
arena_lib.load_celebration('sumo', arena, winner_names)
@ -286,10 +275,10 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
minetest.register_privilege("sumo_admin", {
minetest.register_privilege("sumo_admin", {
description = "With this you can use /sumo create, edit"
})
@ -316,8 +305,8 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
arena_lib.remove_arena(name, "sumo", arena_name)
end)
-- list of the arenas
cmd:sub("list", function(name)
arena_lib.print_arenas(name, "sumo")
@ -329,7 +318,7 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
-- enter editor mode
cmd:sub("edit :arena", function(sender, arena)
arena_lib.enter_editor(sender, "sumo", arena)
@ -350,19 +339,17 @@ local allow_swap_distance = 3 -- if an opponent is within this distance, then if
end, {
description = [[
(/help sumo)
Use this to configure your arena:
- create <arena name> [min players] [max players]
- edit <arena name>
- edit <arena name>
- enable <arena name>
Other commands:
- remove <arena name>
- disable <arena>
]],
privs = { sumo_admin = true }
})