from toee import *
from utilities import *

def san_dialog( attachee, triggerer ):
	if (attachee.map == 5001):
		attachee.turn_towards(triggerer)
		triggerer.begin_dialog( attachee, 1 )
	if (attachee.map == 5051):
		triggerer.begin_dialog( attachee, 200 )
	return SKIP_DEFAULT

#def zombie_tele(chaim,moshe,yosef):
#	game.global_vars[830] = chaim
#	game.global_vars[831] = moshe
#	game.global_vars[832] = yosef
#	game.fade_and_teleport(0,0,0,5019,454,467)
#	return SKIP_DEFAULT

def tele2( dialer, town, x, y ):
	game.fade_and_teleport(0,0,0,town,x,y)
	game.timevent_add( bananaphone, ( dialer, x, y ), 300)
	return SKIP_DEFAULT

def bananaphone( dialer, x,y ):
	if (dialer.map == 5001):
		operator = game.obj_create( 14800, location_from_axis (x+1, y+1) )
	elif (dialer.map == 5051):
		operator = game.obj_create( 14800, location_from_axis (x+1, y+1) )
	dialer.begin_dialog(operator, 3000)
	#game.particles( "sp-summon monster I", operator )
	return RUN_DEFAULT


def san_first_heartbeat(attachee,triggerer):
#	if (attachee.map == 5019 and game.global_vars[831] != 0):
#		game.fade_and_teleport(0,0,0,game.global_vars[830],game.global_vars[831],game.global_vars[832])
#		game.global_vars[831] = 0
	dummy = 1
	return SKIP_DEFAULT	

#def flagtest():
#	game.global_vars[500]=0; #first flag set above 231
#	game.global_vars[501]=0; #first flag set above 380
#	game.global_vars[502]=0; #first flag set above 1001
#
#	flagno=231;
#	while (game.global_flags[flagno] == 0):
#		flagno = flagno + 1;
#	game.global_vars[500]=flagno;
#
#	flagno=380;
#	while (game.global_flags[flagno] == 0):
#		flagno = flagno + 1;
#	game.global_vars[501]=flagno;
#
#	flagno=1001;
#	while (game.global_flags[flagno] == 0):
#		flagno = flagno + 1;
#	game.global_vars[502]=flagno;
#
#	#check the vars in console!
#
#	return SKIP_DEFAULT