code:
//This was modified a lot, enough for modularization to make sense
/mob/ClickOn( atom/A, params )
	if(world.time <= next_click)
		return
	next_click = world.time + 1

	if(check_click_intercept(params,A))
		return

	if(notransform)
		return

	if(SEND_SIGNAL(src, COMSIG_MOB_CLICKON, A, params) & COMSIG_MOB_CANCEL_CLICKON)
		return
	var/list/modifiers = params2list(params)
	if(LAZYACCESS(modifiers, SHIFT_CLICK))
		if(LAZYACCESS(modifiers, MIDDLE_CLICK))
			ShiftMiddleClickOn(A)
			return
		if(LAZYACCESS(modifiers, CTRL_CLICK))
			CtrlShiftClickOn(A)
			return
		ShiftClickOn(A)
		return
	if(LAZYACCESS(modifiers, MIDDLE_CLICK))
		MiddleClickOn(A, params)
		return
	if(LAZYACCESS(modifiers, ALT_CLICK)) // alt and alt-gr (rightalt)
		if(LAZYACCESS(modifiers, RIGHT_CLICK))
			alt_click_on_secondary(A)
		else
			AltClickOn(A)
		return
	if(LAZYACCESS(modifiers, CTRL_CLICK))
		CtrlClickOn(A)
		return

	if(incapacitated(ignore_restraints = TRUE, ignore_stasis = TRUE))
		return

	face_atom(A)

	if(next_move > world.time) // in the year 2000...
		//spam prevention
		if(!(world.time % 3))
			to_chat(src, click_fail_msg())
		return

	if(!LAZYACCESS(modifiers, "catcher") && A.IsObscured())
		return

	if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
		changeNext_move(CLICK_CD_HANDCUFFED)   //Doing shit in cuffs shall be vey slow
		UnarmedAttack(A, FALSE, modifiers)
		return

	if(throw_mode)
		changeNext_move(CLICK_CD_THROW)
		throw_item(A)
		return

	var/obj/item/W = get_active_held_item()

	if(W == A)
		if(LAZYACCESS(modifiers, RIGHT_CLICK))
			W.attack_self_secondary(src, modifiers)
			update_inv_hands()
			return
		else
			W.attack_self(src, modifiers)
			update_inv_hands()
			return

	//These are always reachable.
	//User itself, current loc, and user inventory
	var/obj/item/atom_item
	if(isitem(A))
		atom_item = A
	if((A in DirectAccess()) || (atom_item?.stored_in && (atom_item.stored_in in DirectAccess()) ) )
		if(W)
			W.melee_attack_chain(src, A, params)
		else
			if(ismob(A))
				changeNext_move(CLICK_CD_MELEE)
			UnarmedAttack(A, FALSE, modifiers)
		return

	//Can't reach anything else in lockers or other weirdness
	if(!loc.AllowClick())
		return

	//Standard reach turf to turf or reaching inside storage
	if(CanReach(A,W) || (atom_item?.stored_in && CanReach(atom_item.stored_in, W)) )
		if(W)
			W.melee_attack_chain(src, A, params)
		else
			if(ismob(A))
				changeNext_move(CLICK_CD_MELEE)
			UnarmedAttack(A,1,modifiers)
	else
		if(W)
			if(LAZYACCESS(modifiers, RIGHT_CLICK))
				var/after_attack_secondary_result = W.afterattack_secondary(A, src, FALSE, params)

				if(after_attack_secondary_result == SECONDARY_ATTACK_CALL_NORMAL)
					W.afterattack(A, src, FALSE, params)
			else
				W.afterattack(A,src,0,params)
		else
			if(LAZYACCESS(modifiers, RIGHT_CLICK))
				ranged_secondary_attack(A, modifiers)
			else
				RangedAttack(A,modifiers)

/atom/proc/MiddleClick(mob/user)
	if(SEND_SIGNAL(src, COMSIG_CLICK_MIDDLE, user) & COMPONENT_CANCEL_CLICK_MIDDLE)
		return TRUE
	if(user.incapacitated(ignore_restraints = TRUE, ignore_stasis = TRUE))
		return
	if(user.next_move > world.time)
		to_chat(src, click_fail_msg())
		return
	if(isliving(user))
		var/obj/item/atom_item
		if(isitem(src))
			atom_item = src
		var/mob/living/living_user = user
		var/canreach = FALSE
		if((src in living_user.DirectAccess()) || (atom_item?.stored_in && (atom_item.stored_in in living_user.DirectAccess()) ) )
			canreach = TRUE
		else if(living_user.CanReach(src) || (atom_item?.stored_in && living_user.CanReach(atom_item.stored_in)) )
			canreach = TRUE
		switch(living_user.special_attack)
			if(SPECIAL_ATK_BITE)
				if(canreach)
					if(ismob(src))
						user.changeNext_move(CLICK_CD_MELEE)
					return user.UnarmedJaw(src, TRUE)
			if(SPECIAL_ATK_KICK)
				if(canreach)
					if(ismob(src))
						user.changeNext_move(CLICK_CD_MELEE)
					return user.UnarmedFoot(src, TRUE)
			if(SPECIAL_ATK_JUMP)
				user.changeNext_move(CLICK_CD_JUMP)
				return user.MiddleClickJump(src, canreach)
			else
				if(ismob(src))
					user.changeNext_move(CLICK_CD_MELEE)
				if(iscarbon(src) && user.get_active_held_item())
					var/static/list/middleclick_steps = list(/datum/surgery_step/incise, /datum/surgery_step/mechanic_incise, /datum/surgery_step/dissect)
					for(var/datum/surgery_step/step as anything in GLOB.surgery_steps)
						if(!(step.type in middleclick_steps))
							continue
						if(step.try_op(user, src, user.zone_selected, user.get_active_held_item()))
							return TRUE


code:
/atom/movable/screen/fullscreen
	screen_loc = ui_middleofscreen

/atom/movable/screen/fullscreen/update_for_view(client_view)
	if(((screen_loc == "CENTER-7,CENTER-7") || (screen_loc == ui_middleofscreen)) && view != client_view)
		var/list/actualview = getviewsize(client_view)
		view = client_view
		if(client_view=="22x16")
			transform = matrix((actualview[1]-2)/FULLSCREEN_OVERLAY_RESOLUTION_X, 0, 0, 0, (actualview[2]-1)/FULLSCREEN_OVERLAY_RESOLUTION_Y, 0)
		else
			transform = matrix(actualview[1]/FULLSCREEN_OVERLAY_RESOLUTION_X, 0, 0, 0, actualview[2]/FULLSCREEN_OVERLAY_RESOLUTION_Y, 0)

repo_name: AnalWerewolf/sundown

license: mit


code:
/datum/hud
	var/atom/movable/screen/fullscreen/noise/noise
	var/atom/movable/screen/sadness/sadness
	var/atom/movable/screen/fullscreen/pain_flash/pain_flash
	var/atom/movable/screen/fov_holder/fov_holder
	var/atom/movable/screen/stats/stat_viewer
	var/atom/movable/screen/lookup/lookup
	var/atom/movable/screen/lookdown/lookdown
	var/atom/movable/screen/surrender/surrender
	var/atom/movable/screen/pressure/pressure
	var/atom/movable/screen/nutrition/nutrition
	var/atom/movable/screen/hydration/hydration
	var/atom/movable/screen/temperature/temperature
	var/atom/movable/screen/bodytemperature/bodytemperature
	var/atom/movable/screen/fixeye/fixeye
	var/atom/movable/screen/human/pain/pain_guy
	var/atom/movable/screen/breath/breath
	var/atom/movable/screen/fatigue/fatigue
	var/atom/movable/screen/bookmark/bookmark
	var/atom/movable/screen/human/equip
	var/atom/movable/screen/swap_hand/swap_hand
	var/atom/movable/screen/info/info_button
	var/atom/movable/screen/combat_style/combat_style
	var/atom/movable/screen/intent_select/intents
	var/atom/movable/screen/dodge_parry/dodge_parry
	var/atom/movable/screen/special_attack/special_attack
	var/atom/movable/screen/sleeping/sleeping
	var/atom/movable/screen/teach/teach
	var/atom/movable/screen/wield/wield
	var/atom/movable/screen/sprint/sprint
	var/atom/movable/screen/mov_intent/mov_intent
	var/atom/movable/screen/enhanced_sel/enhanced_sel
	var/atom/movable/screen/filler/filler

	var/upper_inventory_shown = FALSE
	var/list/upper_inventory = list()

	var/uses_film_grain = TRUE

/datum/hud/New(mob/owner)
	. = ..()
	if(uses_film_grain && (!owner?.client || owner.client?.prefs?.read_preference(/datum/preference/toggle/filmgrain)))
		noise = new()
		noise.hud = src
		screenoverlays |= noise
		noise.update_appearance()
	sadness = new()
	sadness.hud = src
	screenoverlays |= sadness
	pain_flash = new()
	pain_flash.hud = src
	screenoverlays |= pain_flash

/datum/hud/show_hud(version, mob/viewmob)
	. = ..()
	var/mob/screenmob = viewmob || mymob
	if(noise)
		screenmob.client?.screen |= noise
	if(pain_flash)
		screenmob.client?.screen |= pain_flash
	if(sadness)
		screenmob.client?.screen |= sadness
	if(fov_holder)
		screenmob.client?.screen |= fov_holder


code:
/datum/hud/new_player
	uses_film_grain = FALSE

/datum/hud/new_player/New(mob/owner)
	. = ..()
	for(var/atom/movable/screen/lobby/button/button in static_inventory)
		if(!button.enabled)
			button.update_appearance(UPDATE_ICON)

INITIALIZE_IMMEDIATE(/atom/movable/screen/lobby)

/atom/movable/screen/lobby/button
	var/highlight_eyeball = TRUE
	var/image/eyeball_image
	var/eyeball_scale_x = 0.32
	var/eyeball_scale_y = 0.32
	var/eyeball_pixel_x = 80
	var/eyeball_pixel_y = -22
	var/static/sound/click_sound = sound('modular_septic/sound/effects/postalclick.wav', FALSE, 0, CHANNEL_CLICKITY_CLACK, 150)

/atom/movable/screen/lobby/button/Initialize(mapload)
	. = ..()
	if(highlight_eyeball && !eyeball_image)
		eyeball_image = image('modular_septic/icons/hud/lobby/eyeball.dmi', "eyeball")
		eyeball_image.transform = eyeball_image.transform.Scale(eyeball_scale_x, eyeball_scale_y)
		eyeball_image.pixel_x = eyeball_pixel_x
		eyeball_image.pixel_y = eyeball_pixel_y

/atom/movable/screen/lobby/button/update_overlays()
	. = ..()
	if(enabled && highlighted && highlight_eyeball && eyeball_image)
		. += eyeball_image

/atom/movable/screen/lobby/button/MouseEntered(location, control, params)
	. = ..()
	if(highlight_eyeball)
		update_appearance(UPDATE_OVERLAYS)

/atom/movable/screen/lobby/button/MouseExited(location, control, params)
	. = ..()
	if(highlight_eyeball)
		update_appearance(UPDATE_OVERLAYS)

/atom/movable/screen/lobby/button/Click(location, control, params)
	. = ..()
	if(usr.client && click_sound)
		SEND_SOUND(usr.client, click_sound)

/atom/movable/screen/lobby/background
	icon = 'modular_septic/icons/hud/lobby/title.dmi'
	icon_state = "title"
	screen_loc = "SOUTH+10,CENTER:-120"

/atom/movable/screen/lobby/button/character_setup
	icon = 'modular_septic/icons/hud/lobby/character_setup.dmi'
	screen_loc = "SOUTH+8:-6,CENTER:-54"

/atom/movable/screen/lobby/button/settings
	icon = 'modular_septic/icons/hud/lobby/settings.dmi'
	screen_loc = "SOUTH+6:-6,CENTER:-54"

/atom/movable/screen/lobby/button/ready
	icon = 'modular_septic/icons/hud/lobby/ready.dmi'
	screen_loc = "SOUTH+4:-6,CENTER:-54"

/atom/movable/screen/lobby/button/join
	icon = 'modular_septic/icons/hud/lobby/join.dmi'
	screen_loc = "SOUTH+4:-6,CENTER:-54"

/atom/movable/screen/lobby/button/observe
	icon = 'modular_septic/icons/hud/lobby/observe.dmi'
	screen_loc = "SOUTH+2:-6,CENTER:-54"

/atom/movable/screen/lobby/button/crew_manifest
	icon = 'modular_septic/icons/hud/lobby/crew_manifest_small.dmi'
	screen_loc = "SOUTH+2:-24,CENTER:8"
	highlight_eyeball = FALSE

/atom/movable/screen/lobby/button/changelog_button
	enabled = FALSE
	highlight_eyeball = FALSE

/atom/movable/screen/lobby/button/poll
	enabled = FALSE
	highlight_eyeball = FALSE


code:
/atom/movable/screen/plane_master/openspace
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT

/atom/movable/screen/plane_master/game_world/backdrop(mob/mymob)
	. = ..()
	remove_filter("AO")
	remove_filter("AO2")
	if(istype(mymob) && mymob.client?.prefs.read_preference(/datum/preference/toggle/ambient_occlusion))
		add_filter("AO", 1, GENERAL_AMBIENT_OCCLUSION1)
		add_filter("AO2", 2, GENERAL_AMBIENT_OCCLUSION2)

/// Contains mobs and things that should be rendered along with mobs
/atom/movable/screen/plane_master/mobs
	name = "mob plane master"
	plane = MOB_PLANE
	appearance_flags = PLANE_MASTER //should use client color
	blend_mode = BLEND_OVERLAY
	render_relay_plane = RENDER_PLANE_GAME

/atom/movable/screen/plane_master/mobs/Initialize(mapload)
	. = ..()
	add_filter("VC", 100, list(type="alpha", render_source=FIELD_OF_VISION_MASK_RENDER_TARGET, flags=MASK_INVERSE))

/atom/movable/screen/plane_master/mobs/backdrop(mob/mymob)
	. = ..()
	remove_filter("AO")
	remove_filter("AO2")
	if(istype(mymob) && mymob.client?.prefs.read_preference(/datum/preference/toggle/ambient_occlusion))
		add_filter("AO", 1, MOB_AMBIENT_OCCLUSION1)
		add_filter("AO2", 2, MOB_AMBIENT_OCCLUSION2)

/atom/movable/screen/plane_master/over_mob
	name = "over mob plane master"
	plane = OVER_MOB_PLANE
	appearance_flags = PLANE_MASTER //should use client color
	blend_mode = BLEND_OVERLAY
	render_relay_plane = RENDER_PLANE_GAME

/atom/movable/screen/plane_master/over_mob/backdrop(mob/mymob)
	. = ..()
	remove_filter("AO")
	remove_filter("AO2")
	if(istype(mymob) && mymob.client?.prefs.read_preference(/datum/preference/toggle/ambient_occlusion))
		add_filter("AO", 1, GENERAL_AMBIENT_OCCLUSION1)
		add_filter("AO2", 2, GENERAL_AMBIENT_OCCLUSION2)

/atom/movable/screen/plane_master/pollution
	name = "pollution plane master"
	plane = POLLUTION_PLANE
	appearance_flags = PLANE_MASTER //should use client color
	blend_mode = BLEND_OVERLAY
	render_relay_plane = RENDER_PLANE_GAME
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT

/// Used to display the owner and its adjacent surroundings through the FoV plane mask.
/atom/movable/screen/plane_master/field_of_vision_blocker
	name = "field of vision blocker plane master"
	plane = FIELD_OF_VISION_BLOCKER_PLANE
	render_target = FIELD_OF_VISION_BLOCKER_RENDER_TARGET
	blend_mode = BLEND_OVERLAY
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT
	render_relay_plane = null

/// Contains all shadow cone masks, whose image overrides are displayed only to their respective owners.
/atom/movable/screen/plane_master/field_of_vision_mask
	name = "field of vision mask plane master"
	plane = FIELD_OF_VISION_MASK_PLANE
	render_target = FIELD_OF_VISION_MASK_RENDER_TARGET
	blend_mode = BLEND_OVERLAY
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT
	render_relay_plane = null

/atom/movable/screen/plane_master/field_of_vision_mask/Initialize()
	. = ..()
	add_filter("VC", 100, list(type="alpha", render_source=FIELD_OF_VISION_BLOCKER_RENDER_TARGET, flags=MASK_INVERSE))

/// Stores the visible FoV shadow cone
/atom/movable/screen/plane_master/field_of_vision_visual
	name = "field of vision visual plane master"
	plane = FIELD_OF_VISION_VISUAL_PLANE
	render_target = FIELD_OF_VISION_VISUAL_RENDER_TARGET
	appearance_flags = PLANE_MASTER //should use client color
	blend_mode = BLEND_OVERLAY
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT
	render_relay_plane = RENDER_PLANE_GAME

/atom/movable/screen/plane_master/runechat/backdrop(mob/mymob)
	. = ..()
	remove_filter("AO")
	if(istype(mymob) && mymob.client?.prefs.read_preference(/datum/preference/toggle/ambient_occlusion))
		add_filter("AO", 1, RUNECHAT_AMBIENT_OCCLUSION1)


code:
/atom/movable/plane_master_controller/game
	name = PLANE_MASTERS_GAME
	controlled_planes = list(
		FLOOR_PLANE,
		GAME_PLANE,
		MOB_PLANE,
		OVER_MOB_PLANE,
		POLLUTION_PLANE,
		FIELD_OF_VISION_BLOCKER_PLANE,
		FIELD_OF_VISION_MASK_PLANE,
		FIELD_OF_VISION_VISUAL_PLANE,
		AREA_PLANE,
		MASSIVE_OBJ_PLANE,
		GHOST_PLANE,
		POINT_PLANE,
		LIGHTING_PLANE,
		O_LIGHTING_VISUAL_PLANE,
	)


code:
/atom/movable/screen
	screentip_flags = SCREENTIP_ON_MOUSE_ENTERED|SCREENTIP_ON_MOUSE_CLICK

//also terrible
/atom/movable/screen/Click(location, control, params)
	if(flags_1 & INITIALIZED_1)
		SEND_SIGNAL(src, COMSIG_CLICK, location, control, params, usr)
	// Screentips
	if(screentip_flags & SCREENTIP_ON_MOUSE_CLICK)
		// This is VERY dumb
		addtimer(CALLBACK(src, .proc/update_screentip, usr, params, SCREENTIP_ON_MOUSE_CLICK), 1)

//terrible but it has to be done like this, i guess
/atom/movable/screen/examine_more(mob/user)
	SEND_SIGNAL(src, COMSIG_PARENT_EXAMINE_MORE, user, .)
	return list()

//would be very weird if examining a hud object showed up in chat...
/atom/movable/screen/on_examined_check()
	return FALSE


code:
#define AB_MAX_ROWS 12

/atom/movable/screen/movable/action_button
	layer = 3 //above rack and alerts

/atom/movable/screen/movable/action_button/hide_toggle
	hide_icon = 'modular_septic/icons/hud/quake/actions.dmi'

/datum/hud/ButtonNumberToScreenCoords(number)
	number -= 1
	var/col = -(1 + FLOOR(number/AB_MAX_ROWS, 1))
	var/row = 4+(number%AB_MAX_ROWS)
	var/coord_col = "[col >= 0 ? "+[abs(col)]" : "-[abs(col)]"]" //"Default" is EAST-1
	var/coord_row = "+[abs(row)]" //"Default" is SOUTH+4
	return "EAST[coord_col],SOUTH[coord_row]"


code:
/atom/movable/screen/alert
	layer = 2 //above rack, below actions

// Re-render all alerts - also called in /datum/hud/show_hud() because it's needed there
/datum/hud/reorganize_alerts(mob/viewmob)
	var/mob/screenmob = viewmob || mymob
	if(!screenmob.client)
		return
	var/list/alerts = mymob.alerts
	if(!hud_shown)
		for(var/i = 1, i <= alerts.len, i++)
			screenmob.client.screen -= alerts[alerts[i]]
		return TRUE
	for(var/i = 1, i <= alerts.len, i++)
		var/atom/movable/screen/alert/alert = alerts[alerts[i]]
		if(alert.icon_state == "template")
			alert.icon = ui_style
		switch(i)
			if(1)
				. = ui_alert1
			if(2)
				. = ui_alert2
			if(3)
				. = ui_alert3
			if(4)
				. = ui_alert4
			if(5)
				. = ui_alert5
			if(6)
				. = ui_alert6 // Right now there's 5 slots
			else
				. = ""
		alert.screen_loc = .
		screenmob.client.screen |= alert
	if(!viewmob)
		for(var/observer in mymob.observers)
			reorganize_alerts(observer)
	return TRUE

/atom/movable/screen/alert/buckled
	icon = 'modular_septic/icons/hud/quake/screen_alert.dmi'

/atom/movable/screen/alert/cant_breathe
	name = "Choking"
	desc = "C-Can't... b-breathe..."
	icon_state = "not_enough_oxy"

/atom/movable/screen/alert/too_much_tox //yes we have it already but this is totes different
	name = "Toxic Air"
	desc = "Fuck, my nostrils sting!"
	icon_state = "too_much_tox"


code:
/atom/movable/screen/bodytemperature
	name = "body temperature"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "bodytemp2"
	base_icon_state = "bodytemp"
	screen_loc = ui_bodytemperature
	var/temperature_index = 3

/atom/movable/screen/bodytemperature/update_icon_state()
	. = ..()
	icon_state = "[base_icon_state][clamp(CEILING(temperature_index/2, 1), 1, 3)]"

/atom/movable/screen/bodytemperature/Click(location, control, params)
	. = ..()
	switch(temperature_index)
		if(6)
			to_chat(usr, span_userdanger("I'm cooking alive!"))
		if(5)
			to_chat(usr, span_danger("I'm overheating!"))
		if(4)
			to_chat(usr, span_warning("I'm uncomfortably hot."))
		if(3)
			to_chat(usr, span_notice("I'm at a comfortable temperature."))
		if(2)
			to_chat(usr, span_warning("I'm uncomfortably cold."))
		if(1)
			to_chat(usr, span_danger("I'm hypothermic!"))
		if(0)
			to_chat(usr, span_userdanger("I'm freezing!"))

/atom/movable/screen/bodytemperature/proc/update_temperature(new_temp = 3)
	if(temperature_index == new_temp)
		return
	temperature_index = new_temp
	update_appearance()


code:
/atom/movable/screen/bookmark
	name = "toggle upper inventory on"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "bookmark"
	base_icon_state = "bookmark"
	screen_loc = ui_bookmark_off

/atom/movable/screen/bookmark/update_name(updates)
	. = ..()
	name = (hud?.upper_inventory_shown ? "toggle upper inventory off" : "toggle upper inventory on")

/atom/movable/screen/bookmark/Click()
	var/mob/targetmob = usr

	if(isobserver(usr))
		if(ishuman(usr.client.eye) && (usr.client.eye != usr))
			var/mob/M = usr.client.eye
			targetmob = M

	usr.hud_used?.inventory_shown = TRUE
	usr.hud_used?.upper_inventory_shown = !usr.hud_used.upper_inventory_shown
	if(usr.hud_used.upper_inventory_shown && targetmob.hud_used)
		targetmob.client.screen += usr.hud_used.upper_inventory
		screen_loc = ui_bookmark_on
		if(targetmob.client.prefs && !targetmob.client.prefs.read_preference(/datum/preference/toggle/widescreen))
			screen_loc = ui_boxbookmark_on
	else
		targetmob.client.screen -= usr.hud_used.upper_inventory
		screen_loc = ui_bookmark_off

	targetmob.hud_used.hidden_inventory_update(usr)


code:
/atom/movable/screen/breath
	name = "breath"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "breath3"
	base_icon_state = "breath"
	screen_loc = ui_breath
	var/breath_index = 3

/atom/movable/screen/breath/update_icon_state()
	. = ..()
	icon_state = "[base_icon_state][breath_index]"

/atom/movable/screen/breath/Click(location, control, params)
	. = ..()
	var/list/modifiers = params2list(params)
	if(LAZYACCESS(modifiers, SHIFT_CLICK))
		if(HAS_TRAIT_FROM(usr, TRAIT_HOLDING_BREATH, usr))
			to_chat(usr, span_userdanger("I am holding my breath."))
			return
		switch(breath_index)
			if(3)
				to_chat(usr, span_notice("I can breathe just fine."))
			if(2)
				to_chat(usr, span_danger("I am having some difficulty breathing."))
			if(1, 0)
				to_chat(usr, span_userdanger("I can't breathe!"))
	else
		if(HAS_TRAIT_FROM(usr, TRAIT_HOLDING_BREATH, usr))
			REMOVE_TRAIT(usr, TRAIT_HOLDING_BREATH, usr)
			to_chat(usr, span_notice("I stop holding my breath."))
		else
			ADD_TRAIT(usr, TRAIT_HOLDING_BREATH, usr)
			to_chat(usr, span_userdanger("I start holding my breath."))

/atom/movable/screen/breath/proc/update_breath(new_breath = 3)
	if(breath_index == new_breath)
		return
	breath_index = new_breath
	update_appearance()


code:
/atom/movable/screen/combat_style
	name = "combat style"
	icon = 'modular_septic/icons/hud/quake/screen_quake_combat_styles.dmi'
	icon_state = CS_DEFAULT
	screen_loc = ui_combat_style
	var/expanded = FALSE
	var/obj/effect/overlay/combatstyle/style_overlay

/atom/movable/screen/combat_style/Initialize()
	. = ..()
	style_overlay = new()
	style_overlay.owner = src
	style_overlay.pixel_y = pixel_y + 32

/atom/movable/screen/combat_style/Click(location, control, params)
	. = ..()
	var/list/modifiers = params2list(params)
	if(LAZYACCESS(modifiers, SHIFT_CLICK))
		var/mob/living/user = usr
		if(istype(user))
			user.print_combat_style(user.combat_style)
		return
	expanded = !expanded
	update_appearance()

/atom/movable/screen/combat_style/update_icon_state()
	. = ..()
	if(hud?.mymob && isliving(hud.mymob))
		var/mob/living/owner = hud.mymob
		icon_state = owner.combat_style

/atom/movable/screen/combat_style/update_overlays()
	. = ..()
	if(expanded && style_overlay)
		vis_contents += style_overlay
	else
		vis_contents -= style_overlay

/obj/effect/overlay/combatstyle
	name = "combat styles"
	icon = 'modular_septic/icons/hud/quake/screen_quake_combat_style.dmi'
	icon_state = "combat_style"
	anchored = TRUE
	plane = HUD_PLANE
	screentip_flags = SCREENTIP_HOVERER_CLICKER
	var/atom/movable/screen/combat_style/owner

/obj/effect/overlay/combatstyle/Click(location, control, params)
	. = ..()
	var/list/modifiers = params2list(params)
	var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/style = get_style_at(icon_x, icon_y)
	if(LAZYACCESS(modifiers, SHIFT_CLICK))
		var/mob/living/user = usr
		if(istype(user))
			user.print_combat_style(style)
		return
	if(!style)
		owner?.expanded = FALSE
		owner?.update_appearance()
	else
		var/mob/living/carbon/user = usr
		if(istype(user))
			user.switch_combat_style(style)
		owner?.update_appearance()

/obj/effect/overlay/combatstyle/return_screentip(mob/user, params)
	if(flags_1 & NO_SCREENTIPS_1)
		return ""

	var/list/modifiers = params2list(params)
	var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/parsed_style = get_style_at(icon_x, icon_y)
	if(!parsed_style)
		parsed_style = name
	return SCREENTIP_OBJ(uppertext(parsed_style))

/obj/effect/overlay/combatstyle/proc/get_style_at(icon_x, icon_y)
	switch(icon_x)
		if(3 to 30)
			switch(icon_y)
				if(12 to 17)
					return CS_NONE
				if(18 to 23)
					return CS_FEINT
				if(24 to 29)
					return CS_DUAL
				if(30 to 35)
					return CS_GUARD
				if(36 to 41)
					return CS_DEFEND
				if(42 to 47)
					return CS_STRONG
				if(48 to 53)
					return CS_FURY
				if(54 to 59)
					return CS_AIMED
				if(60 to 66)
					return CS_WEAK


code:
/atom/movable/screen/combattoggle
	name = "combat mode on"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "combat_on"
	base_icon_state = "combat"
	screen_loc = ui_combat_toggle

/atom/movable/screen/combattoggle/update_name(updates)
	. = ..()
	var/mob/living/user = hud?.mymob
	if(!istype(user) || !user.client)
		return
	name = (user.combat_mode ? "combat mode off" : "combat mode on")

/atom/movable/screen/combattoggle/update_icon_state()
	. = ..()
	var/mob/living/user = hud?.mymob
	if(!istype(user) || !user.client)
		return
	icon_state = user.combat_mode ? "[base_icon_state]_on" : "[base_icon_state]"


code:
/atom/movable/screen/skills
	name = "skills"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "skills"
	screen_loc = ui_skills

/atom/movable/screen/skills/Click(location, control, params)
	. = ..()
	if(ismob(usr))
		var/list/modifiers = params2list(params)
		var/mob/user = usr
		user.attributes?.print_skills(user, LAZYACCESS(modifiers, SHIFT_CLICK))

/atom/movable/screen/craft
	name = "crafting"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_crafting

/atom/movable/screen/language_menu
	name = "language"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_language_menu

/atom/movable/screen/language_menu/Click(location, control, params)
	. = ..()
	var/list/modifiers = params2list(params)
	var/mob/user = usr
	var/datum/language_holder/holder = user.get_language_holder()
	if(LAZYACCESS(modifiers, SHIFT_CLICK))
		var/datum/language/selected_language = holder.get_selected_language()
		var/selected_language_text = "[initial(selected_language.name)]"
		var/datum/asset/spritesheet/sheet = get_asset_datum(/datum/asset/spritesheet/chat)
		if(initial(selected_language.icon_state))
			selected_language_text = "[sheet.icon_tag("language-[initial(selected_language.icon_state)]")] [selected_language_text]"
		to_chat(user, span_notice("I will speak [selected_language_text] by default."))
	else
		holder.open_language_menu(user)

/atom/movable/screen/area_creator
	name = "area"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_building

/atom/movable/screen/area_creator/Click(location, control, params)
	. = ..()
	if(usr.incapacitated() || (isobserver(usr) && !isAdminGhostAI(usr)))
		return TRUE
	var/list/modifiers = params2list(params)
	var/area/A = get_area(usr)
	if(LAZYACCESS(modifiers, SHIFT_CLICK))
		to_chat(usr, span_notice("I am located at [A.name]."))
	else
		if(!A.outdoors)
			to_chat(usr, span_warning("There is already a defined structure here."))
			return TRUE
		create_area(usr)


code:
/atom/movable/screen/dodge_parry
	name = "dodge/parry toggle"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = DP_PARRY
	screentip_flags = SCREENTIP_HOVERER_CLICKER
	screen_loc = ui_dodge_parry

/atom/movable/screen/dodge_parry/Click(location, control, params)
	. = ..()
	var/mob/living/carbon/user = usr
	if(!istype(user))
		return
	var/list/modifiers = params2list(params)
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/what_we_chose = (icon_y > 16 ? DP_DODGE : DP_PARRY)
	user.toggle_dodge_parry(what_we_chose)
	update_appearance()

/atom/movable/screen/dodge_parry/return_screentip(mob/user, params)
	if(flags_1 & NO_SCREENTIPS_1)
		return ""

	var/list/modifiers = params2list(params)
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/what_we_chose = (icon_y > 16 ? DP_DODGE : DP_PARRY)
	return SCREENTIP_OBJ(uppertext(what_we_chose))

/atom/movable/screen/dodge_parry/update_icon_state()
	. = ..()
	var/mob/living/owner = hud?.mymob
	if(istype(owner) && (owner.dodge_parry == DP_DODGE))
		icon_state = DP_DODGE
	else
		icon_state = DP_PARRY


code:
/atom/movable/screen/drop
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_drop


code:
/atom/movable/screen/enhanced_sel
	name = "enhanced zone"
	icon = 'modular_septic/icons/hud/quake/screen_quake_enhance.dmi'
	icon_state = "enhanced"
	base_icon_state = "enhanced"
	screen_loc = ui_enhancesel
	screentip_flags = SCREENTIP_HOVERER_CLICKER
	var/overlay_icon = 'modular_septic/icons/hud/quake/screen_quake_enhance.dmi'
	var/static/list/hover_overlays_cache = list()
	var/hovering

/obj/effect/overlay/enhanced_sel
	icon = 'modular_septic/icons/hud/quake/screen_quake_enhance.dmi'
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT
	alpha = 128
	anchored = TRUE
	plane = ABOVE_HUD_PLANE

/atom/movable/screen/enhanced_sel/update_icon_state()
	. = ..()
	if(!hud?.mymob)
		icon_state = base_icon_state
		return
	switch(hud.mymob.zone_selected)
		if(BODY_ZONE_HEAD, BODY_ZONE_PRECISE_R_EYE, BODY_ZONE_PRECISE_L_EYE, BODY_ZONE_PRECISE_FACE, BODY_ZONE_PRECISE_MOUTH, BODY_ZONE_PRECISE_NECK)
			icon_state = "[base_icon_state]_head"
		if(BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_PRECISE_R_FINGER_THUMB, BODY_ZONE_PRECISE_R_FINGER_INDEX, BODY_ZONE_PRECISE_R_FINGER_MIDDLE, BODY_ZONE_PRECISE_R_FINGER_RING, BODY_ZONE_PRECISE_R_FINGER_PINKY)
			icon_state = "[base_icon_state]_hand_r"
		if(BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_L_FINGER_THUMB, BODY_ZONE_PRECISE_L_FINGER_INDEX, BODY_ZONE_PRECISE_L_FINGER_MIDDLE, BODY_ZONE_PRECISE_L_FINGER_RING, BODY_ZONE_PRECISE_L_FINGER_PINKY)
			icon_state = "[base_icon_state]_hand_l"
		if(BODY_ZONE_PRECISE_R_FOOT)
			icon_state = "[base_icon_state]_foot_r"
		if(BODY_ZONE_PRECISE_L_FOOT)
			icon_state = "[base_icon_state]_foot_l"
		else
			icon_state = base_icon_state

/atom/movable/screen/enhanced_sel/update_overlays()
	. = ..()
	if(!(hud?.mymob?.zone_selected in ENHANCEABLE_ZONES))
		return
	. += mutable_appearance(overlay_icon, "[hud.mymob.zone_selected]")

/atom/movable/screen/enhanced_sel/Click(location, control,params)
	. = ..()
	if(isobserver(usr))
		return

	var/list/modifiers = params2list(params)
	var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/choice = get_zone_at(icon_x, icon_y)
	if (!choice)
		return 1

	return set_selected_zone(choice, usr)

/atom/movable/screen/enhanced_sel/return_screentip(mob/user, params)
	if(flags_1 & NO_SCREENTIPS_1)
		return ""

	var/list/modifiers = params2list(params)
	var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/parsed_zone = get_zone_at(icon_x, icon_y)
	if(!parsed_zone)
		return SCREENTIP_OBJ(uppertext(name))
	parsed_zone = parse_zone(parsed_zone)
	return SCREENTIP_OBJ(uppertext(parsed_zone))

/atom/movable/screen/enhanced_sel/MouseEntered(location, control, params)
	. = ..()
	MouseMove(location, control, params)

/atom/movable/screen/enhanced_sel/MouseMove(location, control, params)
	. = ..()
	if(isobserver(usr))
		return

	var/list/modifiers = params2list(params)
	var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/choice = get_zone_at(icon_x, icon_y)
	if(!choice)
		vis_contents -= hover_overlays_cache[hovering]
		hovering = null
		return
	if(hovering == choice)
		return

	vis_contents -= hover_overlays_cache[hovering]
	hovering = choice

	var/obj/effect/overlay/enhanced_sel/overlay_object = hover_overlays_cache[choice]
	if(!overlay_object)
		overlay_object = new
		overlay_object.icon_state = "[choice]"
		hover_overlays_cache[choice] = overlay_object
	vis_contents += overlay_object

/atom/movable/screen/enhanced_sel/MouseExited(location, control, params)
	. = ..()
	if(!isobserver(usr) && hovering)
		vis_contents -= hover_overlays_cache[hovering]
		hovering = null

/atom/movable/screen/enhanced_sel/proc/set_selected_zone(choice, mob/user)
	if(user != hud?.mymob)
		return

	if(choice != hud.mymob.zone_selected)
		hud.mymob.zone_selected = choice
		hud.zone_select?.update_appearance()
		update_appearance()

	if(isliving(hud.mymob))
		var/mob/living/living_mob = hud.mymob
		//Update the hand shit
		living_mob.hand_index_to_zone[living_mob.active_hand_index] = living_mob.zone_selected

	return TRUE

/atom/movable/screen/enhanced_sel/proc/get_zone_at(icon_x, icon_y)
	if(icon_state == "[base_icon_state]_head")
		switch(icon_y)
			if(6) //Jaw
				switch(icon_x)
					if(13 to 19)
						return BODY_ZONE_PRECISE_MOUTH
			if(7) //Jaw
				switch(icon_x)
					if(12 to 20)
						return BODY_ZONE_PRECISE_MOUTH
			if(8, 9) //Jaw
				switch(icon_x)
					if(11 to 21)
						return BODY_ZONE_PRECISE_MOUTH
			if(10) //Jaw
				switch(icon_x)
					if(10 to 22)
						return BODY_ZONE_PRECISE_MOUTH
			if(11) //Jaw
				switch(icon_x)
					if(9 to 23)
						return BODY_ZONE_PRECISE_MOUTH
			if(12) //Jaw, face
				switch(icon_x)
					if(9, 10)
						return BODY_ZONE_PRECISE_MOUTH
					if(11 to 21)
						return BODY_ZONE_PRECISE_FACE
					if(22, 23)
						return BODY_ZONE_PRECISE_MOUTH
			if(13) //Face
				switch(icon_x)
					if(8 to 24)
						return BODY_ZONE_PRECISE_FACE
			if(14 to 16) //Face
				switch(icon_x)
					if(7 to 25)
						return BODY_ZONE_PRECISE_FACE
			if(17) //Face, eyes
				switch(icon_x)
					if(7 to 9)
						return BODY_ZONE_PRECISE_FACE
					if(10 to 13)
						return BODY_ZONE_PRECISE_R_EYE
					if(14 to 18)
						return BODY_ZONE_PRECISE_FACE
					if(19 to 22)
						return BODY_ZONE_PRECISE_L_EYE
					if(23 to 25)
						return BODY_ZONE_PRECISE_FACE
			if(18, 19) //Face, eyes
				switch(icon_x)
					if(7,8)
						return BODY_ZONE_PRECISE_FACE
					if(9 to 14)
						return BODY_ZONE_PRECISE_R_EYE
					if(15 to 17)
						return BODY_ZONE_PRECISE_FACE
					if(18 to 23)
						return BODY_ZONE_PRECISE_L_EYE
					if(24, 25)
						return BODY_ZONE_PRECISE_FACE
			if(20) //Face, eyes
				switch(icon_x)
					if(7 to 9)
						return BODY_ZONE_PRECISE_FACE
					if(10 to 13)
						return BODY_ZONE_PRECISE_R_EYE
					if(14 to 18)
						return BODY_ZONE_PRECISE_FACE
					if(19 to 22)
						return BODY_ZONE_PRECISE_L_EYE
					if(23 to 25)
						return BODY_ZONE_PRECISE_FACE
			if(21, 22) //Head, face
				switch(icon_x)
					if(7,8)
						return BODY_ZONE_HEAD
					if(9 to 23)
						return BODY_ZONE_PRECISE_FACE
					if(24,25)
						return BODY_ZONE_HEAD
			if(23) //Head, face
				switch(icon_x)
					if(7 to 9)
						return BODY_ZONE_HEAD
					if(10 to 13)
						return BODY_ZONE_PRECISE_FACE
					if(14 to 18)
						return BODY_ZONE_HEAD
					if(19 to 22)
						return BODY_ZONE_PRECISE_FACE
					if(23 to 25)
						return BODY_ZONE_HEAD
			if(24) //Head
				switch(icon_x)
					if(7 to 25)
						return BODY_ZONE_HEAD
			if(25) //Head
				switch(icon_x)
					if(8 to 24)
						return BODY_ZONE_HEAD
			if(26) //Head
				switch(icon_x)
					if(9 to 23)
						return BODY_ZONE_HEAD
			if(27) //Head
				switch(icon_x)
					if(10 to 22)
						return BODY_ZONE_HEAD
			if(28)
				switch(icon_x)
					if(12 to 20)
						return BODY_ZONE_HEAD
	else if(icon_state == "[base_icon_state]_hand_r")
		switch(icon_y)
			if(7) //Hand
				switch(icon_x)
					if(15 to 20)
						return BODY_ZONE_PRECISE_R_HAND
			if(8) //Hand
				switch(icon_x)
					if(14 to 21)
						return BODY_ZONE_PRECISE_R_HAND
			if(9) //Hand
				switch(icon_x)
					if(14 to 22)
						return BODY_ZONE_PRECISE_R_HAND
			if(10) //Hand, thumb
				switch(icon_x)
					if(13)
						return BODY_ZONE_PRECISE_R_FINGER_THUMB
					if(14 to 22)
						return BODY_ZONE_PRECISE_R_HAND
			if(11) //Hand, thumb
				switch(icon_x)
					if(12 to 14)
						return BODY_ZONE_PRECISE_R_FINGER_THUMB
					if(15 to 23)
						return BODY_ZONE_PRECISE_R_HAND
			if(12) //Hand, thumb
				switch(icon_x)
					if(11 to 14)
						return BODY_ZONE_PRECISE_R_FINGER_THUMB
					if(15 to 23)
						return BODY_ZONE_PRECISE_R_HAND
			if(13) //Hand, thumb
				switch(icon_x)
					if(10 to 13)
						return BODY_ZONE_PRECISE_R_FINGER_THUMB
					if(14 to 23)
						return BODY_ZONE_PRECISE_R_HAND
			if(14) //Hand, thumb
				switch(icon_x)
					if(9 to 12)
						return BODY_ZONE_PRECISE_R_FINGER_THUMB
					if(13 to 23)
						return BODY_ZONE_PRECISE_R_HAND
			if(15) //Hand, thumb
				switch(icon_x)
					if(8 to 11)
						return BODY_ZONE_PRECISE_R_FINGER_THUMB
					if(12 to 23)
						return BODY_ZONE_PRECISE_R_HAND
			if(16) //Hand, thumb
				switch(icon_x)
					if(8 to 10)
						return BODY_ZONE_PRECISE_R_FINGER_THUMB
					if(12 to 23)
						return BODY_ZONE_PRECISE_R_HAND
			if(17) //Hand, pinky
				switch(icon_x)
					if(12 to 21)
						return BODY_ZONE_PRECISE_R_HAND
					if(22, 23)
						return BODY_ZONE_PRECISE_R_FINGER_PINKY
			if(18) //Hand, ring, pinky
				switch(icon_x)
					if(12 to 20)
						return BODY_ZONE_PRECISE_R_HAND
					if(21)
						return BODY_ZONE_PRECISE_R_FINGER_RING
					if(22, 23)
						return BODY_ZONE_PRECISE_R_FINGER_PINKY
			if(19) //Index, hand, ring,  pinky
				switch(icon_x)
					if(12, 13)
						return BODY_ZONE_PRECISE_R_FINGER_INDEX
					if(14 to 19)
						return BODY_ZONE_PRECISE_R_HAND
					if(20, 21)
						return BODY_ZONE_PRECISE_R_FINGER_RING
					if(22, 23)
						return BODY_ZONE_PRECISE_R_FINGER_PINKY
			if(20 to 22) //Index, middle, ring, pinky
				switch(icon_x)
					if(12 to 14)
						return BODY_ZONE_PRECISE_R_FINGER_INDEX
					if(15 to 17)
						return BODY_ZONE_PRECISE_R_FINGER_MIDDLE
					if(18 to 21)
						return BODY_ZONE_PRECISE_R_FINGER_RING
					if(22, 23)
						return BODY_ZONE_PRECISE_R_FINGER_PINKY
			if(23) //Index, middle, ring, pinky
				switch(icon_x)
					if(12 to 14)
						return BODY_ZONE_PRECISE_R_FINGER_INDEX
					if(15 to 17)
						return BODY_ZONE_PRECISE_R_FINGER_MIDDLE
					if(18 to 21)
						return BODY_ZONE_PRECISE_R_FINGER_RING
					if(22)
						return BODY_ZONE_PRECISE_R_FINGER_PINKY
			if(24 to 26) //Index, middle, ring
				switch(icon_x)
					if(12 to 14)
						return BODY_ZONE_PRECISE_R_FINGER_INDEX
					if(15 to 17)
						return BODY_ZONE_PRECISE_R_FINGER_MIDDLE
					if(18 to 21)
						return BODY_ZONE_PRECISE_R_FINGER_RING
			if(27) //Index, middle, ring
				switch(icon_x)
					if(13, 14)
						return BODY_ZONE_PRECISE_R_FINGER_INDEX
					if(16, 17)
						return BODY_ZONE_PRECISE_R_FINGER_MIDDLE
					if(19 to 21)
						return BODY_ZONE_PRECISE_R_FINGER_RING
	else if(icon_state == "[base_icon_state]_hand_l")
		switch(icon_y)
			if(7) //Hand
				switch(abs(icon_x-33))
					if(15 to 20)
						return BODY_ZONE_PRECISE_L_HAND
			if(8) //Hand
				switch(abs(icon_x-33))
					if(14 to 21)
						return BODY_ZONE_PRECISE_L_HAND
			if(9) //Hand
				switch(abs(icon_x-33))
					if(14 to 22)
						return BODY_ZONE_PRECISE_L_HAND
			if(10) //Hand, thumb
				switch(abs(icon_x-33))
					if(13)
						return BODY_ZONE_PRECISE_L_FINGER_THUMB
					if(14 to 22)
						return BODY_ZONE_PRECISE_L_HAND
			if(11) //Hand, thumb
				switch(abs(icon_x-33))
					if(12 to 14)
						return BODY_ZONE_PRECISE_L_FINGER_THUMB
					if(15 to 23)
						return BODY_ZONE_PRECISE_L_HAND
			if(12) //Hand, thumb
				switch(abs(icon_x-33))
					if(11 to 14)
						return BODY_ZONE_PRECISE_L_FINGER_THUMB
					if(15 to 23)
						return BODY_ZONE_PRECISE_L_HAND
			if(13) //Hand, thumb
				switch(abs(icon_x-33))
					if(10 to 13)
						return BODY_ZONE_PRECISE_L_FINGER_THUMB
					if(14 to 23)
						return BODY_ZONE_PRECISE_L_HAND
			if(14) //Hand, thumb
				switch(abs(icon_x-33))
					if(9 to 12)
						return BODY_ZONE_PRECISE_L_FINGER_THUMB
					if(13 to 23)
						return BODY_ZONE_PRECISE_L_HAND
			if(15) //Hand, thumb
				switch(abs(icon_x-33))
					if(8 to 11)
						return BODY_ZONE_PRECISE_L_FINGER_THUMB
					if(12 to 23)
						return BODY_ZONE_PRECISE_L_HAND
			if(16) //Hand, thumb
				switch(abs(icon_x-33))
					if(8 to 10)
						return BODY_ZONE_PRECISE_L_FINGER_THUMB
					if(12 to 23)
						return BODY_ZONE_PRECISE_L_HAND
			if(17) //Hand, pinky
				switch(abs(icon_x-33))
					if(12 to 21)
						return BODY_ZONE_PRECISE_L_HAND
					if(22, 23)
						return BODY_ZONE_PRECISE_L_FINGER_PINKY
			if(18) //Hand, ring, pinky
				switch(abs(icon_x-33))
					if(12 to 20)
						return BODY_ZONE_PRECISE_L_HAND
					if(21)
						return BODY_ZONE_PRECISE_L_FINGER_RING
					if(22, 23)
						return BODY_ZONE_PRECISE_L_FINGER_PINKY
			if(19) //Index, hand, ring,  pinky
				switch(abs(icon_x-33))
					if(12, 13)
						return BODY_ZONE_PRECISE_L_FINGER_INDEX
					if(14 to 19)
						return BODY_ZONE_PRECISE_L_HAND
					if(20, 21)
						return BODY_ZONE_PRECISE_L_FINGER_RING
					if(22, 23)
						return BODY_ZONE_PRECISE_L_FINGER_PINKY
			if(20 to 22) //Index, middle, ring, pinky
				switch(abs(icon_x-33))
					if(12 to 14)
						return BODY_ZONE_PRECISE_L_FINGER_INDEX
					if(15 to 17)
						return BODY_ZONE_PRECISE_L_FINGER_MIDDLE
					if(18 to 21)
						return BODY_ZONE_PRECISE_L_FINGER_RING
					if(22, 23)
						return BODY_ZONE_PRECISE_L_FINGER_PINKY
			if(23) //Index, middle, ring, pinky
				switch(abs(icon_x-33))
					if(12 to 14)
						return BODY_ZONE_PRECISE_L_FINGER_INDEX
					if(15 to 17)
						return BODY_ZONE_PRECISE_L_FINGER_MIDDLE
					if(18 to 21)
						return BODY_ZONE_PRECISE_L_FINGER_RING
					if(22)
						return BODY_ZONE_PRECISE_L_FINGER_PINKY
			if(24 to 26) //Index, middle, ring
				switch(abs(icon_x-33))
					if(12 to 14)
						return BODY_ZONE_PRECISE_L_FINGER_INDEX
					if(15 to 17)
						return BODY_ZONE_PRECISE_L_FINGER_MIDDLE
					if(18 to 21)
						return BODY_ZONE_PRECISE_L_FINGER_RING
			if(27) //Index, middle, ring
				switch(abs(icon_x-33))
					if(13, 14)
						return BODY_ZONE_PRECISE_L_FINGER_INDEX
					if(16, 17)
						return BODY_ZONE_PRECISE_L_FINGER_MIDDLE
					if(19 to 21)
						return BODY_ZONE_PRECISE_L_FINGER_RING


code:
/atom/movable/screen/human/equip
	name = "quick equip"
	icon = 'modular_septic/icons/hud/quake/screen_quake_64x32.dmi'
	icon_state = "act_equip"


code:
//fatigue shit
/atom/movable/screen/fatigue
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	name = "fatigue"
	icon_state = "fatigue20"
	base_icon_state = "fatigue"
	screen_loc = ui_fatigue

/atom/movable/screen/fatigue/Click(location,control,params)
	. = ..()
	if(isliving(usr))
		var/mob/living/user = usr
		var/msg = list("
")
		msg += span_notice("Fatigue")
		if(LAZYLEN(user.fatigue_modification))
			var/list/meaningful_fatigue_mods = list()
			for(var/thing in user.fatigue_modification)
				var/datum/fatigue_modifier/modifier = user.fatigue_modification[thing]
				var/fatigue_add = initial(modifier.fatigue_add)
				var/modifier_desc = initial(modifier.desc)
				var/left_symbols = get_signs_from_number(FLOOR(initial(modifier.fatigue_add)/10, 1), 1)
				var/right_symbols = get_signs_from_number(FLOOR(initial(modifier.fatigue_add)/10, 1), 0)
				if(initial(modifier.variable))
					fatigue_add = modifier.fatigue_add
					modifier_desc = modifier.desc
					left_symbols = get_signs_from_number(FLOOR(modifier.fatigue_add/10, 1), 1)
					right_symbols = get_signs_from_number(FLOOR(modifier.fatigue_add/10, 1), 0)
				if(!fatigue_add)
					continue
				meaningful_fatigue_mods |= thing
				msg += span_info("\n[left_symbols][modifier_desc][right_symbols]")
			if(!LAZYLEN(meaningful_fatigue_mods))
				msg += span_info("\nNothing is affecting my fatigue at the moment.")
		else
			msg += span_info("\nNothing is affecting my fatigue at the moment.")
		msg += "
" //div infobox
		to_chat(user, jointext(msg, ""))

/atom/movable/screen/fatigue/update_icon_state()
	. = ..()
	var/mob/living/carbon/user = hud?.mymob
	if(!istype(user))
		return
	if(user.stat >= DEAD || (user.hal_screwyhud in 1 to 2))
		icon_state = "[base_icon_state]0"
	else if((user.hal_screwyhud == SCREWYHUD_HEALTHY))
		icon_state = "[base_icon_state]20"
	else
		var/tired = clamp(FATIGUE_CRIT_THRESHOLD-user.getFatigueLoss(), 0, FATIGUE_CRIT_THRESHOLD)
		icon_state = "[base_icon_state][clamp(FLOOR(tired/FATIGUE_CRIT_THRESHOLD*20, 1), 0, 20)]"

/atom/movable/screen/fatigue/update_overlays()
	. = ..()
	var/mob/living/carbon/user = hud?.mymob
	if(!istype(user))
		return
	var/fatigue_reduction = user.total_fatigue_reduction()
	if(fatigue_reduction >= 0)
		return
	if(user.hal_screwyhud == SCREWYHUD_HEALTHY)
		return
	var/image/overfatigue = image(icon, src, "overfatigue[clamp(FLOOR(abs(fatigue_reduction)/FATIGUE_CRIT_THRESHOLD*20, 1), 0, 20)]", layer+1)
	. += overfatigue


code:
/atom/movable/screen/filler
	name = "action rack"
	icon = 'modular_septic/icons/hud/quake/screen_quake_rack.dmi'
	icon_state = "rack"
	layer = 1 //most hud objects occupy layer 3
	screentip_flags = SCREENTIP_HOVERER
	plane = HUD_PLANE
	screen_loc = ui_filler


code:
/atom/movable/screen/fixeye
	name = "fix eye"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "fixeye"
	base_icon_state = "fixeye"
	screen_loc = ui_fixeye
	var/fixed_eye = FALSE

/atom/movable/screen/fixeye/Click(location, control, params)
	. = ..()
	if(hud && usr == hud.mymob)
		SEND_SIGNAL(hud.mymob, COMSIG_FIXEYE_TOGGLE)

/atom/movable/screen/fixeye/update_name(updates)
	. = ..()
	if(fixed_eye)
		name = "unfix eye"
	else
		name = "fix eye"

/atom/movable/screen/fixeye/update_icon_state()
	. = ..()
	if(fixed_eye)
		icon_state = "[base_icon_state]_on"
	else
		icon_state = base_icon_state


code:
/**
  * The shadow cone's mask and visual images holder which can't locate inside the mob,
  * lest they inherit the mob opacity and cause a lot of hindrance
  */
/atom/movable/screen/fov_holder
	name = "field of vision holder"
	icon = 'modular_septic/icons/hud/fov_15x15.dmi'
	screen_loc = ui_fov
	plane = FIELD_OF_VISION_MASK_PLANE
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT

/atom/movable/screen/fov_holder/has_gravity(turf/T)
	return FALSE

/atom/movable/screen/fov_holder/ex_act(severity)
	return FALSE

/atom/movable/screen/fov_holder/singularity_act()
	return FALSE

/atom/movable/screen/fov_holder/singularity_pull()
	return FALSE

/atom/movable/screen/fov_holder/blob_act()
	return FALSE

/// Prevents people from moving these after creation, because they shouldn't
/atom/movable/screen/fov_holder/forceMove(atom/destination, no_tp, harderforce)
	return FALSE

/// Last but not least, these shouldn't be deleted by anything but the component itself
/atom/movable/screen/fov_holder/Destroy(force = FALSE)
	if(!force)
		return QDEL_HINT_LETMELIVE
	return ..()


code:
/atom/movable/screen/fullscreen/impaired/left
	icon_state = "impairedoverlay_left"

/atom/movable/screen/fullscreen/impaired/right
	icon_state = "impairedoverlay_right"


code:
/atom/movable/screen/give
	name = "give"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_give"
	screen_loc = ui_give

/atom/movable/screen/give/Click(location, control, params)
	. = ..()
	if(iscarbon(usr))
		var/mob/living/carbon/user = usr
		user.give()


code:
/atom/movable/screen/hydration
	name = "hydration"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "hydration3"
	base_icon_state = "hydration"
	screen_loc = ui_hydration
	var/hydration_index = 3

/atom/movable/screen/hydration/update_icon_state()
	. = ..()
	icon_state = "[base_icon_state][hydration_index]"

/atom/movable/screen/hydration/Click(location, control, params)
	. = ..()
	if(!isliving(usr))
		to_chat(usr, span_notice("I don't need water."))
		return
	var/mob/living/living_user = usr
	switch(living_user.hydration)
		if(HYDRATION_LEVEL_FULL to INFINITY)
			to_chat(usr, span_notice("I'm completely soaked!"))
		if(HYDRATION_LEVEL_WELL_HYDRATED to HYDRATION_LEVEL_FULL)
			to_chat(usr, span_notice("I'm well hydrated!"))
		if(HYDRATION_LEVEL_HYDRATED to HYDRATION_LEVEL_WELL_HYDRATED)
			to_chat(usr, span_notice("I'm not thirsty."))
		if(HYDRATION_LEVEL_THIRSTY to HYDRATION_LEVEL_HYDRATED)
			to_chat(usr, span_warning("I could use a drink."))
		if(HYDRATION_LEVEL_DEHYDRATED to HYDRATION_LEVEL_THIRSTY)
			to_chat(usr, span_danger("I feel quite parched."))
		if(0 to HYDRATION_LEVEL_DEHYDRATED)
			to_chat(usr, span_userdanger("I'm dehydrated!"))

/atom/movable/screen/hydration/proc/update_hydration(new_hydra = 3)
	if(hydration_index == new_hydra)
		return
	hydration_index = new_hydra
	update_appearance()


code:
//Item/mob information
/atom/movable/screen/info
	name = "examine"
	icon = 'modular_septic/icons/hud/quake/screen_quake_64x32.dmi'
	icon_state = "act_info"

/atom/movable/screen/info/Click(location, control, params)
	. = ..()
	if(ismob(usr))
		var/obj/item/thing = usr.get_active_held_item()
		if(thing)
			usr.examinate(thing)
		else
			usr.examinate(usr)


code:
/atom/movable/screen/intent_select
	name = "intent selection"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = INTENT_HELP
	screentip_flags = SCREENTIP_HOVERER_CLICKER
	screen_loc = ui_intents

/atom/movable/screen/intent_select/Click(location, control, params)
	var/mob/living/L = usr
	if(istype(L))
		L.a_intent_change(INTENT_HOTKEY_RIGHT)

/atom/movable/screen/intent_select/segmented/Click(location, control, params)
	var/mob/living/L = usr
	if(!istype(L))
		return
	var/_x = text2num(params2list(params)["icon-x"])
	var/_y = text2num(params2list(params)["icon-y"])

	if(_x<=16 && _y<=16)
		L.a_intent_change(INTENT_HARM)

	else if(_x<=16 && _y>=17)
		L.a_intent_change(INTENT_HELP)

	else if(_x>=17 && _y<=16)
		L.a_intent_change(INTENT_GRAB)

	else if(_x>=17 && _y>=17)
		L.a_intent_change(INTENT_DISARM)

/atom/movable/screen/intent_select/segmented/return_screentip(mob/user, params)
	if(flags_1 & NO_SCREENTIPS_1)
		return ""

	var/_x = text2num(params2list(params)["icon-x"])
	var/_y = text2num(params2list(params)["icon-y"])
	if(_x<=16 && _y<=16)
		return SCREENTIP_OBJ("HARM INTENT")

	else if(_x<=16 && _y>=17)
		return SCREENTIP_OBJ("HELP INTENT")

	else if(_x>=17 && _y<=16)
		return SCREENTIP_OBJ("GRAB INTENT")

	else if(_x>=17 && _y>=17)
		return SCREENTIP_OBJ("DISARM INTENT")


code:
/atom/movable/screen/internals
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_internal

/atom/movable/screen/internals/Click(location, control, params)
	. = ..()
	if(!iscarbon(usr))
		return
	var/mob/living/carbon/C = usr
	var/list/modifiers = params2list(params)
	if(LAZYACCESS(modifiers, RIGHT_CLICK))
		var/obj/item/tank/internal = C.internal
		if(istype(internal))
			to_chat(C, span_alert("I am not running on internals."))
		else
			internal.examine(C)
		return
	if(C.incapacitated())
		return

	if(C.internal)
		C.internal = null
		to_chat(C, span_notice("You are no longer running on internals."))
		icon_state = "internal0"
	else
		if(!C.getorganslot(ORGAN_SLOT_BREATHING_TUBE))
			if(!istype(C.wear_mask, /obj/item/clothing/mask))
				to_chat(C, span_warning("You are not wearing an internals mask!"))
				return 1
			else
				var/obj/item/clothing/mask/M = C.wear_mask
				if(M.mask_adjusted) // if mask on face but pushed down
					M.adjustmask(C) // adjust it back
				if( !(M.clothing_flags & MASKINTERNALS) )
					to_chat(C, span_warning("You are not wearing an internals mask!"))
					return

		var/obj/item/I = C.is_holding_item_of_type(/obj/item/tank)
		if(I)
			to_chat(C, span_notice("You are now running on internals from [I] in your [C.get_held_index_name(C.get_held_index_of_item(I))]."))
			C.internal = I
		else if(ishuman(C))
			var/mob/living/carbon/human/H = C
			if(istype(H.s_store, /obj/item/tank))
				to_chat(H, span_notice("You are now running on internals from [H.s_store] on your [H.wear_suit.name]."))
				H.internal = H.s_store
			else if(istype(H.belt, /obj/item/tank))
				to_chat(H, span_notice("You are now running on internals from [H.belt] on your belt."))
				H.internal = H.belt
			else if(istype(H.l_store, /obj/item/tank))
				to_chat(H, span_notice("You are now running on internals from [H.l_store] in your left pocket."))
				H.internal = H.l_store
			else if(istype(H.r_store, /obj/item/tank))
				to_chat(H, span_notice("You are now running on internals from [H.r_store] in your right pocket."))
				H.internal = H.r_store

		//Separate so CO2 jetpacks are a little less cumbersome.
		if(!C.internal && istype(C.back, /obj/item/tank))
			to_chat(C, span_notice("You are now running on internals from [C.back] on your back."))
			C.internal = C.back

		if(C.internal)
			icon_state = "internal1"
		else
			to_chat(C, span_warning("You don't have an oxygen tank!"))
			return
	C.update_action_buttons_icon()


code:
/atom/movable/screen/inventory
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_full = "occupied"

/atom/movable/screen/inventory/add_overlays()
	var/mob/user = hud?.mymob

	if(!user || !slot_id)
		return

	var/obj/item/our_item = user.get_item_by_slot(slot_id)
	if(our_item)
		our_item.apply_outline()
		return

	var/obj/item/holding = user.get_active_held_item()
	if(!holding)
		return

	var/image/item_overlay = image(holding)
	item_overlay.alpha = 92

	if(!user.can_equip(holding, slot_id, disable_warning = TRUE, bypass_equip_delay_self = TRUE))
		item_overlay.color = "#FF0000"
	else
		item_overlay.color = "#00ff00"

	cut_overlay(object_overlay)
	object_overlay = item_overlay
	add_overlay(object_overlay)

/atom/movable/screen/inventory/MouseExited()
	. = ..()
	var/mob/user = hud?.mymob
	var/obj/item/our_item = user?.get_item_by_slot(slot_id)
	if(our_item)
		our_item.remove_filter("hover_outline")

/atom/movable/screen/inventory/hand
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_full = null


code:
/atom/movable/screen/lookdown
	name = "look down"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_lookdown"
	screen_loc = ui_lookdown

/atom/movable/screen/lookdown/Click(location, control, params)
	. = ..()
	if(isliving(usr))
		var/mob/living/user = usr
		user.look_down()


code:
/atom/movable/screen/lookup
	name = "look up"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_lookup"
	screen_loc = ui_lookup

/atom/movable/screen/lookup/Click(location, control, params)
	. = ..()
	if(isliving(usr))
		var/mob/living/user = usr
		user.look_up()


code:
/atom/movable/screen/mood
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_mood


code:
/atom/movable/screen/mov_intent
	name = "jogging"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "jogging"
	screen_loc = ui_movi

/atom/movable/screen/mov_intent/update_name(updates)
	. = ..()
	if(hud?.mymob)
		switch(hud?.mymob?.m_intent)
			if(MOVE_INTENT_WALK)
				name = "walking"
			else
				name = "jogging"
		if(iscarbon(hud?.mymob))
			var/mob/living/carbon/C = hud.mymob
			if(C.combat_flags & COMBAT_FLAG_SPRINTING)
				name = "sprinting"

/atom/movable/screen/mov_intent/update_icon_state()
	. = ..()
	if(hud?.mymob)
		switch(hud?.mymob?.m_intent)
			if(MOVE_INTENT_WALK)
				icon_state = "walking"
			else
				icon_state = "jogging"
		if(iscarbon(hud?.mymob))
			var/mob/living/carbon/C = hud.mymob
			if(C.combat_flags & COMBAT_FLAG_SPRINTING)
				icon_state = "sprinting"


code:
//Noise holder
/atom/movable/screen/fullscreen/noise
	icon = 'modular_septic/icons/hud/noise.dmi'
	icon_state = "blank"
	screen_loc = "WEST,SOUTH to EAST,NORTH"
	plane = FULLSCREEN_PLANE
	layer = NOISE_LAYER
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT
	show_when_dead = TRUE
	var/poggers = 1
	var/loggers = "j"

/atom/movable/screen/fullscreen/noise/update_for_view(client_view)
	screen_loc = "WEST,SOUTH to EAST,NORTH"
	poggers = rand(1,9)
	update_appearance()

/atom/movable/screen/fullscreen/noise/update_icon_state()
	. = ..()
	icon_state = "[poggers][loggers]"


code:
/atom/movable/screen/nutrition
	name = "nutrition"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "nutrition3"
	base_icon_state = "nutrition"
	screen_loc = ui_nutrition
	var/nutrition_index = 3

/atom/movable/screen/nutrition/update_icon_state()
	. = ..()
	icon_state = "[base_icon_state][nutrition_index]"

/atom/movable/screen/nutrition/Click(location, control, params)
	. = ..()
	if(!isliving(usr))
		to_chat(usr, span_notice("I don't need food."))
		return
	var/mob/living/living_user = usr
	switch(living_user.nutrition)
		if(NUTRITION_LEVEL_FULL to INFINITY)
			to_chat(usr, span_notice("I'm completely stuffed!"))
		if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
			to_chat(usr, span_notice("I'm well fed!"))
		if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
			to_chat(usr, span_notice("I'm not hungry."))
		if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
			to_chat(usr, span_warning("I could use a bite to eat."))
		if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
			to_chat(usr, span_danger("I feel quite hungry."))
		if(0 to NUTRITION_LEVEL_STARVING)
			to_chat(usr, span_userdanger("I'm starving!"))

/atom/movable/screen/nutrition/proc/update_nutrition(new_nutri = 3)
	if(nutrition_index == new_nutri)
		return
	nutrition_index = new_nutri
	update_appearance()


code:
//Pain flashy
/atom/movable/screen/fullscreen/pain_flash
	icon = 'modular_septic/icons/hud/screen_gen.dmi'
	icon_state = "blank"
	screen_loc = "WEST,SOUTH to EAST,NORTH"
	plane = FULLSCREEN_PLANE
	layer = PAIN_FLASH_LAYER
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT
	show_when_dead = FALSE

/atom/movable/screen/fullscreen/pain_flash/update_for_view(client_view)
	screen_loc = "WEST,SOUTH to EAST,NORTH"
	update_appearance()


code:
//pain guy
/atom/movable/screen/human/pain
	name = "pain"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "pain0"
	base_icon_state = "pain"
	screen_loc = ui_pain

/atom/movable/screen/human/pain/Click(location, control, params)
	. = ..()
	var/mob/living/carbon/C = usr
	if(istype(C))
		C.print_pain()


code:
/atom/movable/screen/pressure
	name = "pressure"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "pressure2"
	base_icon_state = "pressure"
	screen_loc = ui_pressure
	var/pressure_index = 2

/atom/movable/screen/pressure/update_icon_state()
	. = ..()
	icon_state = "[base_icon_state][pressure_index]"

/atom/movable/screen/pressure/Click(location, control, params)
	. = ..()
	switch(pressure_index)
		if(4)
			to_chat(usr, span_userdanger("The air pressure here feels crushing!"))
		if(3)
			to_chat(usr, span_warning("The air pressure here feels dangerously high."))
		if(2)
			to_chat(usr, span_notice("The air pressure here feels comfortable."))
		if(1)
			to_chat(usr, span_warning("The air pressure here feels dangerously low."))
		if(0)
			to_chat(usr, span_userdanger("There's barely any air here!"))

/atom/movable/screen/pressure/proc/update_pressure(new_pressure = 2)
	if(icon_state == "[base_icon_state][new_pressure]")
		return
	pressure_index = new_pressure
	update_appearance()


code:
/atom/movable/screen/pull
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_pull"
	base_icon_state = "act_pull"
	screen_loc = ui_pull

/atom/movable/screen/pull/update_name(updates)
	. = ..()
	if(hud?.mymob?.pulling)
		name = "stop pulling"
	else
		name = "pull"

/atom/movable/screen/pull/update_icon_state()
	. = ..()
	if(hud?.mymob?.pulling)
		icon_state = "[base_icon_state]_on"
	else
		icon_state = base_icon_state


code:
/atom/movable/screen/healths
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_pulse

/atom/movable/screen/healths/Click(location, control, params)
	. = ..()
	if(iscarbon(usr))
		var/mob/living/carbon/carbon_user = usr
		carbon_user.check_pulse(carbon_user)


code:
/atom/movable/screen/resist
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_resist


code:
//resting
/atom/movable/screen/rest
	name = "rest"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_rest"
	base_icon_state = "act_rest"
	screen_loc = ui_rest

/atom/movable/screen/rest/update_icon_state()
	. = ..()
	var/mob/living/user = hud?.mymob
	if(!istype(user))
		return
	if(user.resting)
		icon_state = "[base_icon_state]_on"
	else
		icon_state = base_icon_state


code:
/atom/movable/screen/sadness
	icon = 'modular_septic/icons/hud/screen_gen.dmi'
	icon_state = "black"
	alpha = 0
	screen_loc = "WEST,SOUTH to EAST,NORTH"
	plane = FULLSCREEN_PLANE
	layer = FULLSCREEN_LAYER+1
	mouse_opacity = MOUSE_OPACITY_TRANSPARENT


code:
/atom/movable/screen/safety
	name = "safety"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "safety"
	base_icon_state = "safety"
	screen_loc = ui_safety

/atom/movable/screen/safety/Click(location, control, params)
	. = ..()
	var/obj/item/gun/held_item = usr.get_active_held_item()
	if(istype(held_item))
		held_item.toggle_safety(usr)
	else if(held_item)
		to_chat(usr, span_warning("I am not holding a gun."))
	else
		to_chat(usr, span_warning("I am unarmed."))

/atom/movable/screen/safety/Initialize(mapload)
	. = ..()
	update_appearance()

/atom/movable/screen/safety/update_icon_state()
	. = ..()
	if(hud?.mymob)
		var/obj/item/gun/held_item = hud.mymob.get_active_held_item()
		if(istype(held_item))
			if(CHECK_MULTIPLE_BITFIELDS(held_item.safety_flags, HAS_SAFETY|SAFETY_ENABLED))
				icon_state = "[base_icon_state]_on"
			else
				icon_state = "[base_icon_state]_off"
		else
			icon_state = "[base_icon_state]_on"
	else
		icon_state = "[base_icon_state]_on"


code:
/atom/movable/screen/screentip
	screen_loc = ui_screentip
	maptext_height = 64
	maptext_width = 256
	maptext_x = -16
	maptext = ""


code:
/atom/movable/screen/sleeping
	name = "sleep"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_sleep"
	base_icon_state = "act_sleep"
	screen_loc = ui_sleep

/atom/movable/screen/sleeping/Click(location, control, params)
	. = ..()
	if(iscarbon(usr))
		var/mob/living/carbon/C = usr
		if(HAS_TRAIT_FROM(C, TRAIT_TRYINGTOSLEEP, src))
			REMOVE_TRAIT(C, TRAIT_TRYINGTOSLEEP, src)
		else
			if(C.getShock() >= PAIN_NO_SLEEP * (GET_MOB_ATTRIBUTE_VALUE(C, STAT_ENDURANCE)/ATTRIBUTE_MIDDLING))
				to_chat(C, span_warning("[fail_msg()]I can't sleep while... [span_animatedpain("IN PAIN!")]"))
				return
			ADD_TRAIT(C, TRAIT_TRYINGTOSLEEP, src)
		update_appearance()

/atom/movable/screen/sleeping/update_icon_state()
	. = ..()
	if(!iscarbon(hud?.mymob))
		return
	var/mob/living/carbon/C = hud?.mymob
	if(HAS_TRAIT_FROM(C, TRAIT_TRYINGTOSLEEP, src))
		icon_state = "[base_icon_state]_on"
	else
		if(C.IsSleeping() || C.IsUnconscious())
			icon_state = "[base_icon_state]_waking"
		else
			icon_state = base_icon_state

/atom/movable/screen/sleeping/update_name(updates)
	. = ..()
	if(!iscarbon(hud?.mymob))
		return
	var/mob/living/carbon/C = hud?.mymob
	if(HAS_TRAIT_FROM(C, TRAIT_TRYINGTOSLEEP, src))
		name = "sleeping"
	else
		if(C.IsSleeping() || C.IsUnconscious())
			name = "waking up"
		else
			name = "sleep"


code:
/atom/movable/screen/spacesuit
	name = "suit cell"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	screen_loc = ui_spacesuit

/atom/movable/screen/spacesuit/Click(location, control, params)
	. = ..()
	if(!ishuman(usr))
		to_chat(usr, span_warning("I'm incapable of wearing a space suit."))
		return
	var/mob/living/carbon/human/humie = usr
	var/obj/item/clothing/suit/space/spacesuit = humie.wear_suit
	if(istype(spacesuit))
		var/obj/item/stock_parts/cell/cell = spacesuit.cell
		if(!istype(cell))
			to_chat(humie, span_warning("Power cell missing."))
		else if(cell.charge > cell.maxcharge * 0.2)
			to_chat(humie, span_notice("Cell charge OK: [CEILING((cell.charge/cell.maxcharge)*100, 1)]%"))
		else
			to_chat(humie, span_alert("Cell charge LOW: [CEILING((cell.charge/cell.maxcharge)*100, 1)]%"))
	else
		to_chat(humie, span_warning("I am not wearing a spacesuit."))


code:
/atom/movable/screen/special_attack
	name = "special attack"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_specialatk"
	base_icon_state = "act_specialatk"
	screentip_flags = SCREENTIP_HOVERER_CLICKER
	screen_loc = ui_specialattack

/atom/movable/screen/special_attack/Click(location, control, params)
	. = ..()
	var/mob/living/user = usr
	if(!istype(user))
		return
	var/list/PL = params2list(params)
	var/icon_y = text2num(PL["icon-y"])
	var/what_we_chose = SPECIAL_ATK_KICK
	switch(icon_y)
		if(23 to INFINITY)
			what_we_chose = SPECIAL_ATK_KICK
		if(16 to 22)
			what_we_chose = SPECIAL_ATK_JUMP
		if(9 to 15)
			what_we_chose = SPECIAL_ATK_BITE
		if(0 to 8)
			what_we_chose = SPECIAL_ATK_STEAL
	user.toggle_special_attack(what_we_chose)
	update_appearance()

/atom/movable/screen/special_attack/return_screentip(mob/user, params)
	if(flags_1 & NO_SCREENTIPS_1)
		return ""

	var/list/modifiers = params2list(params)
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/what_we_chose = SPECIAL_ATK_KICK
	switch(icon_y)
		if(23 to INFINITY)
			what_we_chose = SPECIAL_ATK_KICK
		if(16 to 22)
			what_we_chose = SPECIAL_ATK_JUMP
		if(9 to 15)
			what_we_chose = SPECIAL_ATK_BITE
		if(0 to 8)
			what_we_chose = SPECIAL_ATK_STEAL
	return SCREENTIP_OBJ(uppertext(what_we_chose))

/atom/movable/screen/special_attack/update_icon_state()
	. = ..()
	var/mob/living/owner = hud?.mymob
	if(istype(owner) && (owner.special_attack != SPECIAL_ATK_NONE))
		icon_state = "[base_icon_state]_[owner.special_attack]"
	else
		icon_state = base_icon_state


code:
//Sprint button shit
/atom/movable/screen/sprint
	name = "sprint toggle"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_sprint"
	base_icon_state = "act_sprint"
	screen_loc = ui_sprint
	var/mutable_appearance/flashy

/atom/movable/screen/sprint/update_name(updates)
	. = ..()
	if(isliving(hud?.mymob))
		var/mob/living/user = hud?.mymob
		if(user.combat_flags & COMBAT_FLAG_SPRINT_ACTIVE)
			name = "toggle sprint off"
		else
			name = "toggle sprint on"

/atom/movable/screen/sprint/Click()
	. = ..()
	if(isliving(usr))
		var/mob/living/user= usr
		user.toggle_sprint()

/atom/movable/screen/sprint/update_icon_state()
	. = ..()
	var/mob/living/user = hud?.mymob
	if(!istype(user))
		return
	if(user.combat_flags & COMBAT_FLAG_SPRINT_ACTIVE)
		icon_state = "[base_icon_state]_on"
	else
		icon_state = base_icon_state


code:
/atom/movable/screen/stats
	name = "stats"
	icon = 'modular_septic/icons/hud/quake/screen_quake_32x64.dmi'
	icon_state = "stats"
	screen_loc = ui_stats
	screentip_flags = SCREENTIP_HOVERER
	var/static/overlay_x = 0
	var/static/overlay_y = 0
	var/static/list/stat_to_y_offset = list(STAT_INTELLIGENCE = 0,
											STAT_ENDURANCE = 10,
											STAT_DEXTERITY = 20,
											STAT_STRENGTH = 30,
											) //This is dumb. Stat's path = stat's offset.
	var/list/stat_to_value = list(STAT_INTELLIGENCE = "00",
								  STAT_ENDURANCE = "00",
								  STAT_DEXTERITY = "00",
								  STAT_STRENGTH = "00",
								  ) //Stat's path to it's value - easier than getting it always
	var/list/list/stat_to_number_overlays = list()
	var/list/image/numbers = list()

/atom/movable/screen/stats/Click(location, control, params)
	. = ..()
	if(ismob(usr))
		var/mob/user = usr
		user.attributes?.print_stats(user)

/atom/movable/screen/stats/return_screentip(mob/user, params)
	if(flags_1 & NO_SCREENTIPS_1)
		return ""

	var/list/modifiers = params2list(params)
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	switch(icon_y)
		if(0 to 18)
			return SCREENTIP_OBJ("WILLPOWER")
		if(19 to 28)
			return SCREENTIP_OBJ("INTELLIGENCE")
		if(29 to 38)
			return SCREENTIP_OBJ("ENDURANCE")
		if(39 to 48)
			return SCREENTIP_OBJ("DEXTERITY")
		if(49 to 59)
			return SCREENTIP_OBJ("STRENGTH")
	return SCREENTIP_OBJ(uppertext(name))

/atom/movable/screen/stats/update_overlays()
	. = ..()
	. |= numbers

/atom/movable/screen/stats/Initialize(mapload)
	. = ..()
	regen_overlays()
	update_appearance()

/atom/movable/screen/stats/proc/update_stats()
	if(!hud?.mymob?.attributes)
		return FALSE
	for(var/stat_path in stat_to_value)
		stat_to_value[stat_path] = stat_number_to_string(GET_MOB_ATTRIBUTE_VALUE(hud.mymob, stat_path))
	regen_overlays()
	update_appearance()

/atom/movable/screen/stats/proc/regen_overlays()
	cut_overlays()
	QDEL_LIST(numbers)
	numbers = list()
	for(var/stat in stat_to_value)
		var/y_off = stat_to_y_offset[stat]
		var/left = copytext(stat_to_value[stat], 1, 2)
		var/right = copytext(stat_to_value[stat], 2)
		var/image/a = image(icon, src, "a[left]")
		var/image/b = image(icon, src, "b[right]")
		a.pixel_x = b.pixel_x = overlay_x
		a.pixel_y = b.pixel_y = overlay_y + y_off
		stat_to_number_overlays[stat] = list(a, b)
		numbers |= stat_to_number_overlays[stat]

	if(length(numbers))
		return numbers

/atom/movable/screen/stats/proc/stat_number_to_string(value)
	. = "[value]"
	if(length(.) < 2)
		. = "0[.]"


code:
/atom/movable/screen/storage
	icon = 'modular_septic/icons/hud/quake/storage.dmi'

/atom/movable/screen/close
	icon = 'modular_septic/icons/hud/quake/storage.dmi'
	icon_state = "close"


code:
/atom/movable/screen/surrender
	name = "surrender"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_surrender"
	screen_loc = ui_surrender

/atom/movable/screen/surrender/Click(location, control, params)
	. = ..()
	if(isliving(usr))
		var/mob/living/user = usr
		user.emote("surrender")


code:
/atom/movable/screen/swap_hand
	name = "attack delay"
	icon = 'modular_septic/icons/hud/quake/screen_quake_64x32.dmi'
	icon_state = "cooldown_8"
	base_icon_state = "cooldown"
	var/last_user_move = 0
	var/target_time = 0

/atom/movable/screen/swap_hand/process(delta_time)
	update_icon_state()
	if(world.time >= target_time)
		return PROCESS_KILL

/atom/movable/screen/swap_hand/update_icon_state()
	. = ..()
	var/completion = clamp(FLOOR(8-(((target_time - world.time)/(target_time - last_user_move))*8), 1), 0, 8)
	icon_state = "[base_icon_state]_[completion]"


code:
/atom/movable/screen/teach
	name = "teach"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_teach"
	base_icon_state = "act_teach"
	screen_loc = ui_teach
/*
/atom/movable/screen/teach/Click(location, control, params)
	. = ..()
	SEND_SIGNAL(usr, COMSIG_ELEMENT_TRY_TEACHING)

/atom/movable/screen/teach/update_icon_state()
	. = ..()
	if(hud?.mymob && (SEND_SIGNAL(hud.mymob, COMSIG_ELEMENT_CHECK_TEACHING) || SEND_SIGNAL(hud.mymob, COMSIG_ELEMENT_CHECK_TAUGHT)))
		icon_state = "[base_icon_state]_on"
	else
		icon_state = base_icon_state
*/


code:
/atom/movable/screen/temperature
	name = "temperature"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "temp2"
	base_icon_state = "temp"
	screen_loc = ui_temperature
	var/temperature_index = 3

/atom/movable/screen/temperature/update_icon_state()
	. = ..()
	icon_state = "[base_icon_state][clamp(CEILING(temperature_index/2, 1), 1, 3)]"

/atom/movable/screen/temperature/Click(location, control, params)
	. = ..()
	switch(temperature_index)
		if(6)
			to_chat(usr, span_userdanger("I'm being cooked alive!"))
		if(5)
			to_chat(usr, span_danger("It feels very hot!"))
		if(4)
			to_chat(usr, span_warning("It feels uncomfortably hot."))
		if(3)
			to_chat(usr, span_notice("The temperature here feels comfortable."))
		if(2)
			to_chat(usr, span_warning("It feels uncomfortably cold."))
		if(1)
			to_chat(usr, span_danger("It feels very cold!"))
		if(0)
			to_chat(usr, span_userdanger("I'm being frozen solid!"))

/atom/movable/screen/temperature/proc/update_temperature(new_temp = 3)
	if(temperature_index == new_temp)
		return
	temperature_index = new_temp
	update_appearance()


code:
/atom/movable/screen/throw_catch
	name = "throw/catch"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_throw"
	screentip_flags = SCREENTIP_CLICKER
	screen_loc = ui_throw


code:
/atom/movable/screen/wield
	name = "wield"
	icon = 'modular_septic/icons/hud/quake/screen_quake.dmi'
	icon_state = "act_wield"
	base_icon_state = "act_wield"
	screen_loc = ui_wield
	var/active = FALSE

/atom/movable/screen/wield/update_name(updates)
	. = ..()
	if(active)
		name = "unwield active item"
	else
		name = "wield active item"

/atom/movable/screen/wield/update_icon_state()
	. = ..()
	if(active)
		icon_state = "[base_icon_state]_on"
	else
		icon_state = base_icon_state

/atom/movable/screen/wield/Click()
	. = ..()
	if(isliving(usr))
		var/mob/living/user = usr
		user.wield_active_hand()


code:
/atom/movable/screen/zone_sel
	name = "zone doll"
	icon = 'modular_septic/icons/hud/quake/screen_quake_32x64.dmi'
	overlay_icon = 'modular_septic/icons/hud/quake/screen_quake_32x64.dmi'
	screentip_flags = SCREENTIP_HOVERER_CLICKER

/obj/effect/overlay/zone_sel
	icon = 'modular_septic/icons/hud/quake/screen_quake_32x64.dmi'

/atom/movable/screen/zone_sel/return_screentip(mob/user, params)
	if(flags_1 & NO_SCREENTIPS_1)
		return ""

	var/list/modifiers = params2list(params)
	var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
	var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
	var/parsed_zone = get_zone_at(icon_x, icon_y)
	if(!parsed_zone)
		return SCREENTIP_OBJ(uppertext(name))
	parsed_zone = parse_zone(parsed_zone)
	return SCREENTIP_OBJ(uppertext(parsed_zone))

/atom/movable/screen/zone_sel/set_selected_zone(choice, mob/user)
	if(user != hud?.mymob)
		return

	if(choice != hud.mymob.zone_selected)
		hud.mymob.zone_selected = choice
		hud.enhanced_sel?.update_appearance()
		update_appearance()

	if(isliving(hud.mymob))
		var/mob/living/living_mob = hud.mymob
		//Update the hand shit
		living_mob.hand_index_to_zone[living_mob.active_hand_index] = living_mob.zone_selected

	return TRUE

/atom/movable/screen/zone_sel/proc/get_zone_at(icon_x, icon_y)
	switch(icon_y)
		if(5) //Feet
			switch(icon_x)
				if(7 to 13)
					return BODY_ZONE_PRECISE_R_FOOT
				if(19 to 25)
					return BODY_ZONE_PRECISE_L_FOOT
		if(6) //Feet
			switch(icon_x)
				if(7 to 14)
					return BODY_ZONE_PRECISE_R_FOOT
				if(18 to 25)
					return BODY_ZONE_PRECISE_L_FOOT
		if(7) //Feet
			switch(icon_x)
				if(8 to 14)
					return BODY_ZONE_PRECISE_R_FOOT
				if(18 to 24)
					return BODY_ZONE_PRECISE_L_FOOT
		if(9, 10) //Feet
			switch(icon_x)
				if(10 to 14)
					return BODY_ZONE_PRECISE_R_FOOT
				if(18 to 22)
					return BODY_ZONE_PRECISE_L_FOOT
		if(11 to 20) //Legs
			switch(icon_x)
				if(10 to 14)
					return BODY_ZONE_R_LEG
				if(18 to 22)
					return BODY_ZONE_L_LEG
		if(21 to 24) //Legs
			switch(icon_x)
				if(11 to 15)
					return BODY_ZONE_R_LEG
				if(19 to 23)
					return BODY_ZONE_L_LEG
		if(25) //Legs and groin
			switch(icon_x)
				if(10 to 13)
					return BODY_ZONE_R_LEG
				if(14 to 18)
					return BODY_ZONE_PRECISE_GROIN
				if(19 to 22)
					return BODY_ZONE_L_LEG
		if(26) //Legs and groin
			switch(icon_x)
				if(10 to 12)
					return BODY_ZONE_R_LEG
				if(13 to 19)
					return BODY_ZONE_PRECISE_GROIN
				if(20 to 22)
					return BODY_ZONE_L_LEG
		if(27) //Groin
			switch(icon_x)
				if(10 to 22)
					return BODY_ZONE_PRECISE_GROIN
		if(28) //Groin, hands
			switch(icon_x)
				if(7, 8)
					return BODY_ZONE_PRECISE_R_HAND
				if(10 to 22)
					return BODY_ZONE_PRECISE_GROIN
				if(24, 25)
					return BODY_ZONE_PRECISE_L_HAND
		if(29) //Groin, hands
			switch(icon_x)
				if(6 to 9)
					return BODY_ZONE_PRECISE_R_HAND
				if(10 to 22)
					return BODY_ZONE_PRECISE_GROIN
				if(23 to 26)
					return BODY_ZONE_PRECISE_L_HAND
		if(30) //Groin, chest, hands
			switch(icon_x)
				if(6 to 9)
					return BODY_ZONE_PRECISE_R_HAND
				if(11, 12)
					return BODY_ZONE_PRECISE_GROIN
				if(13 to 19)
					return BODY_ZONE_CHEST
				if(20, 21)
					return BODY_ZONE_PRECISE_GROIN
				if(23 to 26)
					return BODY_ZONE_PRECISE_L_HAND
		if(31) //Chest, hands
			switch(icon_x)
				if(6 to 9)
					return BODY_ZONE_PRECISE_R_HAND
				if(11 to 21)
					return BODY_ZONE_CHEST
				if(23 to 26)
					return BODY_ZONE_PRECISE_L_HAND
		if(32, 33) //Chest, hands
			switch(icon_x)
				if(6 to 8)
					return BODY_ZONE_PRECISE_R_HAND
				if(11 to 21)
					return BODY_ZONE_CHEST
				if(24 to 26)
					return BODY_ZONE_PRECISE_L_EYE
		if(34) //Chest, arms
			switch(icon_x)
				if(6 to 8)
					return BODY_ZONE_R_ARM
				if(11 to 21)
					return BODY_ZONE_CHEST
				if(24 to 26)
					return BODY_ZONE_L_ARM
		if(34 to 38) //Chest, arms
			switch(icon_x)
				if(6 to 9)
					return BODY_ZONE_R_ARM
				if(12 to 22)
					return BODY_ZONE_CHEST
				if(23 to 26)
					return BODY_ZONE_L_ARM
		if(39 to 41) //Chest, arms
			switch(icon_x)
				if(6 to 10)
					return BODY_ZONE_R_ARM
				if(11 to 21)
					return BODY_ZONE_CHEST
				if(22 to 26)
					return BODY_ZONE_L_ARM
		if(42) //Chest, arms
			switch(icon_x)
				if(7 to 10)
					return BODY_ZONE_R_ARM
				if(11 to 21)
					return BODY_ZONE_CHEST
				if(22 to 25)
					return BODY_ZONE_L_ARM
		if(43,44) //Chest, arms
			switch(icon_x)
				if(7 to 11)
					return BODY_ZONE_R_ARM
				if(12 to 20)
					return BODY_ZONE_CHEST
				if(21 to 25)
					return BODY_ZONE_L_ARM
		if(45) //Chest, arms, neck
			switch(icon_x)
				if(8 to 12)
					return BODY_ZONE_R_ARM
				if(13, 14)
					return BODY_ZONE_CHEST
				if(15 to 17)
					return BODY_ZONE_PRECISE_NECK
				if(18, 19)
					return BODY_ZONE_CHEST
				if(20 to 24)
					return BODY_ZONE_L_ARM
		if(46) //Arms, neck
			switch(icon_x)
				if(9 to 12)
					return BODY_ZONE_R_ARM
				if(13 to 19)
					return BODY_ZONE_PRECISE_NECK
				if(20 to 23)
					return BODY_ZONE_L_ARM
		if(47) //Arms, neck
			switch(icon_x)
				if(10, 11)
					return BODY_ZONE_R_ARM
				if(12 to 20)
					return BODY_ZONE_PRECISE_NECK
				if(21, 22)
					return BODY_ZONE_L_ARM
		if(48) //Neck
			switch(icon_x)
				if(11 to 21)
					return BODY_ZONE_PRECISE_NECK
		if(49) //Head, neck
			switch(icon_x)
				if(12, 13)
					return BODY_ZONE_PRECISE_NECK
				if(14 to 18)
					return BODY_ZONE_HEAD
				if(19, 20)
					return BODY_ZONE_PRECISE_NECK
		if(50) //Head
			switch(icon_x)
				if(14 to 18)
					return BODY_ZONE_HEAD
		if(51,52) //Head
			switch(icon_x)
				if(13 to 19)
					return BODY_ZONE_HEAD
		if(53 to 55) //Head
			switch(icon_x)
				if(12 to 20)
					return BODY_ZONE_HEAD
		if(56, 57) //Head
			switch(icon_x)
				if(13 to 19)
					return BODY_ZONE_HEAD
		if(58) //Head
			switch(icon_x)
				if(14 to 18)
					return BODY_ZONE_HEAD
		if(59)
			switch(icon_x)
				if(15 to 17)
					return BODY_ZONE_HEAD


code:
/mob/living/attackby(obj/item/I, mob/living/user, params)
	if(..())
		return TRUE
	user.changeNext_move(I.attack_delay)
	user.adjustFatigueLoss(I.attack_fatigue_cost*I.w_class)
	return I.attack(src, user, params)

/mob/living/attackby_secondary(obj/item/weapon, mob/living/user, params)
	var/result = weapon.attack_secondary(src, user, params)

	// Normal attackby updates click cooldown, so we have to make up for it
	if (result != SECONDARY_ATTACK_CALL_NORMAL)
		user.changeNext_move(weapon.attack_delay)
		user.adjustFatigueLoss(weapon.attack_fatigue_cost*weapon.w_class)

	return result

/obj/item/attack(mob/living/M, mob/living/user, params)
	var/signal_return = SEND_SIGNAL(src, COMSIG_ITEM_ATTACK, M, user, params)
	if(signal_return & COMPONENT_CANCEL_ATTACK_CHAIN)
		return TRUE
	if(signal_return & COMPONENT_SKIP_ATTACK)
		return

	SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, M, user, params)

	if(item_flags & NOBLUDGEON)
		return

	if(force && HAS_TRAIT(user, TRAIT_PACIFISM))
		to_chat(user, span_warning("I don't want to harm other living beings!"))
		return

	if(!ishuman(M))
		if(!force)
			playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), TRUE, -1)
		else if(hitsound)
			playsound(loc, hitsound, get_clamped_volume(), TRUE, extrarange = stealthy_audio ? SILENCED_SOUND_EXTRARANGE : -1, falloff_distance = 0)

	M.lastattacker = user.real_name
	M.lastattackerckey = user.ckey

	if(force && M == user && user.client)
		user.client.give_award(/datum/award/achievement/misc/selfouch, user)

	user.do_attack_animation(M)
	M.attacked_by(src, user)

	log_combat(user, M, "attacked", src.name, "(COMBAT MODE: [uppertext(user.combat_mode)]) INTENT: [uppertext(user.a_intent)] (DAMTYPE: [uppertext(damtype)])")
	add_fingerprint(user)

/obj/item/attack_atom(atom/attacked_atom, mob/living/user, params)
	if(SEND_SIGNAL(src, COMSIG_ITEM_ATTACK_OBJ, attacked_atom, user) & COMPONENT_CANCEL_ATTACK_CHAIN)
		return
	if(item_flags & NOBLUDGEON)
		return
	user.changeNext_move(attack_delay)
	user.adjustFatigueLoss(attack_fatigue_cost*w_class)
	user.do_attack_animation(attacked_atom)
	attacked_atom.attacked_by(src, user)


code:
/// WARNING: Shitcode!
/mob/living/carbon/human/ClickOn(atom/A, params)
	if(combat_style == CS_DUAL)
		var/list/modifiers = params2list(params)
		if(LAZYACCESS(modifiers, RIGHT_CLICK))
			swap_hand()
			modifiers -= RIGHT_CLICK
			params = list2params(modifiers)
			. = ..()
			swap_hand()
			adjustFatigueLoss(4)
		else
			return ..()
	else
		return ..()

/// Return TRUE to cancel other attack foot effects that respect it. Modifiers is the assoc list for click info such as if it was a right click.
/atom/proc/attack_foot(mob/user)
	. = FALSE
	//Adding fingerprints for kicking would be a bit weird, wouldn't it?
	if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_FOOT, user) & COMPONENT_CANCEL_ATTACK_CHAIN)
		. = TRUE

/// Return TRUE to cancel other attack jaw effects that respect it. Modifiers is the assoc list for click info such as if it was a right click.
/atom/proc/attack_jaw(mob/user, list/modifiers)
	. = FALSE
	//Adding fingerprints for kicking would be a bit weird, wouldn't it?
	if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_JAW, user) & COMPONENT_CANCEL_ATTACK_CHAIN)
		. = TRUE


code:
/datum/controller/configuration
	/// For punctuation forcing
	var/static/regex/punctuation_filter_regex
	var/static/regex/punctuation_filter_bypass_regex
	/// Prevents "NiggaMaster420" from joining
	var/static/regex/ckey_filter
	/// Prevents characters with dumb names
	var/static/regex/name_filter

/datum/controller/configuration/LoadChatFilter()
	if(!ic_filter_regex)
		log_config("Loading in character filter regex...")
		ic_filter_regex = LoadInCharacterFilter()
	if(!punctuation_filter_regex)
		log_config("Loading punctuation filter regex...")
		punctuation_filter_regex = LoadPunctuationFilter()
	if(!punctuation_filter_bypass_regex)
		log_config("Loading punctuation filter bypass regex...")
		punctuation_filter_bypass_regex = LoadPunctuationFilterBypass()
	if(!punctuation_filter_bypass_regex)
		log_config("Loading punctuation filter bypass regex...")
		punctuation_filter_bypass_regex = LoadPunctuationFilterBypass()
	if(!ckey_filter)
		log_config("Loading name filter regex...")
		ckey_filter = LoadNameFilter()
	if(!ckey_filter)
		log_config("Loading ckey filter regex...")
		ckey_filter = LoadCkeyFilter()

/datum/controller/configuration/proc/LoadInCharacterFilter()
	var/list/filter = list()
	if(!fexists("[directory]/in_character_filter.txt"))
		return
	log_config("Loading config file in_character_filter.txt...")
	for(var/line in world.file2list("[directory]/in_character_filter.txt"))
		if(!line)
			continue
		if(findtextEx(line,"#",1,2))
			continue
		filter += REGEX_QUOTE(line)
	return (length(filter) ? regex("\\b([jointext(filter, "|")])\\b", "gi") : null)

/datum/controller/configuration/proc/LoadPunctuationFilter()
	var/list/filter = list()
	if(!fexists("[directory]/septic/punctuation_filter.txt"))
		return
	log_config("Loading config file punctuation_filter.txt...")
	for(var/line in world.file2list("[directory]/septic/punctuation_filter.txt"))
		if(!line)
			continue
		if(findtextEx(line,"#",1,2))
			continue
		filter += REGEX_QUOTE(line)
	return (length(filter) ? regex("([jointext(filter, "|")])", "gi") : null)

/datum/controller/configuration/proc/LoadPunctuationFilterBypass()
	var/list/filter = list()
	if(!fexists("[directory]/septic/punctuation_filter_bypass.txt"))
		return
	log_config("Loading config file punctuation_filter_bypass.txt...")
	for(var/line in world.file2list("[directory]/septic/punctuation_filter_bypass.txt"))
		if(!line)
			continue
		if(findtextEx(line,"#",1,2))
			continue
		filter += REGEX_QUOTE(line)
	return (length(filter) ? regex("([jointext(filter, "|")])", "gi") : null)

/datum/controller/configuration/proc/LoadNameFilter()
	var/list/filter = list()
	if(!fexists("[directory]/septic/name_filter.txt"))
		return
	log_config("Loading config file name_filter.txt...")
	for(var/line in world.file2list("[directory]/septic/name_filter.txt"))
		if(!line)
			continue
		if(findtextEx(line,"#",1,2))
			continue
		filter += REGEX_QUOTE(line)
	return (length(filter) ? regex("\\b([jointext(filter, "|")])\\b", "gi") : null)

/datum/controller/configuration/proc/LoadCkeyFilter()
	var/list/filter = list()
	if(!fexists("[directory]/septic/ckey_filter.txt"))
		return
	log_config("Loading config file ckey_filter.txt...")
	for(var/line in world.file2list("[directory]/septic/ckey_filter.txt"))
		if(!line)
			continue
		if(findtextEx(line,"#",1,2))
			continue
		filter += REGEX_QUOTE(line)
	return (length(filter) ? regex("([jointext(filter, "|")])", "gi") : null)


code:
/**
  * Enables the FoV component, which hides objects and mobs behind the parent from their sight, unless they turn around, duh.
  * Camera mobs, AIs, ghosts and some other are of course exempt from this. This also doesn't influence simplemob AI, for the best.
  */
/datum/config_entry/flag/use_field_of_vision
	config_entry_value = 1

/datum/config_entry/string/ipstack_api_key
	protection = CONFIG_ENTRY_HIDDEN | CONFIG_ENTRY_LOCKED

/datum/config_entry/string/servertagline

/datum/config_entry/string/flufftagline

/datum/config_entry/string/bunkertroll

/datum/config_entry/string/bantroll

/datum/config_entry/number/movedelay/sprint_speed
	integer = FALSE

/datum/config_entry/number/movedelay/sprint_speed/ValidateAndSet()
	. = ..()
	var/datum/movespeed_modifier/sprinting/M = get_cached_movespeed_modifier(/datum/movespeed_modifier/sprinting)
	M.sync()

/datum/config_entry/number/sprint_cost
	config_entry_value = SPRINT_DEFAULT_STAMINA_COST
	integer = FALSE

/datum/config_entry/number/sprint_cost/ValidateAndSet()
	. = ..()
	GLOB.sprint_stamina_cost = config_entry_value


code:
SUBSYSTEM_DEF(antagonists)
	name = "Antagonists Setup"
	flags = SS_NO_FIRE

/datum/controller/subsystem/antagonists/Initialize(start_timeofday)
	. = ..()
	GLOB.syndicate_employers = list("Itobe Agent", "Itobe Hijacker")
	GLOB.normal_employers = list("Itobe Agent", "ZoomTech Psy Ops")
	GLOB.hijack_employers = list("Itobe Hijacker")
	GLOB.nanotrasen_employers = list("ZoomTech Psy Ops")


code:
//Used to handle cultural information stuff
SUBSYSTEM_DEF(cultural_info)
	name = "Cultural Info"
	flags = SS_NO_FIRE

/datum/controller/subsystem/cultural_info/Initialize(start_timeofday)
	. = ..()
	if(!LAZYLEN(GLOB.species_to_available_birthsigns))
		for(var/species_type in subtypesof(/datum/species))
			var/datum/species/species = new species_type()
			GLOB.species_to_available_birthsigns[species_type] = species.available_birthsigns.Copy()
			qdel(species)


code:
SUBSYSTEM_DEF(donators)
	name = "Donators"
	flags = SS_NO_FIRE
	var/list/connected_donators = list()
	var/list/donator_to_ooc_color = list()
	var/list/donator_to_ooc_flag = list()

/datum/controller/subsystem/donators/Initialize(start_timeofday)
	. = ..()
	load_donator_flags()
	load_donator_colors()

/datum/controller/subsystem/donators/proc/add_donator(ckey = "", rank = "")
	if(!LAZYLEN(ckey))
		return
	connected_donators[ckey] = rank

/datum/controller/subsystem/donators/proc/load_donator_flags()
	var/list/flags = icon_states('modular_septic/icons/ui_icons/chat/donator.dmi')
	for(var/flag in flags)
		donator_to_ooc_flag[flag] = flag

/datum/controller/subsystem/donators/proc/load_donator_colors()
	var/list/unsanitized_donators = world.file2list('config/septic/donator_colors.txt')
	for(var/unsanitized_donator in unsanitized_donators)
		if(findtext(unsanitized_donator, "#", 1, 2))
			continue
		unsanitized_donator = replacetext(unsanitized_donator, " ", "")
		var/list/donator_and_color = splittext(unsanitized_donator, "=")
		donator_to_ooc_color[donator_and_color[1]] = donator_and_color[2]


code:
//Used to manage sending droning sounds to various clients
SUBSYSTEM_DEF(droning)
	name = "Droning"
	flags = SS_NO_FIRE

/datum/controller/subsystem/droning/proc/area_entered(area/area_entered, client/entering)
	if(!area_entered || !entering)
		return
	if(!area_entered.droning_sound)
		//just kill the previous droning sound
		kill_droning(entering)
		return
	var/list/last_droning = list()
	last_droning |= entering.last_droning_sound
	var/list/new_droning = list()
	new_droning |= area_entered.droning_sound
	//Same ambience, don't bother
	if(last_droning ~= new_droning)
		return
	play_area_sound(area_entered, entering)

/datum/controller/subsystem/droning/proc/play_area_sound(area/area_player, client/listener)
	if(!area_player || !listener)
		return
	if(length(area_player.droning_sound) && (listener.prefs.toggles & SOUND_SHIP_AMBIENCE))
		//kill the previous droning sound
		kill_droning(listener)
		var/sound/droning = sound(pick(area_player.droning_sound), area_player.droning_repeat, area_player.droning_wait, area_player.droning_channel, area_player.droning_volume)
		SEND_SOUND(listener, droning)
		listener.droning_sound = droning
		listener.last_droning_sound = area_player.droning_sound

/datum/controller/subsystem/droning/proc/play_combat_music(music = null, client/dreamer)
	if(!music || !dreamer)
		return
	//kill the previous droning sound
	kill_droning(dreamer)
	var/sound/combat_music = sound(pick(music), repeat = TRUE, wait = 0, channel = CHANNEL_BUZZ, volume = 75)
	SEND_SOUND(dreamer, combat_music)
	dreamer.droning_sound = combat_music
	dreamer.last_droning_sound = combat_music.file

/datum/controller/subsystem/droning/proc/kill_droning(client/victim)
	if(!victim?.droning_sound)
		return
	var/sound/sound_killer = sound()
	sound_killer.channel = victim.droning_sound.channel
	SEND_SOUND(victim, sound_killer)
	victim.droning_sound = null
	victim.last_droning_sound = null


code:
/datum/controller/subsystem/id_access
	var/list/safe_codes = list(
		CODE_SYRINGE_GUN
	)

/datum/controller/subsystem/id_access/Initialize(start_timeofday)
	. = ..()
	for(var/e in safe_codes)
		safe_codes[e] = random_string(5, GLOB.numerals)


code:
SUBSYSTEM_DEF(ipstack)
	name = "IPStack"
	init_order = INIT_ORDER_XKEYSCORE
	flags = SS_NO_FIRE

	var/list/cache = list()

/datum/controller/subsystem/ipstack/proc/check_ip(ip)
	if(!ip)
		return DEFAULT_CLIENT_COUNTRY
	if(cache[ip])
		return cache[ip]
	if(SSdbcore.Connect())
		var/datum/db_query/query_get_ip = SSdbcore.NewQuery({"
			SELECT country
			FROM [format_table_name("ipstack")]
			WHERE
				ip = INET_ATON('[ip]')"})
		if(!query_get_ip.Execute())
			qdel(query_get_ip)
			return DEFAULT_CLIENT_COUNTRY
		if(query_get_ip.NextRow())
			var/country = query_get_ip.item[1]
			if(country)
				cache[ip] = country
				qdel(query_get_ip)
				return country
		else
			qdel(query_get_ip)
	return fetch_ip(ip)

/datum/controller/subsystem/ipstack/proc/fetch_ip(ip)
	if(!ip)
		return DEFAULT_CLIENT_COUNTRY
	if(cache[ip])
		return cache[ip]
	if(!CONFIG_GET(string/ipstack_api_key))
		return DEFAULT_CLIENT_COUNTRY
	var/list/http[] = world.Export("http://api.ipstack.com/[ip]?access_key=[CONFIG_GET(string/ipstack_api_key)]")
	if(http)
		var/status = text2num(http["STATUS"])
		if(status == 200)
			var/response = json_decode(file2text(http["CONTENT"]))
			if(response && response["country_name"])
				var/country = response["country_name"]
				cache[ip] = country
				var/datum/db_query/query_add_ip = SSdbcore.NewQuery("INSERT INTO [format_table_name("ipstack")] (ip, country) VALUES (INET_ATON('[ip]'), '[country]')")
				query_add_ip.Execute()
				qdel(query_add_ip)
				return country
			else
				return DEFAULT_CLIENT_COUNTRY
		else
			return DEFAULT_CLIENT_COUNTRY
	else
		return DEFAULT_CLIENT_COUNTRY


code:
/datum/controller/subsystem/job/setup_officer_positions()
	return

/atom/JoinPlayerHere(mob/M, buckle)
	. = ..()
	if(M.attributes)
		//update the hud please
		M.attributes.update_attributes()


code:
/datum/controller/subsystem/language/Initialize(start_timeofday)
	. = ..()
	if(!LAZYLEN(GLOB.name_to_language_datum))
		for(var/language_type in GLOB.all_languages)
			var/datum/language/instance = GLOB.language_datum_instances[language_type]
			GLOB.name_to_language_datum[instance.name] = instance
	if(!LAZYLEN(GLOB.species_to_learnable_languages) || !LAZYLEN(GLOB.species_to_necessary_languages) || !LAZYLEN(GLOB.species_to_default_languages))
		for(var/species_type in subtypesof(/datum/species))
			var/datum/species/species = new species_type()
			GLOB.species_to_learnable_languages[species_type] = species.learnable_languages.Copy()
			GLOB.species_to_necessary_languages[species_type] = species.necessary_languages.Copy()
			GLOB.species_to_default_languages[species_type] = species.default_languages.Copy()
			qdel(species)


code:
SUBSYSTEM_DEF(liquids)
	name = "Liquids"
	wait = 1 SECONDS
	flags = SS_KEEP_TIMING
	runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME

	var/list/active_turfs = list()
	var/list/currentrun_active_turfs = list()

	var/list/active_groups = list()

	var/list/active_immutables = list()

	var/list/evaporation_queue = list()
	var/evaporation_counter = 0 //Only process evaporation on intervals

	var/list/processing_fire = list()
	var/fire_counter = 0 //Only process fires on intervals

	var/list/singleton_immutables = list()

	var/run_type = SSLIQUIDS_RUN_TYPE_TURFS

/datum/controller/subsystem/liquids/proc/get_immutable(type)
	if(!singleton_immutables[type])
		var/atom/movable/liquid/immutable/new_one = new type()
		singleton_immutables[type] = new_one
	return singleton_immutables[type]

/datum/controller/subsystem/liquids/stat_entry(msg)
	msg += "AT:[active_turfs.len]|AG:[active_groups.len]|AIM:[active_immutables.len]|EQ:[evaporation_queue.len]|PF:[processing_fire.len]"
	return ..()

/datum/controller/subsystem/liquids/fire(resumed = FALSE)
	if(run_type == SSLIQUIDS_RUN_TYPE_TURFS)
		if(!length(currentrun_active_turfs) && length(active_turfs))
			currentrun_active_turfs = active_turfs.Copy()
		for(var/turf in currentrun_active_turfs)
			if(MC_TICK_CHECK)
				return
			var/turf/processing = turf
			processing.process_liquid_cell()
			currentrun_active_turfs -= processing //work off of index later
		if(!currentrun_active_turfs.len)
			run_type = SSLIQUIDS_RUN_TYPE_GROUPS
	if(run_type == SSLIQUIDS_RUN_TYPE_GROUPS)
		var/datum/liquids_group/liquids_group //faster declaration
		for(var/group in active_groups)
			liquids_group = group
			if(liquids_group.dirty)
				liquids_group.share()
				liquids_group.dirty = FALSE
			else if(!liquids_group.amount_of_active_turfs)
				liquids_group.decay_counter++
				if(liquids_group.decay_counter >= LIQUIDS_GROUP_DECAY_TIME)
					//Perhaps check if any turfs in here can spread before removing it? It's not unlikely they would
					liquids_group.break_group()
			if(MC_TICK_CHECK)
				break
		run_type = SSLIQUIDS_RUN_TYPE_IMMUTABLES
	if(run_type == SSLIQUIDS_RUN_TYPE_IMMUTABLES)
		var/turf/processing //faster declaration
		for(var/turf in active_immutables)
			processing = turf
			processing.process_immutable_liquid()
		run_type = SSLIQUIDS_RUN_TYPE_EVAPORATION

	if(run_type == SSLIQUIDS_RUN_TYPE_EVAPORATION)
		evaporation_counter++
		if(evaporation_counter >= REQUIRED_EVAPORATION_PROCESSES)
			for(var/turf in evaporation_queue)
				var/turf/evaporating = turf
				if(prob(EVAPORATION_CHANCE))
					evaporating.liquids.process_evaporation()
				if(MC_TICK_CHECK)
					break
			evaporation_counter = 0
		run_type = SSLIQUIDS_RUN_TYPE_FIRE

	if(run_type == SSLIQUIDS_RUN_TYPE_FIRE)
		fire_counter++
		if(fire_counter >= REQUIRED_FIRE_PROCESSES)
			var/turf/processing //faster declaration
			for(var/turf in processing_fire)
				processing = turf
				processing.liquids.process_fire()
				if(MC_TICK_CHECK)
					break
			fire_counter = 0
		run_type = SSLIQUIDS_RUN_TYPE_TURFS

/datum/controller/subsystem/liquids/proc/add_active_turf(turf/added_turf)
	if(!active_turfs[added_turf])
		active_turfs[added_turf] = TRUE
		if(added_turf.liquids_group)
			added_turf.liquids_group.amount_of_active_turfs++

/datum/controller/subsystem/liquids/proc/remove_active_turf(turf/remove_turf)
	if(active_turfs[remove_turf])
		active_turfs -= remove_turf
		if(remove_turf.liquids_group)
			remove_turf.liquids_group.amount_of_active_turfs--


code:
SUBSYSTEM_DEF(pollution)
	name = "Pollution"
	init_order = INIT_ORDER_POLLUTION //Before atoms, because the emitters may need to know the singletons
	runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
	wait = 2 SECONDS
	/// Currently active pollution
	var/list/active_pollution = list()
	/// All pollution in the world
	var/list/all_polution = list()
	/// Currently processed batch of pollutants
	var/list/current_run = list()
	/// Already processed pollutants in cell process
	var/list/processed_this_run = list()
	/// Ticker for dissipation task
	var/dissapation_ticker = 0
	/// What's the current task we're doing
	var/pollution_task = POLLUTION_TASK_PROCESS
	/// Associative list of types of pollutants to their instanced singletons
	var/list/singletons = list()

/datum/controller/subsystem/pollution/stat_entry(msg)
	msg += "|AT:[active_pollution.len]|P:[all_polution.len]"
	return ..()

/datum/controller/subsystem/pollution/Initialize(start_timeofday)
	//Initialize singletons
	for(var/type in subtypesof(/datum/pollutant))
		var/datum/pollutant/pollutant_cast = type
		if(!initial(pollutant_cast.name))
			continue
		singletons[type] = new type()
	return ..()

/datum/controller/subsystem/pollution/fire(resumed = FALSE)
	var/list/current_run_cache = current_run
	if(pollution_task == POLLUTION_TASK_PROCESS)
		if(!current_run_cache.len)
			current_run_cache = active_pollution.Copy()
			processed_this_run.Cut()
		while(current_run_cache.len)
			var/datum/pollution/pollution = current_run_cache[current_run_cache.len]
			current_run_cache.len--
			processed_this_run[pollution] = TRUE
			pollution.process_cell()
			if(MC_TICK_CHECK)
				return
		dissapation_ticker++
		if(dissapation_ticker >= TICKS_TO_DISSIPATE)
			pollution_task = POLLUTION_TASK_DISSIPATE
			dissapation_ticker = 0
			current_run_cache = all_polution.Copy()
	if(pollution_task == POLLUTION_TASK_DISSIPATE)
		while(current_run_cache.len)
			var/datum/pollution/pollution = current_run_cache[current_run_cache.len]
			current_run_cache.len--
			pollution.scrub_amount(POLLUTION_HEIGHT_DIVISOR, FALSE, TRUE)
			if(MC_TICK_CHECK)
				return
		pollution_task = POLLUTION_TASK_PROCESS


code:
PROCESSING_SUBSYSTEM_DEF(fraggots)
	wait = 2


code:
// Smooth HUD updates, but low priority
PROCESSING_SUBSYSTEM_DEF(huds)
	name = "HUD updates"
	wait = 1
	priority = FIRE_PRIORITY_OBJ
	stat_tag = "HUDS"


code:
PROCESSING_SUBSYSTEM_DEF(pollution_emitters)
	name = "Pollution Emitters"
	priority = FIRE_PRIORITY_OBJ
	flags = SS_NO_INIT
	wait = 10 SECONDS


code:
/datum/controller/subsystem/ticker/Shutdown()
	round_end_sound = SSstation.announcer.get_rand_roundend_sound()
	return ..()

/datum/controller/subsystem/ticker/PostSetup()
	. = ..()
	for(var/i in GLOB.player_list)
		if(!ismob(i))
			continue
		var/mob/attribute_guy = i
		if(!attribute_guy.attributes)
			continue
		//update the hud please
		attribute_guy.attributes.update_attributes()


code:
SUBSYSTEM_DEF(turf_fire)
	name = "Turf Fire"
	runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
	wait = 2 SECONDS
	var/list/fires = list()

/datum/controller/subsystem/turf_fire/fire()
	for(var/i in fires)
		var/atom/movable/fire/fire = i
		fire.process()


code:
/*!
This subsystem mostly exists to populate and manage the who datums
*/
SUBSYSTEM_DEF(who)
	name = "Who"
	flags = SS_NO_FIRE
	/// Who datum
	var/datum/who/who_datum
	/// Adminwho datum
	var/datum/adminwho/adminwho_datum

/datum/controller/subsystem/who/Initialize(start_timeofday)
	. = ..()
	who_datum = new()
	adminwho_datum = new()


code:
/datum/centcom_announcer
	welcome_sounds = list('modular_septic/sound/round/roundstart.ogg')
	///Roundshift end audio
	var/goodbye_sounds = list('modular_septic/sound/round/roundend.ogg')

/datum/centcom_announcer/proc/get_rand_roundend_sound()
	return pick(goodbye_sounds)


code:
/datum/centcom_announcer/default
	welcome_sounds = list('modular_septic/sound/round/roundstart.ogg')


code:
// Atmos types used for planetary airs
/datum/atmosphere/nevado_surface
	id = NEVADO_SURFACE_DEFAULT_ATMOS

	base_gases = list(
		/datum/gas/oxygen=20,
		/datum/gas/nitrogen=50,
	)
	normal_gases = list(
		/datum/gas/oxygen=10,
		/datum/gas/nitrogen=10,
		/datum/gas/carbon_dioxide=5,
		/datum/gas/water_vapor=2,
	)
	restricted_gases = list(
		/datum/gas/plasma=0.5,
		/datum/gas/pluoxium=0.3,
		/datum/gas/freon=0.2,
		/datum/gas/miasma=0.15,
	)
	restricted_chance = 20

	//some pretty normal pressures
	minimum_pressure = ONE_ATMOSPHERE-20
	maximum_pressure = ONE_ATMOSPHERE

	minimum_temp = 248 //-25.15 celsius
	maximum_temp = 263.15 // -10 celsius

/datum/atmosphere/nevado_caves
	id = NEVADO_CAVES_DEFAULT_ATMOS

	base_gases = list(
		/datum/gas/oxygen=20,
		/datum/gas/nitrogen=50,
	)
	normal_gases = list(
		/datum/gas/oxygen=10,
		/datum/gas/nitrogen=25,
		/datum/gas/water_vapor=2,
	)
	restricted_gases = list(
		/datum/gas/miasma=0.2,
		/datum/gas/plasma=0.1,
	)
	restricted_chance = 5

	//some pretty normal pressures
	minimum_pressure = ONE_ATMOSPHERE
	maximum_pressure = ONE_ATMOSPHERE

	minimum_temp = T0C-5 //-5 celsius
	maximum_temp = T20C-10 // 10 celsius