SNACKS_RESOURCE_INTRO:NEEDS[SnacksStress]
{
	name = Hydrazine
	title = Hydrazine!
	description = If you're a fan of the Kerbfleet series by forum user Kuzzter, then this Snacks addon is for you! When kerbals get stressed, they can turn to "Hydrazine," a hard liquor created by Bill Kerman that's distilled from monopropellant and (hopefully) named so that Kerbfleet Command won't realize what the crew has been up to in deep space. An occasional shot of Hydrazine is great at calming nerves, but sometimes a kerbal ties one too many on and passes out.
}

RESOURCE_DEFINITION:NEEDS[SnacksStress]
{
	name = HydrazineVodka
	displayName = "Hydrazine"
	density = 0.0000121
	unitCost = .5
	flowMode = ALL_VESSEL
	transfer = PUMP
	isTweakable = true
	volume = 0.044
}

@PART[radialSnackTin]:NEEDS[SnacksStress]
{
	@MODULE[SnacksResourceSwitcher]
	{
		OPTION
		{
			name = Hydrazine

			RESOURCE
			{
				name = HydrazineVodka
				amount = 17
				maxAmount = 17
			}

			RESOURCE
			{
				name = Snacks
				amount = 148
				maxAmount = 148
			}
		}
	}
}

SNACKS_PART_RESOURCE:NEEDS[SnacksStress]
{
	resourceName = HydrazineVodka
	amount = 17
	maxAmount = 17
	isPerKerbal = false
}

SNACKS_RESOURCE_PROCESSOR:NEEDS[SnacksStress]
{
	name = TakeAShotOfHydrazine
	secondPerCycle = 21600

	PRECONDITION
	{
		name = CheckCondition
		conditionSummary = Stressed Out
	}

	PRECONDITION
	{
		name = CheckRandomChance
		dieRollMin = 1
		dieRollMax = 100
		targetNumber = 80
	}

	CONSUMED_RESOURCE
	{
		resourceName = HydrazineVodka
		amount = 1.0
		showInSnapshot = false
		failureResultAppliesOutcomes = false
	}
}

SNACKS_EVENT:NEEDS[SnacksStress]
{
	name = mellowOut
	eventCategory = categoryPostProcessCycle
	kerbalsAffected = affectsAllAssigned

	PRECONDITION 
	{
		name = CheckProcessorResult
		type = resultConsumptionSuccess
		processorName = TakeAShotOfHydrazine
		resourceName = HydrazineVodka
		cyclesRequired = 1
	}

	OUTCOME
	{
		name = ConsumeResource
		resourceName = Stress
		amount = 1
	}
}

SNACKS_EVENT:NEEDS[SnacksStress]
{
	name = drankTooMuch
	eventCategory = categoryPostProcessCycle
	kerbalsAffected = affectsAllAssigned

	PRECONDITION 
	{
		name = CheckProcessorResult
		type = resultConsumptionSuccess
		processorName = TakeAShotOfHydrazine
		resourceName = HydrazineVodka
		cyclesRequired = 1
	}

	PRECONDITION
	{
		name = CheckRandomChance
		dieRollMin = 1
		dieRollMax = 100
		targetNumber = 80
	}

	OUTCOME
	{
		name = FaintPenalty
		playerMessage = passes out from drinking too much!
		faintDurationSeconds = 180
	}
}