Changeset - 6a8a5d28230f
[Not reviewed]
default
0 2 0
Silverwing - 8 years ago 2016-03-03 17:50:17

More fixes
2 files changed with 20 insertions and 21 deletions:
0 comments (0 inline, 0 general)
main.lua
Show inline comments
 
@@ -131,19 +131,19 @@ function init()
 
	warehouse18_init();
 
	warehouse32_init();
 
	---game init
 
	pl.where = intro;
 
	put(submarine_leviathan:disable(), dock_mooring);
 
	---debug
 
	-- pl.where = warehouse_32_entry;
 
	-- pl.where = warehouse_32_night;
 
	-- pl.where = w32_mgr;
 
	-- put(item_toolbox, pl);
 
	-- put(item_cogs, pl);
 
	-- put(item_pump_details, pl);
 
	-- put(item_electrodes, pl);
 
	-- put(item_lamp, pl);
 
	put(item_lamp, pl);
 
	-- pl.where = aurora_borealis;
 
	-- move(submarine_leviathan, first_city_entrance);
 
	-- move(submarine_leviathan, first_city_outer_east);
 
	-- walk(final_scene);
 
	-- walk(leviathan_wardroom);
 
	-- walk(leviathan_wardroom);
warehouse32.lua
Show inline comments
 
@@ -98,21 +98,22 @@ warehouse_32_night = room {
 
		vroom("В переулок", "warehouse_32_alley_night");
 
	};
 
};
 
 
warehouse_32_alley_night = darkroom {
 
	nam = "warehouse_32_alley_night";
 
	disp = "Переулок у склада 32";
 
	dsc_halflit = [[
 
		Вы стоите в небольшом грязном переулке неподалеку от склада 32. 
 
	]];
 
	dsc_dark = [[
 
		Вы стоите в небольшом грязном переулке неподалеку от склада 32. Здесь совсем темно и вы ничего не видите. 
 
	]];
 
	way = {
 
		vroom("К главному входу", "warehouse_32_night", 0);
 
		vroom("Пройти дальше", "warehouse_32_behind_night", 1);
 
		kh_vroom("К главному входу", "warehouse_32_night", 2);
 
		kh_vroom("Пройти дальше", "warehouse_32_behind_night", 1);
 
	};
 
};
 
 
warehouse_32_behind_night = room {
 
	nam = "warehouse_32_behind_night";
 
	disp = "За складом 32";
 
@@ -182,12 +183,14 @@ w32_mgr = darkroom {
 
		warehouse_32.pos = "54";
 
	end;
 
	key_inplace = true;
 
	book_inplace = true;
 
	way = {
 
		kh_vroom("Выйти", function(s)
 
			print(w32_mgr.key_inplace);
 
			print(w32_mgr.book_inplace);
 
			if (not w32_mgr.key_inplace or not w32_mgr.book_inplace) then
 
				pr("Стоит вернуть все как было. ");
 
				return false;
 
			elseif (pl.has_light) then
 
				pr("Если я не погашу лампу, меня заметят. ");
 
				return false;
 
@@ -297,17 +300,12 @@ w32_mgr_bookcase = obj {
 
	end;
 
	obj = {
 
		item_w32_key:disable();
 
	};
 
};
 
 
w32_frontdoor = room {
 
	nam = "w32_frontdoor";
 
	--TODO decide if this s#!t is needed
 
};
 
 
warehouse_32_definitions = {
 
	---line E
 
	["01"] = { name="у задней двери", dsc=[[
 
		К югу от вас расположена задняя дверь склада. 
 
	]], e1 = "11", ex3 = "w32_backdoor"};
 
	["02"] = { name="тупик", dsc=[[
 
@@ -397,14 +395,14 @@ warehouse_32_definitions = {
 
	]], e4 = "34", corner = true};
 
	---line A
 
	["51"] = { name="тупик", dsc=[[
 
		
 
	]], e3 = "41", corner = true};
 
	["52"] = { name="у входа", dsc=[[
 
		К северу от вас расположен главный вход склада. 
 
	]], e3 = "42", ex1 = "w32_frontdoor"};
 
		К северу от вас расположен главный вход склада, но он заперт. 
 
	]], e3 = "42"};
 
	["53"] = { name="тупик", dsc=[[
 
		
 
	]], e3 = "43", corner = true};
 
	["54"] = { name="у входа в кабинет управляющего", dsc=[[
 
		К северу от вас расположена дверь, ведущая, судя по табличке на ней, в кабинет управляющего. 
 
	]], e3 = "44", ex1="w32_mgr"};
 
@@ -478,13 +476,13 @@ warehouse_32 = room {
 
		end;
 
		return true;
 
	end;
 
	guardTurn = function(s)
 
		local pl_y = math.floor(tonumber(s.pos) / 10);
 
		local pl_x = tonumber(s.pos) % 10;
 
		print("player:", pl_x, pl_y);
 
		--print("player:", pl_x, pl_y);
 
		--Каждый стражник делает ход, игрок получает сообщения, о том, слышит ли он шаги, откуда и как они движутся
 
		for i = 1, #s.guards do
 
			--TODO play with this random number to assume good gameplay: predictable enough, yet somewhat random
 
			if (rnd(10) < 9) then
 
				if (s.guards[i].s == 1) then
 
					s.guards[i].s = 2;
 
@@ -513,13 +511,13 @@ warehouse_32 = room {
 
					end;
 
				end;
 
			end;
 
			
 
			local g_y = math.floor(tonumber(s.guards[i].pos) / 10);
 
			local g_x = tonumber(s.guards[i].pos) % 10;
 
			print("guard:", g_x, g_y)
 
			--print("guard:", g_x, g_y)
 
			--Видимость при разнице не более двух. В прямой видимости - видно, иначе - слышно
 
			--TODO может стоит сделать, чтобы шаги были слышны только при движении стражнека?
 
			if (g_x == pl_x) then
 
				--North-south line
 
				if (g_y - pl_y == 2) then
 
					pr("На севере вы видите охранника. Он смотрит на " .. getDirName(s.guards[i].dir) .. ". ");
 
@@ -552,17 +550,17 @@ warehouse_32 = room {
 
					pr("К югозападу от вас вы слышите шаги охранника. ");
 
				end;
 
			end;
 
		end;
 
	end;
 
	makeTurn = function(s)
 
		print("turn");
 
		print(s.guards[1].pos, s.guards[1].dir);
 
		print(s.guards[2].pos, s.guards[2].dir);
 
		print(s.guards[3].pos, s.guards[3].dir);
 
		print(s.guards[4].pos, s.guards[4].dir);
 
		--print("turn");
 
		--print(s.guards[1].pos, s.guards[1].dir);
 
		--print(s.guards[2].pos, s.guards[2].dir);
 
		--print(s.guards[3].pos, s.guards[3].dir);
 
		--print(s.guards[4].pos, s.guards[4].dir);
 
		-- TODO debug
 
		if (s:checkGuardSight()) then
 
			s:guardTurn();
 
			if (s:checkGuardSight()) then				
 
				if (warehouse_32_definitions[warehouse_32.pos].e1 or warehouse_32_definitions[warehouse_32.pos].ex1) then
 
					path("На север"):enable();
 
@@ -594,15 +592,16 @@ warehouse_32 = room {
 
					path("Спрятаться"):disable();
 
				end;
 
				
 
				if (warehouse_32.hidden) then
 
					path("Спрятаться"):disable();
 
					path("Выбраться из укрытия"):enable();
 
					path("Вперед"):disable();
 
					path("Повернуть налево"):disable();
 
					path("Повернуть направо"):disable();
 
					path("На запад"):disable();
 
					path("На восток"):disable();
 
					path("На север"):disable();
 
					path("На юг"):disable();
 
				else
 
					path("Выбраться из укрытия"):disable();
 
				end;
 
				
 
				if (warehouse_32_definitions[warehouse_32.pos].sector) then
 
					warehouse_32_shelves.current = warehouse_32_definitions[warehouse_32.pos].sector;
0 comments (0 inline, 0 general)