// Lava Puzzle Floors v1.0.0
// lavapuzzle.txt
// by Kelandon (tomwatts@berkeley.edu)
// 
// When a PC steps on this space, the space directly in front turns into
// something else, defaulting to lava.
//
// Memory Cells - 
//	0 - What floor to set the space to. If left at 0, defaults to 134, which is
//		lava in Bahssikava.
//	1,2 - SDF. This script needs to know the leading character, which may not be
//		character 0. The way this script figures out the leading character is
//		through this SDF. Set this SDF to the leading character's number
//		sometime before the party gets to this terrain script's location. This
//		SDF defaults to (16,4) if both of these are left at 0.
beginterrainscript; 

variables;
short i,j;

body;

beginstate INIT_STATE; // state 0
	if (get_memory_cell(0) == 0)
		set_memory_cell(0,134);
	if ((get_memory_cell(1) == 0) && (get_memory_cell(2) == 0))
		{set_memory_cell(1,16);
		set_memory_cell(2,4); }
break;

beginstate START_STATE; // state 2
break;

beginstate SEARCH_STATE; // state 100
break;

beginstate UNLOCK_SPELL_STATE; // state 101
break;

beginstate SANCTIFICATION_STATE; // state 102
break;

beginstate BLOCK_MOVE_STATE; // state 112
break;

beginstate DISPEL_BARRIER_STATE; // state 113
break;

beginstate STEP_INTO_SPOT_STATE; // state 114
	set_floor(2 * my_loc_x() - char_loc_x(get_flag(get_memory_cell(1),get_memory_cell(2))),2 * my_loc_y() - char_loc_y(get_flag(get_memory_cell(1),get_memory_cell(2))),get_memory_cell(0));
break;