Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in /var/www/vhosts/gamedevstudiogame.com/httpdocs/classes/client.php on line 124

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /var/www/vhosts/gamedevstudiogame.com/httpdocs/classes/client.php on line 124
Game dev studio

Classes

Concepts

Libraries

Objects

contractor »

conversationAnswerData »

engineStatData »

issueData »

playerPlatformSpecialistData »

projectReviewConclusion »

projectReviewRemark »

randomEventData »

statusIcon »

new

Description

Creates an instance of contractData.

Example

local data = contractData.new()

-- taken from game/contract_work/contractor.lua

function contractor:getGamePublishingContract(gameObj, riskRating)
	local publishData = self.data.publishing
	
	-- the closer we are to release, the shorter the deadline becomes

	local scale = gameObj:getScale()
	local scale = scale - publishData.minimumGameScale
	local deadline = timeline.curTime + self:calculateDeadline(1 - gameObj:getOverallCompletion(), scale) * timeline.DAYS_IN_MONTH
	local rep = studio:getReputation()
	
	-- calculate the advertisement strength

	local strength = math.lerp(publishData.minAdvertisement, 1, math.min(1, scale / (publishData.maxAdvertAtGameScale - publishData.minimumGameScale))) * math.lerp(publishData.minReputationAdvert, 1, (rep - publishData.minimumReputation) / (publishData.maximumReputation - publishData.minimumReputation))
	
	local data = contractData.new()
	data:setContractType(contractor.CONTRACT_TYPES.PUBLISHED)
	data:setScale(gameObj:getScale())
	data:setDeadline(deadline)
	data:setAdvertisementStrength(math.lerp(publishData.popularityGainMin, publishData.popularityGainMax, strength))
	data:setAdvertisementCosts(math.lerp(publishData.advertisementCostMin, publishData.advertisementCostMax, strength))
	data:setFinalShares(math.lerp(publishData.minShare, publishData.maxShare, riskRating))
	data:setMilestone(math.round(gameObj:getOverallCompletion(), 1))
	
	return data
end