Merge lp:~widelands-dev/widelands/tutorial-improvements into lp:widelands

Proposed by wl-zocker
Status: Merged
Merged at revision: 7471
Proposed branch: lp:~widelands-dev/widelands/tutorial-improvements
Merge into: lp:widelands
Diff against target: 248 lines (+57/-25)
10 files modified
campaigns/emp01.wmf/scripting/init.lua (+0/-1)
campaigns/emp01.wmf/scripting/mission_thread.lua (+5/-3)
campaigns/emp02.wmf/scripting/mission_thread.lua (+1/-1)
campaigns/tutorial01_basic_control.wmf/scripting/mission_thread.lua (+17/-11)
campaigns/tutorial01_basic_control.wmf/scripting/texts.lua (+18/-0)
campaigns/tutorial02_warfare.wmf/scripting/mission_thread.lua (+1/-1)
campaigns/tutorial03_seafaring.wmf/scripting/mission_thread.lua (+12/-4)
campaigns/tutorial03_seafaring.wmf/scripting/texts.lua (+1/-2)
campaigns/tutorial04_economy.wmf/scripting/helper_functions.lua (+1/-1)
campaigns/tutorial04_economy.wmf/scripting/mission_thread.lua (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/tutorial-improvements
Reviewer Review Type Date Requested Status
GunChleoc Approve
Widelands Developers Pending
Review via email: mp+260656@code.launchpad.net

Description of the change

This branch makes use of the features requested in bug 1380286 and bug 1380287.

I also noticed some graphical glitch after starting a game, therefore I increased sleep() to 1000 in all campaigns/tutorials.

To post a comment you must log in.
Revision history for this message
TiborB (tiborb95) wrote :

one small question in the diff. Otherwise it looks good, but I have not tested it.

Revision history for this message
wl-zocker (wl-zocker) wrote :

Answer in the diff.

Revision history for this message
TiborB (tiborb95) wrote :

see replay

Revision history for this message
wl-zocker (wl-zocker) wrote :

If the player destroys the quarry construction site, he is not allowed to rebuild it. I see three possibilities:

- Allow the user to rebuild the quarry. This would mean to redefinitions of immovable_is_legal() inside the while loop, which makes the code quite messy.
- Send a message to the user that destroying the quarry was not clever, and ask him to restart from savegame xy. However, this makes the impression that we were lazy.
- Leave it as is. The unexperienced user will hopefully not dismantle the quarry. If he does, the game does not crash. I can also remove the inner while loop, so the player gets automatically notified that something went wrong.

Revision history for this message
TiborB (tiborb95) wrote :

But now, the inner loop will "loop" forever and player will not know what is going on - do I understand it correctly?

I think player should receive an message he had messed things up and he should restart or reload the game.

Revision history for this message
wl-zocker (wl-zocker) wrote :

I changed it according to your suggestion. The bug that the game would not continue, has been in there before these changes, and I have heard of no complaint.

Please test it. Maybe GunChleoc should have a look on the strings before merging. I requested her review.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I have added some suggestions for the strings, and 1 for the code. I haven't tested anything yet.

review: Needs Fixing
Revision history for this message
TiborB (tiborb95) wrote :

"I have heard of no complaint" - I believe this, there are probably a lot of such corner cases in tutorials, but no harm is done when you think also about this. I just left one comment in the diff.

Otherwise it LGTM (and yes, I tested it of course)

I presume GunChleoc will look at this yet and give approve if OK.

Revision history for this message
wl-zocker (wl-zocker) wrote :

Thank you both for you input. I am waiting for your approval now.

Revision history for this message
TiborB (tiborb95) wrote :

It is OK for me...

Revision history for this message
GunChleoc (gunchleoc) wrote :

Please go ahead and merge :)

review: Approve
Revision history for this message
wl-zocker (wl-zocker) wrote :

How do I do that? I've never merged to trunk before.

Revision history for this message
TiborB (tiborb95) wrote :

I prefer this method:

https://wl.widelands.org/wiki/BzrPrimer/#alternative_method

or somebody can do it for you :)

Revision history for this message
GunChleoc (gunchleoc) wrote :

Since the changes are small and current, there is no need to merge trunk into the branch first. So, this will do:

    $ cd ~/widelands-repo/trunk
    $ bzr pull (to get any recent changes to the main trunk)
    $ bzr merge ../bug-xxx
    $ bzr commit -m "Bug xxx fixed"
    $ bzr push lp:widelands/trunk

I usually grab the branch for merging from launchpad - merge requests already display the code needed on top of the page:

To merge this branch: bzr merge lp:~widelands-dev/widelands/tutorial-improvements

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'campaigns/emp01.wmf/scripting/init.lua'
2--- campaigns/emp01.wmf/scripting/init.lua 2014-10-02 17:05:38 +0000
3+++ campaigns/emp01.wmf/scripting/init.lua 2015-06-01 20:08:53 +0000
4@@ -11,6 +11,5 @@
5
6 p1 = wl.Game().players[1]
7
8-include "map:scripting/starting_conditions.lua"
9 include "map:scripting/texts.lua"
10 include "map:scripting/mission_thread.lua"
11
12=== modified file 'campaigns/emp01.wmf/scripting/mission_thread.lua'
13--- campaigns/emp01.wmf/scripting/mission_thread.lua 2014-10-31 11:36:29 +0000
14+++ campaigns/emp01.wmf/scripting/mission_thread.lua 2015-06-01 20:08:53 +0000
15@@ -1,10 +1,10 @@
16 include "scripting/messages.lua"
17
18 function mission_thread()
19- sleep(100) -- This is needed for yet unknown reasons
20+ sleep(1000)
21
22 -- Initial messages
23- local sea = wl.Game().map:get_field(47,25)
24+ local sea = wl.Game().map:get_field(50,25)
25 scroll_smoothly_to(sea,0)
26
27 campaign_message_box(diary_page_1)
28@@ -12,15 +12,17 @@
29
30 -- Show the sea
31 p1:reveal_fields(sea:region(6))
32+ local ship = p1:place_bob("ship",sea)
33 sleep(200)
34 campaign_message_box(diary_page_2)
35 -- Hide the sea after 5 seconds
36 run(function() sleep(5000) p1:hide_fields(sea:region(6)) end)
37
38 -- Back home
39+ include "map:scripting/starting_conditions.lua"
40 scroll_smoothly_to(wl.Game().map.player_slots[1].starting_field)
41 campaign_message_box(diary_page_3)
42-
43+ ship:remove()
44
45 sleep(400)
46
47
48=== modified file 'campaigns/emp02.wmf/scripting/mission_thread.lua'
49--- campaigns/emp02.wmf/scripting/mission_thread.lua 2014-10-31 11:36:29 +0000
50+++ campaigns/emp02.wmf/scripting/mission_thread.lua 2015-06-01 20:08:53 +0000
51@@ -5,7 +5,7 @@
52 include "scripting/messages.lua"
53
54 function building_materials()
55- sleep(200)
56+ sleep(1000)
57 campaign_message_box(diary_page_5)
58
59 local map = wl.Game().map
60
61=== modified file 'campaigns/tutorial01_basic_control.wmf/scripting/mission_thread.lua'
62--- campaigns/tutorial01_basic_control.wmf/scripting/mission_thread.lua 2014-10-25 08:29:32 +0000
63+++ campaigns/tutorial01_basic_control.wmf/scripting/mission_thread.lua 2015-06-01 20:08:53 +0000
64@@ -6,7 +6,7 @@
65 map:place_immovable("debris00",second_quarry_field)
66 -- so that the player cannot build anything here
67
68- sleep(100)
69+ sleep(1000)
70
71 message_box_objective(plr, initial_message_01)
72 sleep(500)
73@@ -56,7 +56,7 @@
74 end
75 sleep(500)
76
77- click_on_field(map.player_slots[1].starting_field.brn)
78+ click_on_field(sf.brn)
79
80 message_box_objective(plr, lumberjack_message_04)
81
82@@ -206,7 +206,7 @@
83 -- Showoff direct roadbuilding
84 click_on_field(first_quarry_field.brn)
85 click_on_panel(wl.ui.MapView().windows.field_action.buttons.build_road, 300)
86- click_on_field(map.player_slots[1].starting_field.brn)
87+ click_on_field(sf.brn)
88
89 sleep(3000)
90
91@@ -224,21 +224,20 @@
92 else return false end
93 end
94
95- -- Give the player some time to build the road
96- -- It is not possible to check for the road. See https://bugs.launchpad.net/widelands/+bug/1380286
97+ -- Wait till the construction site is connected to the headquarters
98 sleep(20*1000)
99+ while first_quarry_field.brn.immovable.debug_economy ~= sf.brn.immovable.debug_economy do
100+ message_box_objective(plr,quarry_not_connected)
101+ sleep(60*1000)
102+ if not first_quarry_field.immovable then message_box_objective(plr,quarry_illegally_destroyed) return end
103+ end
104
105 second_quarry()
106
107- -- Wait a while
108- sleep(60*1000)
109- -- When the said bug is fixed, check every 30 seconds if the second quarry is connected. Inform the player if not.
110- -- When that is finally done (and 30 seconds have passed), go on
111-
112 -- Interludium: talk about census and statistics
113 census_and_statistics()
114
115- while #plr:get_buildings("quarry") < 1 do sleep(1400) end
116+ while #plr:get_buildings("quarry") < 2 do sleep(1400) end
117 o.done = true
118
119 messages()
120@@ -265,6 +264,13 @@
121 -- Wait for the constructionsite to be placed
122 while not cs do sleep(200) end
123
124+ sleep(60*1000)
125+ while second_quarry_field.brn.immovable.debug_economy ~= sf.brn.immovable.debug_economy do
126+ message_box_objective(plr,quarry_not_connected)
127+ sleep(60*1000)
128+ if not second_quarry_field.immovable then message_box_objective(plr,quarry_illegally_destroyed) return end
129+ end
130+
131 o.done = true
132 register_immovable_as_allowed(cs)
133 end
134
135=== modified file 'campaigns/tutorial01_basic_control.wmf/scripting/texts.lua'
136--- campaigns/tutorial01_basic_control.wmf/scripting/texts.lua 2015-01-24 11:43:42 +0000
137+++ campaigns/tutorial01_basic_control.wmf/scripting/texts.lua 2015-06-01 20:08:53 +0000
138@@ -338,6 +338,24 @@
139 )
140 }
141
142+quarry_not_connected = {
143+ title = _"Quarry not Connected",
144+ body = rt(
145+ p(_[[Your workers do not like to walk across country. You have to build a road from your headquarters to the construction site so that carriers can transport wares. The simplest way is to click on the construction site’s flag, choose ‘Build road’, and then click on the destination flag (the one in front of your headquarters), just like I’ve demonstrated.]])
146+ ),
147+ w = 350,
148+ h = 250
149+}
150+
151+quarry_illegally_destroyed = {
152+ title = _"You Destroyed the Construction Site!",
153+ body = rt(
154+ p(_[[It seems you destroyed a construction site for a quarry we wanted to build. Since we need the stones, I suggest you reload the game from a previous savegame. Luckily, the are created from time to time. To do so, you have to go back to the main menu and choose ‘Single Player’ → ‘Load Game’. And please be a bit more careful next time.]])
155+ ),
156+ w = 350,
157+ h = 250
158+}
159+
160 build_second_quarry = {
161 position = "topright",
162 title = _"Build a second quarry",
163
164=== modified file 'campaigns/tutorial02_warfare.wmf/scripting/mission_thread.lua'
165--- campaigns/tutorial02_warfare.wmf/scripting/mission_thread.lua 2014-10-17 08:38:24 +0000
166+++ campaigns/tutorial02_warfare.wmf/scripting/mission_thread.lua 2015-06-01 20:08:53 +0000
167@@ -3,7 +3,7 @@
168 -- ================
169
170 function intro()
171- sleep(200)
172+ sleep(1000)
173 message_box_objective(plr, introduction)
174
175 training()
176
177=== modified file 'campaigns/tutorial03_seafaring.wmf/scripting/mission_thread.lua'
178--- campaigns/tutorial03_seafaring.wmf/scripting/mission_thread.lua 2014-10-17 08:38:24 +0000
179+++ campaigns/tutorial03_seafaring.wmf/scripting/mission_thread.lua 2015-06-01 20:08:53 +0000
180@@ -36,8 +36,10 @@
181
182 local o = message_box_objective(plr, tell_about_ships)
183
184- -- we cannot check for ships yet (see https://bugs.launchpad.net/widelands/+bug/1380287), so we just wait some time and hope for the best
185- sleep(25*60*1000) -- 25 minutes
186+ -- we only wait for one ship and a bit longer because it takes long enough
187+ while #plr:get_ships() < 1 do sleep(30*1000) end
188+ sleep(5*60*1000)
189+
190 o.done = true
191
192 expedition()
193@@ -48,8 +50,14 @@
194 message_box_objective(plr, expedition1)
195 local o = message_box_objective(plr, expedition2)
196
197- -- again, we can only wait. Better a bit too long than too short
198- sleep(3*60*1000) -- 3 minutes
199+ local function _ship_ready_for_expedition()
200+ for k,ship in ipairs(plr:get_ships()) do
201+ if ship.state == "exp_waiting" then return true end
202+ end
203+ return false
204+ end
205+
206+ while not _ship_ready_for_expedition() do sleep(1000) end
207 o.done = true
208
209 local o2 = message_box_objective(plr, expedition3)
210
211=== modified file 'campaigns/tutorial03_seafaring.wmf/scripting/texts.lua'
212--- campaigns/tutorial03_seafaring.wmf/scripting/texts.lua 2014-11-11 10:31:01 +0000
213+++ campaigns/tutorial03_seafaring.wmf/scripting/texts.lua 2015-06-01 20:08:53 +0000
214@@ -161,8 +161,7 @@
215 title = _"Off to greener pastures",
216 body = rt(
217 h1(_"Start your expedition") ..
218- p(_[[Your expedition should be ready about now. If not, please wait a bit – you will receive a message.]]) ..
219- p(_[[Your ship will be waiting for your orders in front of your port. It won’t be transporting wares anymore. Use its buttons to send your ship in any of the six main directions of the Widelands map. When it has reached a coastline, you can make it travel around the coast, where it will look for suitable places for landing.]] .. " " ..
220+ p(_[[Your expedition ship is ready. It is waiting for your orders in front of your port. It isn’t transporting wares anymore. Use its buttons to send your ship in any of the six main directions of the Widelands map. When it has reached a coastline, you can make it travel around the coast, where it will look for suitable places for landing.]] .. " " ..
221 _[[Once a port space has been found, you can construct a new port with the button in the center of the ship’s control window.]]) ..
222 p(_[[The wares will then be unloaded, and the ship will take up the task of transporting wares once again. The builder will start his work and build a port.]]) ..
223 paragraphdivider() ..
224
225=== modified file 'campaigns/tutorial04_economy.wmf/scripting/helper_functions.lua'
226--- campaigns/tutorial04_economy.wmf/scripting/helper_functions.lua 2014-10-29 07:55:28 +0000
227+++ campaigns/tutorial04_economy.wmf/scripting/helper_functions.lua 2015-06-01 20:08:53 +0000
228@@ -15,7 +15,7 @@
229 if bdescr.soldiers then
230 b:set_soldiers(bdescr.soldiers)
231 else
232- -- TODO(wl-zocker): this creates "1 soldier (+4)", but I want a capacity of 1 (i.e. "1 soldier")
233+ -- TODO(wl-zocker): this creates "1 soldier (+4)", but I want a capacity of 1 (i.e. "1 soldier"). See https://bugs.launchpad.net/widelands/+bug/1387310
234 b:set_soldiers({0,0,0,0}, 1)
235 end
236 elseif bdescr.soldiers then -- Must be a warehouse
237
238=== modified file 'campaigns/tutorial04_economy.wmf/scripting/mission_thread.lua'
239--- campaigns/tutorial04_economy.wmf/scripting/mission_thread.lua 2014-10-18 16:30:47 +0000
240+++ campaigns/tutorial04_economy.wmf/scripting/mission_thread.lua 2015-06-01 20:08:53 +0000
241@@ -3,7 +3,7 @@
242 -- ===============
243
244 function introduction()
245- sleep(500)
246+ sleep(1000)
247 message_box_objective(plr, intro1)
248 message_box_objective(plr, intro2)
249

Subscribers

People subscribed via source and target branches

to status/vote changes: