1
0
Переглянути джерело

[added] a train schedule. Waiting time is automatically displayed and taken into account

anjuna krokus 9 місяців тому
батько
коміт
ac40b025ad

+ 12 - 4
locations/city_industrial_train.qsrc

@@ -72,14 +72,18 @@ if $ARGS[0] = 'platform':
 	gs 'stat'
 	'<center><img <<$set_imgh>> src="images/locations/pavlovsk/trainstation/vokzalper.jpg" ></center>'
 	'When you arrive at the platform, you can''t help but notice it bustling with activity. Lots of passengers are coming and going, all carrying large bags. It feels like it is always busy here, no matter at what time of the day you are here.'
+	*nl
+	gs 'transport_functions', 'set_train_wait_time', 'ind'
+	'The next train in the direction of the city center ' + iif(transportVars['train_wait_center'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_center'']>> minutes.')
+	'The next train in the direction of Pavlovsk ' + iif(transportVars['train_wait_pavlovsk'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_pavlovsk'']>> minutes.')
 
 	act 'Return to the station': minut += 5 & gt 'city_industrial_train', 'inside'
 	
 	if transportVars['trainpass_day'] > daystart:
-		act 'Take a train to the city center (<<func(''transport_functions'', ''display_train_timecost'', ''ind'', ''center'')>>)': gt 'train', 'ind_center'
-		act 'Take a train to the old platform by the communal village (<<func(''transport_functions'', ''display_train_timecost'', ''ind'', ''communal'')>>)': gt 'train', 'ind_communal'
-		act 'Take a train to the village of Gadukino (<<func(''transport_functions'', ''display_train_timecost'', ''ind'', ''village'')>>)': gt 'train', 'ind_village'
-		act 'Take a train to Pavlovsk (<<func(''transport_functions'', ''display_train_timecost'', ''ind'', ''pavlovsk'')>>)': gt 'train', 'ind_pavlovsk'
+		act 'Take a train to the city center (<<func(''transport_functions'', ''display_train_timecost'', ''ind'')>>)': gt 'train', 'ind_center'
+		act 'Take a train to the old platform by the communal village (<<func(''transport_functions'', ''display_train_timecost'', ''ind'')>>)': gt 'train', 'ind_communal'
+		act 'Take a train to the village of Gadukino (<<func(''transport_functions'', ''display_train_timecost'', ''ind'')>>)': gt 'train', 'ind_village'
+		act 'Take a train to Pavlovsk (<<func(''transport_functions'', ''display_train_timecost'', ''ind'')>>)': gt 'train', 'ind_pavlovsk'
 	end
 end
 
@@ -119,6 +123,10 @@ if $ARGS[0] = 'ticket':
 	gs 'stat'
 	'<center><h4>Ticket office</h4></center>'
 	'<center><img <<$set_imgh>> src="images/locations/pavlovsk/trainstation/ticketoffice.jpg"></center>'
+	*nl
+	gs 'transport_functions', 'set_train_wait_time', 'ind'
+	'The next train in the direction of the city center ' + iif(transportVars['train_wait_center'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_center'']>> minutes.')
+	'The next train in the direction of Pavlovsk ' + iif(transportVars['train_wait_pavlovsk'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_pavlovsk'']>> minutes.')
 
 	act 'Leave the ticket office':minut += 1 & gt 'city_industrial_train', 'inside'
 	

+ 15 - 8
locations/city_train.qsrc

@@ -35,7 +35,11 @@ if $ARGS[0] = 'tickets':
 	'<center><h4>Ticket office</h4></center>'
 	'<center><img <<$set_imgh>> src="images/locations/shared/train/kassa.jpg" ></center>'
 
-	act 'Leave the ticket office':minut += 1 & gt 'city_train', 'start'
+	*nl
+	gs 'transport_functions', 'set_train_wait_time', 'center'
+	'The next train in the direction of Pavlovsk ' + iif(transportVars['train_wait_pavlovsk'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_pavlovsk'']>> minutes.')
+
+	act 'Leave the ticket office': minut += 1 & gt 'city_train', 'start'
 	
 	act 'Buy a ticket':
 		cla
@@ -49,7 +53,7 @@ if $ARGS[0] = 'buy_ticket':
 	$menu_loc = 'city_train'
 	$menu_arg = 'buy_ticket'
 	menu_off = 0
-	
+
 	act 'Leave the ticket office': minut += 1 & gt 'city_train', 'start'
 
 	gs 'transport_functions', 'buy_train_ticket', 'center'
@@ -63,13 +67,16 @@ if $ARGS[0] = 'platform':
 	gs 'stat'
 	'<center><img <<$set_imgh>> src="images/locations/shared/train/indusplat.jpg" ></center>'
 	'When you arrive at the platform, you can''t help but notice it bustling with activity. Lots of passengers are coming and going, all carrying shopping bags. It feels like it is always busy here, no matter at what time of the day it is.'
-
-	act 'Return to the station hall':gt 'city_train', 'start'
+	*nl
+	gs 'transport_functions', 'set_train_wait_time', 'center'
+	'The next train in the direction of Pavlovsk ' + iif(transportVars['train_wait_pavlovsk'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_pavlovsk'']>> minutes.')
+	
+	act 'Return to the station hall': gt 'city_train', 'start'
 	
-	act 'Take a train to the city industrial area (<<func(''transport_functions'', ''display_train_timecost'', ''center'', ''ind'')>>)': gt 'train', 'city_ind'
-	act 'Take a train to the old platform by the communal village (<<func(''transport_functions'', ''display_train_timecost'', ''center'', ''communal'')>>)': gt 'train', 'city_communal'
-	act 'Take a train to the village of Gadukino (<<func(''transport_functions'', ''display_train_timecost'', ''center'', ''village'')>>)': gt 'train', 'city_village'
-	act 'Take a train to Pavlovsk (<<func(''transport_functions'', ''display_train_timecost'', ''center'', ''pavlovsk'')>>)': gt 'train', 'city_pavlovsk'
+	act 'Take a train to the city industrial area (<<func(''transport_functions'', ''display_train_timecost'', ''center'', ''ind'')>>)': gt 'train', 'center_ind'
+	act 'Take a train to the old platform by the communal village (<<func(''transport_functions'', ''display_train_timecost'', ''center'', ''communal'')>>)': gt 'train', 'center_communal'
+	act 'Take a train to the village of Gadukino (<<func(''transport_functions'', ''display_train_timecost'', ''center'', ''village'')>>)': gt 'train', 'center_village'
+	act 'Take a train to Pavlovsk (<<func(''transport_functions'', ''display_train_timecost'', ''center'', ''pavlovsk'')>>)': gt 'train', 'center_pavlovsk'
 end
 
 --- city_train ---------------------------------

+ 2 - 0
locations/intro_initialization.qsrc

@@ -15,6 +15,8 @@ denypreg = 0
 pertemp = 1
 pillcvrt = 1
 
+gs 'transport_functions', 'init_all'
+
 pcs_naturallashes = pcs_lashes
 
 !!	Initializing elasticity

+ 3 - 0
locations/intro_initialization_city.qsrc

@@ -22,6 +22,9 @@ denypreg = 0
 pertemp = 1
 pillcvrt = 1
 
+gs 'transport_functions', 'init_all'
+
+
 pcs_naturallashes = pcs_lashes
 
 !!	Initializing elasticity

+ 12 - 4
locations/pav_train_hall.qsrc

@@ -154,15 +154,18 @@ if $ARGS[0] = 'platform':
 	*nl
 	'Because Pavlovsk is a place that attracts a fair amount of tourists, the station can be quite busy at times. The busiest times on the platforms are between 11:00 and 11:30, and between 18:00 and 18:30 when the long-distance trains are ready for boarding.'
 	*nl
+	gs 'transport_functions', 'set_train_wait_time', 'pavlovsk'
+	'The next train in the direction of St. Petersburg city center ' + iif(transportVars['train_wait_center'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_center'']>> minutes.')
+	*nl
 	if week >= 6 and hour >= 9 and hour <= 10:'You notice <a href="exec:gt ''gschool_socialchg1'', ''tBella''">Bella</a> standing at the train station platform, looking at the time table.'
 
 	act 'Enter the station building': gt'pav_train_hall'
 
 	if transportVars['trainpass_day'] > daystart:
-		act 'Take the train to the village of Gadukino (<<func(''transport_functions'', ''display_train_timecost'', ''pavlovsk'', ''village'')>>)':	gt 'train', 'pavlovsk_village'
-		act 'Take the train to the communal village (<<func(''transport_functions'', ''display_train_timecost'', ''pavlovsk'', ''communal'')>>)':		gt 'train', 'pavlovsk_communal'
-		act 'Take the train to the city industrial area (<<func(''transport_functions'', ''display_train_timecost'', ''pavlovsk'', ''ind'')>>)':		gt 'train', 'pavlovsk_ind'
-		act 'Take the train to the city center (<<func(''transport_functions'', ''display_train_timecost'', ''pavlovsk'', ''center'')>>)':				gt 'train', 'pavlovsk_center'
+		act 'Take the train to the village of Gadukino (<<func(''transport_functions'', ''display_train_timecost'', ''pavlovsk'', ''village'', ''center'')>>)':	gt 'train', 'pavlovsk_village'
+		act 'Take the train to the communal village (<<func(''transport_functions'', ''display_train_timecost'', ''pavlovsk'', ''communal'', ''center'')>>)':	gt 'train', 'pavlovsk_communal'
+		act 'Take the train to the city industrial area (<<func(''transport_functions'', ''display_train_timecost'', ''pavlovsk'', ''ind'', ''center'')>>)':	gt 'train', 'pavlovsk_ind'
+		act 'Take the train to the city center (<<func(''transport_functions'', ''display_train_timecost'', ''pavlovsk'', ''center'', ''center'')>>)':			gt 'train', 'pavlovsk_center'
 	end
 end
 
@@ -230,8 +233,13 @@ if $ARGS[0] = 'ticket':
 	'<center><h2>Ticket office</h2></center>'
 	'<center><img <<$set_imgh>> src="images/locations/pavlovsk/trainstation/ticketoffice.jpg"></center>'
 
+	*nl
+	gs 'transport_functions', 'set_train_wait_time', 'pavlovsk'
+	'The next train in the direction of St. Petersburg city center ' + iif(transportVars['train_wait_center'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_center'']>> minutes.')
+
 	act 'Leave the ticket office':minut += 1 & gt 'pav_train_hall'
 
+
 	if money >= 50:
 		act 'Buy a ticket':
 			cla

+ 1 - 0
locations/saveupdater.qsrc

@@ -2521,6 +2521,7 @@ if temp_current_save_version < 00090200:
 	! Transport update
 	if Trainpass_day ! 0:	transportVars['trainpass_day'] = Trainpass_day	& killvar 'Trainpass_day'
 	killvar 'train_event'
+	gs 'transport_functions', 'init_all'
 end
 
 

+ 69 - 32
locations/train.qsrc

@@ -17,10 +17,15 @@ if $ARGS[0] = 'communal':
 	gs 'stat'
 	'<center><img <<$set_imgh>> src="images/locations/shared/train/oldplat.jpg" ></center>'
 	'An old railway platform, it looks like it was abandoned. The sign is no longer legible, but there''s a hand painted sign from the communal cottages not too far away.'
-
-	act 'Return to the road':minut += 15 & nroad = 5 & gt 'road'
 	*nl
+	gs 'transport_functions', 'set_train_wait_time', 'communal'
+	'The next train in the direction of St. Petersburg city center ' + iif(transportVars['train_wait_center'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_center'']>> minutes.')
+	'The next train in the direction of Pavlovsk ' + iif(transportVars['train_wait_pavlovsk'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_pavlovsk'']>> minutes.')
+
+	act 'Return to the road': minut += 15 & nroad = 5 & gt 'road'
+
 	if transportVars['trainpass_day'] > daystart:
+		*nl
 		func('transport_functions', 'display_trainpass_time')
 		act 'Go to platforms': gt 'train', 'communal_trains'
 	else
@@ -43,6 +48,10 @@ if $ARGS[0] = 'communal_trains':
 	$menu_arg = 'communal_trains'
 	menu_off = 0
 
+	gs 'transport_functions', 'set_train_wait_time', 'pavlovsk'
+	'The next train in the direction of St. Petersburg city center ' + iif(transportVars['train_wait_center'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_center'']>> minutes.')
+	'The next train in the direction of Pavlovsk ' + iif(transportVars['train_wait_pavlovsk'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_pavlovsk'']>> minutes.')
+
 	act 'Leave the platform': gt 'train', 'communal'
 	
 	act 'Take a train to St. Petersburg city center (<<func(''transport_functions'', ''display_train_timecost'', ''communal'', ''center'')>>)': gt 'train', 'communal_center'
@@ -66,10 +75,15 @@ if $ARGS[0] = 'village':
 	gs 'stat'
 	'<center><img <<$set_imgh>> src="images/locations/shared/train/gadplat.jpg" ></center>'
 	'A fairly nondescript railway platform. The small village of Gadukino where your grandparents reside is not far from here.'
-
-	act 'Walk to the road (0:15)':minut += 15 & nroad = 10 & gt 'road'
 	*nl
+	gs 'transport_functions', 'set_train_wait_time', 'village'
+	'The next train in the direction of Pavlovsk ' + iif(transportVars['train_wait_pavlovsk'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_pavlovsk'']>> minutes.')
+	'The next train in the direction of St. Petersburg city center ' + iif(transportVars['train_wait_center'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_center'']>> minutes.')
+
+	act 'Walk to the road (0:15)': minut += 15 & nroad = 10 & gt 'road'
+
 	if transportVars['trainpass_day'] > daystart:
+		*nl
 		func('transport_functions', 'display_trainpass_time')
 		act 'Go to platforms': gt 'train', 'village_trains'
 	else
@@ -92,12 +106,16 @@ if $ARGS[0] = 'village_trains':
 	$menu_arg = 'village_trains'
 	menu_off = 0
 
+	gs 'transport_functions', 'set_train_wait_time', 'village'
+	'The next train in the direction of Pavlovsk ' + iif(transportVars['train_wait_pavlovsk'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_pavlovsk'']>> minutes.')
+	'The next train in the direction of St. Petersburg city center ' + iif(transportVars['train_wait_center'] = 0, 'is leaving now!', 'leaves in <<transportVars[''train_wait_center'']>> minutes.')
+
 	act 'Leave the platform': gt 'train', 'village'
 
-	act 'Take a train to Pavlovsk (<<func(''transport_functions'', ''display_train_timecost'', ''village'', ''pavlovsk'')>>)': gt 'train', 'village_pavlovsk'
-	act 'Take a train to the communal village (<<func(''transport_functions'', ''display_train_timecost'', ''village'', ''communal'')>>)': gt 'train', 'village_communal'
-	act 'Take a train to St. Petersburg city industrial area (<<func(''transport_functions'', ''display_train_timecost'', ''village'', ''ind'')>>)': gt 'train', 'village_ind'
-	act 'Take a train to St. Petersburg city center (<<func(''transport_functions'', ''display_train_timecost'', ''village'', ''center'')>>)': gt 'train', 'village_center'
+	act 'Take a train to Pavlovsk (<<func(''transport_functions'', ''display_train_timecost'', ''village'', ''pavlovsk'', ''pavlovsk'')>>)': gt 'train', 'village_pavlovsk'
+	act 'Take a train to the communal village (<<func(''transport_functions'', ''display_train_timecost'', ''village'', ''communal'', ''center'')>>)': gt 'train', 'village_communal'
+	act 'Take a train to St. Petersburg city industrial area (<<func(''transport_functions'', ''display_train_timecost'', ''village'', ''ind'', ''center'')>>)': gt 'train', 'village_ind'
+	act 'Take a train to St. Petersburg city center (<<func(''transport_functions'', ''display_train_timecost'', ''village'', ''center'', ''center'')>>)': gt 'train', 'village_center'
 end
 
 
@@ -121,7 +139,8 @@ if $ARGS[0] = 'center_ind':
 	$loc_arg = 'platform'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'center', 'ind')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_center_ind'] + transportVars['train_wait_pavlovsk']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -149,7 +168,8 @@ if $ARGS[0] = 'center_communal':
 	$loc_arg = 'communal'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'center', 'communal')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_center_communal'] + transportVars['train_wait_pavlovsk']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -175,7 +195,8 @@ if $ARGS[0] = 'center_village':
 	$loc_arg = 'village'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'center', 'village')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_center_village'] + transportVars['train_wait_pavlovsk']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -201,7 +222,8 @@ if $ARGS[0] = 'center_pavlovsk':
 	$loc_arg = 'platform'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'center', 'pavlovsk')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_center_pavlovsk'] + transportVars['train_wait_pavlovsk']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -238,8 +260,8 @@ if $ARGS[0] = 'ind_center':
 	$loc_arg = 'start'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	*clr & cla
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'ind', 'center')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_ind_center'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -269,7 +291,8 @@ if $ARGS[0] = 'ind_communal':
 	$loc_arg = 'communal'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'ind', 'communal')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_ind_communal'] + transportVars['train_wait_pavlovsk']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -288,7 +311,8 @@ if $ARGS[0] = 'ind_village':
 	$loc_arg = 'village'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'ind', 'village')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_ind_village'] + transportVars['train_wait_pavlovsk']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -314,7 +338,8 @@ if $ARGS[0] = 'ind_pavlovsk':
 	$loc_arg = 'platform'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'ind', 'pavlovsk')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_ind_pavlovsk'] + transportVars['train_wait_pavlovsk']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -351,7 +376,8 @@ if $ARGS[0] = 'communal_center':
 	$loc_arg = 'start'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'communal', 'center')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_communal_center'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -377,7 +403,8 @@ if $ARGS[0] = 'communal_ind':
 	$loc_arg = 'platform'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'communal', 'ind')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_communal_ind'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -396,7 +423,8 @@ if $ARGS[0] = 'communal_village':
 	$loc_arg = 'village'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'communal', 'village')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_communal_village'] + transportVars['train_wait_pavlovsk']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -414,9 +442,10 @@ if $ARGS[0] = 'communal_pavlovsk':
 	$loc = 'pav_train_hall'
 	$loc_arg = ''
 	$location_type = 'public_indoors'
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'communal', 'pavlovsk')
-	minut += transportVars['timecost']
 	menu_off = 1
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_communal_pavlovsk'] + transportVars['train_wait_pavlovsk']
+	minut += transportVars['timecost']
 	gs 'stat'
 
 	if transportVars['train_event_day'] ! daystart:
@@ -445,7 +474,8 @@ if $ARGS[0] = 'village_center':
 	$loc_arg = 'start'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'village', 'center')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_village_center'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -471,7 +501,8 @@ if $ARGS[0] = 'village_ind':
 	$loc_arg = 'platform'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'village', 'ind')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_village_ind'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -496,9 +527,10 @@ if $ARGS[0] = 'village_communal':
 	$loc = 'train'
 	$loc_arg = 'communal'
 	$location_type = 'public_indoors'
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'village', 'communal')
-	minut += transportVars['timecost']
 	menu_off = 1
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_village_communal'] + transportVars['train_wait_center']
+	minut += transportVars['timecost']
 	gs 'stat'
 
 	if transportVars['train_event_day'] ! daystart and rand(1, 100) <= 20: gt 'train_events', 'events'
@@ -515,9 +547,10 @@ if $ARGS[0] = 'village_pavlovsk':
 	$loc = 'pav_train_hall'
 	$loc_arg = 'platform'
 	$location_type = 'public_indoors'
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'village', 'pavlovsk')
-	minut += transportVars['timecost']
 	menu_off = 1
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_village_pavlovsk'] + transportVars['train_wait_pavlovsk']
+	minut += transportVars['timecost']
 	gs 'stat'
 
 	if transportVars['train_event_day'] ! daystart:
@@ -549,7 +582,8 @@ if $ARGS[0] = 'pavlovsk_center':
 	$loc_arg = 'start'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'pavlovsk', 'center')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_pavlovsk_center'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -581,7 +615,8 @@ if $ARGS[0] = 'pavlovsk_ind':
 	$loc_arg = 'platform'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'pavlovsk', 'ind')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_pavlovsk_ind'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -611,7 +646,8 @@ if $ARGS[0] = 'pavlovsk_communal':
 	$loc_arg = 'communal'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'pavlovsk', 'communal')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_pavlovsk_communal'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 
@@ -637,7 +673,8 @@ if $ARGS[0] = 'pavlovsk_village':
 	$loc_arg = 'village'
 	$location_type = 'public_indoors'
 	menu_off = 1
-	transportVars['timecost'] = func('transport_functions', 'get_train_timecost', 'pavlovsk', 'village')
+	gs 'transport_functions', 'set_train_wait_time'
+	transportVars['timecost'] = transportVars['train_time_pavlovsk_village'] + transportVars['train_wait_center']
 	minut += transportVars['timecost']
 	gs 'stat'
 

+ 182 - 3
locations/transport_functions.qsrc

@@ -1,5 +1,11 @@
 # transport_functions
 
+if $ARGS[0] = 'init_all':
+	gs 'transport_functions', 'init_train_prices'
+	gs 'transport_functions', 'init_train_timecosts'
+end
+
+
 
 	!!=======================================!!
 	!!                                       !!
@@ -84,6 +90,96 @@ if $ARGS[0] = 'set_train_ticket':
 	killvar 'temp_price'
 end
 
+
+!	Time Table:
+!		Bus departs every 20 minutes
+!		pavlovsk (07)	->	village (22)	->	communal (32)	->	ind (42)		->	center
+!		center (02)		->	ind (07)		->	communal (17)	->	village (27)	->	pavlovsk
+
+if $ARGS[0] = 'set_train_wait_time':
+	if hour = 0:
+		time_mod = 30
+	elseif hour <= 3:
+		time_mod = 60
+	elseif hour <= 21:
+		time_mod = 15
+	else
+		time_mod = 30
+	end
+
+	if $ARGS[1] = 'pavlovsk':
+		transportVars['train_wait_center']		= (67 - minut) mod time_mod
+	elseif $ARGS[1] = 'village':
+		transportVars['train_wait_center']		= (86 - minut) mod time_mod
+		transportVars['train_wait_pavlovsk']	= (87 - minut) mod time_mod
+	elseif $ARGS[1] = 'communal':
+		transportVars['train_wait_center']		= (92 - minut) mod time_mod
+		transportVars['train_wait_pavlovsk']	= (77 - minut) mod time_mod
+	elseif $ARGS[1] = 'ind':
+		transportVars['train_wait_center']		= (102 - minut) mod time_mod
+		transportVars['train_wait_pavlovsk']	= (67 - minut) mod time_mod
+	elseif $ARGS[1] = 'center':
+		transportVars['train_wait_pavlovsk']	= (62 - minut) mod time_mod
+	end
+end
+
+
+if $ARGS[0] = 'init_train_prices':
+	transportVars['train_price_pavlovsk_village']	= func('transport_functions', 'get_train_price', 'pavlovsk', 'village')
+	transportVars['train_price_pavlovsk_communal']	= func('transport_functions', 'get_train_price', 'pavlovsk', 'communal')
+	transportVars['train_price_pavlovsk_ind']		= func('transport_functions', 'get_train_price', 'pavlovsk', 'ind')
+	transportVars['train_price_pavlovsk_center']	= func('transport_functions', 'get_train_price', 'pavlovsk', 'center')
+
+	transportVars['train_price_village_pavlovsk']	= transportVars['train_price_pavlovsk_village']
+	transportVars['train_price_village_communal']	= func('transport_functions', 'get_train_price', 'village', 'communal')
+	transportVars['train_price_village_ind']		= func('transport_functions', 'get_train_price', 'village', 'ind')
+	transportVars['train_price_village_center']		= func('transport_functions', 'get_train_price', 'village', 'center')
+
+	transportVars['train_price_communal_pavlovsk']	= transportVars['train_price_pavlovsk_communal']
+	transportVars['train_price_communal_village']	= transportVars['train_price_village_communal']
+	transportVars['train_price_communal_ind']		= func('transport_functions', 'get_train_price', 'communal', 'ind')
+	transportVars['train_price_communal_center']	= func('transport_functions', 'get_train_price', 'communal', 'center')
+
+	transportVars['train_price_ind_pavlovsk']		= transportVars['train_price_pavlovsk_ind']
+	transportVars['train_price_ind_village']		= transportVars['train_price_village_ind']
+	transportVars['train_price_ind_communal']		= transportVars['train_price_communal_ind']
+	transportVars['train_price_ind_center']			= func('transport_functions', 'get_train_price', 'ind', 'center')
+
+	transportVars['train_price_center_pavlovsk']	= transportVars['train_price_pavlovsk_center']
+	transportVars['train_price_center_village']		= transportVars['train_price_village_center']
+	transportVars['train_price_center_communal']	= transportVars['train_price_communal_center']
+	transportVars['train_price_center_ind']			= transportVars['train_price_ind_center']
+end
+
+if $ARGS[0] = 'init_train_timecosts':
+	transportVars['train_time_pavlovsk_village']	= func('transport_functions', 'get_train_timecost', 'pavlovsk', 'village')
+	transportVars['train_time_pavlovsk_communal']	= func('transport_functions', 'get_train_timecost', 'pavlovsk', 'communal')
+	transportVars['train_time_pavlovsk_ind']		= func('transport_functions', 'get_train_timecost', 'pavlovsk', 'ind')
+	transportVars['train_time_pavlovsk_center']		= func('transport_functions', 'get_train_timecost', 'pavlovsk', 'center')
+
+	transportVars['train_time_village_pavlovsk']	= transportVars['train_time_pavlovsk_village']
+	transportVars['train_time_village_communal']	= func('transport_functions', 'get_train_timecost', 'village', 'communal')
+	transportVars['train_time_village_ind']			= func('transport_functions', 'get_train_timecost', 'village', 'ind')
+	transportVars['train_time_village_center']		= func('transport_functions', 'get_train_timecost', 'village', 'center')
+
+	transportVars['train_time_communal_pavlovsk']	= transportVars['train_time_pavlovsk_communal']
+	transportVars['train_time_communal_village']	= transportVars['train_time_village_communal']
+	transportVars['train_time_communal_ind']		= func('transport_functions', 'get_train_timecost', 'communal', 'ind')
+	transportVars['train_time_communal_center']		= func('transport_functions', 'get_train_timecost', 'communal', 'center')
+
+	transportVars['train_time_ind_pavlovsk']		= transportVars['train_time_pavlovsk_ind']
+	transportVars['train_time_ind_village']			= transportVars['train_time_village_ind']
+	transportVars['train_time_ind_communal']		= transportVars['train_time_communal_ind']
+	transportVars['train_time_ind_center']			= func('transport_functions', 'get_train_timecost', 'ind', 'center')
+
+	transportVars['train_time_center_pavlovsk']		= transportVars['train_time_pavlovsk_center']
+	transportVars['train_time_center_village']		= transportVars['train_time_village_center']
+	transportVars['train_time_center_communal']		= transportVars['train_time_communal_center']
+	transportVars['train_time_center_ind']			= transportVars['train_time_ind_center']
+end
+
+
+
 if $ARGS[0] = 'get_train_price':
 	result = func('transport_functions', '_private_train_price', $ARGS[2]) - func('transport_functions', '_private_train_price', $ARGS[1])
 	if result < 0: result = -result
@@ -107,7 +203,7 @@ end
 
 if $ARGS[0] = 'get_train_timecost':
 	result = func('transport_functions', '_private_train_time', $ARGS[2]) - func('transport_functions', '_private_train_time', $ARGS[1])
-	if result < 0: result = -result
+	if result < 0: result *= -1
 end
 
 if $ARGS[0] = '_private_train_time':
@@ -130,7 +226,17 @@ if $ARGS[0] = 'display_trainpass_time':
 end
 
 if $ARGS[0] = 'display_train_timecost':
-	$result = '00:' + $mid(100 + func('transport_functions', 'get_train_timecost', $ARGS[1], $ARGS[2]), 2, 2)
+	temp_mins = transportVars['train_time_<<$ARGS[1]>>_<<$ARGS[2]>>']
+	if $ARGS[1] = 'pavlovsk' or $ARGS[2] = 'center 'or ($ARGS[1] = 'village' and $ARGS[2] ! 'pavlovsk') or ($ARGS[1] = 'communal' and $ARGS[2] = 'ind'):
+		temp_mins += transportVars['train_wait_center']
+	else
+		temp_mins += transportVars['train_wait_pavlovsk']
+	end
+	temp_hours = temp_mins / 60
+	temp_mins = temp_mins mod 60
+	$result = '<<temp_hours>>:<<$mid(100 + temp_mins, 2, 2)>>'
+	killvar 'temp_mins'
+	killvar 'temp_hours'
 end
 
 
@@ -141,10 +247,83 @@ end
 	!!                                       !!
 	!!=======================================!!
 
+if $ARGS[0] = 'get_bus_timecost':
+	result = func('transport_functions', '_private_bus_time', $ARGS[2]) - func('transport_functions', '_private_bus_time', $ARGS[1])
+	gs 'transport_functions', 'set_bus_wait_time', $ARGS[1]
+	if result > 0:
+		if $ARGS[0] = 'com_center' or $ARGS[0] = 'pav_train' or $ARGS[0] = 'pushkin' or $ARGS[0] = 'construction':
+			result = transportVars['bus_wait_village'] + result
+		else
+			result = transportVars['bus_wait_suburbs'] + result
+		end
+	elseif result < 0:
+		if $ARGS[0] = 'pav_train' or $ARGS[0] = 'pushkin' or $ARGS[0] = 'construction' or $ARGS[0] = 'village':
+			result = transportVars['bus_wait_pavlovsk'] - result
+		else
+			result = transportVars['bus_wait_village'] - result
+		end
+	end
+end
 
+if $ARGS[0] = '_private_bus_time':
+	if $ARGS[1] = 'com_center':
+		result = 0
+	elseif $ARGS[0] = 'pav_train':
+		result = 2
+	elseif $ARGS[0] = 'pushkin':
+		result = 10
+	elseif $ARGS[0] = 'construction':
+		result = 25
+	elseif $ARGS[0] = 'village':
+		result = 50
+	elseif $ARGS[0] = 'communal':
+		result = 70
+	elseif $ARGS[0] = 'graveyard':
+		result = 80
+	elseif $ARGS[0] = 'suburbs':
+		result = 90
+	end
+end
 
 
-
+!	Time Table:
+!		Bus departs every 20 minutes
+!		com_center (13)	->	pav_train (15)		->	pushkin (23)	->	construction (38)	->	village
+!		village (13)	->	construction (38)	->	pushkin (53)	->	pav_train (01)		->	com_center
+!		village (15)	->	communal (35)		->	graveyard (45)	->	suburbs
+!		suburbs (05)	->	graveyard (15)		->	communal (25)	->	village
+
+if $ARGS[0] = 'set_bus_wait_time':
+	result = func('transport_functions', '_private_bus_time', $ARGS[2]) - func('transport_functions', '_private_bus_time', $ARGS[1])
+	if $ARGS[1] = 'com_center':
+		transportVars['bus_wait_village']	= (73 - minut) mod 20
+	elseif $ARGS[1] = 'pav_train':
+		transportVars['bus_wait_village']	= (75 - minut) mod 20
+		transportVars['bus_wait_pavlovsk']	= (61 - minut) mod 20
+	elseif $ARGS[1] = 'pushkin':
+		transportVars['bus_wait_village']	= (63 - minut) mod 20
+		transportVars['bus_wait_pavlovsk']	= (73 - minut) mod 20
+	elseif $ARGS[1] = 'construction':
+		transportVars['bus_wait_village']	= (78 - minut) mod 20
+		transportVars['bus_wait_pavlovsk']	= (78 - minut) mod 20
+	elseif $ARGS[1] = 'village':
+		transportVars['bus_wait_suburbs']	= (75 - minut) mod 20
+		transportVars['bus_wait_pavlovsk']	= (65 - minut) mod 20
+	elseif $ARGS[1] = 'communal':
+		transportVars['bus_wait_suburbs']	= (75 - minut) mod 20
+		transportVars['bus_wait_village']	= (65 - minut) mod 20
+	elseif $ARGS[1] = 'graveyard':
+		transportVars['bus_wait_suburbs']	= (65 - minut) mod 20
+		transportVars['bus_wait_village']	= (75 - minut) mod 20
+	elseif $ARGS[1] = 'suburbs':
+		transportVars['bus_wait_village']	= (65 - minut) mod 20
+	end
+	if hour = 4:
+		transportVars['bus_wait_pavlovsk']	+= (60 - minut)
+		transportVars['bus_wait_village']	+= (60 - minut)
+		transportVars['bus_wait_suburbs']	+= (60 - minut)
+	end
+end
 
 
 	!!=======================================!!