widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #12485
[Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands.
Commit message:
Converted MP scenarios to new font renderer
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/fh1-maps-multiplayer/+merge/337506
I have playtested Smugglers until the first smuggling report, but have done no testing on Island Hopping yet apart from loading the scenario.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands.
=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua'
--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua 2016-01-29 16:36:12 +0000
+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/first_island.lua 2018-02-10 11:55:22 +0000
@@ -21,10 +21,10 @@
_nplayers_finished_island[island_idx] = rank
local rewards = _finish_rewards[island_idx][rank]
- send_to_all(rt(
- p(msgs_finished_island[rank]:bformat(plr.name, island_idx + 1)) ..
- p(finished_island_continues:format(format_rewards(rewards)))
- ))
+ send_to_all(
+ msgs_finished_island[rank]:bformat(plr.name, island_idx + 1) ..
+ finished_island_continues:format(format_rewards(rewards))
+ )
local new_hq = hop_to_next_island(plr, island_idx)
add_wares(new_hq, rewards)
=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua'
--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua 2016-01-28 05:24:34 +0000
+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/multiplayer_init.lua 2018-02-10 11:55:22 +0000
@@ -2,10 +2,10 @@
-- Island Hopping Fun Map Scripting
-- =================================
include "scripting/coroutine.lua"
-include "scripting/formatting.lua"
include "scripting/infrastructure.lua"
include "scripting/messages.lua"
include "scripting/objective_utils.lua"
+include "scripting/richtext_scenarios.lua"
-- ==========
-- Constants
@@ -92,24 +92,13 @@
-- Utility functions
-- ==================
--- Sends a game status message to all players
-function send_to_all(text, long_title)
- for idx,plr in ipairs(game.players) do
- if (long_title ~= nil and long_title ~= "") then
- send_message(plr, _"Status", text, {popup=true, heading=long_title})
- else
- send_message(plr, _"Status", text, {popup=true})
- end
- end
-end
-
-- Returns a list of rewards from _finish_rewards, formatted with getplural(count, resource)
function format_rewards(r)
rv = {}
for name,count in pairs(r) do
local ware_description = wl.Game():get_ware_description(name)
-- TRANSLATORS: number + resource name, e.g. '1x Log'
- rv[#rv + 1] = _"%1$dx %2$s":bformat(count, ware_description.descname) .. "<br>\n"
+ rv[#rv + 1] = li(_"%1$dx %2$s":bformat(count, ware_description.descname))
end
return table.concat(rv)
end
@@ -220,7 +209,7 @@
send_to_all(welcome_msg.body, welcome_msg.heading)
-- set the objective with the game type for all players
-- TODO change this to a broadcast once individual game objectives have been implemented
- game.players[1]:add_objective("win_conditions", _"Rules", welcome_msg.body)
+ game.players[1]:add_objective("win_conditions", _"Rules", rt(welcome_msg.body))
for idx,plr in ipairs(game.players) do
run(function() run_island(plr, 1) end)
=== modified file 'data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua'
--- data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua 2016-02-03 09:18:52 +0000
+++ data/maps/MP_Scenarios/Island_Hopping.wmf/scripting/texts.lua 2018-02-10 11:55:22 +0000
@@ -3,7 +3,7 @@
-- =======================================================================
welcome_msg = {
heading = _"Welcome to Island Hopping",
- body = rt(
+ body =
h2(_"Rules") ..
p(_(
[[Island Hopping is a traditional tournament in Atlantean culture. ]] ..
@@ -37,22 +37,19 @@
h4(_"2nd to finish") .. p(format_rewards(_finish_rewards[2][2])) ..
h4(_"3rd to finish") .. p(format_rewards(_finish_rewards[2][3])) ..
h4(_"4th to finish") .. p(format_rewards(_finish_rewards[2][4]))
- )
}
msgs_finished_island = {
- _"%1$s was the first to reach Island number %2$i.",
- _"%1$s was the second to reach Island number %2$i.",
- _"%1$s was the third to reach Island number %2$i.",
- _"%1$s was the fourth to reach Island number %2$i."
+ li(_"%1$s was the first to reach Island number %2$i."),
+ li(_"%1$s was the second to reach Island number %2$i."),
+ li(_"%1$s was the third to reach Island number %2$i."),
+ li(_"%1$s was the fourth to reach Island number %2$i.")
}
-finished_island_continues = _ "The reward for this feat amounts to:" .. "<br>%s"
+finished_island_continues = p(_"The reward for this feat amounts to:") .. p("%s")
-player_claims_hill = rt(p(_
+player_claims_hill = p(_
[[%s is now King of the Hill and will win the game in 20 minutes, if nobody takes over the hill before then.]]
-))
-lost_control = rt(p(_
-[[%s lost control of the hill.]]
-))
-had_control_for = rt(p(_[[%1$s has been King of the Hill for %2$s!]]))
-player_won = rt(p(_[[%s has won the game. Congratulations!]]))
+)
+lost_control = p(_[[%s lost control of the hill.]])
+had_control_for = p(_[[%1$s has been King of the Hill for %2$s!]])
+player_won = p(_[[%s has won the game. Congratulations!]])
=== modified file 'data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua'
--- data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua 2016-01-28 05:24:34 +0000
+++ data/maps/MP_Scenarios/Smugglers.wmf/scripting/multiplayer_init.lua 2018-02-10 11:55:22 +0000
@@ -3,8 +3,8 @@
-- =================================
include "scripting/coroutine.lua"
include "scripting/infrastructure.lua"
-include "scripting/formatting.lua"
include "scripting/objective_utils.lua"
+include "scripting/richtext_scenarios.lua"
include "scripting/set.lua"
-- ==========
@@ -35,19 +35,6 @@
-- =================
points = { 0, 0 }
--- =================
--- Utility functions
--- =================
-function send_to_all(text, long_title)
- for idx,plr in ipairs(game.players) do
- if (long_title ~= nil and long_title ~= "") then
- send_message(plr, _"Status", text, {popup=true, heading=long_title})
- else
- send_message(plr, _"Status", text, {popup=true})
- end
- end
-end
-
include "map:scripting/texts.lua"
include "map:scripting/smuggling.lua"
@@ -145,7 +132,7 @@
send_to_all(welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)), welcome_msg.heading)
-- set the objective with the game type for all players
-- TODO change this to a broadcast once individual game objectives have been implementes
- game.players[1]:add_objective("win_conditions", _"Rules", welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win)))
+ game.players[1]:add_objective("win_conditions", _"Rules", rt(welcome_msg.body:format((ngettext("%i point", "%i points", points_to_win)):format(points_to_win))))
for idx,descr in ipairs(route_descrs) do
run(wait_for_established_route, descr)
=== modified file 'data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua'
--- data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua 2015-12-03 09:56:01 +0000
+++ data/maps/MP_Scenarios/Smugglers.wmf/scripting/texts.lua 2018-02-10 11:55:22 +0000
@@ -4,41 +4,36 @@
welcome_msg = {
heading = _"Smugglers",
- body = rt(
+ body =
h2(_"Rules") ..
p(_([[Smugglers is a fun map for 4 players. You and your partner start diagonally from each other on a point symmetric island. There are plenty of smuggling tunnels on this island, each consisting of a receiving and a sending end.]])) ..
p(_([[To establish a smuggling route, you need to build a warehouse on a sending/receiving spot while your team mate has to build one on the corresponding receiving/sending spot. A ware is then transported every 10 seconds.]])) ..
-- TRANSLATORS: %s = '<number> points'
p(_([[For harder to defend smuggling routes, you get 2 or 3 points per ware smuggled. The first team to collect %s wins.]])) ..
- rt(h2(_"A sending spot")) .. rt("image=map:send_spot.png", p(" ")) ..
- rt(h2(_"A receiving spot")) .. rt("image=map:recv_spot.png", p(" ")) ..
- rt(h2(_"Notes") ..
- p(_([[Remember that the map has rotational symmetry. For example, when you have found a spot to the top-left of your headquarters, the corresponding spot will be to the bottom-right of the headquarters of your team mate.]]))) ..
- p(_([[You can see the number of wares traded at any time in the general statistics menu. Good luck!]])))
+ h2(_"A sending spot") .. p(img("map:send_spot.png")) ..
+ h2(_"A receiving spot") .. p(img("map:recv_spot.png")) ..
+ h2(_"Notes") ..
+ p(_([[Remember that the map has rotational symmetry. For example, when you have found a spot to the top-left of your headquarters, the corresponding spot will be to the bottom-right of the headquarters of your team mate.]])) ..
+ p(_([[You can see the number of wares traded at any time in the general statistics menu. Good luck!]]))
}
-smuggling_route_established_other_team = rt(
+smuggling_route_established_other_team =
-- TRANSLATORS: the first 2 parameters are player names, the last parameter is '<number> points'
p(_([[A new smuggling route from %1$s to %2$s has been established! Every ware they smuggle there is worth %3$s.]]))
- )
-smuggling_route_established_sender = rt(
+smuggling_route_established_sender =
-- TRANSLATORS: %s = '<number> points'
p(_([[Your team has established a new smuggling route. You have the sending warehouse. Every ware smuggled here is worth %s.]]))
- )
-smuggling_route_established_receiver = rt(
+smuggling_route_established_receiver =
-- TRANSLATORS: %s = '<number> points'
p(_([[Your team has established a new smuggling route. You have the receiving warehouse. Every ware smuggled here is worth %s.]]))
- )
-smuggling_route_broken = rt(
+smuggling_route_broken =
-- TRANSLATORS: the first parameter is '<number> points', the last 2 parameters are player names
p(_[[The smuggling route worth %1$s from %2$s to %3$s has been broken!]])
- )
-game_over = rt(
+game_over =
h1(_"Game over!") ..
-- TRANSLATORS: the first 4 parameters are player names, the last parameter is '<number> points'
p(_[[Game over! %1$s and %2$s have won the game! %3$s and %4$s only managed to collect %5$s.]])
- )
=== modified file 'data/scripting/messages.lua'
--- data/scripting/messages.lua 2017-12-09 06:29:26 +0000
+++ data/scripting/messages.lua 2018-02-10 11:55:22 +0000
@@ -33,6 +33,28 @@
player:send_message(title, body, parameters)
end
+
+-- RST
+-- .. function:: send_to_all(text[, heading])
+--
+-- Sends a game status message to all players.
+--
+-- :arg text: the localized body of the message. You can use rt functions here.
+-- :type text: :class:`string`
+-- :arg heading: the localized title of the message (optional)
+-- :type heading: :class:`string`
+--
+function send_to_all(text, heading)
+ for idx,plr in ipairs(game.players) do
+ if (heading ~= nil and heading ~= "") then
+ send_message(plr, _"Status", text, {popup=true, heading=heading})
+ else
+ send_message(plr, _"Status", text, {popup=true})
+ end
+ end
+end
+
+
-- RST
-- .. function:: message_box(player, title, message, parameters)
--
Follow ups
-
[Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: noreply, 2018-02-25
-
Re: [Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: GunChleoc, 2018-02-25
-
Re: [Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: GunChleoc, 2018-02-24
-
[Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: GunChleoc, 2018-02-24
-
Re: [Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: GunChleoc, 2018-02-19
-
Re: [Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: Klaus Halfmann, 2018-02-19
-
Re: [Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: GunChleoc, 2018-02-19
-
Re: [Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: Klaus Halfmann, 2018-02-18
-
Re: [Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: GunChleoc, 2018-02-17
-
Re: [Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: Klaus Halfmann, 2018-02-11
-
[Merge] lp:~widelands-dev/widelands/fh1-maps-multiplayer into lp:widelands
From: bunnybot, 2018-02-10