Changeset - bff3a59bf8b4
[Not reviewed]
default
0 2 0
Silverwing - 3 years ago 2020-11-09 21:37:16

Logic error: Disallow calling characters that are in wardroom from wardroom
2 files changed with 12 insertions and 3 deletions:
0 comments (0 inline, 0 general)
leviathan.lua
Show inline comments
 
@@ -1207,13 +1207,14 @@ phone_wheelhouse = obj {
 
	act = function(s)
 
        if (not submarine_leviathan.power_on or not submarine_leviathan.battery) then
 
            return [[Без электричества телефон не заработает. ]];
 
        elseif (#pl.party < 1) then
 
            return [[Здесь никого нет. ]];
 
        else
 
            walkin(phone_dlg);
 
            phone_dlg.from_wardroom = false;
 
            walkin("phone_dlg");
 
        end;
 
	end;
 
	seen_level = 1;
 
};
 
 
phone_cabin = obj {
 
@@ -1223,12 +1224,13 @@ phone_cabin = obj {
 
	act = function(s)
 
		if (not submarine_leviathan.power_on or not submarine_leviathan.battery) then
 
            return [[Без электричества телефон не заработает. ]];
 
        elseif (#pl.party < 1) then
 
            return [[Здесь никого нет. ]];
 
        else
 
            phone_dlg.from_wardroom = false;
 
            walkin("phone_dlg");
 
        end;
 
	end;
 
	seen_level = 1;
 
};
 
 
@@ -1238,28 +1240,35 @@ phone_wardroom = obj {
 
	dsc = [[На столе, рядом с креслом капитана установлен {телефонный аппарат} для связи в пределах субмарины. ]];
 
	act = function(s)
 
		if (not submarine_leviathan.power_on or not submarine_leviathan.battery) then
 
            return [[Без электричества телефон не заработает. ]];
 
        elseif (#pl.party < 1) then
 
            return [[Здесь никого нет. ]];
 
        elseif ArrayUtils.indexOf(pl.party, 'radcliffe') == 0 and ArrayUtils.indexOf(pl.party, 'phaetlarr') == 0 then
 
            return [[Весь экипаж находится здесь. Звонить незачем. ]];
 
        else
 
            phone_dlg.from_wardroom = true;
 
            walkin("phone_dlg");
 
        end;
 
	end;
 
	seen_level = 1;
 
};
 
 
phone_dlg = dlg {
 
	nam = "phone_dlg";
 
	disp = "Телефон";
 
	hideinv = true;
 
	dsc = [[Вы снимаете трубку. ]];
 
    from_wardroom = nil;
 
    
 
	entered = function(s)
 
		poff("phaetlarr", "learr", "radcliffe", "wright", "anna");
 
		for i = 1, #pl.party do
 
			pon(pl.party[i]);
 
            if not s.from_wardroom or (pl.party[i] == 'phaetlarr' or pl.party[i] == 'radcliffe') then
 
                pon(pl.party[i]);
 
            end;
 
		end;
 
	end;
 
	phr = {
 
		{ tag = "phaetlarr", always = true, "[Вызвать Фаэтларра]", function(s)
 
			phaetlarr_dlg.from_call = true;
 
			phaetlarr_dlg.home = false;
startup.lua
Show inline comments
 
@@ -220,13 +220,13 @@ end
 

	
 
function fix_save(filename)
 
    local f=stead.io.open(filename,"rb");
 
    if f~=nil then
 
        local content = f:read("*all");
 
        stead.io.close(f);
 
        print(string.find(content, '0.10.0'));
 
        
 
        if string.find(content, '0.10.0') == nil then
 
            print("Fixing save file");
 
            content = stead.string.gsub(content, '([^A-Za-z])rm([^A-Za-z])', '%1warehouse_32%2') .. '\nversion="0.10.0"\n';
 
            print(content)
 
            local f=stead.io.open(filename,"wb")
 
            if f ~= nil then
0 comments (0 inline, 0 general)