local enemy_mapping_clean = {
	["units/payday2/characters/ene_cop_1/ene_cop_1"] = "cop_pistol",
	["units/payday2/characters/ene_cop_2/ene_cop_2"] = "cop_revolver",
	["units/payday2/characters/ene_cop_3/ene_cop_3"] = "cop_smg",
	["units/payday2/characters/ene_cop_4/ene_cop_4"] = "cop_sg",
	["units/pd2_dlc_rvd/characters/ene_la_cop_1/ene_la_cop_1"] = "cop_pistol",
	["units/pd2_dlc_rvd/characters/ene_la_cop_2/ene_la_cop_2"] = "cop_revolver",
	["units/pd2_dlc_rvd/characters/ene_la_cop_3/ene_la_cop_3"] = "cop_smg",
	["units/pd2_dlc_rvd/characters/ene_la_cop_4/ene_la_cop_4"] = "cop_la_sg",	
	["units/pd2_dlc_chas/characters/ene_male_chas_police_01/ene_male_chas_police_01"] = "cop_pistol",
	["units/pd2_dlc_chas/characters/ene_male_chas_police_02/ene_male_chas_police_02"] = "cop_revolver_sf",
	["units/pd2_dlc_ranc/characters/ene_male_ranc_ranger_01/ene_male_ranc_ranger_01"] = "cop_pistol",
	["units/pd2_dlc_ranc/characters/ene_male_ranc_ranger_02/ene_male_ranc_ranger_02"] = "cop_revolver",	
	["units/payday2/characters/ene_fbi_1/ene_fbi_1"] = "fbi_1",
	["units/payday2/characters/ene_fbi_2/ene_fbi_2"] = "fbi_2",
	["units/payday2/characters/ene_fbi_3/ene_fbi_3"] = "fbi_3",
	["units/payday2/characters/ene_murkywater_1/ene_murkywater_1"] = "mrkwater_ump",
	["units/pd2_dlc_berry/characters/ene_murkywater_no_light/ene_murkywater_no_light"] = "mrkwater_ump_nolight",
	["units/payday2/characters/ene_murkywater_2/ene_murkywater_2"] = "mrkwater_scar",
	["units/pd2_mcmansion/characters/ene_hoxton_breakout_guard_1/ene_hoxton_breakout_guard_1"] = "fbi_ump",
	["units/pd2_mcmansion/characters/ene_hoxton_breakout_guard_2/ene_hoxton_breakout_guard_2"] = "fbi_scar",
	["units/payday2/characters/ene_security_1/ene_security_1"] = "sec_pistol",
	["units/payday2/characters/ene_security_2/ene_security_2"] = "sec_smg",
	["units/payday2/characters/ene_security_3/ene_security_3"] = "sec_sg",
	["units/payday2/characters/ene_security_4/ene_security_4"] = "sec_4",
	["units/payday2/characters/ene_security_5/ene_security_5"] = "sec_5",
	["units/payday2/characters/ene_security_6/ene_security_6"] = "sec_6",
	["units/payday2/characters/ene_security_7/ene_security_7"] = "sec_7",
	["units/pd2_dlc1/characters/ene_security_gensec_1/ene_security_gensec_1"] = "sec_pistol",
	["units/pd2_dlc1/characters/ene_security_gensec_2/ene_security_gensec_2"] = "sec_smg"
}

-- do not touch this.
local enemy_mapping = {}
for name, sequence in pairs(enemy_mapping_clean) do
	enemy_mapping[Idstring(name):key()] = sequence
	enemy_mapping[Idstring(name .. "_husk"):key()] = sequence
end

local function random_mat_seq_initialization(cop)
	local sequence = enemy_mapping[cop._unit:name():key()]

	if cop._unit:damage() and cop._unit:damage():has_sequence(sequence) then
		cop._unit:damage():run_sequence_simple(sequence)
	end
end

if RequiredScript == "lib/units/enemies/cop/copbase" then
	Hooks:PreHook(CopBase, "post_init", "lcmfv_post_init", random_mat_seq_initialization)

	local paths = table.list_to_set({
	-- FOR WEKK: ADD IN ANY NEW MATERIAL CONFIGS HERE. YOU'LL ONLY NEED TO ADD IN A FILEPATH AND MAKE SURE
	-- THERE'S COMMAS AT THE END OF EACH ENTRY HERE IN THIS TABLE EXCEPT THE LAST ENTRY
		"units/payday2/characters/ene_cop_vars/ene_cop_var1",
		"units/payday2/characters/ene_cop_vars/ene_cop_var2",
		"units/payday2/characters/ene_cop_vars/ene_cop_var3",
		"units/payday2/characters/ene_fbi_vars/ene_fbi_var1",
		"units/payday2/characters/ene_fbi_vars/ene_fbi_var2",
		"units/payday2/characters/ene_fbi_vars/ene_fbi_var3",
		"units/payday2/characters/ene_fbi_vars/ene_fbi_var4",
		"units/payday2/characters/ene_fbi_vars/ene_fbi_var5",
		"units/payday2/characters/ene_fbi_vars/ene_fbi_var6",
		"units/payday2/characters/ene_security_vars/ene_security_var1",
		"units/payday2/characters/ene_security_vars/ene_security_var2",
		"units/payday2/characters/ene_security_vars/ene_security_var3",
		"units/payday2/characters/ene_security_vars/ene_security_var4",
		"units/payday2/characters/ene_security_vars/ene_security_var5",
		"units/payday2/characters/ene_security_vars/ene_security_var6",
		"units/pd2_dlc_rvd/characters/ene_la_cop_vars/ene_la_cop_var1",
		"units/pd2_dlc_rvd/characters/ene_la_cop_vars/ene_la_cop_var2",
		"units/pd2_dlc_rvd/characters/ene_la_cop_vars/ene_la_cop_var3",
		"units/pd2_dlc_rvd/characters/ene_la_cop_vars/ene_la_cop_var4",
		"units/pd2_dlc_rvd/characters/ene_la_cop_vars/ene_la_cop_var5",
		"units/pd2_dlc_rvd/characters/ene_la_cop_vars/ene_la_cop_var6",
		"units/payday2/characters/ene_murkywater_1_vars/ene_murkywater_var1",
		"units/payday2/characters/ene_murkywater_1_vars/ene_murkywater_var2",
		"units/payday2/characters/ene_murkywater_1_vars/ene_murkywater_var3",
		"units/payday2/characters/ene_murkywater_1_vars/ene_murkywater_var4",
		"units/payday2/characters/ene_murkywater_2_vars/ene_murkywater_var1",
		"units/payday2/characters/ene_murkywater_2_vars/ene_murkywater_var2",
		"units/payday2/characters/ene_murkywater_2_vars/ene_murkywater_var3",
		"units/payday2/characters/ene_murkywater_2_vars/ene_murkywater_var4",
		"units/pd2_dlc_berry/characters/ene_murkywater_vars/ene_murkywater_var1",
		"units/pd2_dlc_berry/characters/ene_murkywater_vars/ene_murkywater_var2",
		"units/pd2_dlc_berry/characters/ene_murkywater_vars/ene_murkywater_var3",
		"units/pd2_dlc_berry/characters/ene_murkywater_vars/ene_murkywater_var4",
		"units/pd2_mcmansion/characters/ene_hoxton_breakout_guard_vars/ene_hoxton_breakout_guard_var1",
		"units/pd2_mcmansion/characters/ene_hoxton_breakout_guard_vars/ene_hoxton_breakout_guard_var2",
		"units/pd2_mcmansion/characters/ene_hoxton_breakout_guard_vars/ene_hoxton_breakout_guard_var3",
		"units/pd2_mcmansion/characters/ene_hoxton_breakout_guard_vars/ene_hoxton_breakout_guard_var4",
		"units/pd2_dlc1/characters/ene_security_gensec_vars/ene_security_gensec_var1",
		"units/pd2_dlc1/characters/ene_security_gensec_vars/ene_security_gensec_var2",
		"units/pd2_dlc1/characters/ene_security_gensec_vars/ene_security_gensec_var3",
		"units/pd2_dlc1/characters/ene_security_gensec_vars/ene_security_gensec_var4",
		"units/pd2_dlc1/characters/ene_security_gensec_vars/ene_security_gensec_var5",
		"units/pd2_dlc1/characters/ene_security_gensec_vars/ene_security_gensec_var6"
	})

	for path in pairs(paths) do
		local normal_ids = Idstring(path)
		local contour_ids = Idstring(path .. "_contour")

		CopBase._material_translation_map[tostring(normal_ids:key())] = contour_ids
		CopBase._material_translation_map[tostring(contour_ids:key())] = normal_ids 
	end
elseif RequiredScript == "lib/units/enemies/cop/huskcopbase" then
	Hooks:PreHook(HuskCopBase, "post_init", "lcmfv_post_init", random_mat_seq_initialization)
end