Changeset - 40fc5e5deacf
[Not reviewed]
default
0 1 0
silverwing - 11 months ago 2024-04-24 18:29:15

Custom last_location variable (from() does not always show what is needed)
1 file changed with 15 insertions and 8 deletions:
main3.lua
15
8
0 comments (0 inline, 0 general) First comment
main3.lua
Show inline comments
 
@@ -115,7 +115,8 @@ declare {
 
	},
 
	menu_sprites = {
 
	},
 
	in_game = false
 
	in_game = false,
 
  last_location = false
 
}
 

	
 
include "tutorial"
 
@@ -153,11 +154,13 @@ game.ondecor = function(s, name, press, 
 
end;
 

	
 
game.afterwalk = function()
 
	dprint(from().nam, '->', here().nam);
 

	
 
	if from().themeDispose then
 
		from():themeDispose();
 
	end;
 
  if last_location then
 
    dprint(last_location.nam, '->', here().nam);
 
    
 
    if last_location.themeDispose then
 
      last_location:themeDispose();
 
    end;
 
  end;
 
	
 
  local theme = std.call(here(), 'theme');
 
  
 
@@ -173,6 +176,8 @@ game.afterwalk = function()
 
  if here().themeInit then
 
		here():themeInit();
 
	end;
 
  
 
  last_location = here();
 
end;
 

	
 
function cat_list(list, sep)
 
@@ -461,7 +466,7 @@ room {
 
	disp = '';
 
	theme = 'menu';
 
	themeInit = function(s)
 
	   init_menu(true, {'back'});
 
    init_menu(true, {'back'});
 
	end;
 
	themeDispose = function(s)
 
		D {'start'};
 
@@ -1648,7 +1653,7 @@ function start(load)
 
			'kbc-s'
 
		};
 
    
 
		local bpi = rnd(#computer_parts);
 
		--[[local bpi = rnd(#computer_parts);
 
		_(computer_parts[bpi]).status = false;
 
		computer_parts[bpi] = computer_parts[#computer_parts];
 
		computer_parts[#computer_parts] = nil;
 
@@ -1658,6 +1663,8 @@ function start(load)
 
		--]]
 
		
 
		-- Debug
 
    power_on = true;
 
    walk('tower_level_4_room_2');
 
	end;
 
end;
 

	
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now