# carF
!2021/04/26
$enddrive = {
	if cardrive = 1:gt 'city_residential'
	if cardrive = 2:gt 'city_center'
	if cardrive = 3:gt 'city_industrial'
	if cardrive = 4:gt 'city_lake', 'start'
	if cardrive = 5:gt 'city_park', 'start'
	if cardrive = 6: litltown = 0 & gt 'zaprF', 'start'
	if cardrive = 7:gt 'autoservisF', 'start'
	if cardrive = 8: gt 'city_house_res_misc', 'fronty'
	if cardrive = 9:gt 'autotraidF', 'start'
	if cardrive = 10:gt 'city_park', 'whore'
	if cardrive = 11:gt 'city_sauna'
	if cardrive = 12:gt 'obekt'
	if cardrive = 13:gt 'dachi'	
	if cardrive = 14:gt 'liam'
	if cardrive = 18:gt 'city_mansion_entrance'
	if cardrive = 19:gt 'city_industrial_train', 'outside'
	if cardrive = 20:gt 'pav_residential'
	if cardrive = 21: litltown = 1 & gt 'zaprF','start'
	if cardrive = 22:gt 'road'
	if cardrive = 23:gt 'gadukino'
	if cardrive = 24:gt 'pav_commercial'
	if cardrive = 25:gt 'city_island'
	if cardrive = 26:gt 'pav_industrial'
	if cardrive = 27:gt 'city_redlight', 'start'
	if cardrive = 28:gt 'city_suburbs', 'start'
	if cardrive = 29:gt 'gas_station_gp_117', 'outside'
}

if $ARGS[0] = 'start':
	$menu_loc = 'carF'
	$menu_arg = 'start'
	menu_off = 0
	$loc_arg = $ARGS[0]
	$loc = 'carF'
	CLOSE ALL
	*clr & cla
	minut += 1
	gs 'stat'
	gs 'themes', 'indoors'
	'<center><b><<$car>></b></center>'
	'<center><img <<$set_imgh>> src="images/pc/items/accessories/car/car<<car>>.jpg"></center>'

	act 'Move away from the car':dynamic $enddrive

	if kanistra > 0:
		'In the trunk there ' + iif(kanistra = 1, 'is 1 cannister', 'are <<kanistra>> canisters') + ' of gasoline. Each canister contains 5 liters of gasoline.'

		if benz <= 45:
			act 'Pour gasoline into the tank':
				cla
				menu_off = 1
				benz += 5
				kanistra -= 1
				'You empty the canister of gasoline into the tank.'

				act 'Move away':gt 'carF', 'start'
			end
		end
	end

	act 'Get in the car':gt 'carF', 'salon'
end

if $ARGS[0] = 'salon':
	menu_off = 1
	$loc_arg = $ARGS[0]
	$loc = 'carF'
	*clr & cla
	minut += 1
	gs 'stat'
	'<center><b><<$car>></b></center>'
	'<center><img <<$set_imgh>> src="images/pc/items/accessories/car/salon<<car>>.jpg"></center>'
	'Gasoline - <<benz>> ' + iif(benz = 1, 'liter', 'liters') + ', the fuel tank has a capacity of 40 liters.'

	if teh <= 0:teh = 0 & wrek = 1
	if teh <= 0 or wrek = 1:$teh = 'The car is in need of repairs and won''t start.'
	if teh >= tehcar * 75 / 100 and wrek = 0:$teh = 'The car is in excellent condition.'
	if teh < tehcar * 75 / 100 and teh >= tehcar * 50 / 100 and wrek = 0:$teh = 'While driving, you occasionally hear some troubling noises.'
	if teh < tehcar * 50 / 100 and teh >= tehcar * 25 / 100 and wrek = 0:$teh = 'The car seems broken and barely drives.'
	if teh < tehcar * 25 / 100 and wrek = 0:$teh = 'How this car still runs is a mystery, even to its designers.'

	'<<$teh>>'

	if cardrive = 1:'Through the windshield, you see St. Petersburg''s residential area.'
	if cardrive = 2:'Through the windshield, you see St. Petersburg''s city center.'
	if cardrive = 3:'Through the windshield, you see St. Petersburg''s industrial region.'
	if cardrive = 4:'Through the windshield, you see the lake.'
	if cardrive = 5:'Through the windshield, you can see the park.'
	if cardrive = 6:'Through the windshield, you can see the gas station in the city industrial region.'
	if cardrive = 7:'Through the windshield, you can see the car service centre.'
	if cardrive = 8:'Through the windshield, you see your house in St. Petersburg''s residential area.'
	if cardrive = 9:'Through the windshield, you can see many of the cars for sale outside the showroom.'
	if cardrive = 10:'Through the windshield, you can see hookers outside the park.'
	if cardrive = 11:'Through the windshield, you can see the sauna.'
	if cardrive = 12:'Through the windshield, you see a construction site.'
	if cardrive = 13:'Through the windshield, you can see the suburban cooperative.'
	if cardrive = 14:'Through the windshield, you see the Old Town district of Pavlovsk.'
	if cardrive = 18:'Through the windshield, you can see your mansion.'
	if cardrive = 19:'Through the windshield, you see the city industrial region train station.'
	if cardrive = 20:'Through the windshield, you can see Pavlovsk''s residential area.'
	if cardrive = 21:'Through the windshield, you can see the gas station near Pavlovsk.'
	if cardrive = 22:'Through the windshield, you can see the highway.'
	if cardrive = 23:'Through the windshield, you see the huts of the village of Gadukino.'
	if cardrive = 24:'Through the windshield, you can see Pavlovsk''s commercial region.'
	if cardrive = 25:'You cross one of the bridges that leads to the island.'
	if cardrive = 26:'Through the windshield, you can see Pavlovsk''s industrial region.'
	if cardrive = 27:'Through the windshield, you see St. Petersburg''s red light district.'
	if cardrive = 28:'Through the windshield, you see St. Petersburg''s suburbs.'
	if cardrive = 29:'Through the windshield, you can see the Gazpromneft gas station on the highway.'

	if prava = 0:'You don''t have a driver''s license.'

	act 'Get out of the car':dynamic $enddrive

	if benz > 0 and wrek = 0 and prava > 0:
		if teh >= tehcar * 75 / 100:
			if rand(0, 1000) = 1000:wrek = 1
		elseif teh >= tehcar * 50 / 100:
			if rand(0, 100) = 100:wrek = 1
		elseif teh >= tehcar * 25 / 100:
			if rand(0, 100) >= 80:wrek = 1
		else
			if rand(0, 100) >= 40:wrek = 1
		end

		if wrek = 1:
			'Something clatters loudly, and the engine stalls.'

			act 'Fuck':gt 'carF', 'salon'
		else
			if alko > 0 and rand(0, 100) <= alko:
				'A policeman stops you. He looks at your condition and requests you breathe into a tube. You breathe, and a red light brightens up on the instrument panel.'
				'The officer snorts and writes something down. He hands you a slip of paper with the number 50,000 on it'
				'"Or I can write a report. But you will get a permanent record for driving drunk."'

				if money >= 50000:
					act 'Bribe him (50,000 <b>₽</b>)':
						cla
						money = money - 50000
						'You pay, and the policeman warns you that you can not keep driving in your drunken state.'

						act 'In the salon':gt 'carF', 'salon'
					end
				end

				act 'Come on, this is within the law':
					cla
					prava = 0
					'"I can take your license for not driving sober."'

					act 'In the salon':gt 'carF', 'salon'
				end
			elseif alko >= 10 and rand(0, 100) >= 50:
				teh = teh/2
				wrek = 1
				'Driving drunk, you crash into a tree and wreck your car.'

				act 'In the salon':gt 'carF', 'salon'
			else
				if (cardrive = 22 and nroad >= 18) or cardrive = 14 or cardrive = 20 or cardrive = 21 or cardrive = 24 or cardrive = 26:
					car_town = 0
					act 'Go to local destination': gs 'carF', 'pav'
					act 'Go to the city':
						minut += 65
						*nl
						'You drive for more than an hour on the highway before you get to the city.'
						gs 'carF', 'city'
					end
					act 'Go to another destination':
						minut += 30
						*nl
						'You drive out of Pavlovsk.'
						gs 'carF', 'other'
					end
				elseif cardrive <= 11 or cardrive = 19 or cardrive = 25 or cardrive = 27:
					car_town = 1
					act 'Go to another city destination': gs 'carF', 'city'
					act 'Go to Pavlovsk':
						minut += 65
						*nl
						'You drive for more than an hour on the highway before you get to the town of Pavlovsk.'
						gs 'carF', 'pav'
					end
					act 'Go to another destination':
						minut += 30
						*nl
						'You drive out of the city.'
						gs 'carF', 'other'
					end
				else
					car_town = 2
					act 'Go to a city destination':
						minut += 30
						*nl
						'You drive for half an hour on the highway before you get to the city.'
						gs 'carF', 'city'
					end
					act 'Go to a Pavlovsk destination':
						minut += 30
						*nl
						'You drive for half an hour on the highway before you get to the town of Pavlovsk.'
						gs 'carF', 'pav'
					end
					act 'Go to another destination': gs 'carF', 'other'
				end
			end
		end
	end
end

if $ARGS[0] = 'other':
	cla
	if func('homes_properties', 'can_live_here', 'matryona_mansion') and cardrive ! 18:
		act 'Go to Matryona Mansion':
			cla

			if cardrive = 28:
				minut += 1
				cardrive = 18
			elseif car_town ! 1:
				minut += 60
				benz -= 1
				teh -= rand(1, 3)
				cardrive = 18
			else
				minut += 10
				benz -= 1
				teh -= rand(1, 3)
				cardrive = 18
			end

			'You drive to your mansion.'
			dynamic $enddrive
		end
	end

	if cardrive ! 28:
		act 'Go to the city suburbs':
			cla

			if cardrive = 18:
				minut += 1
				cardrive = 28
			elseif car_town ! 1:
				minut += 60
				benz -= 1
				teh -= rand(1, 3)
				cardrive = 28
			else
				minut += 10
				benz -= 1
				teh -= rand(1, 3)
				cardrive = 28
			end

			'You drive to St. Petersburg''s suburbs.'
			dynamic $enddrive
		end
	end

	if cardrive ! 12:
		act 'Go to the construction site':
			cla
			if car_town ! 1:
				minut += 55
				'It takes nearly an hour to get to your destination.'
			else
				minut += 15
				'15 minutes later, you arrive at your destination.'
			end
			benz -= 1
			teh -= rand(2, 5)
			cardrive = 12

			dynamic $enddrive
		end
	end

	if cardrive ! 13:
		act 'Go to the Suburban Cooperative':
			cla
			if car_town ! 1:
				minut += 45
				'It takes three quarters of an hour to get to your destination.'
			else
				minut += 25
				'25 minutes later, you arrive at your destination.'
			end
			benz -= 1
			teh -= rand(2, 5)
			cardrive = 13

			dynamic $enddrive
		end
	end

	if cardrive ! 23:
		act 'Go to the village of Gadukino':
			cla
			benz = benz - 1
			teh = teh - RAND(3,6)
			cardrive = 23

			if car_town ! 0:
				minut += 55
				'You spend about an hour on the highway going to Gadukino.'
			else
				minut += 15
				'15 minutes later, you reach your destination.'
			end

			dynamic $enddrive
		end
	end

	if cardrive ! 29 and prostitute['gas_station'] = 1:
		act 'Go to the gas station on M11':
			cla
			benz -= 1
			teh -= rand(1,3)
			minut += rand(25-50)
			if cardrive = 1 or cardrive = 2 or cardrive = 8 or cardrive = 11 or cardrive =4 or cardrive = 5  or cardrive = 10 or cardrive = 28 or cardrive = 18:
				minut += 10
			end 
			cardrive = 29
			dynamic $enddrive
		end
	end

	act 'Drive around the local track (1:00)':
		cla
		minut += 60
		benz -= 4
		teh -= rand(2, 6)
		pcs_mood += 20
		'You go to the track and have fun driving around before leaving.'

		act 'Finish':xgt 'carF', 'salon'
	end
end

if $ARGS[0] = 'pav':
	cla
	if cardrive ! 26:act 'Go to Pavlovsk''s Industrial Region':gs 'carF', 'nearby', 26
	if cardrive ! 20:act 'Go to Pavlovsk''s Residential Area':gs 'carF', 'nearby', 20
	if cardrive ! 24:act 'Go to Pavlovsk''s Commercial Region':gs 'carF', 'nearby', 24
	if cardrive ! 14:act 'Go to Old Town district of Pavlovsk':gs 'carF', 'nearby', 14
	if cardrive ! 21:act 'Go to the gas station':gs 'carF', 'nearby', 21
end

if $ARGS[0] = 'city':
	cla
	if func('homes_properties', 'is_property_of_status', 'owned', 'city_house') and cardrive ! 8: act 'Go to your house in the residential area':gs 'carF', 'nearby', 8
	if cardrive ! 3:act 'Go to St. Petersburg''s Industrial Region':gs 'carF', 'nearby', 3
	if cardrive ! 1:act 'Go to St. Petersburg''s residential area':gs 'carF', 'nearby', 1
	if cardrive ! 2:act 'Go to St. Petersburg city center':gs 'carF', 'nearby', 2
	if cardrive ! 19:act 'Go to the city train station':gs 'carF', 'nearby', 19
	if cardrive ! 4:act 'Go to the city lake':gs 'carF', 'nearby', 4
	if cardrive ! 5:act 'Go to the city park':gs 'carF', 'nearby', 5
	if cardrive ! 6:act 'Go to the gas station':gs 'carF', 'nearby', 6
	if cardrive ! 7 and func('autoservisF', 'is_open'):act 'Go to the auto repair shop':gs 'carF', 'nearby', 7
	if cardrive ! 9 and func('autotraidF', 'is_open'):act 'Go to the car dealership':gs 'carF', 'nearby', 9
	if cardrive ! 25:act 'Go to the island':gs 'carF', 'nearby', 25
	if cardrive ! 27:act 'Go to the red light district':gs 'carF', 'nearby', 27
end

if $ARGS[0] = 'nearby':
	cla
	minut += 5
	benz -= 1
	teh -= rand(1, 3)
	cardrive = ARGS[1]
	if cardrive = 8: minut += 5
	'5 minutes later, you arrive at your destination.'
	dynamic $enddrive
end

--- carF ---------------------------------