<commit_before>/obj/structure/window
	name = "window"
	desc = "A window."
	icon = 'icons/obj/structures.dmi'
	icon_state = "window"
	density = 1
	layer = 3.2//Just above doors
	pressure_resistance = 4*ONE_ATMOSPHERE
	anchored = 1.0
	flags = ON_BORDER
	var/maxhealth = 25
	var/health = 0
	var/ini_dir = null
	var/state = 0
	var/reinf = 0
	var/disassembled = 0
	var/wtype = "glass"
	var/fulltile = 0
	var/obj/item/stack/rods/storedrods
	var/obj/item/weapon/shard/storedshard
//	var/silicate = 0 // number of units of silicate
//	var/icon/silicateIcon = null // the silicated icon

/obj/structure/window/New(Loc,re=0)
	..()
	health = maxhealth
	if(re)	reinf = re
	storedshard = new/obj/item/weapon/shard(src)
	ini_dir = dir
	if(reinf)
		state = 2*anchored
		storedrods = new/obj/item/stack/rods(src)

	air_update_turf(1)
	update_nearby_icons()

	return

/obj/structure/window/bullet_act(var/obj/item/projectile/Proj)
	if((Proj.damage_type == BRUTE || Proj.damage_type == BURN))
		health -= Proj.damage
		update_nearby_icons()
	..()
	if(health <= 0)
		spawnfragments()
	return


/obj/structure/window/ex_act(severity, target)
	switch(severity)
		if(1.0)
			qdel(src)
			return
		if(2.0)
			spawnfragments()
			return
		if(3.0)
			if(prob(50))
				spawnfragments()
				return


/obj/structure/window/blob_act()
	spawnfragments()

/obj/structure/window/singularity_pull(S, current_size)
	if(current_size >= STAGE_FIVE)
		spawnfragments()

/obj/structure/window/CanPass(atom/movable/mover, turf/target, height=0)
	if(istype(mover) && mover.checkpass(PASSGLASS))
		return 1
	if(dir == SOUTHWEST || dir == SOUTHEAST || dir == NORTHWEST || dir == NORTHEAST)
		return 0	//full tile window, you can't move into it!
	if(get_dir(loc, target) == dir)
		return !density
	else
		return 1


/obj/structure/window/CheckExit(atom/movable/O as mob|obj, target as turf)
	if(istype(O) && O.checkpass(PASSGLASS))
		return 1
	if(get_dir(O.loc, target) == dir)
		return 0
	return 1


/obj/structure/window/hitby(AM as mob|obj)
	..()
	visible_message("<span class='danger'>[src] was hit by [AM].</span>")
	var/tforce = 0
	if(ismob(AM))
		tforce = 40

	else if(isobj(AM))
		var/obj/item/I = AM
		tforce = I.throwforce

	if(reinf)
		tforce *= 0.25

	playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1)
	health = max(0, health - tforce)
	if(health <= 7 && !reinf)
		anchored = 0
		update_nearby_icons()
		step(src, get_dir(AM, src))

	if(health <= 0)
		spawnfragments()
	update_nearby_icons()

/obj/structure/window/attack_tk(mob/user as mob)
	user.visible_message("<span class='notice'>Something knocks on [src].</span>")
	add_fingerprint(user)
	playsound(loc, 'sound/effects/Glassknock.ogg', 50, 1)

/obj/structure/window/attack_hulk(mob/living/carbon/human/user)
	if(!can_be_reached(user))
		return
	..(user, 1)
	user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!"))
	user.visible_message("<span class='danger'>[user] smashes through [src]!</span>")
	storedshard.add_fingerprint(user)
	if(storedrods)
		storedrods.add_fingerprint(user)
	hit(50)
	return 1

/obj/structure/window/attack_hand(mob/user as mob)<commit_msg>Simply adds a delay to knocking in windows with TK.<commit_after>/obj/structure/window
	name = "window"
	desc = "A window."
	icon = 'icons/obj/structures.dmi'
	icon_state = "window"
	density = 1
	layer = 3.2//Just above doors
	pressure_resistance = 4*ONE_ATMOSPHERE
	anchored = 1.0
	flags = ON_BORDER
	var/maxhealth = 25
	var/health = 0
	var/ini_dir = null
	var/state = 0
	var/reinf = 0
	var/disassembled = 0
	var/wtype = "glass"
	var/fulltile = 0
	var/obj/item/stack/rods/storedrods
	var/obj/item/weapon/shard/storedshard
//	var/silicate = 0 // number of units of silicate
//	var/icon/silicateIcon = null // the silicated icon

/obj/structure/window/New(Loc,re=0)
	..()
	health = maxhealth
	if(re)	reinf = re
	storedshard = new/obj/item/weapon/shard(src)
	ini_dir = dir
	if(reinf)
		state = 2*anchored
		storedrods = new/obj/item/stack/rods(src)

	air_update_turf(1)
	update_nearby_icons()

	return

/obj/structure/window/bullet_act(var/obj/item/projectile/Proj)
	if((Proj.damage_type == BRUTE || Proj.damage_type == BURN))
		health -= Proj.damage
		update_nearby_icons()
	..()
	if(health <= 0)
		spawnfragments()
	return


/obj/structure/window/ex_act(severity, target)
	switch(severity)
		if(1.0)
			qdel(src)
			return
		if(2.0)
			spawnfragments()
			return
		if(3.0)
			if(prob(50))
				spawnfragments()
				return


/obj/structure/window/blob_act()
	spawnfragments()

/obj/structure/window/singularity_pull(S, current_size)
	if(current_size >= STAGE_FIVE)
		spawnfragments()

/obj/structure/window/CanPass(atom/movable/mover, turf/target, height=0)
	if(istype(mover) && mover.checkpass(PASSGLASS))
		return 1
	if(dir == SOUTHWEST || dir == SOUTHEAST || dir == NORTHWEST || dir == NORTHEAST)
		return 0	//full tile window, you can't move into it!
	if(get_dir(loc, target) == dir)
		return !density
	else
		return 1


/obj/structure/window/CheckExit(atom/movable/O as mob|obj, target as turf)
	if(istype(O) && O.checkpass(PASSGLASS))
		return 1
	if(get_dir(O.loc, target) == dir)
		return 0
	return 1


/obj/structure/window/hitby(AM as mob|obj)
	..()
	visible_message("<span class='danger'>[src] was hit by [AM].</span>")
	var/tforce = 0
	if(ismob(AM))
		tforce = 40

	else if(isobj(AM))
		var/obj/item/I = AM
		tforce = I.throwforce

	if(reinf)
		tforce *= 0.25

	playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1)
	health = max(0, health - tforce)
	if(health <= 7 && !reinf)
		anchored = 0
		update_nearby_icons()
		step(src, get_dir(AM, src))

	if(health <= 0)
		spawnfragments()
	update_nearby_icons()

/obj/structure/window/attack_tk(mob/user as mob)
	user.changeNext_move(CLICK_CD_MELEE)
	user.visible_message("<span class='notice'>Something knocks on [src].</span>")
	add_fingerprint(user)
	playsound(loc, 'sound/effects/Glassknock.ogg', 50, 1)

/obj/structure/window/attack_hulk(mob/living/carbon/human/user)
	if(!can_be_reached(user))
		return
	..(user, 1)
	user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!"))
	user.visible_message("<span class='danger'>[user] smashes through [src]!</span>")
	storedshard.add_fingerprint(user)
	if(storedrods)
		storedrods.add_fingerprint(user)
	hit(50)
	return 1

/obj/structure/window/attack_hand(mob/user as mob)
{'fraction_non_alphanumeric': 0.1514866979655712, 'fraction_numerical': 0.016901408450704224, 'mean_word_length': 4.264415156507414, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 12, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7134934', 'n_tokens_mistral': 2849, 'n_tokens_neox': 2601, 'n_words': 475}