+ Announcing the winner in a broadcast on celebration

+ Knife cooldown set to 20s
+ Renamed Cop in Detective
+ Incremented the celebration  time to 7s
This commit is contained in:
Giov4 2020-12-19 17:39:55 +01:00
parent da77e9d522
commit dd120d2d1c
9 changed files with 30 additions and 26 deletions

View File

@ -15,7 +15,7 @@ murder_settings = {}
murder_settings.loading_time = 10 murder_settings.loading_time = 10
-- The time between the end of the match and the respawn at the hub. -- The time between the end of the match and the respawn at the hub.
murder_settings.celebration_time = 5 murder_settings.celebration_time = 7
-- What's going to appear in most of the lines printed by murder. -- What's going to appear in most of the lines printed by murder.
murder_settings.prefix = "Murder > " murder_settings.prefix = "Murder > "

View File

@ -41,12 +41,15 @@ end)
arena_lib.on_celebration("murder", function(arena) arena_lib.on_celebration("murder", function(arena, winner_name)
murder.log(arena, "- celebration started -") murder.log(arena, "- celebration started -")
winner_name = murder.T("@1 won!", winner_name)
for pl_name, _ in pairs(arena.players) do for pl_name, _ in pairs(arena.players) do
arena.roles[pl_name].on_end(arena, pl_name) arena.roles[pl_name].on_end(arena, pl_name)
end end
arena_lib.HUD_send_msg_all("broadcast", arena, winner_name, murder_settings.celebration_time)
end) end)

View File

@ -8,10 +8,10 @@ minetest.register_craftitem("murder:gun", {
local pl_name = player:get_player_name() local pl_name = player:get_player_name()
if not murder.is_player_playing(pl_name) then return end if not murder.is_player_playing(pl_name) then return end
local arena = arena_lib.get_arena_by_player(pl_name) local arena = arena_lib.get_arena_by_player(pl_name)
local cop_props = arena.roles[pl_name].properties local detective_props = arena.roles[pl_name].properties
local reload_delay = 2 local reload_delay = 2
if cop_props.can_shoot then if detective_props.can_shoot then
local ray, pos_head, shoot_dir = murder.look_raycast(player, 100) local ray, pos_head, shoot_dir = murder.look_raycast(player, 100)
local particle_shot = { local particle_shot = {
pos = pos_head, pos = pos_head,
@ -44,8 +44,8 @@ minetest.register_craftitem("murder:gun", {
minetest.sound_play("murder_gun_shoot", {pos = player:get_pos(), to_player = pl_name}) minetest.sound_play("murder_gun_shoot", {pos = player:get_pos(), to_player = pl_name})
cop_props.can_shoot = false detective_props.can_shoot = false
minetest.after(reload_delay, function() cop_props.can_shoot = true end) minetest.after(reload_delay, function() detective_props.can_shoot = true end)
else else
minetest.sound_play("murder_empty_gun", {pos = player:get_pos(), to_player = pl_name}) minetest.sound_play("murder_empty_gun", {pos = player:get_pos(), to_player = pl_name})
end end

View File

@ -1,17 +1,17 @@
murder.register_role("Cop", { murder.register_role("Detective", {
default = true, default = true,
name = "Cop", name = "Detective",
hotbar_description = "Kill the murderer, but if you kill another cop you'll die!", hotbar_description = "Kill the murderer, if you kill another detective you'll die!",
items = {"murder:gun"}, items = {"murder:gun"},
sound = "cop-role", sound = "detective-role",
on_kill = function(arena, pl_name, killed_pl_name) on_kill = function(arena, pl_name, killed_pl_name)
local killed_role = arena.roles[killed_pl_name] local killed_role = arena.roles[killed_pl_name]
-- If the player killed another cop. -- If the player killed another detective.
if killed_role.name == "Cop" then if killed_role.name == "Detective" then
local player_inv = minetest.get_player_by_name(pl_name):get_inventory() local player_inv = minetest.get_player_by_name(pl_name):get_inventory()
murder.print_msg(pl_name, murder.T("You killed another cop (@1)!", killed_pl_name)) murder.print_msg(pl_name, murder.T("You killed another detective (@1)!", killed_pl_name))
murder.eliminate_role(pl_name) murder.eliminate_role(pl_name)
minetest.after(0, function() player_inv:remove_item("main", "murder:gun") end) minetest.after(0, function() player_inv:remove_item("main", "murder:gun") end)
elseif killed_role.name == "Murderer" then elseif killed_role.name == "Murderer" then
@ -37,7 +37,7 @@ murder.register_role("Cop", {
-- Adding a 4s lasting waypoint to the death place if the player's -- Adding a 4s lasting waypoint to the death place if the player's
-- been killed by another role. -- been killed by another role.
if killer_role.name ~= "Cop" then if killer_role.name ~= "Detective" then
for other_pl_name, _ in pairs(arena.players) do for other_pl_name, _ in pairs(arena.players) do
local death_waypoint = { local death_waypoint = {
hud_elem_type = "image_waypoint", hud_elem_type = "image_waypoint",
@ -59,4 +59,4 @@ murder.register_role("Cop", {
dofile(minetest.get_modpath("murder") .. "/_roles/cop/cop_items.lua") dofile(minetest.get_modpath("murder") .. "/_roles/detective/detective_items.lua")

View File

@ -4,7 +4,7 @@ murder.register_role("Murderer", {
items = {"murder:knife", "murder:blinder", "murder:skin_shuffler", "murder:locator"}, items = {"murder:knife", "murder:blinder", "murder:skin_shuffler", "murder:locator"},
sound = "murderer-role", sound = "murderer-role",
properties = { properties = {
kill_delay = 10, kill_delay = 20,
can_kill = true, can_kill = true,
thrown_knife = nil, thrown_knife = nil,
thrown_knives_count = 0, thrown_knives_count = 0,

View File

@ -32,7 +32,7 @@ dofile(minetest.get_modpath("murder") .. "/_debug/logs.lua")
dofile(minetest.get_modpath("murder") .. "/_arena_lib/arena_callbacks.lua") dofile(minetest.get_modpath("murder") .. "/_arena_lib/arena_callbacks.lua")
dofile(minetest.get_modpath("murder") .. "/_arena_lib/arena_utils.lua") dofile(minetest.get_modpath("murder") .. "/_arena_lib/arena_utils.lua")
dofile(minetest.get_modpath("murder") .. "/_roles/roles_registration.lua") dofile(minetest.get_modpath("murder") .. "/_roles/roles_registration.lua")
dofile(minetest.get_modpath("murder") .. "/_roles/cop/cop_role.lua") dofile(minetest.get_modpath("murder") .. "/_roles/detective/detective_role.lua")
dofile(minetest.get_modpath("murder") .. "/_roles/murderer/murderer_role.lua") dofile(minetest.get_modpath("murder") .. "/_roles/murderer/murderer_role.lua")
dofile(minetest.get_modpath("murder") .. "/chatcmdbuilder.lua") dofile(minetest.get_modpath("murder") .. "/chatcmdbuilder.lua")
dofile(minetest.get_modpath("murder") .. "/commands.lua") dofile(minetest.get_modpath("murder") .. "/commands.lua")

View File

@ -13,7 +13,7 @@ The match will start in @1 seconds!=La partita inizierà tra @1 secondi!
@1 (@2) killed @3 (@4)!=@1 (@2) ha ucciso @3 (@4)! @1 (@2) killed @3 (@4)!=@1 (@2) ha ucciso @3 (@4)!
Read your items description to learn their utility=Leggi la descrizione degli oggetti per scoprirne l'utilità Read your items description to learn their utility=Leggi la descrizione degli oggetti per scoprirne l'utilità
The @1 team=Il team @1 The @1 team=Il team @1
@1 won!=@1 ha vinto!
# Murderer # Murderer
@ -26,12 +26,12 @@ Shuffles all players skins!=Rimescola le skin dei giocatori!
Blinds everyone for @1s!=Acceca tutti per @1s! Blinds everyone for @1s!=Acceca tutti per @1s!
# Cop # Detective
Cop=Poliziotto Detective=Detective
Kill the murderer, but if you kill another cop you'll die!=Uccidi l'assassino, se uccidi un altro poliziotto morirai! Kill the murderer, if you kill another detective you'll die!=Uccidi l'assassino, se uccidi un altro detective morirai!
Shoot and kill!=Spara e uccidi! Shoot and kill!=Spara e uccidi!
You killed another cop (@1)!=Hai ucciso un altro poliziotto (@1)! You killed another detective (@1)!=Hai ucciso un altro detective (@1)!
# Commands messages # Commands messages

View File

@ -13,6 +13,7 @@ The match will start in @1 seconds!=
@1 (@2) killed @3 (@4)!= @1 (@2) killed @3 (@4)!=
Read your items description to learn their utility= Read your items description to learn their utility=
The @1 team= The @1 team=
@1 won!=
# Murderer # Murderer
@ -26,12 +27,12 @@ Shuffles all players skins!=
Blinds everyone for @1s!= Blinds everyone for @1s!=
# Cop # Detective
Cop= Detective=
Kill the murderer, but if you kill another cop you'll die!= Kill the murderer, if you kill another detective you'll die!=
Shoot and kill!= Shoot and kill!=
You killed another cop (@1)!= You killed another detective (@1)!=
# Commands messages # Commands messages

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 272 B