Classes

Concepts

Libraries

Objects

contractor »

conversationAnswerData »

engineStatData »

issueData »

playerPlatformSpecialistData »

projectReviewConclusion »

projectReviewRemark »

randomEventData »

statusIcon »

switchCallback

Description

Called when toggling the preference.

Arguments

1 bool newState

the new state of the preference.

Example

-- taken from game/preferences.lua


preferences:registerNew({
	id = developer.AUTO_SPEND_AP_PREFERENCE,
	display = _T("AUTO_SPEND_ATTRIBUTE_POINTS", "Auto-spend attribute points"),
	description = _T("AUTO_SPEND_ATTRIBUTE_POINTS_DESCRIPTION", "When employees level up they gain 1 attribute point, and you have to manually assign it. Enabling this preference will make employees automatically spend gained attribute points into attributes which are the most important to their role."),
	switchCallback = function(self, state)
		if state then
			for key, employee in ipairs(studio:getEmployees()) do
				employee:autoSpendAttributePoints()
			end
		end
	end
})