mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 21:08:48 +00:00
Allow showing [chat] to observers, fixes #1735
Fixes https://github.com/wesnoth/wesnoth/issues/1735 Implements https://forums.wesnoth.org/viewtopic.php?f=12&t=46029 [chat] has key observable=yes/no, default yes, which controls, if the message should be visible to observers.
This commit is contained in:
parent
9faf177472
commit
3bcc2ec0fa
@ -75,11 +75,28 @@ function wml_actions.chat(cfg)
|
||||
)
|
||||
|
||||
for index, side in ipairs(side_list) do
|
||||
if side.controller == "human" then
|
||||
if side.controller == "human" and side.is_local then
|
||||
wesnoth.message(speaker, message)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local observable = cfg.observable ~= false
|
||||
|
||||
if observable then
|
||||
local all_sides = wesnoth.get_sides()
|
||||
local has_human_side = false
|
||||
for index, side in ipairs(all_sides) do
|
||||
if side.controller == "human" and side.is_local then
|
||||
has_human_side = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not has_human_side then
|
||||
wesnoth.message(speaker, message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function wml_actions.gold(cfg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user