Classes

Concepts

Libraries

Objects

contractor »

conversationAnswerData »

engineStatData »

issueData »

playerPlatformSpecialistData »

projectReviewConclusion »

projectReviewRemark »

randomEventData »

statusIcon »

update

Description

Called when time is running and an employee is performing some kind of action.

Arguments

1 number delta

the frame delta.

Example

-- taken from game/developer/actions.lua


function useWaterDispenser:update(dt)
	if not self.path then
		local path, result = studio:getPathToObjectEntrance(self.employee, self.targetObject)
		-- if result is nil it means it's not yet done trying to find a path, if it's false it means it failed

		
		if result == false then -- pathfinding failed, don't do anything

			self.done = true
			self:abort()
		elseif result == true then
			self.path = path -- we got a path, apply it to the employee and let him do the rest

			self.employee:setWalkPath(path)
		end
	else		
		if not self.employee:getWalkPath() and not self.employee.requiresPathRecomputation then
			if not self.facing then
				self.facing = true
				self.employee:faceObject(self.targetObject)
			else
				if self.employee:getAvatar():isAnimQueueEmpty() then
					self.path = nil
					self.done = true -- the employee has used the water dispenser, end here

					self.targetObject:setInteractionTarget(nil)
				end
			end
		end
	end
end