Kinkocalypse = Kinkocalypse or {}
Kinkocalypse.ConditionalSpeechSayOrig = nil

function Kinkocalypse.Say(text, isDialogueAlreadyMuffled)
	local equipedTags = Kinkocalypse.GetPlayerEquipedRestrictionsTags()
	-- allow specific muffled/gagged dialogue to be used without also playing the random moan in front of it
	isDialogueAlreadyMuffled = isDialogueAlreadyMuffled or false
	if equipedTags["SteelGag"] ~= nil and isDialogueAlreadyMuffled == false then
		local moan = Kinkocalypse.GetMoan()
		getPlayer():Say(moan.."! ("..text..")")
	else
		getPlayer():Say(text)
	end	
end

-- Konditional speech override
Kinkocalypse.ConditionalSpeechSay = function(player, dialogue, vocal_volume)
	local equipedTags = Kinkocalypse.GetPlayerEquipedRestrictionsTags()
	if equipedTags["SteelGag"] ~= nil and dialogue ~= nil then
		vocal_volume = 1
		dialogue = Kinkocalypse.GetMoan().."!"
	end
	Kinkocalypse.ConditionalSpeechSayOrig(player, dialogue, vocal_volume)
end

function Kinkocalypse.GetMoan()
	local moan = "Mhm"
	local x = ZombRand(1,4)
	for i = 0, x do
		local rand = ZombRand(0,100)
		if rand >= 95 then moan = moan.."-"
		elseif rand >= 80 then moan = moan.."mh"
		elseif rand >= 70 then moan = moan.."mpf"
		elseif rand >= 60 then moan = moan.."m"
		elseif rand >= 50 then moan = moan.."p"
		elseif rand >= 40 then moan = moan.."f"
		elseif rand >= 30 then moan = moan.."ph"
		elseif rand >= 20 then moan = moan.."hmpf"
		elseif rand >= 10 then moan = moan.."mf"
		else moan = moan.."h" end
	end
	moan = moan.."m"
	return moan
end

function Kinkocalypse.GetMuffledOrgasm(orgasmSound)
	-- bespoke gagged cum sounds :D
	local rand = ZombRand(0, 100)
	if rand >= 75 then orgasmSound = "Mghhh!!!"
	elseif rand >= 50 then orgasmSound = "Mmm... Mmm..!!"
	elseif rand >= 25 then orgasmSound = "Mmfff!!! Mmm.. mrr..."
	else orgasmSound = "Mm- Mm - MMH!!!" end
	return orgasmSound
end

function Kinkocalypse.GetNormalOrgasm(orgasmSound)
	local rand = ZombRand(0, 100)
	if rand >= 75 then orgasmSound = "O-ooh"
	elseif rand >= 50 then orgasmSound = "A-ah"
	elseif rand >= 25 then orgasmSound = "Uuuhh"
	else orgasmSound = "O-Uuhha" end
	return orgasmSound
end

function Kinkocalypse.GetOrgasmSound()
	local equipedTags = Kinkocalypse.GetPlayerEquipedRestrictionsTags()
	local orgasmSound = ""
	if equipedTags["SteelGag"] ~= nil then orgasmSound = Kinkocalypse.GetMuffledOrgasm(orgasmSound)
	else orgasmSound = Kinkocalypse.GetNormalOrgasm(orgasmSound) end
	return orgasmSound
end