 doors(initialize):- 
	zone_surface_d(1),!.

zone_surface_d(_Surface) :-
	curr_zone(_Zone_number),
	load_z_surface_d(_Zone_number,_Surface),
	asserta(z_surface_d(_Zone_number,_Surface)),
	uset(z_surface_d,_Zone_number,_Surface).

load_z_surface_d(_Zone_number,_Surface) :-
	tell_usr(zone_surface_d, _Surface),
	load_x_off_d1(_Zone_number, _Surface),
	load_x_off_d2(_Zone_number, _Surface),
	load_door_wth1(_Zone_number, _Surface),
	load_door_wth2(_Zone_number, _Surface),
	load_door_ht1(_Zone_number, _Surface),
	load_door_ht2(_Zone_number, _Surface).

x_offset_d1(_Xoffsetd1) :-
 	curr_zone(_Current_zone),
	z_surface_d(_Current_zone,_Surface),
	asserta(x_offset_door1(_Current_zone,_Surface,_Xoffsetd1)),
	uset(x_offset_door1,[_Current_zone,_Surface],_Xoffsetd1).

load_x_off_d1(_Zone_number,_Surface) :-
	x_offset_door1(_Zone_number,_Surface,_Xoffsetd1),
	tell_usr(x_offset_d1,_Xoffsetd1);
	tell_usr(x_offset_d1, 0).

x_offset_d2(_Xoffsetd2) :-
 	curr_zone(_Current_zone),
	z_surface_d(_Current_zone,_Surface),
	asserta(x_offset_door2(_Current_zone,_Surface,_Xoffsetd2)),
	uset(x_offset_door2,[_Current_zone,_Surface],_Xoffsetd2).

load_x_off_d2(_Zone_number,_Surface) :-
	x_offset_door1(_Zone_number,_Surface,_Xoffsetd2),
	tell_usr(x_offset_d2,_Xoffsetd2);
	tell_usr(x_offset_d2, 0).

door_width1(_Door_width1) :-
 	curr_zone(_Current_zone),
	z_surface_d(_Current_zone,_Surface),
	asserta(door1_width(_Current_zone,_Surface,_Door_width1)),
	uset(door1_width,[_Current_zone,_Surface],_Door_width1).

load_door_wth1(_Zone_number,_Surface) :-
	door1_width(_Zone_number,_Surface,_Door_width1),
	tell_usr(door_width1,_Door_width1);
	tell_usr(door_width1, 0).

door_width2(_Door_width2) :-
 	curr_zone(_Current_zone),
	z_surface_d(_Current_zone,_Surface),
	asserta(door2_width(_Current_zone,_Surface,_Door_width2)),
	uset(door2_width,[_Current_zone,_Surface],_Door_width2).

load_door_wth2(_Zone_number,_Surface) :-
	door2_width(_Zone_number,_Surface,_Door_width2),
	tell_usr(door_width2,_Door_width2);
	tell_usr(door_width2, 0).

door_height1(_Door_height1) :-
 	curr_zone(_Current_zone),
	z_surface_d(_Current_zone,_Surface),
	asserta(door1_height(_Current_zone,_Surface,_Door_height1)),
	uset(door1_height,[_Current_zone,_Surface],_Door_height1).

load_door_ht1(_Zone_number,_Surface) :-
	door1_height(_Zone_number,_Surface,_Door_height1),
	tell_usr(door_height1,_Door_height1);
	tell_usr(door_height1, 0).

door_height2(_Door_height2) :-
 	curr_zone(_Current_zone),
	z_surface_d(_Current_zone,_Surface),
	assert(door2_height(_Current_zone,_Surface,_Door_height2)),
	uset(door2_height,[_Current_zone,_Surface],_Door_height2).

load_door_ht2(_Zone_number,_Surface) :-
	door2_height(_Zone_number,_Surface,_Door_height2),
	tell_usr(door_height2,_Door_height2);
	tell_usr(door_height2, 0).
