Files @ fda22c203ad5
Branch filter:

Location: games/Awakening/party.lua

Silverwing
Utils.lua added. Text fixes. Allow joining Phaetlarr to party
-- TODO больше отвлеченных диалогов, дабы было о чем поговорить с сопартийцами. Не стоит делать их деревянными безжизненными манекенами
char_learr = obj {
	nam = "learr";
	disp = "Леарр";
	dsc = function(s)
		if (stead.nameof(where(s)) == s.home) then
			return [[
				{Леарр} стоит возле одного из иллюминаторов и наблюдает за происходящим снаружи субмарины. ^
			]];
		else
			return [[
				{Леарр} ждет ваших указаний. ^
			]];
		end;
	end;
	home = "leviathan_wardroom";
	accompany = function(s, value)
		s.follow = value;
		if (value) then
			lifeon(s);
		else
			move(s, s.home, where(s));
			lifeoff(s);
		end;
	end;
	life = function(s)
		if (where(pl).leviathan) then
			if (stead.nameof(where(s)) ~= s.home) then
				move(s, s.home, where(s));
			end;
		else
			move(s, where(pl), where(s));
		end;
	end;
	act = function(s)
		if (stead.nameof(where(s)) == s.home) then
			walkin(learr_home_dlg);
		else
			walkin(learr_dlg);
		end;
	end;
};

char_phaetlarr = obj {
	nam = "phaetlarr";
	disp = "Фаэтларр";
	dsc = function(s)
		if (stead.nameof(where(s)) == s.home) then
			return [[
				{Фаэтларр} с интересом наблюдает за работой двигателей "Левиафана" ^
			]];
		else
			return [[
				{Фаэтларр} ждет ваших указаний. ^
			]];
		end;
	end;
	home = "leviathan_engines";
	accompany = function(s, value)
		s.follow = value;
		if (value) then
			lifeon(s);
		else
			move(s, s.home, where(s));
			lifeoff(s);
		end;
	end;
	life = function(s)
		if (where(pl).leviathan) then
			if (stead.nameof(where(s)) ~= s.home) then
				move(s, s.home, where(s));
			end;
		else
			move(s, where(pl), where(s));
		end;
	end;
	act = function(s)
		if (stead.nameof(where(s)) == s.home) then
			walkin(phaetlarr_home_dlg);
		else
			walkin(phaetlarr_dlg);
		end;
	end;
};

char_radcliffe = obj {
	nam = "radcliffe";
	disp = "Уолтер Рэдклифф";
	dsc = function(s)
		if (stead.nameof(where(s)) == s.home) then
			return [[
				{Уолтер Рэдклифф} задумчиво крутит в руках какую-то деталь. ^
			]];
		else
			return [[
				{Уолтер Рэдклифф} ждет ваших указаний. ^
			]];
		end;
	end;
	home = "leviathan_engines";
	accompany = function(s, value)
		s.follow = value;
		if (value) then
			lifeon(s);
		else
			move(s, s.home, where(s));
			lifeoff(s);
		end;
	end;
	life = function(s)
		if (where(pl).leviathan) then
			if (stead.nameof(where(s)) ~= s.home) then
				move(s, s.home, where(s));
			end;
		else
			move(s, where(pl), where(s));
		end;
	end;
	act = function(s)
		if (stead.nameof(where(s)) == s.home) then
			walkin(radcliffe_home_dlg);
		else
			walkin(radcliffe_dlg);
		end;
	end;
};

char_wright = obj {
	nam = "wright";
	disp = "Джек Райт";
	dsc = function(s)
		if (stead.nameof(where(s)) == s.home) then
			return [[
				{Джек Райт} читает какую-то книгу, сидя в кресле командира. ^
			]];
		else
			return [[
				{Джек Райт} ждет ваших указаний. ^
			]];
		end;
	end;
	home = "leviathan_wardroom";
	accompany = function(s, value)
		s.follow = value;
		if (value) then
			lifeon(s);
		else
			move(s, s.home, where(s));
			lifeoff(s);
		end;
	end;
	life = function(s)
		print("wright");
		if (where(pl).leviathan) then
			print("wright:leviathan");
			if (stead.nameof(where(s)) ~= s.home) then
				print("wright:goinghome");
				move(s, s.home, where(s));
			end;
		else
			print("wright:following");
			move(s, where(pl), where(s));
		end;
	end;
	act = function(s)
		if (stead.nameof(where(s)) == s.home) then
			walkin(wright_home_dlg);
		else
			walkin(wright_dlg);
		end;
	end;
};

learr_home_dlg = dlg {
	nam = "learr_dlg";
	disp = "Леарр";
	hideinv = true;
	entered = function(s)
		if (char_learr.follow) then
			pon('stay');
			poff('join');
		else
			pon('join');
			poff('stay');
		end;
	
		return [[
			Леарр вопросительно смотрит на вас
		]];
	end;
	phr = {
		{ tag = "join", always = "true", "Я хочу, чтобы ты пошла со мной в следующий раз", "Хорошо", 
			function()
				char_learr.accompany(char_learr, true);
				char_phaetlarr.accompany(char_phaetlarr, false);
				char_radcliffe.accompany(char_radcliffe, false);
				char_wright.accompany(char_wright, false);
				pon('stay');
				poff('join');
			end;
		};
		{ tag = "stay", always = "true", "Оставайся на Левиафане", "Хорошо", 
			function()
				char_learr.accompany(char_learr, false);
				poff('stay');
				pon('join');
			end;
		};
		{ tag = "exit", always = "true", "Это все", "Хорошо", 
			function() 
				back();
			end;
		}
	};
};

phaetlarr_home_dlg = dlg {
	nam = "phaetlarr_dlg";
	disp = "Фаэтларр";
	hideinv = true;
	entered = function(s)
		if (char_phaetlarr.follow) then
			pon('stay');
			poff('join');
		else
			pon('join');
			poff('stay');
		end;
	
		return [[
			Фаэтларр ждет ваших указаний
		]];
	end;
	phr = {
		{ tag = "join", always = "true", "Я хочу, чтобы ты пошел со мной в следующий раз", "Хорошо",
			function()
				char_learr.accompany(char_learr, false);
				char_phaetlarr.accompany(char_phaetlarr, true);
				char_radcliffe.accompany(char_radcliffe, false);
				char_wright.accompany(char_wright, false);
				poff('join');
				pon('stay');
			end; 
		};
		{ tag = "stay", always = "true", "Оставайся на Левиафане", "Хорошо", 
			function()
				char_phaetlarr.accompany(char_phaetlarr, false);
				pon('join');
				poff('stay');
			end;
		};
		{ tag = "exit", always = "true", "Это все", "Хорошо", 
			function() 
				back();
			end;
		}
	};
};

radcliffe_home_dlg = dlg {
	nam = "radcliffe_dlg";
	disp = "Уолтер Рэдклифф";
	hideinv = true;
	entered = function (s)
		if (char_learr.follow) then
			pon('stay');
			poff('join');
		else
			pon('join');
			poff('stay');
		end;
		
		return [[
			Уолтер задумчиво смотрит на вас
		]];
	end;
	phr = {
		{ tag = "join", always = "true", "Я хочу, чтобы ты пошел со мной в следующий раз", "Хорошо",
			function()
				if (submarine_leviathan.suits > 1) then
					char_learr.accompany(char_learr, false);
					char_phaetlarr.accompany(char_phaetlarr, false);
					char_radcliffe.accompany(char_radcliffe, true);
					char_wright.accompany(char_wright, false);
					pon('stay');
					poff('join');
					return [[Я готов]];
				else
					-- TODO сообщать это только если в партии есть навьяры
					return [[У нас не хватит оборудования. Лучше возьми кого-нибудь из навьяров]];
				end;
			end;  
		};
		{ tag = "stay", always = "true", "Оставайся на Левиафане", "Хорошо", 
			function()
				char_radcliffe.accompany(char_radcliffe, false);
				pon('join');
				poff('stay');
			end;
		};
		{ tag = "exit", always = "true", "Это все", "Хорошо", 
			function() 
				back();
			end;
		}
	};
};

wright_home_dlg = dlg {
	nam = "wright_dlg";
	disp = "Джек Райт";
	hideinv = true;
	entered = function(s)
		if (char_learr.follow) then
			pon('stay');
			poff('join');
		else
			pon('join');
			poff('stay');
		end;
		return [[
			Джек ждет ваших указаний
		]];
	end;
	phr = {
		{ tag = "join", always = "true", "Я хочу, чтобы ты пошел со мной в следующий раз", 
			function()
				if (submarine_leviathan.suits > 1) then
					char_learr.accompany(char_learr, false);
					char_phaetlarr.accompany(char_phaetlarr, false);
					char_radcliffe.accompany(char_radcliffe, false);
					char_wright.accompany(char_wright, true);
					pon('stay');
					poff('join');
					return [[Я готов]];
				else
					-- TODO сообщать это только если в партии есть навьяры
					return [[У нас не хватит оборудования. Лучше возьми кого-нибудь из навьяров]];
				end;
			end; 
		};
		{ tag = "stay", always = "true", "Оставайся на Левиафане", "Хорошо", 
			function()
				char_wright.accompany(char_wright, false);
				pon('join');
				poff('stay');
			end;
		};
		{ tag = "exit", always = "true", "Это все", "Хорошо", 
			function() 
				back();
			end;
		}
	};
};