code:
////////////////////
//Clusterbang
////////////////////
/obj/item/weapon/grenade/clusterbuster
	desc = "Use of this weapon may constiute a war crime in your area, consult your local captain."
	name = "clusterbang"
	icon = 'icons/obj/grenade.dmi'
	icon_state = "clusterbang"
	var/payload = /obj/item/weapon/grenade/flashbang/cluster

/obj/item/weapon/grenade/clusterbuster/prime()
	update_mob()
	var/numspawned = rand(4,8)
	var/again = 0

	for(var/more = numspawned,more > 0,more--)
		if(prob(35))
			again++
			numspawned--

	for(var/loop = again ,loop > 0, loop--)
		new /obj/item/weapon/grenade/clusterbuster/segment(loc, payload)//Creates 'segments' that launches a few more payloads

	new /obj/effect/payload_spawner(loc, payload, numspawned)//Launches payload

	playsound(loc, 'sound/weapons/armbomb.ogg', 75, 1, -3)

	qdel(src)

//////////////////////
//Clusterbang segment
//////////////////////
/obj/item/weapon/grenade/clusterbuster/segment
	desc = "A smaller segment of a clusterbang. Better run."
	name = "clusterbang segment"
	icon = 'icons/obj/grenade.dmi'
	icon_state = "clusterbang_segment"

/obj/item/weapon/grenade/clusterbuster/segment/New(var/loc, var/payload_type = /obj/item/weapon/grenade/flashbang/cluster)
	..()
	icon_state = "clusterbang_segment_active"
	payload = payload_type
	active = 1
	walk_away(src,loc,rand(1,4))
	spawn(rand(15,60))
		prime()

/obj/item/weapon/grenade/clusterbuster/segment/prime()

	new /obj/effect/payload_spawner(loc, payload, rand(4,8))

	playsound(loc, 'sound/weapons/armbomb.ogg', 75, 1, -3)

	qdel(src)

//////////////////////////////////
//The payload spawner effect
/////////////////////////////////
/obj/effect/payload_spawner/New(var/turf/newloc,var/type, var/numspawned as num)

	for(var/loop = numspawned ,loop > 0, loop--)
		var/obj/item/weapon/grenade/P = new type(loc)
		P.active = 1
		walk_away(P,loc,rand(1,4))

		spawn(rand(15,60))
			if(P && !P.gc_destroyed)
				P.prime()
			qdel(src)

//////////////////////////////////
//Custom payload clusterbusters
/////////////////////////////////
/obj/item/weapon/grenade/flashbang/cluster
	icon_state = "flashbang_active"

/obj/item/weapon/grenade/clusterbuster/emp
	name = "Electromagnetic Storm"
	payload = /obj/item/weapon/grenade/empgrenade

/obj/item/weapon/grenade/clusterbuster/smoke
	name = "Ninja Vanish"
	payload = /obj/item/weapon/grenade/smokebomb

/obj/item/weapon/grenade/clusterbuster/metalfoam
	name = "Instant Concrete"
	payload = /obj/item/weapon/grenade/chem_grenade/metalfoam

/obj/item/weapon/grenade/clusterbuster/inferno
	name = "Inferno"
	payload = /obj/item/weapon/grenade/chem_grenade/incendiary

/obj/item/weapon/grenade/clusterbuster/antiweed
	name = "RoundDown"
	payload = /obj/item/weapon/grenade/chem_grenade/antiweed

/obj/item/weapon/grenade/clusterbuster/cleaner
	name = "Mr. Proper"
	payload = /obj/item/weapon/grenade/chem_grenade/cleaner

/obj/item/weapon/grenade/clusterbuster/teargas
	name = "Oignon Grenade"
	payload = /obj/item/weapon/grenade/chem_grenade/teargas

/obj/item/weapon/grenade/clusterbuster/pacid
	name = "Aciding Rain"
	payload = /obj/item/weapon/grenade/chem_grenade/pacid

/obj/item/weapon/grenade/clusterbuster/syndieminibomb
	name = "SyndiWrath"
	payload = /obj/item/weapon/grenade/syndieminibomb

/obj/item/weapon/grenade/clusterbuster/spawner_manhacks
	name = "iViscerator"
	payload = /obj/item/weapon/grenade/spawnergrenade/manhacks

/obj/item/weapon/grenade/clusterbuster/spawner_spesscarp
	name = "Invasion of the Space Carps"
	payload = /obj/item/weapon/grenade/spawnergrenade/spesscarp


code:
/obj/item/weapon/grenade/empgrenade
	name = "classic EMP grenade"
	desc = "It is designed to wreak havok on electronic systems."
	icon_state = "emp"
	item_state = "emp"
	origin_tech = "materials=2;magnets=3"

/obj/item/weapon/grenade/empgrenade/prime()
	update_mob()
	empulse(src, 4, 10)
	qdel(src)

license: mit


code:
/obj/item/weapon/grenade/flashbang
	name = "flashbang"
	icon_state = "flashbang"
	item_state = "flashbang"
	origin_tech = "materials=2;combat=1"

/obj/item/weapon/grenade/flashbang/prime()
	update_mob()
	var/flashbang_turf = get_turf(src)
	if(!flashbang_turf)
		return
	for(var/mob/living/M in get_hearers_in_view(7, flashbang_turf))
		bang(get_turf(M), M)

	for(var/obj/effect/blob/B in get_hear(8,flashbang_turf))     		//Blob damage here
		var/damage = round(30/(get_dist(B,get_turf(src))+1))
		B.health -= damage
		B.update_icon()
	qdel(src)

/obj/item/weapon/grenade/flashbang/proc/bang(var/turf/T , var/mob/living/M)
	M.show_message("BANG", 2)
	playsound(loc, 'sound/effects/bang.ogg', 25, 1)

//Checking for protection
	var/ear_safety = M.check_ear_prot()
	var/distance = max(1,get_dist(src,T))

//Flash
	if(M.flash_eyes())
		M.eye_stat += rand(1, 3)
		M.Stun(max(10/distance, 3))
		M.Weaken(max(10/distance, 3))

//Bang
	if((loc == M) || loc == M.loc)//Holding on person or being exactly where lies is significantly more dangerous and voids protection
		M.Stun(10)
		M.Weaken(10)
	if(!ear_safety)
		M.Stun(max(10/distance, 3))
		M.Weaken(max(10/distance, 3))
		M.setEarDamage(M.ear_damage + rand(0, 5), max(M.ear_deaf,15))
		if (M.ear_damage >= 15)
			M << "Your ears start to ring badly!"
			if(prob(M.ear_damage - 10 + 5))
				M << "You can't hear anything!"
				M.disabilities |= DEAF
		else
			if (M.ear_damage >= 5)
				M << "Your ears start to ring!"


code:
//improvised explosives//

/obj/item/weapon/grenade/iedcasing
	name = "improvised firebomb"
	desc = "A weak, improvised incendiary device."
	w_class = 2.0
	icon = 'icons/obj/grenade.dmi'
	icon_state = "improvised_grenade"
	item_state = "flashbang"
	throw_speed = 3
	throw_range = 7
	flags = CONDUCT
	slot_flags = SLOT_BELT
	active = 0
	det_time = 50
	display_timer = 0
	var/range = 3
	var/times = list()

/obj/item/weapon/grenade/iedcasing/New(loc)
	..()
	overlays += image('icons/obj/grenade.dmi', icon_state = "improvised_grenade_filled")
	overlays += image('icons/obj/grenade.dmi', icon_state = "improvised_grenade_wired")
	times = list("5" = 10, "-1" = 20, "[rand(30,80)]" = 50, "[rand(65,180)]" = 20)// "Premature, Dud, Short Fuse, Long Fuse"=[weighting value]
	det_time = text2num(pickweight(times))
	if(det_time < 0) //checking for 'duds'
		range = 1
		det_time = rand(30,80)
	else
		range = pick(2,2,2,3,3,3,4)

/obj/item/weapon/grenade/iedcasing/CheckParts()
	var/obj/item/weapon/reagent_containers/food/drinks/soda_cans/can = locate() in contents
	if(can)
		underlays += can

/obj/item/weapon/grenade/iedcasing/attack_self(mob/user as mob) //
	if(!active)
		if(clown_check(user))
			user << "You light the [name]!"
			active = 1
			overlays -= image('icons/obj/grenade.dmi', icon_state = "improvised_grenade_filled")
			icon_state = initial(icon_state) + "_active"
			add_fingerprint(user)
			var/turf/bombturf = get_turf(src)
			var/area/A = get_area(bombturf)

			message_admins("[key_name(usr)]? has primed a [name] for detonation at [A.name] (JMP).")
			log_game("[key_name(usr)] has primed a [name] for detonation at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z]).")
			if(iscarbon(user))
				var/mob/living/carbon/C = user
				C.throw_mode_on()
			spawn(det_time)
				prime()

/obj/item/weapon/grenade/iedcasing/prime() //Blowing that can up
	update_mob()
	explosion(src.loc,-1,-1,-1, flame_range = range)	// no explosive damage, only a large fireball.
	qdel(src)

/obj/item/weapon/grenade/iedcasing/examine(mob/user)
	..()
	user << "You can't tell when it will explode!"


code:
/obj/item/weapon/grenade
	name = "grenade"
	desc = "It has an adjustable timer."
	w_class = 2.0
	icon = 'icons/obj/grenade.dmi'
	icon_state = "grenade"
	item_state = "flashbang"
	throw_speed = 3
	throw_range = 7
	flags = CONDUCT
	slot_flags = SLOT_BELT
	var/active = 0
	var/det_time = 50
	var/display_timer = 1

/obj/item/weapon/grenade/proc/clown_check(var/mob/living/carbon/human/user)
	if(user.disabilities & CLUMSY && prob(50))
		user << "Huh? How does this thing work?"
		active = 1
		icon_state = initial(icon_state) + "_active"
		playsound(loc, 'sound/weapons/armbomb.ogg', 75, 1, -3)
		spawn(5)
			if(user)
				user.drop_item()
			prime()
		return 0
	return 1

/*/obj/item/weapon/grenade/afterattack(atom/target as mob|obj|turf|area, mob/user as mob)
	if (istype(target, /obj/item/weapon/storage)) return ..() // Trying to put it in a full container
	if (istype(target, /obj/item/weapon/gun/grenadelauncher)) return ..()
	if((user.get_active_hand() == src) && (!active) && (clown_check(user)) && target.loc != src.loc)
		user << "You prime the [name]! [det_time/10] seconds!"
		active = 1
		icon_state = initial(icon_state) + "_active"
		playsound(loc, 'sound/weapons/armbomb.ogg', 75, 1, -3)
		spawn(det_time)
			prime()
			return
		user.dir = get_dir(user, target)
		user.drop_item()
		var/t = (isturf(target) ? target : target.loc)
		walk_towards(src, t, 3)
	return*/

/obj/item/weapon/grenade/examine(mob/user)
	..()
	if(display_timer)
		if(det_time > 1)
			user << "The timer is set to [det_time/10] second\s."
		else
			user << "\The [src] is set for instant detonation."

/obj/item/weapon/grenade/attack_self(mob/user as mob)
	if(!active)
		if(clown_check(user))
			user << "You prime the [name]! [det_time/10] seconds!"
			playsound(user.loc, 'sound/weapons/armbomb.ogg', 60, 1)
			active = 1
			icon_state = initial(icon_state) + "_active"
			add_fingerprint(user)
			var/turf/bombturf = get_turf(src)
			var/area/A = get_area(bombturf)
			message_admins("[key_name(usr)]? has primed a [name] for detonation at [A.name] (JMP).")
			log_game("[key_name(usr)] has primed a [name] for detonation at [A.name] ([bombturf.x],[bombturf.y],[bombturf.z]).")
			if(iscarbon(user))
				var/mob/living/carbon/C = user
				C.throw_mode_on()
			spawn(det_time)
				prime()

/obj/item/weapon/grenade/proc/prime()

/obj/item/weapon/grenade/proc/update_mob()
	if(ismob(loc))
		var/mob/M = loc
		M.unEquip(src)

/obj/item/weapon/grenade/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
	if(istype(W, /obj/item/weapon/screwdriver))
		switch(det_time)
			if ("1")
				det_time = 10
				user << "You set the [name] for 1 second detonation time."
			if ("10")
				det_time = 30
				user << "You set the [name] for 3 second detonation time."
			if ("30")
				det_time = 50
				user << "You set the [name] for 5 second detonation time."
			if ("50")
				det_time = 1
				user << "You set the [name] for instant detonation."
		add_fingerprint(user)
	..()

/obj/item/weapon/grenade/attack_hand()
	walk(src, null, null)
	..()

/obj/item/weapon/grenade/attack_paw(mob/user as mob)
	return attack_hand(user)


code:
/obj/item/weapon/grenade/smokebomb
	name = "smoke bomb"
	icon = 'icons/obj/grenade.dmi'
	icon_state = "flashbang"
	det_time = 20
	item_state = "flashbang"
	slot_flags = SLOT_BELT
	var/datum/effect/effect/system/bad_smoke_spread/smoke

/obj/item/weapon/grenade/smokebomb/New()
	..()
	src.smoke = new /datum/effect/effect/system/bad_smoke_spread
	src.smoke.attach(src)

/obj/item/weapon/grenade/smokebomb/Destroy()
	qdel(smoke)
	..()

/obj/item/weapon/grenade/smokebomb/prime()
	update_mob()
	playsound(src.loc, 'sound/effects/smoke.ogg', 50, 1, -3)
	src.smoke.set_up(10, 0, usr.loc)
	spawn(0)
		src.smoke.start()
		sleep(10)
		src.smoke.start()
		sleep(10)
		src.smoke.start()
		sleep(10)
		src.smoke.start()

	for(var/obj/effect/blob/B in view(8,src))
		var/damage = round(30/(get_dist(B,src)+1))
		B.health -= damage
		B.update_icon()
	sleep(80)
	qdel(src)


code:
/obj/item/weapon/grenade/spawnergrenade
	desc = "It will unleash unleash an unspecified anomaly into the vicinity."
	name = "delivery grenade"
	icon = 'icons/obj/grenade.dmi'
	icon_state = "delivery"
	item_state = "flashbang"
	origin_tech = "materials=3;magnets=4"
	var/spawner_type = null // must be an object path
	var/deliveryamt = 1 // amount of type to deliver

/obj/item/weapon/grenade/spawnergrenade/prime()			// Prime now just handles the two loops that query for people in lockers and people who can see it.
	update_mob()
	if(spawner_type && deliveryamt)
		// Make a quick flash
		var/turf/T = get_turf(src)
		playsound(T, 'sound/effects/phasein.ogg', 100, 1)
		for(var/mob/living/carbon/human/M in viewers(T, null))
			M.flash_eyes()

		for(var/i=1, i<=deliveryamt, i++)
			var/atom/movable/x = new spawner_type
			x.loc = T
			if(prob(50))
				for(var/j = 1, j <= rand(1, 3), j++)
					step(x, pick(NORTH,SOUTH,EAST,WEST))

			// Spawn some hostile syndicate critters

	qdel(src)

/obj/item/weapon/grenade/spawnergrenade/manhacks
	name = "viscerator delivery grenade"
	spawner_type = /mob/living/simple_animal/hostile/viscerator
	deliveryamt = 5
	origin_tech = "materials=3;magnets=4;syndicate=4"

/obj/item/weapon/grenade/spawnergrenade/spesscarp
	name = "carp delivery grenade"
	spawner_type = /mob/living/simple_animal/hostile/carp
	deliveryamt = 5
	origin_tech = "materials=3;magnets=4;syndicate=4"


code:
/obj/item/weapon/grenade/syndieminibomb
	desc = "A syndicate manufactured explosive used to sow destruction and chaos"
	name = "syndicate minibomb"
	icon = 'icons/obj/grenade.dmi'
	icon_state = "syndicate"
	item_state = "flashbang"
	origin_tech = "materials=3;magnets=4;syndicate=4"

/obj/item/weapon/grenade/syndieminibomb/prime()
	update_mob()
	explosion(src.loc,1,2,4,flame_range = 2)
	qdel(src)


code:
//Handcuffs

/obj/item/weapon/restraints/handcuffs
	name = "handcuffs"
	desc = "Use this to keep prisoners in line."
	gender = PLURAL
	icon = 'icons/obj/items.dmi'
	icon_state = "handcuff"
	flags = CONDUCT
	slot_flags = SLOT_BELT
	throwforce = 0
	w_class = 2.0
	throw_speed = 3
	throw_range = 5
	m_amt = 500
	origin_tech = "materials=1"
	var/breakouttime = 600 //Deciseconds = 60s = 1 minute
	var/cuffsound = 'sound/weapons/handcuffs.ogg'
	var/trashtype = null //for disposable cuffs

/obj/item/weapon/restraints/handcuffs/attack(mob/living/carbon/C, mob/living/carbon/human/user)
	if(user.disabilities & CLUMSY && prob(50))
		user << "Uh... how do those things work?!"
		apply_cuffs(user,user)
		return

	if(!C.handcuffed)
		C.visible_message("[user] is trying to put [src.name] on [C]!", \
							"[user] is trying to put [src.name] on [C]!")

		playsound(loc, cuffsound, 30, 1, -2)
		if(do_mob(user, C, 30))
			apply_cuffs(C,user)
			user << "You handcuff [C]."
			if(istype(src, /obj/item/weapon/restraints/handcuffs/cable))
				feedback_add_details("handcuffs","C")
			else
				feedback_add_details("handcuffs","H")

			add_logs(user, C, "handcuffed")
		else
			user << "You fail to handcuff [C]."

/obj/item/weapon/restraints/handcuffs/proc/apply_cuffs(mob/living/carbon/target, mob/user)
	if(!target.handcuffed)
		user.drop_item()
		//target.throw_alert("handcuffed", src) // Can't do this because escaping cuffs isn't standardized. Also zipties.
		if(trashtype)
			target.handcuffed = new trashtype(target)
			qdel(src)
		else
			loc = target
			target.handcuffed = src
		target.update_inv_handcuffed(0)
		return

/obj/item/weapon/restraints/handcuffs/cable
	name = "cable restraints"
	desc = "Looks like some cables tied together. Could be used to tie something up."
	icon_state = "cuff_red"
	item_state = "coil_red"
	breakouttime = 300 //Deciseconds = 30s
	cuffsound = 'sound/weapons/cablecuff.ogg'

/obj/item/weapon/restraints/handcuffs/cable/red
	icon_state = "cuff_red"

/obj/item/weapon/restraints/handcuffs/cable/yellow
	icon_state = "cuff_yellow"

/obj/item/weapon/restraints/handcuffs/cable/blue
	icon_state = "cuff_blue"
	item_state = "coil_blue"

/obj/item/weapon/restraints/handcuffs/cable/green
	icon_state = "cuff_green"

/obj/item/weapon/restraints/handcuffs/cable/pink
	icon_state = "cuff_pink"

/obj/item/weapon/restraints/handcuffs/cable/orange
	icon_state = "cuff_orange"

/obj/item/weapon/restraints/handcuffs/cable/cyan
	icon_state = "cuff_cyan"

/obj/item/weapon/restraints/handcuffs/cable/white
	icon_state = "cuff_white"

/obj/item/weapon/restraints/handcuffs/cable/attackby(var/obj/item/I, mob/user as mob, params)
	..()
	if(istype(I, /obj/item/stack/rods))
		var/obj/item/stack/rods/R = I
		if (R.use(1))
			var/obj/item/weapon/wirerod/W = new /obj/item/weapon/wirerod
			user.unEquip(src)
			user.put_in_hands(W)
			user << "You wrap the cable restraint around the top of the rod."
			qdel(src)
		else
			user << "You need one rod to make a wired rod."
			return

/obj/item/weapon/restraints/handcuffs/cable/zipties/cyborg/attack(mob/living/carbon/C, mob/user)
	if(isrobot(user))
		if(!C.handcuffed)
			playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2)
			C.visible_message("[user] is trying to put zipties on [C]!", \
								"[user] is trying to put zipties on [C]!")
			if(do_mob(user, C, 30))
				if(!C.handcuffed)
					C.handcuffed = new /obj/item/weapon/restraints/handcuffs/cable/zipties/used(C)
					C.update_inv_handcuffed(0)
					user << "You handcuff [C]."
					add_logs(user, C, "handcuffed")
			else
				user << "You fail to handcuff [C]."

/obj/item/weapon/restraints/handcuffs/cable/zipties
	name = "zipties"
	desc = "Plastic, disposable zipties that can be used to restrain temporarily but are destroyed after use."
	icon_state = "cuff_white"
	breakouttime = 450 //Deciseconds = 45s
	trashtype = /obj/item/weapon/restraints/handcuffs/cable/zipties/used

/obj/item/weapon/restraints/handcuffs/cable/zipties/used
	desc = "A pair of broken zipties."
	icon_state = "cuff_white_used"

/obj/item/weapon/restraints/handcuffs/cable/zipties/used/attack()
	return

//Legcuffs

/obj/item/weapon/restraints/legcuffs
	name = "leg cuffs"
	desc = "Use this to keep prisoners in line."
	gender = PLURAL
	icon = 'icons/obj/items.dmi'
	icon_state = "handcuff"
	flags = CONDUCT
	throwforce = 0
	w_class = 3.0
	origin_tech = "materials=1"
	slowdown = 7
	var/breakouttime = 300	//Deciseconds = 30s = 0.5 minute

/obj/item/weapon/restraints/legcuffs/beartrap
	name = "bear trap"
	throw_speed = 1
	throw_range = 1
	icon_state = "beartrap0"
	desc = "A trap used to catch bears and other legged creatures."
	var/armed = 0

/obj/item/weapon/restraints/legcuffs/beartrap/suicide_act(mob/user)
	user.visible_message("[user] is sticking \his head in the [src.name]! It looks like \he's trying to commit suicide.")
	playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
	return (BRUTELOSS)

/obj/item/weapon/restraints/legcuffs/beartrap/attack_self(mob/user as mob)
	..()
	if(ishuman(user) && !user.stat && !user.restrained())
		armed = !armed
		icon_state = "beartrap[armed]"
		user << "[src] is now [armed ? "armed" : "disarmed"]"

/obj/item/weapon/restraints/legcuffs/beartrap/Crossed(AM as mob|obj)
	if(armed && isturf(src.loc))
		if( (iscarbon(AM) || isanimal(AM)) && !istype(AM, /mob/living/simple_animal/parrot) && !istype(AM, /mob/living/simple_animal/construct) && !istype(AM, /mob/living/simple_animal/shade) && !istype(AM, /mob/living/simple_animal/hostile/viscerator))
			var/mob/living/L = AM
			armed = 0
			icon_state = "beartrap0"
			playsound(src.loc, 'sound/effects/snap.ogg', 50, 1)
			L.visible_message("[L] triggers \the [src].", \
					"You trigger \the [src]!")

			if(ishuman(AM))
				var/mob/living/carbon/H = AM
				if(H.lying)
					H.apply_damage(20,BRUTE,"chest")
				else
					H.apply_damage(20,BRUTE,(pick("l_leg", "r_leg")))
				if(!H.legcuffed) //beartrap can't cuff you leg if there's already a beartrap or legcuffs.
					H.legcuffed = src
					src.loc = H
					H.update_inv_legcuffed(0)
					feedback_add_details("handcuffs","B") //Yes, I know they're legcuffs. Don't change this, no need for an extra variable. The "B" is used to tell them apart.

			else
				L.apply_damage(20,BRUTE)
	..()


code:
/obj/item/weapon/implant
	name = "implant"
	icon = 'icons/obj/implants.dmi'
	icon_state = "generic" //Shows up as the action button icon
	action_button_is_hands_free = 1
	var/activated = 1 //1 for implant types that can be activated, 0 for ones that are "always on" like loyalty implants
	var/implanted = null
	var/mob/living/imp_in = null
	item_color = "b"
	var/allow_reagents = 0

/obj/item/weapon/implant/proc/trigger(emote, mob/source)
	return

/obj/item/weapon/implant/proc/activate()
	return

/obj/item/weapon/implant/ui_action_click()
	activate("action_button")

//What does the implant do upon injection?
//return 0 if the implant fails (ex. Revhead and loyalty implant.)
//return 1 if the implant succeeds (ex. Nonrevhead and loyalty implant.)
/obj/item/weapon/implant/proc/implanted(var/mob/source)
	if(activated)
		action_button_name = "Activate [src.name]"
	if(istype(source, /mob/living/carbon/human))
		var/mob/living/carbon/human/H = source
		H.sec_hud_set_implants()
	return 1

/obj/item/weapon/implant/proc/get_data()
	return "No information available"

/obj/item/weapon/implant/dropped(mob/user as mob)
	. = 1
	qdel(src)
	return .

/obj/item/weapon/implant/tracking
	name = "tracking implant"
	desc = "Track with this."
	activated = 0
	var/id = 1.0

/obj/item/weapon/implant/tracking/get_data()
	var/dat = {"Implant Specifications:

				Name: Tracking Beacon

				Life: 10 minutes after death of host

				Important Notes: None

				Implant Details:

				Function: Continuously transmits low power signal. Useful for tracking.

				Special Features:

				Neuro-Safe- Specialized shell absorbs excess voltages self-destructing the chip if
				a malfunction occurs thereby securing safety of subject. The implant will melt and
				disintegrate into bio-safe elements.

				Integrity: Gradient creates slight risk of being overcharged and frying the
				circuitry. As a result neurotoxins can cause massive damage.

				Implant Specifics:
"}
	return dat

/obj/item/weapon/implant/weapons_auth
	name = "firearms authentication implant"
	desc = "Lets you shoot your guns"
	activated = 0
	icon_state = "auth"

/obj/item/weapon/implant/weapons_auth/get_data()
	var/dat = {"Implant Specifications:

				Name: Firearms Authentication Implant

				Life: 4 hours after death of host

				Implant Details:

				Function: Allows operation of implant-locked weaponry, preventing equipment from falling into enemy hands."}
	return dat

/obj/item/weapon/implant/explosive
	name = "explosive implant"
	desc = "And boom goes the weasel."
	icon_state = "explosive"

/obj/item/weapon/implant/explosive/get_data()
	var/dat = {"Implant Specifications:

				Name: Robust Corp RX-78 Employee Management Implant

				Life: Activates upon death.

				Important Notes: Explodes

				Implant Details:

				Function: Contains a compact, electrically detonated explosive that detonates upon receiving a specially encoded signal or upon host death.

				Special Features: Explodes

				Integrity: Implant will occasionally be degraded by the body's immune system and thus will occasionally malfunction."}
	return dat

/obj/item/weapon/implant/explosive/trigger(emote, mob/source)
	if(emote == "deathgasp")
		activate("death")

/obj/item/weapon/implant/explosive/activate(var/cause)
	if(!cause || !imp_in)	return 0
	if(cause == "action_button" && alert(imp_in, "Are you sure you want to activate your explosive implant? This will cause you to explode and gib!", "Explosive Implant Confirmation", "Yes", "No") != "Yes")
		return 0
	explosion(src,1,2,5,7,10, flame_range = 5)
	if(imp_in)
		imp_in.gib()

/obj/item/weapon/implant/chem
	name = "chem implant"
	desc = "Injects things."
	icon_state = "reagents"
	allow_reagents = 1

/obj/item/weapon/implant/chem/get_data()
	var/dat = {"Implant Specifications:

				Name: Robust Corp MJ-420 Prisoner Management Implant

				Life: Deactivates upon death but remains within the body.

				Important Notes: Due to the system functioning off of nutrients in the implanted subject's body, the subject

				will suffer from an increased appetite.

				Implant Details:

				Function: Contains a small capsule that can contain various chemicals. Upon receiving a specially encoded signal

				the implant releases the chemicals directly into the blood stream.

				Special Features:
				Micro-Capsule- Can be loaded with any sort of chemical agent via the common syringe and can hold 50 units.

				Can only be loaded while still in its original case.

				Integrity: Implant will last so long as the subject is alive. However, if the subject suffers from malnutrition,

				the implant may become unstable and either pre-maturely inject the subject or simply break."}
	return dat

/obj/item/weapon/implant/chem/New()
	..()
	create_reagents(50)

/obj/item/weapon/implant/chem/trigger(emote, mob/source)
	if(emote == "deathgasp")
		activate(reagents.total_volume)

/obj/item/weapon/implant/chem/activate(var/cause)
	if(!cause || !imp_in)	return 0
	var/mob/living/carbon/R = imp_in
	reagents.trans_to(R, cause)
	R << "You hear a faint *beep*."
	if(!reagents.total_volume)
		R << "You hear a faint click from your chest."
		qdel(src)

/obj/item/weapon/implant/loyalty
	name = "loyalty implant"
	desc = "Makes you loyal or such."
	activated = 0

/obj/item/weapon/implant/loyalty/get_data()
	var/dat = {"Implant Specifications:

				Name: Nanotrasen Employee Management Implant

				Life: Ten years.

				Important Notes: Personnel injected with this device tend to be much more loyal to the company.

				Implant Details:

				Function: Contains a small pod of nanobots that manipulate the host's mental functions.

				Special Features: Will prevent and cure most forms of brainwashing.

				Integrity: Implant will last so long as the nanobots are inside the bloodstream."}
	return dat

/obj/item/weapon/implant/loyalty/implanted(mob/target)
	..()
	if((target.mind in ticker.mode.head_revolutionaries) || (target.mind in ticker.mode.A_bosses) || (target.mind in ticker.mode.B_bosses) || is_shadow_or_thrall(target))
		target.visible_message("[target] seems to resist the implant!", "You feel the corporate tendrils of Nanotrasen try to invade your mind!")
		return 0
	if((target.mind in ticker.mode.revolutionaries) || (target.mind in ticker.mode.A_gangsters) || (target.mind in ticker.mode.B_gangsters))
		ticker.mode.remove_revolutionary(target.mind)
		ticker.mode.remove_gangster(target.mind, exclude_bosses=0)
	target << "You feel a surge of loyalty towards Nanotrasen."
	return 1

/obj/item/weapon/implant/adrenalin
	name = "adrenal implant"
	desc = "Removes all stuns and knockdowns."
	icon_state = "adrenal"
	var/uses = 3

/obj/item/weapon/implant/adrenalin/get_data()
	var/dat = {"Implant Specifications:

				Name: Cybersun Industries Adrenaline Implant

				Life: Five days.

				Important Notes: Illegal

				Implant Details: Subjects injected with implant can activate an injection of medical cocktails.

				Function: Removes stuns, increases speed, and has a mild healing effect.

				Integrity: Implant can only be used three times before reserves are depleted."}
	return dat

/obj/item/weapon/implant/adrenalin/activate()
	if(uses < 1)	return 0
	uses--
	imp_in << "You feel a sudden surge of energy!"
	imp_in.SetStunned(0)
	imp_in.SetWeakened(0)
	imp_in.SetParalysis(0)
	imp_in.adjustStaminaLoss(-75)
	imp_in.lying = 0
	imp_in.update_canmove()

	imp_in.reagents.add_reagent("synaptizine", 10)
	imp_in.reagents.add_reagent("omnizine", 10)
	imp_in.reagents.add_reagent("morphine", 10)

/obj/item/weapon/implant/emp
	name = "emp implant"
	desc = "Triggers an EMP."
	icon_state = "emp"

	var/uses = 2

/obj/item/weapon/implant/emp/activate()
	if (src.uses < 1)	return 0
	src.uses--
	empulse(imp_in, 3, 5)


code:
/obj/item/weapon/implantcase
	name = "glass case"
	desc = "A case containing an implant."
	icon_state = "implantcase-0"
	item_state = "implantcase"
	throw_speed = 2
	throw_range = 5
	w_class = 1.0
	var/obj/item/weapon/implant/imp = null

/obj/item/weapon/implantcase/update_icon()
	if(imp)
		icon_state = "implantcase-[imp.item_color]"
	else
		icon_state = "implantcase-0"

/obj/item/weapon/implantcase/attackby(obj/item/weapon/W, mob/user, params)
	..()
	if(istype(W, /obj/item/weapon/pen))
		var/t = stripped_input(user, "What would you like the label to be?", name, null)
		if(user.get_active_hand() != W)
			return
		if(!in_range(src, user) && loc != user)
			return
		if(t)
			name = "glass case- '[t]'"
		else
			name = "glass case"
	else if(istype(W, /obj/item/weapon/reagent_containers/syringe))
		if(!imp)	return
		if(!imp.allow_reagents)	return
		if(imp.reagents.total_volume >= imp.reagents.maximum_volume)
			user << "[src] is full."
		else
			W.reagents.trans_to(imp, 5)
			user << "You inject 5 units of the solution. The syringe now contains [W.reagents.total_volume] units."
	else if(istype(W, /obj/item/weapon/implanter))
		var/obj/item/weapon/implanter/I = W
		if(I.imp)
			if((imp || I.imp.implanted))
				return
			I.imp.loc = src
			imp = I.imp
			I.imp = null
			update_icon()
			I.update_icon()
		else
			if(imp)
				if(I.imp)
					return
				imp.loc = I
				I.imp = imp
				imp = null
				update_icon()
			I.update_icon()

/obj/item/weapon/implantcase/tracking
	name = "glass case- 'Tracking'"
	desc = "A case containing a tracking implant."
	icon = 'icons/obj/items.dmi'
	icon_state = "implantcase-b"

/obj/item/weapon/implantcase/tracking/New()
	imp = new /obj/item/weapon/implant/tracking(src)
	..()

/obj/item/weapon/implantcase/explosive
	name = "glass case- 'Explosive'"
	desc = "A case containing an explosive implant."
	icon = 'icons/obj/items.dmi'
	icon_state = "implantcase-r"

/obj/item/weapon/implantcase/explosive/New()
	imp = new /obj/item/weapon/implant/explosive(src)
	..()

/obj/item/weapon/implantcase/chem
	name = "glass case- 'Chem'"
	desc = "A case containing a chemical implant."
	icon = 'icons/obj/items.dmi'
	icon_state = "implantcase-b"

/obj/item/weapon/implantcase/chem/New()
	imp = new /obj/item/weapon/implant/chem(src)
	..()

/obj/item/weapon/implantcase/loyalty
	name = "glass case- 'Loyalty'"
	desc = "A case containing a loyalty implant."
	icon = 'icons/obj/items.dmi'
	icon_state = "implantcase-r"

/obj/item/weapon/implantcase/loyalty/New()
	imp = new /obj/item/weapon/implant/loyalty(src)
	..()

/obj/item/weapon/implantcase/weapons_auth
	name = "glass case- 'Firearms Authentication'"
	desc = "A case containing a firearms authentication implant."
	icon = 'icons/obj/items.dmi'
	icon_state = "implantcase-r"

/obj/item/weapon/implantcase/weapons_auth/New()
	imp = new /obj/item/weapon/implant/weapons_auth(src)
	..()


code:
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32

/obj/machinery/implantchair
	name = "loyalty implanter"
	desc = "Used to implant occupants with loyalty implants."
	icon = 'icons/obj/machines/implantchair.dmi'
	icon_state = "implantchair"
	density = 1
	opacity = 0
	anchored = 1

	var/ready = 1
	var/malfunction = 0
	var/list/obj/item/weapon/implant/loyalty/implant_list = list()
	var/max_implants = 5
	var/injection_cooldown = 600
	var/replenish_cooldown = 6000
	var/replenishing = 0
	var/injecting = 0

/obj/machinery/implantchair/proc
	go_out()
	put_mob(mob/living/carbon/M as mob)
	implant(var/mob/M)
	add_implants()

/obj/machinery/implantchair/New()
	..()
	add_implants()

/obj/machinery/implantchair/attack_hand(mob/user as mob)
	user.set_machine(src)
	var/health_text = ""
	if(src.occupant)
		if(src.occupant.health <= -100)
			health_text = "Dead"
		else if(src.occupant.health < 0)
			health_text = "[round(src.occupant.health,0.1)]"
		else
			health_text = "[round(src.occupant.health,0.1)]"

	var/dat ="Implanter Status
"

	dat +="Current occupant: [src.occupant ? "
Name: [src.occupant]
Health: [health_text]
" : "None"]
"
	dat += "Implants: [src.implant_list.len ? "[implant_list.len]" : "Replenish"]
"
	if(src.occupant)
		dat += "[src.ready ? "Implant" : "Recharging"]
"
	user.set_machine(src)
	user << browse(dat, "window=implant")
	onclose(user, "implant")

/obj/machinery/implantchair/Topic(href, href_list)
	if(..())
		return
	if(href_list["implant"])
		if(src.occupant)
			injecting = 1
			go_out()
			ready = 0
			spawn(injection_cooldown)
				ready = 1

	if(href_list["replenish"])
		ready = 0
		spawn(replenish_cooldown)
			add_implants()
			ready = 1

	src.updateUsrDialog()
	return

/obj/machinery/implantchair/attackby(var/obj/item/weapon/G as obj, var/mob/user as mob, params)
	if(istype(G, /obj/item/weapon/grab))
		if(!ismob(G:affecting))
			return
		for(var/mob/living/carbon/slime/M in range(1,G:affecting))
			if(M.Victim == G:affecting)
				usr << "[G:affecting:name] will not fit into the [src.name] because they have a slime latched onto their head."
				return
		var/mob/M = G:affecting
		if(put_mob(M))
			qdel(G)
	src.updateUsrDialog()
	return

/obj/machinery/implantchair/go_out(var/mob/M)
	if(!( src.occupant ))
		return
	if(M == occupant) // so that the guy inside can't eject himself -Agouri
		return
	if (src.occupant.client)
		src.occupant.client.eye = src.occupant.client.mob
		src.occupant.client.perspective = MOB_PERSPECTIVE
	src.occupant.loc = src.loc
	if(injecting)
		implant(src.occupant)
		injecting = 0
	src.occupant = null
	icon_state = "implantchair"
	return

/obj/machinery/implantchair/put_mob(mob/living/carbon/M as mob)
	if(!iscarbon(M))
		usr << "The [src.name] cannot hold this!"
		return
	if(src.occupant)
		usr << "The [src.name] is already occupied!"
		return
	if(M.client)
		M.client.perspective = EYE_PERSPECTIVE
		M.client.eye = src
	M.stop_pulling()
	M.loc = src
	src.occupant = M
	src.add_fingerprint(usr)
	icon_state = "implantchair_on"
	return 1

/obj/machinery/implantchair/implant(var/mob/M)
	if (!istype(M, /mob/living/carbon))
		return
	if(!implant_list.len)	return
	for(var/obj/item/weapon/implant/loyalty/imp in implant_list)
		if(!imp)	continue
		if(istype(imp, /obj/item/weapon/implant/loyalty))
			M.visible_message("[M] has been implanted by the [src.name].")

			if(imp.implanted(M))
				imp.loc = M
				imp.imp_in = M
				imp.implanted = 1
			implant_list -= imp
			break
	return

/obj/machinery/implantchair/add_implants()
	for(var/i=0, i<src.max_implants, i++)
		var/obj/item/weapon/implant/loyalty/I = new /obj/item/weapon/implant/loyalty(src)
		implant_list += I
	return

/obj/machinery/implantchair/verb/get_out()
	set name = "Eject occupant"
	set category = "Object"
	set src in oview(1)
	if(usr.stat != 0)
		return
	src.go_out(usr)
	add_fingerprint(usr)
	return

/obj/machinery/implantchair/verb/move_inside()
	set name = "Move Inside"
	set category = "Object"
	set src in oview(1)
	if(usr.stat != 0 || stat & (NOPOWER|BROKEN))
		return
	put_mob(usr)
	return


code:
/obj/item/weapon/implanter
	name = "implanter"
	icon = 'icons/obj/items.dmi'
	icon_state = "implanter0"
	item_state = "syringe_0"
	throw_speed = 3
	throw_range = 5
	w_class = 2.0
	var/obj/item/weapon/implant/imp = null

/obj/item/weapon/implanter/update_icon()
	if(imp)
		icon_state = "implanter1"
	else
		icon_state = "implanter0"

/obj/item/weapon/implanter/attack(mob/living/carbon/M, mob/user)
	if(!iscarbon(M))
		return
	if(user && imp)
		M.visible_message("[user] is attemping to implant [M].")

		var/turf/T = get_turf(M)
		if(T && (M == user || do_after(user, 50)))
			if(user && M && (get_turf(M) == T) && src && imp)
				M.visible_message("[user] has implanted [M].")
				add_logs(user, M, "implanted", object="[name]")
				user << "You implanted the implant into [M]."
				if(imp.implanted(M))
					imp.loc = M
					imp.imp_in = M
					imp.implanted = 1

				imp = null
				update_icon()
				if(istype(M, /mob/living/carbon/human))
					var/mob/living/carbon/human/H = M
					H.sec_hud_set_implants()

/obj/item/weapon/implanter/loyalty
	name = "implanter-loyalty"

/obj/item/weapon/implanter/loyalty/New()
	imp = new /obj/item/weapon/implant/loyalty(src)
	..()
	update_icon()

/obj/item/weapon/implanter/explosive
	name = "implanter-explosive"

/obj/item/weapon/implanter/explosive/New()
	imp = new /obj/item/weapon/implant/explosive(src)
	..()
	update_icon()

/obj/item/weapon/implanter/adrenalin
	name = "implanter-adrenalin"

/obj/item/weapon/implanter/adrenalin/New()
	imp = new /obj/item/weapon/implant/adrenalin(src)
	..()
	update_icon()

/obj/item/weapon/implanter/emp
	name = "implanter-EMP"

/obj/item/weapon/implanter/emp/New()
	imp = new /obj/item/weapon/implant/emp(src)
	..()
	update_icon()


code:
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32

/obj/item/weapon/implant/freedom
	name = "freedom implant"
	desc = "Use this to escape from those evil Red Shirts."
	icon_state = "freedom"
	item_color = "r"
	var/uses = 4.0

/obj/item/weapon/implant/freedom/activate()
	if (src.uses < 1)	return 0
	src.uses--
	imp_in << "You feel a faint click."
	if(iscarbon(imp_in))
		var/mob/living/carbon/C_imp_in = imp_in
		if (C_imp_in.handcuffed)
			var/obj/item/weapon/W = C_imp_in.handcuffed
			C_imp_in.handcuffed = null
			if(C_imp_in.buckled && C_imp_in.buckled.buckle_requires_restraints)
				C_imp_in.buckled.unbuckle_mob()
			C_imp_in.update_inv_handcuffed(0)
			if (C_imp_in.client)
				C_imp_in.client.screen -= W
			if (W)
				W.loc = C_imp_in.loc
				W.dropped(C_imp_in)
				if (W)
					W.layer = initial(W.layer)
		if (C_imp_in.legcuffed)
			var/obj/item/weapon/W = C_imp_in.legcuffed
			C_imp_in.legcuffed = null
			C_imp_in.update_inv_legcuffed(0)
			if (C_imp_in.client)
				C_imp_in.client.screen -= W
			if (W)
				W.loc = C_imp_in.loc
				W.dropped(C_imp_in)
				if (W)
					W.layer = initial(W.layer)

/obj/item/weapon/implant/freedom/get_data()
	var/dat = {"
Implant Specifications:

Name: Freedom Beacon

Life: optimum 5 uses

Important Notes: Illegal

Implant Details:

Function: Transmits a specialized cluster of signals to override handcuff locking
mechanisms

Special Features:

Neuro-Scan- Analyzes certain shadow signals in the nervous system

Integrity: The battery is extremely weak and commonly after injection its
life can drive down to only 1 use.

No Implant Specifics"}
	return dat


code:
/obj/item/weapon/implantpad
	name = "implantpad"
	desc = "Used to modify implants."
	icon = 'icons/obj/items.dmi'
	icon_state = "implantpad-0"
	item_state = "electronic"
	throw_speed = 3
	throw_range = 5
	w_class = 2.0
	var/obj/item/weapon/implantcase/case = null
	var/broadcasting = null
	var/listening = 1.0

/obj/item/weapon/implantpad/update_icon()
	if(case)
		icon_state = "implantpad-1"
	else
		icon_state = "implantpad-0"

/obj/item/weapon/implantpad/attack_hand(mob/user as mob)
	if(case && (user.l_hand == src || user.r_hand == src))
		user.put_in_active_hand(case)

		case.add_fingerprint(user)
		case = null

		add_fingerprint(user)
		update_icon()
	else
		return ..()

/obj/item/weapon/implantpad/attackby(obj/item/weapon/implantcase/C, mob/user, params)
	..()
	if(istype(C, /obj/item/weapon/implantcase))
		if(!case)
			user.drop_item()
			C.loc = src
			case = C
	else
		return
	update_icon()

/obj/item/weapon/implantpad/attack_self(mob/user)
	user.set_machine(src)
	var/dat = "Implant Mini-Computer:
"
	if(case)
		if(case.imp)
			if(istype(case.imp, /obj/item/weapon/implant))
				dat += case.imp.get_data()
				if(istype(case.imp, /obj/item/weapon/implant/tracking))
					dat += {"ID (1-100):
					-
					- [case.imp:id]
					+
					+
"}
		else
			dat += "The implant casing is empty."
	else
		dat += "Please insert an implant casing!"
	user << browse(dat, "window=implantpad")
	onclose(user, "implantpad")

/obj/item/weapon/implantpad/Topic(href, href_list)
	..()
	if(usr.stat)
		return
	if((usr.contents.Find(src)) || ((in_range(src, usr) && istype(loc, /turf))))
		usr.set_machine(src)
		if(href_list["tracking_id"])
			var/obj/item/weapon/implant/tracking/T = case.imp
			T.id += text2num(href_list["tracking_id"])
			T.id = min(100, T.id)
			T.id = max(1, T.id)

		if(istype(loc, /mob))
			attack_self(loc)
		else
			for(var/mob/M in viewers(1, src))
				if(M.client)
					attack_self(M)
		add_fingerprint(usr)
	else
		usr << browse(null, "window=implantpad")


code:
/obj/item/weapon/implant/uplink
	name = "uplink implant"
	desc = "Summon things."
	icon = 'icons/obj/radio.dmi'
	icon_state = "radio"

/obj/item/weapon/implant/uplink/New()
	hidden_uplink = new(src)
	hidden_uplink.uses = 10
	..()

/obj/item/weapon/implant/uplink/implanted(mob/source)
	..()
	hidden_uplink.uplink_owner="[source.key]"
	return 1

/obj/item/weapon/implant/uplink/activate()
	if(hidden_uplink)
		hidden_uplink.check_trigger(imp_in)


code:
/obj/item/weapon/holosign_creator
	name = "holographic sign projector"
	desc = "A handy-dandy hologaphic projector that displays a janitorial sign."
	icon = 'icons/obj/janitor.dmi'
	icon_state = "signmaker"
	item_state = "electronic"
	force = 5
	w_class = 2
	throwforce = 0
	throw_speed = 3
	throw_range = 7
	origin_tech = "programming=3"
	var/list/signs = list()
	var/max_signs = 10

/obj/item/weapon/holosign_creator/afterattack(atom/target, mob/user, flag)
	if(flag)
		if(!check_allowed_items(target, 1)) return
		var/turf/T = get_turf(target)
		var/obj/effect/overlay/holograph/H = locate() in T
		if(H)
			user << "You use [src] to destroy [H]."
			signs.Remove(H)
			qdel(H)
		else
			if(signs.len < max_signs)
				H = new(get_turf(target))
				signs += H
				user << "You create \a [H] with [src]."
			else
				user << "[src] is projecting at max capacity!"

/obj/item/weapon/holosign_creator/attack(mob/living/carbon/human/M, mob/user)
	return

/obj/item/weapon/holosign_creator/attack_self(mob/user)
	if(signs.len)
		var/list/L = signs.Copy()
		for(var/sign in L)
			qdel(sign)
			signs -= sign
		user << "You clear all active holograms."

/obj/effect/overlay/holograph
	name = "wet floor sign"
	desc = "The words flicker as if they mean nothing."
	icon = 'icons/obj/janitor.dmi'
	icon_state = "holosign"
	anchored = 1

/obj/item/weapon/caution
	desc = "Caution! Wet Floor!"
	name = "wet floor sign"
	icon = 'icons/obj/janitor.dmi'
	icon_state = "caution"
	force = 1.0
	throwforce = 3.0
	throw_speed = 2
	throw_range = 5
	w_class = 2.0
	attack_verb = list("warned", "cautioned", "smashed")


code:
/* Kitchen tools
 * Contains:
 *		Utensils
 *		Spoons
 *		Forks
 *		Knives
 *		Kitchen knives
 *		Butcher's cleaver
 *		Rolling Pins
 *		Trays
 *		Whetstone
 */

/obj/item/weapon/kitchen
	icon = 'icons/obj/kitchen.dmi'

/*
 * Utensils
 */
/obj/item/weapon/kitchen/utensil
	force = 5.0
	w_class = 1.0
	throwforce = 0
	throw_speed = 3
	throw_range = 5
	flags = CONDUCT
	origin_tech = "materials=1"
	attack_verb = list("attacked", "stabbed", "poked")
	hitsound = 'sound/weapons/bladeslice.ogg'

/obj/item/weapon/kitchen/utensil/New()
	if (prob(60))
		src.pixel_y = rand(0, 4)
	return

/*
 * Spoons
 */
 /obj/item/weapon/kitchen/utensil/spoon
	name = "spoon"
	desc = "SPOON!"
	icon_state = "spoon"
	attack_verb = list("attacked", "poked")

/*
 * Forks
 */
/obj/item/weapon/kitchen/utensil/fork
	name = "fork"
	desc = "Pointy."
	icon_state = "fork"

/obj/item/weapon/kitchen/utensil/fork/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
	if(!istype(M))
		return ..()

	if(user.zone_sel.selecting != "eyes" && user.zone_sel.selecting != "head")
		return ..()

	if (src.icon_state == "forkloaded") //This is a poor way of handling it, but a proper rewrite of the fork to allow for a more varied foodening can happen when I'm in the mood. --NEO
		if(M == user)
			M.visible_message("[user] eats a delicious forkful of omelette!")
			M.reagents.add_reagent("nutriment", 1)
		else
			M.visible_message("[user] feeds [M] a delicious forkful of omelette!")
			M.reagents.add_reagent("nutriment", 1)
		src.icon_state = "fork"
		return
	else
		if(user.disabilities & CLUMSY && prob(50))
			M = user
		return eyestab(M,user)

/*
 * Knives
 */
/obj/item/weapon/kitchen/utensil/knife
	name = "knife"
	desc = "Can cut through any food."
	icon_state = "knife"
	force = 10.0
	throwforce = 10.0

/obj/item/weapon/kitchen/utensil/knife/suicide_act(mob/user)
	user.visible_message(pick("[user] is slitting \his wrists with the [src.name]! It looks like \he's trying to commit suicide.", \
						"[user] is slitting \his throat with the [src.name]! It looks like \he's trying to commit suicide.", \
						"[user] is slitting \his stomach open with the [src.name]! It looks like \he's trying to commit seppuku."))
	return (BRUTELOSS)

/obj/item/weapon/kitchen/utensil/knife/attack(target, mob/living/carbon/human/user)
	if(istype(user) && user.disabilities & CLUMSY && prob(50))
		user << "You accidentally cut yourself with \the [src]."
		user.take_organ_damage(20)
		return
	playsound(loc, 'sound/weapons/bladeslice.ogg', 50, 1, -1)
	return ..()

/*
 * Kitchen knives
 */
/obj/item/weapon/kitchenknife
	name = "kitchen knife"
	icon = 'icons/obj/kitchen.dmi'
	icon_state = "knife"
	desc = "A general purpose Chef's Knife made by SpaceCook Incorporated. Guaranteed to stay sharp for years to come."
	flags = CONDUCT
	force = 10.0
	w_class = 3.0
	throwforce = 10.0
	throw_speed = 3
	throw_range = 6
	m_amt = 12000
	sharp = 1
	origin_tech = "materials=1"
	attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")

/obj/item/weapon/kitchenknife/suicide_act(mob/user)
	user.visible_message(pick("[user] is slitting \his wrists with the [src.name]! It looks like \he's trying to commit suicide.", \
						"[user] is slitting \his throat with the [src.name]! It looks like \he's trying to commit suicide.", \
						"[user] is slitting \his stomach open with the [src.name]! It looks like \he's trying to commit seppuku."))
	return (BRUTELOSS)

/obj/item/weapon/kitchenknife/ritual
	name = "ritual knife"
	desc = "The unearthly energies that once powered this blade are now dormant."
	icon = 'icons/obj/wizard.dmi'
	icon_state = "render"

/*
 * Bucher's cleaver
 */
/obj/item/weapon/kitchenknife/butcher
	name = "butcher's cleaver"
	icon = 'icons/obj/kitchen.dmi'
	icon_state = "butch"
	desc = "A huge thing used for chopping and chopping up meat. This includes clowns and clown-by-products."
	flags = CONDUCT
	force = 15.0
	w_class = 3.0
	throwforce = 8.0
	throw_speed = 3
	throw_range = 6
	m_amt = 12000
	sharp = 1
	origin_tech = "materials=1"
	hitsound = 'sound/weapons/bladeslice.ogg'
	attack_verb = list("cleaved", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")

/*
 * Rolling Pins
 */

/obj/item/weapon/kitchen/rollingpin
	name = "rolling pin"
	desc = "Used to knock out the Bartender."
	icon_state = "rolling_pin"
	force = 8.0
	throwforce = 5.0
	throw_speed = 3
	throw_range = 7
	w_class = 3.0
	attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "whacked")

/* Trays moved to /obj/item/weapon/storage/bag */

/*
 * Whetstone
 */

/obj/item/weapon/kitchen/whetstone
	name = "Whetstone"
	desc = "A tool used for sharpening your knives to make it easier to bork bork bork."
	icon_state = "whetstone"
	force = 5.0
	throwforce = 3.0
	throw_speed = 3
	throw_range = 7
	w_class = 3.0
	attack_verb = list("beaten", "battered", "bludgeoned")
	origin_tech = "materials=3"

/obj/item/weapon/kitchen/whetstone/attackby(obj/item/weapon/W as obj, mob/user as mob)
	if(isSharpenable(W))
		sharpen(W, src, user)
	else
		user << "You cannot sharpen [W][(src.sharp)? "" : " further"]."
	..()

/obj/item/weapon/kitchen/whetstone/Destroy()
	visible_message("The [src] crumbles away")
	..()

/obj/item/proc/isSharpenable(var/obj/item/W) //Proc that governs if you can sharpen it
	if(W.sharp == 2) //Too sharp
		return 0
	if (istype(W, /obj/item/weapon/hatchet))
		return 1
	if (istype(W, /obj/item/weapon/kitchenknife)) //Includes cleavers
		return 1

	return 0 //If none of the above

/obj/item/proc/sharpen(var/obj/item/O, var/obj/item/weapon/kitchen/whetstone/W, var/mob/user)
	if(!user)
		return 0
	user << "You start sharpening the [O]"
	if(do_after(user, 30))
		user.visible_message("[src] sharpens the [O]","You sharpen \the [O]", "You hear grinding")
		O.sharp++
		O.force += 9
		O.throwforce += 7
		O.name = "sharpened " + O.name
		qdel(W)
		return 1
	return 0


code:
/*********************MANUALS (BOOKS)***********************/

//Oh god what the fuck I am not good at computer
/obj/item/weapon/book/manual
	icon = 'icons/obj/library.dmi'
	due_date = 0 // Game time in 1/10th seconds
	unique = 1   // 0 - Normal book, 1 - Should not be treated as normal book, unable to be copied, unable to be modified

/obj/item/weapon/book/manual/engineering_particle_accelerator
	name = "Particle Accelerator User's Guide"
	icon_state ="bookParticleAccelerator"
	author = "Engineering Encyclopedia"		 // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned
	title = "Particle Accelerator User's Guide"
	dat = {"

Experienced user's guide

Setting up

Wrench all pieces to the floor

Add wires to all the pieces

Close all the panels with your screwdriver

Use

Open the control panel

Set the speed to 2

Start firing at the singularity generator

When the singularity reaches a large enough size so it starts moving on it's own set the speed down to 0, but don't shut it off

Remember to wear a radiation suit when working with this machine... we did tell you that at the start, right?

				"}

/obj/item/weapon/book/manual/engineering_singularity_safety
	name = "Singularity Safety in Special Circumstances"
	icon_state ="bookEngineeringSingularitySafety"
	author = "Engineering Encyclopedia"		 // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned
	title = "Singularity Safety in Special Circumstances"
//big pile of shit below.

	dat = {"

Singularity Safety in Special Circumstances

Power outage

				A power problem has made the entire station lose power? Could be station-wide wiring problems or syndicate power sinks. In any case follow these steps:

				Step one: PANIC!

				Step two: Get your ass over to engineering! QUICKLY!!!

				Step three: Make sure the SMES is still powering the emitters, if not, setup the generator in secure storage and disconnect the emitters from the SMES.

				Step four: Next, head over to the APC and swipe it with your ID card - if it doesn't unlock, continue with step 15.

				Step five: Open the console and disengage the cover lock.

				Step six: Pry open the APC with a Crowbar.

				Step seven: Take out the empty power cell.

				Step eight: Put in the new, full power cell - if you don't have one, continue with step 15.

				Step nine: Quickly put on a Radiation suit.

				Step ten: Check if the singularity field generators withstood the down-time - if they didn't, continue with step 15.

				Step eleven: Since disaster was averted you now have to ensure it doesn't repeat. If it was a powersink which caused it and if the engineering apc is wired to the same powernet, which the powersink is on, you have to remove the piece of wire which links the apc to the powernet. If it wasn't a powersink which caused it, then skip to step 14.

				Step twelve: Grab your crowbar and pry away the tile closest to the APC.

				Step thirteen: Use the wirecutters to cut the wire which is conecting the grid to the terminal.

				Step fourteen: Go to the bar and tell the guys how you saved them all. Stop reading this guide here.

				Step fifteen: GET THE FUCK OUT OF THERE!!!

Shields get damaged

				Step one: GET THE FUCK OUT OF THERE!!! FORGET THE WOMEN AND CHILDREN, SAVE YOURSELF!!!

				"}

/obj/item/weapon/book/manual/hydroponics_pod_people
	name = "The Human Harvest - From seed to market"
	icon_state ="bookHydroponicsPodPeople"
	author = "Farmer John"
	title = "The Human Harvest - From seed to market"
	dat = {"

Growing Humans

				Why would you want to grow humans? Well I'm expecting most readers to be in the slave trade, but a few might actually
				want to revive fallen comrades. Growing pod people is easy, but prone to disaster.

Find a dead person who is in need of cloning.

Take a blood sample with a syringe.

Inject a seed pack with the blood sample.

Plant the seeds.

Tend to the plants water and nutrition levels until it is time to harvest the cloned human.

				It really is that easy! Good luck!

				"}

/obj/item/weapon/book/manual/medical_cloning
	name = "Cloning techniques of the 26th century"
	icon_state ="bookCloning"
	author = "Medical Journal, volume 3"		 // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned
	title = "Cloning techniques of the 26th century"
//big pile of shit below.

	dat = {"

How to Clone People

				So there’s 50 dead people lying on the floor, chairs are spinning like no tomorrow and you haven’t the foggiest idea of what to do? Not to worry! This guide is intended to teach you how to clone people and how to do it right, in a simple step-by-step process! If at any point of the guide you have a mental meltdown, genetics probably isn’t for you and you should get a job-change as soon as possible before you’re sued for malpractice.

Acquire body

Strip body

Put body in cloning machine

Scan body

Clone body

Get clean Structurel Enzymes for the body

Put body in morgue

Await cloned body

Use the clean SW injector

Give person clothes back

Send person on their way

Step 1: Acquire body

				This is pretty much vital for the process because without a body, you cannot clone it. Usually, bodies will be brought to you, so you do not need to worry so much about this step. If you already have a body, great! Move on to the next step.

Step 2: Strip body

				The cloning machine does not like abiotic items. What this means is you can’t clone anyone if they’re wearing clothes, so take all of it off. If it’s just one person, it’s courteous to put their possessions in the closet. If you have about seven people awaiting cloning, just leave the piles where they are, but don’t mix them around and for God’s sake don’t let the Clown in to steal them.

Step 3: Put body in cloning machine

				Grab the body and then put it inside the DNA modifier. If you cannot do this, then you messed up at Step 2. Go back and check you took EVERYTHING off - a commonly missed item is their headset.

Step 4: Scan body

				Go onto the computer and scan the body by pressing ‘Scan - <Subject Name Here>’. If you’re successful, they will be added to the records (note that this can be done at any time, even with living people, so that they can be cloned without a body in the event that they are lying dead on port solars and didn‘t turn on their suit sensors)! If not, and it says “Error: Mental interface failure.”, then they have left their bodily confines and are one with the spirits. If this happens, just shout at them to get back in their body, click ‘Refresh‘ and try scanning them again. If there’s no success, threaten them with gibbing. Still no success? Skip over to Step 7 and don‘t continue after it, as you have an unresponsive body and it cannot be cloned. If you got “Error: Unable to locate valid genetic data.“, you are trying to clone a monkey - start over.

Step 5: Clone body

				Now that the body has a record, click ’View Records’, click the subject’s name, and then click ‘Clone’ to start the cloning process. Congratulations! You’re halfway there. Remember not to ‘Eject’ the cloning pod as this will kill the developing clone and you’ll have to start the process again.

Step 6: Get clean SEs for body

				Cloning is a finicky and unreliable process. Whilst it will most certainly bring someone back from the dead, they can have any number of nasty disabilities given to them during the cloning process! For this reason, you need to prepare a clean, defect-free Structural Enzyme (SE) injection for when they’re done. If you’re a competent Geneticist, you will already have one ready on your working computer. If, for any reason, you do not, then eject the body from the DNA modifier (NOT THE CLONING POD) and take it next door to the Genetics research room. Put the body in one of those DNA modifiers and then go onto the console. Go into View/Edit/Transfer Buffer, find an open slot and click “SE“ to save it. Then click ‘Injector’ to get the SEs in syringe form. Put this in your pocket or something for when the body is done.

Step 7: Put body in morgue

				Now that the cloning process has been initiated and you have some clean Structural Enzymes, you no longer need the body! Drag it to the morgue and tell the Chef over the radio that they have some fresh meat waiting for them in there. To put a body in a morgue bed, simply open the tray, grab the body, put it on the open tray, then close the tray again. Use one of the nearby pens to label the bed “CHEF MEAT” in order to avoid confusion.

Step 8: Await cloned body

				Now go back to the lab and wait for your patient to be cloned. It won’t be long now, I promise.

Step 9: Use the clean SE injector on person

				Has your body been cloned yet? Great! As soon as the guy pops out, grab your injector and jab it in them. Once you’ve injected them, they now have clean Structural Enzymes and their defects, if any, will disappear in a short while.

Step 10: Give person clothes back

				Obviously the person will be naked after they have been cloned. Provided you weren’t an irresponsible little shit, you should have protected their possessions from thieves and should be able to give them back to the patient. No matter how cruel you are, it’s simply against protocol to force your patients to walk outside naked.

Step 11: Send person on their way

				Give the patient one last check-over - make sure they don’t still have any defects and that they have all their possessions. Ask them how they died, if they know, so that you can report any foul play over the radio. Once you’re done, your patient is ready to go back to work! Chances are they do not have Medbay access, so you should let them out of Genetics and the Medbay main entrance.

If you’ve gotten this far, congratulations! You have mastered the art of cloning. Now, the real problem is how to resurrect yourself after that traitor had his way with you for cloning his target.

				"}

/obj/item/weapon/book/manual/ripley_build_and_repair
	name = "APLU \"Ripley\" Construction and Operation Manual"
	icon_state ="book"
	author = "Weyland-Yutani Corp"		 // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned
	title = "APLU \"Ripley\" Construction and Operation Manual"
//big pile of shit below.

	dat = {"

				Weyland-Yutani - Building Better Worlds

Autonomous Power Loader Unit \"Ripley\"

Specifications:

Class: Autonomous Power Loader

Scope: Logistics and Construction

Weight: 820kg (without operator and with empty cargo compartment)

Height: 2.5m

Width: 1.8m

Top speed: 5km/hour

Operation in vacuum/hostile environment: Possible

Airtank Volume: 500liters

Devices:

Hydraulic Clamp

High-speed Drill

Propulsion Device: Powercell-powered electro-hydraulic system.

Powercell capacity: Varies.

Construction:

Connect all exosuit parts to the chassis frame

Connect all hydraulic fittings and tighten them up with a wrench

Adjust the servohydraulics with a screwdriver

Wire the chassis. (Cable is not included.)

Use the wirecutters to remove the excess cable if needed.

Install the central control module (Not included. Use supplied datadisk to create one).

Secure the mainboard with a screwdriver.

Install the peripherals control module (Not included. Use supplied datadisk to create one).

Secure the peripherals control module with a screwdriver

Install the internal armor plating (Not included due to Nanotrasen regulations. Can be made using 5 metal sheets.)

Secure the internal armor plating with a wrench

Weld the internal armor plating to the chassis

Install the external reinforced armor plating (Not included due to Nanotrasen regulations. Can be made using 5 reinforced metal sheets.)

Secure the external reinforced armor plating with a wrench

Weld the external reinforced armor plating to the chassis

Additional Information:

The firefighting variation is made in a similar fashion.

A firesuit must be connected to the Firefighter chassis for heat shielding.

Internal armor is plasteel for additional strength.

External armor must be installed in 2 parts, totaling 10 sheets.

Completed mech is more resiliant against fire, and is a bit more durable overall

Nanotrasen is determined to the safety of its <s>investments</s> employees.

Operation

				Coming soon...
			"}

/obj/item/weapon/book/manual/experimentor
	name = "Mentoring your Experiments"
	icon_state = "rdbook"
	author = "Dr. H.P. Kritz"
	dat = {"

THE E.X.P.E.R.I-MENTOR

		The Enhanced Xenobiological Period Extraction (and) Restoration Instructor is a machine designed to discover the secrets behind every item in existence.
		With advanced technology, it can process 99.95% of items, and discover their uses and secrets.
		The E.X.P.E.R.I-MENTOR is a Research apparatus that takes items, and through a process of elimination, it allows you to deduce new technological designs from them.
		Due to the volatile nature of the E.X.P.E.R.I-MENTOR, there is a slight chance for malfunction, potentially causing irreparable damage to you or your environment.
		However, upgrading the apparatus has proven to decrease the chances of undesirable, potentially life-threatening outcomes.
		Please note that the E.X.P.E.R.I-MENTOR uses a state-of-the-art random generator, which has a larger entropy than the observable universe,
		therefore it can generate wildly different results each day, therefore it is highly suggested to re-scan objects of interests frequently (e.g. each shift).

BASIC PROCESS

		The usage of the E.X.P.E.R.I-MENTOR is quite simple:

Find an item with a technological background

Insert the item into the E.X.P.E.R.I-MENTOR

Cycle through each processing method of the device.

Stand back, even in case of a successful experiment, as the machine might produce undesired behaviour.

ADVANCED USAGE

		The E.X.P.E.R.I-MENTOR has a variety of uses, beyond menial research work. The different results can be used to combat localised events, or even to get special items.

		The E.X.P.E.R.I-MENTOR's OBLITERATE function has the added use of transferring the destroyed item's material into a linked lathe.

		The IRRADIATE function can be used to transform items into other items, resulting in potential upgrades (or downgrades).

		Users should remember to always wear appropriate protection when using the machine, because malfunction can occur at any moment!

EVENTS

GLOBAL (happens at any time):

DETECTION MALFUNCTION - The machine's onboard sensors have malfunctioned, causing it to redefine the item's experiment type.
			Produces the message: The E.X.P.E.R.I-MENTOR's onboard detection system has malfunctioned!

IANIZATION - The machine's onboard corgi-filter has malfunctioned, causing it to produce a corgi from.. somewhere.
			Produces the message: The E.X.P.E.R.I-MENTOR melts the banana, ian-izing the air around it!

RUNTIME ERROR - The machine's onboard C4T-P processor has encountered a critical error, causing it to produce a cat from.. somewhere.
			Produces the message: The E.X.P.E.R.I-MENTOR encounters a run-time error!

B100DG0D.EXE - The machine has encountered an unknown subroutine, which has been injected into it's runtime. It upgrades the held item!
			Produces the message: The E.X.P.E.R.I-MENTOR improves the banana, drawing the life essence of those nearby!

POWERSINK - The machine's PSU has tripped the charging mechanism! It consumes massive amounts of power!
			Produces the message: The E.X.P.E.R.I-MENTOR begins to smoke and hiss, shaking violently!

FAIL:

			This event is produced when the item mismatches the selected experiment.
			Produces a random message similar to: "the Banana rumbles, and shakes, the experiment was a failure!"

POKE:

WILD ARMS - The machine's gryoscopic processors malfunction, causing it to lash out at nearby people with it's arms.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions and destroys the banana, lashing it's arms out at nearby people!

MISTYPE - The machine's interface has been garbled, and it switches to OBLITERATE.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions!

THROW - The machine's spatial recognition device has shifted several meters across the room, causing it to try and repostion the item there.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, throwing the banana!

IRRADIATE:

RADIATION LEAK - The machine's shield has failed, resulting in a toxic radiation leak.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, melting the banana and leaking radiation!

RADIATION DUMP - The machine's recycling and containment functions have failed, resulting in a dump of toxic waste around it
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, spewing toxic waste!

MUTATION - The machine's radio-isotope level meter has malfunctioned, causing it over-irradiate the item, making it transform.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, transforming the banana!

GAS:

TOXIN LEAK - The machine's filtering and vent systems have failed, resulting in a cloud of toxic gas being expelled.
			Produces the message: The E.X.P.E.R.I-MENTOR destroys the banana, leaking dangerous gas!

GAS LEAK - The machine's vent systems have failed, resulting in a cloud of harmless, but obscuring gas.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, spewing harmless gas!

ELECTROMAGNETIC IONS - The machine's electrolytic scanners have failed, causing a dangerous Electromagnetic reaction.
			Produces the message: The E.X.P.E.R.I-MENTOR melts the banana, ionizing the air around it!

HEAT:

TOASTER - The machine's heating coils have come into contact with the machine's gas storage, causing a large, sudden blast of flame.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, melting the banana and releasing a burst of flame!

SAUNA - The machine's vent loop has sprung a leak, resulting in a large amount of superheated air being dumped around it.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, melting the banana and leaking hot air!

EMERGENCY VENT - The machine's temperature gauge has malfunctioned, resulting in it attempting to cool the area around it, but instead, dumping a cloud of steam.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, activating it's emergency coolant systems!

COLD:

FREEZER - The machine's cooling loop has sprung a leak, resulting in a cloud of super-cooled liquid being blasted into the air.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, shattering the banana and releasing a dangerous cloud of coolant!

FRIDGE - The machine's cooling loop has been exposed to the outside air, resulting in a large decrease in temperature.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, shattering the banana and leaking cold air!

SNOWSTORM - The machine's cooling loop has come into contact with the heating coils, resulting in a sudden blast of cool air.
			Produces the message: The E.X.P.E.R.I-MENTOR malfunctions, releasing a flurry of chilly air as the banana pops out!

OBLITERATE:

IMPLOSION - The machine's pressure leveller has malfunctioned, causing it to pierce the space-time momentarily, making everything in the area fly towards it.
			Produces the message: The E.X.P.E.R.I-MENTOR's crusher goes way too many levels too high, crushing right through space-time!

DISTORTION - The machine's pressure leveller has completely disabled, resulting in a momentary space-time distortion, causing everything to fly around.
			Produces the message: The E.X.P.E.R.I-MENTOR's crusher goes one level too high, crushing right into space-time!

	"}

/obj/item/weapon/book/manual/research_and_development
	name = "Research and Development 101"
	icon_state = "rdbook"
	author = "Dr. L. Ight"
	title = "Research and Development 101"
	dat = {"

Science For Dummies

				So you want to further SCIENCE? Good man/woman/thing! However, SCIENCE is a complicated process even though it's quite easy. For the most part, it's a three step process:

 1) Deconstruct items in the Destructive Analyzer to advance technology or improve the design.

 2) Build unlocked designs in the Protolathe and Circuit Imprinter

 3) Repeat!

				Those are the basic steps to furthing science. What do you do science with, however? Well, you have four major tools: R&D Console, the Destructive Analyzer, the Protolathe, and the Circuit Imprinter.

The R&D Console

				The R&D console is the cornerstone of any research lab. It is the central system from which the Destructive Analyzer, Protolathe, and Circuit Imprinter (your R&D systems) are controled. More on those systems in their own sections. On its own, the R&D console acts as a database for all your technological gains and new devices you discover. So long as the R&D console remains intact, you'll retain all that SCIENCE you've discovered. Protect it though, because if it gets damaged, you'll lose your data! In addition to this important purpose, the R&D console has a disk menu that lets you transfer data from the database onto disk or from the disk into the database. It also has a settings menu that lets you re-sync with nearby R&D devices (if they've become disconnected), lock the console from the unworthy, upload the data to all other R&D consoles in the network (all R&D consoles are networked by default), connect/disconnect from the network, and purge all data from the database.
				NOTE: The technology list screen, circuit imprinter, and protolathe menus are accessible by non-scientists. This is intended to allow 'public' systems for the plebians to utilize some new devices.

Destructive Analyzer

				This is the source of all technology. Whenever you put a handheld object in it, it analyzes it and determines what sort of technological advancements you can discover from it. If the technology of the object is equal or higher then your current knowledge, you can destroy the object to further those sciences. Some devices (notably, some devices made from the protolathe and circuit imprinter) aren't 100% reliable when you first discover them. If these devices break down, you can put them into the Destructive Analyzer and improve their reliability rather then futher science. If their reliability is high enough ,it'll also advance their related technologies.

Circuit Imprinter

				This machine, along with the Protolathe, is used to actually produce new devices. The Circuit Imprinter takes glass and various chemicals (depends on the design) to produce new circuit boards to build new machines or computers. It can even be used to print AI modules.

Protolathe

				This machine is an advanced form of the Autolathe that produce non-circuit designs. Unlike the Autolathe, it can use processed metal, glass, solid plasma, silver, gold, and diamonds along with a variety of chemicals to produce devices. The downside is that, again, not all devices you make are 100% reliable when you first discover them.

Reliability and You

				As it has been stated, many devices when they're first discovered do not have a 100% reliablity when you first discover them. Instead, the reliablity of the device is dependent upon a base reliability value, whatever improvements to the design you've discovered through the Destructive Analyzer, and any advancements you've made with the device's source technologies. To be able to improve the reliability of a device, you have to use the device until it breaks beyond repair. Once that happens, you can analyze it in a Destructive Analyzer. Once the device reachs a certain minimum reliability, you'll gain tech advancements from it.

Building a Better Machine

				Many machines produces from circuit boards and inserted into a machine frame require a variety of parts to construct. These are parts like capacitors, batteries, matter bins, and so forth. As your knowledge of science improves, more advanced versions are unlocked. If you use these parts when constructing something, its attributes may be improved. For example, if you use an advanced matter bin when constructing an autolathe (rather then a regular one), it'll hold more materials. Experiment around with stock parts of various qualities to see how they affect the end results! Be warned, however: Tier 3 and higher stock parts don't have 100% reliability and their low reliability may affect the reliability of the end machine.

			"}

/obj/item/weapon/book/manual/robotics_cyborgs
	name = "Cyborgs for Dummies"
	icon_state = "borgbook"
	author = "XISC"
	title = "Cyborgs for Dummies"
	dat = {"

Cyborgs for Dummies

Chapters

Cyborg Related Equipment

Cyborg Modules

Cyborg Construction

Cyborg Deconstruction

Cyborg Maintenance

Cyborg Repairs

In Case of Emergency

Cyborg Related Equipment

Exosuit Fabricator

				The Exosuit Fabricator is the most important piece of equipment related to cyborgs. It allows the construction of the core cyborg parts. Without these machines, cyborgs can not be built. It seems that they may also benefit from advanced research techniques.

Cyborg Recharging Station

				This useful piece of equipment will suck power out of the power systems to charge a cyborg's power cell back up to full charge.

Robotics Control Console

				This useful piece of equipment can be used to immobolize or destroy a cyborg. A word of warning: Cyborgs are expensive pieces of equipment, do not destroy them without good reason, or Nanotrasen may see to it that it never happens again.

Cyborg Modules

				When a cyborg is created it picks out of an array of modules to designate its purpose. There are 6 different cyborg modules.

Standard Cyborg

				The standard cyborg module is a multi-purpose cyborg. It is equipped with various modules, allowing it to do basic tasks.

Engineering Cyborg

				The Engineering cyborg module comes equipped with various engineering-related tools to help with engineering-related tasks.

Mining Cyborg

				The Mining Cyborg module comes equipped with the latest in mining equipment. They are efficient at mining due to no need for oxygen, but their power cells limit their time in the mines.

Security Cyborg

				The Security Cyborg module is equipped with effective security measures used to apprehend and arrest criminals without harming them a bit.

Janitor Cyborg

				The Janitor Cyborg module is equipped with various cleaning-facilitating devices.

Service Cyborg

				The service cyborg module comes ready to serve your human needs. It includes various entertainment and refreshment devices. Occasionally some service cyborgs may have been referred to as "Bros"

Cyborg Construction

				Cyborg construction is a rather easy process, requiring a decent amount of metal and a few other supplies.
The required materials to make a cyborg are:

Metal

Two Flashes

One Power Cell (Preferrably rated to 15000w)

Some electrical wires

One Human Brain

One Man-Machine Interface

				Once you have acquired the materials, you can start on construction of your cyborg.
To construct a cyborg, follow the steps below:

Start the Exosuit Fabricators constructing all of the cyborg parts

While the parts are being constructed, take your human brain, and place it inside the Man-Machine Interface

Once you have a Robot Head, place your two flashes inside the eye sockets

Once you have your Robot Chest, wire the Robot chest, then insert the power cell

Attach all of the Robot parts to the Robot frame

Insert the Man-Machine Interface (With the Brain inside) Into the Robot Body

Congratulations! You have a new cyborg!

Cyborg Deconstruction

				If you want to deconstruct a cyborg, say to remove its MMI without blowing the Cyborg to pieces, they come apart very quickly, and very safely, in a few simple steps.

Crowbar

Wrench

				  Optional:

Screwdriver

Wirecutters

Begin by unlocking the Cyborg's access panel using your ID

Use your crowbar to open the Cyborg's access panel

Using your bare hands, remove the power cell from the Cyborg

Lockdown the Cyborg to disengage safety protocols

				    Option 1: Robotics console

Use the Robotics console in the RD's office

Find the entry for your Cyborg

Press the Lockdown button on the Robotics console

				    Option 2: Lockdown wire

Use your screwdriver to expose the Cyborg's wiring

Use your wirecutters to start cutting all of the wires until the lockdown light turns off, cutting all of the wires irregardless of the lockdown light works as well

Use your wrench to unfasten the Cyborg's bolts, the Cyborg will then fall apart onto the floor, the MMI will be there as well

Cyborg Maintenance

				Occasionally Cyborgs may require maintenance of a couple types, this could include replacing a power cell with a charged one, or possibly maintaining the cyborg's internal wiring.

Replacing a Power Cell

				Replacing a Power cell is a common type of maintenance for cyborgs. It usually involves replacing the cell with a fully charged one, or upgrading the cell with a larger capacity cell.
The steps to replace a cell are follows:

Unlock the Cyborg's Interface by swiping your ID on it

Open the Cyborg's outer panel using a crowbar

Remove the old power cell

Insert the new power cell

Close the Cyborg's outer panel using a crowbar

Lock the Cyborg's Interface by swiping your ID on it, this will prevent non-qualified personnel from attempting to remove the power cell

Exposing the Internal Wiring

				Exposing the internal wiring of a cyborg is fairly easy to do, and is mainly used for cyborg repairs.
You can easily expose the internal wiring by following the steps below:

Follow Steps 1 - 3 of "Replacing a Cyborg's Power Cell"

Open the cyborg's internal wiring panel by using a screwdriver to unsecure the panel

			  To re-seal the cyborg's internal wiring:

Use a screwdriver to secure the cyborg's internal panel

Follow steps 4 - 6 of "Replacing a Cyborg's Power Cell" to close up the cyborg

Cyborg Repairs

			  Occasionally a Cyborg may become damaged. This could be in the form of impact damage from a heavy or fast-travelling object, or it could be heat damage from high temperatures, or even lasers or Electromagnetic Pulses (EMPs).

Dents

			  If a cyborg becomes damaged due to impact from heavy or fast-moving objects, it will become dented. Sure, a dent may not seem like much, but it can compromise the structural integrity of the cyborg, possibly causing a critical failure.
			  Dents in a cyborg's frame are rather easy to repair, all you need is to apply a welding tool to the dented area, and the high-tech cyborg frame will repair the dent under the heat of the welder.

Excessive Heat Damage

        If a cyborg becomes damaged due to excessive heat, it is likely that the internal wires will have been damaged. You must replace those wires to ensure that the cyborg remains functioning properly.
To replace the internal wiring follow the steps below:

Unlock the Cyborg's Interface by swiping your ID

Open the Cyborg's External Panel using a crowbar

Remove the Cyborg's Power Cell

Using a screwdriver, expose the internal wiring or the Cyborg

Replace the damaged wires inside the cyborg

Secure the internal wiring cover using a screwdriver

Insert the Cyborg's Power Cell

Close the Cyborg's External Panel using a crowbar

Lock the Cyborg's Interface by swiping your ID

        These repair tasks may seem difficult, but are essential to keep your cyborgs running at peak efficiency.

In Case of Emergency

        In case of emergency, there are a few steps you can take.

"Rogue" Cyborgs

        If the cyborgs seem to become "rogue", they may have non-standard laws. In this case, use extreme caution.
        To repair the situation, follow these steps:

Locate the nearest robotics console

Determine which cyborgs are "Rogue"

Press the lockdown button to immobolize the cyborg

Locate the cyborg

Expose the cyborg's internal wiring

Check to make sure the LawSync and AI Sync lights are lit

If they are not lit, pulse the LawSync wire using a multitool to enable the cyborg's Law Sync

Proceed to a cyborg upload console. Nanotrasen usually places these in the same location as AI uplaod consoles.

Use a "Reset" upload moduleto reset the cyborg's laws

Proceed to a Robotics Control console

Remove the lockdown on the cyborg

As a last resort

        If all else fails in a case of cyborg-related emergency. There may be only one option. Using a Robotics Control console, you may have to remotely detonate the cyborg.

WARNING:
 Do not detonate a borg without an explicit reason for doing so. Cyborgs are expensive pieces of Nanotrasen equipment, and you may be punished for detonating them without reason.

		"}

/obj/item/weapon/book/manual/chef_recipes
	name = "Chef Recipes"
	icon_state = "cooked_book"
	author = "Lord Frenrir Cageth"
	title = "Chef Recipes"
	dat = {"

Food for Dummies

				Here is a guide on basic food recipes and also how to not poison your customers accidentally.

Basic ingredients preparation:

				Dough: 10u water + 15u flour for simple dough.

				15u egg yolk + 15u flour + 5u sugar for cake batter.

				Doughs can be transformed by using a knife and rolling pin.

				All doughs can be microwaved.

				Bowl: Add water to it for soup preparation.

				Meat: Microwave it, process it, slice it into microwavable cutlets with your knife, or use it raw.

				Cheese: Add 5u universal enzyme (catalyst) to milk and soy milk to prepare cheese (sliceable) and tofu.

Custom food:

				Add ingredients to a base item to prepare a custom meal.

				The bases are:

				- bun (burger)

				- breadslices(sandwich)

				- plain bread

				- plain pie

				- vanilla cake

				- empty bowl (salad)

				- bowl with 10u water (soup)

				- boiled spaghetti

				- pizza bread

				- metal rod (kebab)

Table Craft:

				Put ingredients on table, then click and drag the table onto yourself to see what recipes you can prepare.

Microwave:

				Use it to cook or boil food ingredients (meats, doughs, egg, spaghetti, donkpocket, etc...).
				It can cook multiple items at once. Use the higher power settings for faster (and riskier) cooking.

Processor:

				Use it to process certain ingredients (meat into faggot, doughslice into spaghetti, potato into fries,etc...)

Gibber:

				Stuff an animal in it to grind it into meat.

Meat spike:

				Stick an animal on it then begin collecting its meat.

Example recipes:

				Vanilla Cake: Microwave cake batter.

				Burger: 1 bun + 1 meat steak

				Bread: Microwave dough.

				Waffles: 2 pastry base

				Popcorn: Microwave corn.

				Meat Steak: Microwave meat.

				Meat Pie: 1 plain pie + 1u black pepper + 1u salt + 2 meat cutlets

				Boiled Spagetti: Microwave spaghetti.

				Donuts: 1u sugar + 1 pastry base

				Fries: Process potato.

			"}

/obj/item/weapon/book/manual/barman_recipes
	name = "Barman Recipes"
	icon_state = "barbook"
	author = "Sir John Rose"
	title = "Barman Recipes"
	dat = {"

Drinks for dummies

				Heres a guide for some basic drinks.

Manly Dorf:

				Mix ale and beer into a glass.

Grog:

				Mix rum and water into a glass.

Black Russian:

				Mix vodka and kahlua into a glass.

Irish Cream:

				Mix cream and whiskey into a glass.

Screwdriver:

				Mix vodka and orange juice into a glass.

Cafe Latte:

				Mix milk and coffee into a glass.

Mead:

				Mix Enzyme, water and sugar into a glass.

Gin Tonic:

				Mix gin and tonic into a glass.

Classic Martini:

				Mix vermouth and gin into a glass.

			"}

/obj/item/weapon/book/manual/detective
	name = "The Film Noir: Proper Procedures for Investigations"
	icon_state ="bookDetective"
	author = "Nanotrasen"
	title = "The Film Noir: Proper Procedures for Investigations"
	dat = {"

Detective Work

			Between your bouts of self-narration, and drinking whiskey on the rocks, you might get a case or two to solve.

			To have the best chance to solve your case, follow these directions:

Go to the crime scene.

Take your scanner and scan EVERYTHING (Yes, the doors, the tables, even the dog.)

Once you are reasonably certain you have every scrap of evidence you can use, find all possible entry points and scan them, too.

Return to your office.

Using your forensic scanning computer, scan your Scanner to upload all of your evidence into the database.

Browse through the resulting dossiers, looking for the one that either has the most complete set of prints, or the most suspicious items handled.

If you have 80% or more of the print (The print is displayed) go to step 10, otherwise continue to step 8.

Look for clues from the suit fibres you found on your perp, and go about looking for more evidence with this new information, scanning as you go.

Try to get a fingerprint card of your perp, as if used in the computer, the prints will be completed on their dossier.

Assuming you have enough of a print to see it, grab the biggest complete piece of the print and search the security records for it.

Since you now have both your dossier and the name of the person, print both out as evidence, and get security to nab your baddie.

Give yourself a pat on the back and a bottle of the ships finest vodka, you did it!

			It really is that easy! Good luck!

			"}

/obj/item/weapon/book/manual/nuclear
	name = "Fission Mailed: Nuclear Sabotage 101"
	icon_state ="bookNuclear"
	author = "Syndicate"
	title = "Fission Mailed: Nuclear Sabotage 101"
	dat = {"
			Nuclear Explosives 101:

			Hello and thank you for choosing the Syndicate for your nuclear information needs.

			Today's crash course will deal with the operation of a Fusion Class Nanotrasen made Nuclear Device.

			First and foremost, DO NOT TOUCH ANYTHING UNTIL THE BOMB IS IN PLACE.

			Pressing any button on the compacted bomb will cause it to extend and bolt itself into place.

			If this is done to unbolt it one must completely log in which at this time may not be possible.

			To make the nuclear device functional:

Place the nuclear device in the designated detonation zone.

Extend and anchor the nuclear device from its interface.

Insert the nuclear authorisation disk into slot.

Type numeric authorisation code into the keypad. This should have been provided. Note: If you make a mistake press R to reset the device.

Press the E button to log onto the device.

			You now have activated the device. To deactivate the buttons at anytime for example when you've already prepped the bomb for detonation	remove the auth disk OR press the R on the keypad.

			Now the bomb CAN ONLY be detonated using the timer. Manual detonation is not an option.

			Note: Nanotrasen is a pain in the neck.

			Toggle off the SAFETY.

			Note: You wouldn't believe how many Syndicate Operatives with doctorates have forgotten this step.

			So use the - - and + + to set a det time between 5 seconds and 10 minutes.

			Then press the timer toggle button to start the countdown.

			Now remove the auth. disk so that the buttons deactivate.

			Note: THE BOMB IS STILL SET AND WILL DETONATE

			Now before you remove the disk if you need to move the bomb you can:

			Toggle off the anchor, move it, and re-anchor.

			Good luck. Remember the order:

			Disk, Code, Safety, Timer, Disk, RUN!

			Intelligence Analysts believe that normal Nanotrasen procedure is for the Captain to secure the nuclear authorisation disk.

			Good luck!
			"}

// Wiki books that are linked to the configured wiki link.

// A book that links to the wiki
/obj/item/weapon/book/manual/wiki
	var/page_link = ""
	window_size = "970x710"

/obj/item/weapon/book/manual/wiki/attack_self()
	if(!dat)
		initialize_wikibook()
	..()

/obj/item/weapon/book/manual/wiki/proc/initialize_wikibook()
	if(config.wikiurl)
		dat = {"

You start skimming through the manual...

			"}

/obj/item/weapon/book/manual/wiki/engineering_construction
	name = "Station Repairs and Construction"
	icon_state ="bookEngineering"
	author = "Engineering Encyclopedia"
	title = "Station Repairs and Construction"
	page_link = "Guide_to_construction"

/obj/item/weapon/book/manual/wiki/engineering_guide
	name = "Engineering Textbook"
	icon_state ="bookEngineering2"
	author = "Engineering Encyclopedia"
	title = "Engineering Textbook"
	page_link = "Guide_to_engineering"

/obj/item/weapon/book/manual/wiki/security_space_law
	name = "Space Law"
	desc = "A set of Nanotrasen guidelines for keeping law and order on their space stations."
	icon_state = "bookSpaceLaw"
	author = "Nanotrasen"
	title = "Space Law"
	page_link = "Space_Law"

/obj/item/weapon/book/manual/wiki/infections
	name = "Infections - Making your own pandemic!"
	icon_state = "bookInfections"
	author = "Infections Encyclopedia"
	title = "Infections - Making your own pandemic!"
	page_link = "Infections"

/obj/item/weapon/book/manual/wiki/telescience
	name = "Teleportation Science - Bluespace for dummies!"
	icon_state = "book7"
	author = "University of Bluespace"
	title = "Teleportation Science - Bluespace for dummies!"
	page_link = "Guide_to_telescience"

/obj/item/weapon/book/manual/wiki/engineering_hacking
	name = "Hacking"
	icon_state ="bookHacking"
	author = "Engineering Encyclopedia"
	title = "Hacking"
	page_link = "Hacking"


code:
/obj/item/weapon/melee/energy
	var/active = 0
	var/force_on = 30 //force when active
	var/throwforce_on = 20
	var/icon_state_on = "axe1"
	var/attack_verb_on = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
	w_class = 2
	var/w_class_on = 4

/obj/item/weapon/melee/energy/suicide_act(mob/user)
	user.visible_message(pick("[user] is slitting \his stomach open with the [src.name]! It looks like \he's trying to commit seppuku.", \
						"[user] is falling on the [src.name]! It looks like \he's trying to commit suicide."))
	return (BRUTELOSS|FIRELOSS)

/obj/item/weapon/melee/energy/rejects_blood()
	return 1

/obj/item/weapon/melee/energy/axe
	name = "energy axe"
	desc = "An energised battle axe."
	icon_state = "axe0"
	force = 40.0
	force_on = 150
	throwforce = 25
	throwforce_on = 30
	hitsound = 'sound/weapons/bladeslice.ogg'
	throw_speed = 3
	throw_range = 5
	w_class = 3
	w_class_on = 5
	flags = CONDUCT | NOSHIELD
	origin_tech = "combat=3"
	attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut")
	attack_verb_on = null

/obj/item/weapon/melee/energy/axe/suicide_act(mob/user)
	user.visible_message("[user] swings the [src.name] towards /his head! It looks like \he's trying to commit suicide.")
	return (BRUTELOSS|FIRELOSS)

/obj/item/weapon/melee/energy/sword
	name = "energy sword"
	desc = "May the force be within you."
	icon_state = "sword0"
	force = 3.0
	throwforce = 5.0
	hitsound = "swing_hit" //it starts deactivated
	throw_speed = 3
	throw_range = 5
	flags = NOSHIELD
	attack_verb = null
	origin_tech = "magnets=3;syndicate=4"
	var/hacked = 0

/obj/item/weapon/melee/energy/sword/New()
	if(item_color == null)
		item_color = pick("red", "blue", "green", "purple")

/obj/item/weapon/melee/energy/sword/IsShield()
	if(active)
		return 1
	return 0

/obj/item/weapon/melee/energy/attack_self(mob/living/carbon/user)
	if(user.disabilities & CLUMSY && prob(50))
		user << "You accidentally cut yourself with [src], like a doofus!"
		user.take_organ_damage(5,5)
	active = !active
	if (active)
		force = force_on
		throwforce = throwforce_on
		hitsound = 'sound/weapons/blade1.ogg'
		if(attack_verb_on)
			attack_verb = attack_verb_on
		if(!item_color)
			icon_state = icon_state_on
		else
			icon_state = "sword[item_color]"
		w_class = w_class_on
		playsound(user, 'sound/weapons/saberon.ogg', 35, 1) //changed it from 50% volume to 35% because deafness
		user << "[src] is now active."
	else
		force = initial(force)
		throwforce = initial(throwforce)
		hitsound = initial(hitsound)
		attack_verb = initial(attack_verb)
		icon_state = initial(icon_state)
		w_class = initial(w_class)
		playsound(user, 'sound/weapons/saberoff.ogg', 35, 1)  //changed it from 50% volume to 35% because deafness
		user << "[src] can now be concealed."
	add_fingerprint(user)
	return

/obj/item/weapon/melee/energy/sword/cyborg
	var/hitcost = 500

/obj/item/weapon/melee/energy/sword/cyborg/attack(mob/M, var/mob/living/silicon/robot/R)
	if(R.cell)
		var/obj/item/weapon/stock_parts/cell/C = R.cell
		if(active && !(C.use(hitcost)))
			attack_self(R)
			R << "It's out of charge!"
			return
		..()
	return

/obj/item/weapon/melee/energy/sword/saber

/obj/item/weapon/melee/energy/sword/saber/blue
	item_color = "blue"

/obj/item/weapon/melee/energy/sword/saber/purple
	item_color = "purple"

/obj/item/weapon/melee/energy/sword/saber/green
	item_color = "green"

/obj/item/weapon/melee/energy/sword/saber/red
	item_color = "red"

/obj/item/weapon/melee/energy/sword/saber/attackby(obj/item/weapon/W, mob/living/user, params)
	..()
	if(istype(W, /obj/item/weapon/melee/energy/sword/saber))
		if(W == src)
			user << "You try to attach the end of the energy sword to... itself. You're not very smart, are you?"
			if(ishuman(user))
				user.adjustBrainLoss(10)
		else
			user << "You attach the ends of the two energy swords, making a single double-bladed weapon! You're cool."
			var/obj/item/weapon/twohanded/dualsaber/newSaber = new /obj/item/weapon/twohanded/dualsaber(user.loc)
			if(src.hacked) // That's right, we'll only check the "original" esword.
				newSaber.hacked = 1
				newSaber.item_color = "rainbow"
			user.unEquip(W)
			user.unEquip(src)
			qdel(W)
			qdel(src)
			user.put_in_hands(newSaber)
	else if(istype(W, /obj/item/device/multitool))
		if(hacked == 0)
			hacked = 1
			item_color = "rainbow"
			user << "RNBW_ENGAGE"

			if(active)
				icon_state = "swordrainbow"
				// Updating overlays, copied from welder code.
				// I tried calling attack_self twice, which looked cool, except it somehow didn't update the overlays!!
				if(user.r_hand == src)
					user.update_inv_r_hand(0)
				else if(user.l_hand == src)
					user.update_inv_l_hand(0)

		else
			user << "It's already fabulous!"

/obj/item/weapon/melee/energy/sword/pirate
	name = "energy cutlass"
	desc = "Arrrr matey."
	icon_state = "cutlass0"
	icon_state_on = "cutlass1"

/obj/item/weapon/melee/energy/sword/pirate/New()
	return

/obj/item/weapon/melee/energy/blade
	name = "energy blade"
	desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal."
	icon_state = "blade"
	force = 30	//Normal attacks deal esword damage
	hitsound = 'sound/weapons/blade1.ogg'
	active = 1
	throwforce = 1//Throwing or dropping the item deletes it.
	throw_speed = 3
	throw_range = 1
	w_class = 4.0//So you can't hide it in your pocket or some such.
	flags = NOSHIELD
	var/datum/effect/effect/system/spark_spread/spark_system

//Most of the other special functions are handled in their own files. aka special snowflake code so kewl
/obj/item/weapon/melee/energy/blade/New()
	spark_system = new /datum/effect/effect/system/spark_spread()
	spark_system.set_up(5, 0, src)
	spark_system.attach(src)

/obj/item/weapon/melee/energy/blade/dropped()
	qdel(src)

/obj/item/weapon/melee/energy/blade/attack_self(mob/user)
	return


code:
/obj/item/weapon/melee/chainofcommand
	name = "chain of command"
	desc = "A tool used by great men to placate the frothing masses."
	icon_state = "chain"
	item_state = "chain"
	flags = CONDUCT
	slot_flags = SLOT_BELT
	force = 10
	throwforce = 7
	w_class = 3
	origin_tech = "combat=4"
	attack_verb = list("flogged", "whipped", "lashed", "disciplined")
	hitsound = 'sound/weapons/slash.ogg' //pls replace

/obj/item/weapon/melee/chainofcommand/suicide_act(mob/user)
		user.visible_message("[user] is strangling \himself with the [src.name]! It looks like \he's trying to commit suicide.")
		return (OXYLOSS)

/obj/item/weapon/melee/classic_baton
	name = "police baton"
	desc = "A wooden truncheon for beating criminal scum."
	icon = 'icons/obj/weapons.dmi'
	icon_state = "baton"
	item_state = "classic_baton"
	slot_flags = SLOT_BELT
	force = 12 //9 hit crit
	w_class = 3
	var/cooldown = 0
	var/on = 1

/obj/item/weapon/melee/classic_baton/attack(mob/target as mob, mob/living/user as mob)
	if(on)
		add_fingerprint(user)
		if((CLUMSY in user.disabilities) && prob(50))
			user << "You club yourself over the head."
			user.Weaken(3 * force)
			if(ishuman(user))
				var/mob/living/carbon/human/H = user
				H.apply_damage(2*force, BRUTE, "head")
			else
				user.take_organ_damage(2*force)
			return
		if(isrobot(target))
			..()
			return
		if(!isliving(target))
			return
		if (user.a_intent == "harm")
			if(!..()) return
			if(!isrobot(target)) return
		else
			if(cooldown <= 0)
				playsound(get_turf(src), 'sound/effects/woodhit.ogg', 75, 1, -1)
				target.Weaken(3)
				add_logs(user, target, "stunned", object="classic baton")
				src.add_fingerprint(user)
				target.visible_message("[user] has knocked down [target] with \the [src]!", \
					"[user] has knocked down [target] with \the [src]!")
				if(!iscarbon(user))
					target.LAssailant = null
				else
					target.LAssailant = user
				cooldown = 1
				spawn(40)
					cooldown = 0
		return
	else
		return ..()

/obj/item/weapon/melee/classic_baton/telescopic
	name = "telescopic baton"
	desc = "A compact yet robust personal defense weapon. Can be concealed when folded."
	icon = 'icons/obj/weapons.dmi'
	icon_state = "telebaton_0"
	item_state = null
	slot_flags = SLOT_BELT
	w_class = 2
	force = 0
	on = 0

/obj/item/weapon/melee/classic_baton/telescopic/attack_self(mob/user as mob)
	on = !on
	if(on)
		user << "You extend the baton."
		icon_state = "telebaton_1"
		item_state = "nullrod"
		w_class = 4 //doesnt fit in backpack when its on for balance
		force = 10 //stunbaton damage
		attack_verb = list("smacked", "struck", "cracked", "beaten")
	else
		user << "You collapse the baton."
		icon_state = "telebaton_0"
		item_state = null //no sprite for concealment even when in hand
		slot_flags = SLOT_BELT
		w_class = 2
		force = 0 //not so robust now
		attack_verb = list("hit", "poked")

	playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, 1)
	add_fingerprint(user)


code:
/obj/item/weapon/mop
	desc = "The world of janitalia wouldn't be complete without a mop."
	name = "mop"
	icon = 'icons/obj/janitor.dmi'
	icon_state = "mop"
	force = 3.0
	throwforce = 5.0
	throw_speed = 3
	throw_range = 7
	w_class = 3.0
	attack_verb = list("mopped", "bashed", "bludgeoned", "whacked")
	var/mopping = 0
	var/mopcount = 0
	var/mopcap = 5
	var/mopspeed = 30

/obj/item/weapon/mop/New()
	create_reagents(mopcap)

obj/item/weapon/mop/proc/clean(turf/simulated/A)
	if(reagents.has_reagent("water", 1) || reagents.has_reagent("holywater", 1))
		A.clean_blood()
		var/turf/simulated/floor/F = A
		F.dirt = 0
		for(var/obj/effect/O in A)
			if(istype(O,/obj/effect/decal/cleanable) || istype(O,/obj/effect/overlay))
				qdel(O)
	reagents.reaction(A, TOUCH, 10)	//10 is the multiplier for the reaction effect. probably needed to wet the floor properly.
	reagents.remove_any(1)			//reaction() doesn't use up the reagents

/obj/item/weapon/mop/afterattack(atom/A, mob/user, proximity)
	if(!proximity) return

	if(reagents.total_volume < 1)
		user << "Your mop is dry!"
		return

	var/turf/simulated/turf = A
	if(istype(A, /obj/effect/rune) || istype(A, /obj/effect/decal/cleanable) || istype(A, /obj/effect/overlay))
		turf = A.loc
	A = null

	if(istype(turf))
		user.visible_message("[user] begins to clean \the [turf] with [src].")

		if(do_after(user, mopspeed))
			clean(turf)
			user << "You have finished mopping!"

/obj/effect/attackby(obj/item/I, mob/user, params)
	if(istype(I, /obj/item/weapon/mop) || istype(I, /obj/item/weapon/soap))
		return
	..()

/obj/item/weapon/mop/proc/janicart_insert(mob/user, obj/structure/janitorialcart/J)
	J.put_in_cart(src, user)
	J.mymop=src
	J.update_icon()

/obj/item/weapon/mop/cyborg

/obj/item/weapon/mop/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J)
	return