/*

DO NOT EDIT THIS FILE!

If you've messed with the Mitadake Map Editor, the concept is similar.

Markers are objects that are teleported to; in SL2, when you enter a door, it ports you to a marker inside of that house. (Excluding house doors.)

The way this works is by setting a marker object's marker_tag; for example, to cellsvich_fishmarket, in the map editor by using right-click and Edit.
Then, when an area with its marker_tag variable set to cellsvich_fishmarket is entered, the party is teleported to that marker. Setting the area's marker_tag
is accomplished the same way (I recommend turning on Frame Areas in the map editor).

*/


obj
	marker
		icon='marker.dmi'
		layer=10000
		var
			marker_tag=""
		New()
			..()
			src.icon=null
			if(length(tag)>0)
				marker_tag=tag
				tag=null
obj
	marker
		spiritualism
			icon_state="spirits"
		caravan_npc
			name="Caravan NPC Marker"
			icon_state="caravan"
			cellsvich

area
	var
		marker_tag
		must_near=0

		should_light=1
		lstate
		alpha_mod=0
	proc
		light_state(times)
			return lstate
		should_light(times)
			.=should_light
		alpha_mod()
			.=alpha_mod
	layer=5000
	mouse_opacity=0
	dark_dungeon
		luminosity=0
	interior
		should_light=0
		dark
			icon='shading.dmi'
			icon_state="dark_old"
		cold
			icon='shading.dmi'
			icon_state="cold"
	feature
		must_near=1
	Entered(mob/combat/M)
		var/old_z=M.z
		..()
		var/can_tele=1
		if(can_tele)
			if(marker_tag)
				if(get_marker(marker_tag))
					goto_marker(M,marker_tag)
					wo_eyes(M)
				else
					goto_feature(M,marker_tag)
					wo_eyes(M)
			if(old_z!=M.z)
				reg_weatherse(M)
				reg_weatherscreen(M)
			update_music(M)

// Added 06-19-2016

	conditional
		chinotoa // Requires the Phoenix Band to enter this area.

	no_light_con
		icon='icons/animations/shading.dmi'

		streetlight
			icon_state="brightest"
			alpha_mod=-180
			alpha_mod()
				if(time.hour in list(0,1,2,23,24,20,21,22,3,4,5,18,19))
					.=..()
				else .=0
/*			light_state(times=1)
				if(time.hour in list(0,1,2,23,24,20,21,22,3,4,5,18,19))
					.="dusk"*/
		streetlight_further
			icon_state="brighter"
			alpha_mod=-130
/*			light_state(times=1)
				if(time.hour in list(0,1,2,23,24,20,21,22,3,4,5,18,19))
					.="lessdark"*/
			alpha_mod()
				if(time.hour in list(0,1,2,23,24,20,21,22,3,4,5,18,19))
					.=..()
				else .=0
		streetlight_further2
			icon_state="least bright"
			alpha_mod=-80
			alpha_mod()
				if(time.hour in list(0,1,2,23,24,20,21,22,3,4,5,18,19))
					.=..()
				else .=0

area
	in_town

	conditional
		summon_house_outside

		capital_gate


proc
	wo_eyes(mob/combat/user)

		var/list/whats=list()
		if(ismob(user))
			whats+=user
		if(length(whats)>0)

			var/mob/main=whats[1]
			var/obj/world_obj/eye_restrict/Z
			for(var/obj/world_obj/eye_restrict/XX in world)
				if(XX.z==main.z)
					Z=XX
			for(var/mob/M in whats)
	//			world << M
				var/sets=0
				if(Z)
					if(M.z==Z.z)
						Z.set_eyes(M)
						sets=1

				if(sets==0)
					if(M.client)
						M.client.edge_limit=null
	get_marker(tag)
		for(var/obj/marker/X)
			if(X.marker_tag==tag)
				return X
	goto_marker(mob/user,tag)
		var/obj/Y=get_marker(tag)
		if(Y)
			user.loc=locate(Y.x,Y.y,Y.z)
	party_nearby(mob/combat/user)
		.=1
	on_teleport(party/M)
