示例#1
0
	def GameFinish (self, delay):
		self.info = vizinfo.add(self.tooltips['congrats'])
		self.info.visible(0)
		self.info.icon(viz.add('textures/c-olive_icon.png'))
		self.info.add(viz.TEXT3D, self.tooltips['finish']+'\n'+self.tooltips['produce'] % self._oil.getMessage())
		self.info.add(viz.TEXT3D, self.tooltips['stats'])
		self.info.translate(0.1,0.95)
		self.info.alignment(vizinfo.UPPER_LEFT)
		self.info.scale(2.4,2.6)
		self.info.messagecolor(100,100,0)
		self.info.bgcolor(viz.BLACK, 0.8)
		self.info.bordercolor([100,100,0], .9)
		points = self.info.add(viz.TEXQUAD, self.tooltips['score']+': %s' % self._total.getMessage())
		points.texture(viz.add('textures/total_icon.png'))
		time = self.info.add(viz.TEXQUAD, self.tooltips['time']+': %s' % self.ConvertTime(viz.tick()))
		time.texture(viz.add('textures/time_icon.png'))
		self.info.shrink()
		#hide all other panels
		self._scorePanel.visible(0)
		self._infoPanel.visible(0)
		self._alertPanel.visible(0)
		for p in self.PLAYERS.values():
			p._infoPanel.visible(0)
			p._alertPanel.visible(0)
			p._hud.visible(0)
		time.addAction(vizact.waittime(delay))
		time.addAction(vizact.call(self.info.visible, 1))
		time.addAction(vizact.waittime(.1))
		time.addAction(vizact.call(self.PlayVictory))
		time.addAction(vizact.call(self.info.expand))
示例#2
0
def lowerBox():
	starting_box.audio_start.stop()
	starting_box.audio_start.play()
	starting_box.audio_running.play()
	starting_box.runAction(vizact.move(0,-2,0,time=(starting_box_height/2)))
	starting_box.addAction(vizact.call(starting_box.audio_stop.play))
	starting_box.addAction(vizact.call(starting_box.audio_running.pause))	
示例#3
0
def raiseWalls():
	for i, height in enumerate(wallHeights):
		leftWalls[i].runAction(vizact.move(0,2,0,time=(height/2)))
		rightWalls[i].runAction(vizact.move(0,2,0,time=(height/2)))
		if i == len(wallHeights) - 1:
			walls.audio_running.play()
			walls.runAction(vizact.move(0,2,0,time=(height/2)))
			walls.addAction(vizact.call(walls.audio_stop.play))
			walls.addAction(vizact.call(walls.audio_running.pause))
示例#4
0
文件: pit.py 项目: vhilab/VRITS-2015
def TogglePlatform():
    """Toggle raising/lower of platform"""
    platform.raised = not platform.raised
    pos = platform.positions[platform.raised]
    platform.audio_start.stop()
    platform.audio_start.play()
    platform.audio_running.play()
    platform.runAction(vizact.moveTo(pos,speed=2.0))
    platform.addAction(vizact.call(platform.audio_stop.play))
    platform.addAction(vizact.call(platform.audio_running.pause))
示例#5
0
	def IncreaseOilTotal (self, dur, amount):
		self.SOUNDS['oil'].loop(viz.ON)
		self.SOUNDS['oil'].play()
		score = int(self._score.getMessage())
		oil = int(self._oil.getMessage())
		total = int(self._total.getMessage())
		oilCounter = vizact.mix(oil, oil+amount, time=dur)
		totalCounter = vizact.mix(total, total+score*amount, time=dur)
		self._total.addAction(vizact.call(self.CounterIncrease, self._total, totalCounter))
		self._oil.addAction(vizact.call(self.CounterIncrease, self._oil, oilCounter))
		self._oil.addAction(vizact.call(self.CounterSoundStop))
示例#6
0
def TogglePit():
    """Toggle raising/lowering of pit"""
    pit.lowered = not pit.lowered
    pos = pit.positions[pit.lowered]
    pit.audio_running.play()
    pit.runAction(vizact.moveTo(pos,speed=2.0))
    pit.addAction(vizact.call(pit.audio_stop.play))
    pit.addAction(vizact.call(pit.audio_running.pause))

    # Use pit color to blend between lower/upper lightmaps
    duration = pit.getActionInstance().getDuration()
    color = pit.colors[pit.lowered]
    pit.runAction(vizact.fadeTo(color,time=duration),pool=1)
示例#7
0
	def ChangeGuide (self, dir):	#dir=1 -> move right, -1 -> move left
		dir = -dir
		handle = self.components['handle']
		pos = handle.getPosition()
		newPos = [pos[0]+.095*dir, pos[1], pos[2]]
		self.faClass.belts['oilPump'].MoveBelt(-dir, .095)
		handle.addAction(vizact.moveTo(newPos, time=2, interpolate=vizact.easeInOut))
		if dir < 0:
			handle.addAction(vizact.call(self.StopCrazy))
			handle.addAction(vizact.call(self.SetMotion))
		else:
			handle.addAction(vizact.call(self.StartCrazy))
			handle.addAction(vizact.call(self.EndMotion))
示例#8
0
	def CoalAction(self, act):	#act=1->load, 2->light, 3->waste
		coalFurnace = self.components['coalfurnace']
		if act == 1:	#fade in the coals
			coalFurnace.addAction(vizact.method.visible(1))
			coalFurnace.addAction(vizact.fadeTo(1, begin=0, time=1))
		elif act == 2:	#turn coals red and light fire
			self.PlayAudio('boiler_light', coalFurnace, viz.PLAY)
			fireSignal = vizact.signal()
			coalFurnace.addAction(vizact.fadeTo(viz.RED, time=1))
			coalFurnace.addAction(fireSignal.trigger)
			cPos = coalFurnace.getPosition()
			coalFurnace.addAction(vizact.moveTo([cPos[0],cPos[1],cPos[2]+.1],time=.5))
			self.fire.addAction(fireSignal.wait)
			self.fire.addAction(vizact.method.visible(1))
			self.fire.addAction(vizact.fadeTo(0.75, time=1))
			self.fire.addAction(vizact.waittime(4))
			self.fire.addAction(vizact.call(self.PlayAudio, 'boiler_furnace'))
		elif act == 3:	#fade out the coals and fire
			self.AdjustAudio(.5)
			coalFurnace.addAction(vizact.fadeTo(0.25, time=.5))
			self.fire.addAction(vizact.fadeTo(0.25, time=.5))
		elif act == 4:	#light up the coals and fire again
			self.AdjustAudio(1)
			coalFurnace.addAction(vizact.fadeTo(1, time=.5))
			self.fire.addAction(vizact.fadeTo(.75, time=.5))
		elif act == 5:	#fade out the coals and fire completely
			self.AdjustAudio(0)
			self.AdjustAudio(1)
			coalFurnace.addAction(vizact.fadeTo(0, time=.5))
			coalFurnace.addAction(vizact.method.setPosition([0,0,0]))
			coalFurnace.addAction(vizact.method.color(viz.GRAY))
			coalFurnace.addAction(vizact.method.visible(0))
			self.fire.addAction(vizact.fadeTo(0, time=.5))
			self.fire.addAction(vizact.method.visible(0))
def FallAction():
	"""Flashes screen red and animates blur effect"""

	flash_quad.visible(True)
	flash_quad.color(viz.RED)
	fade_out = vizact.fadeTo(viz.BLACK,time=2.5)
	flash_quad.runAction(vizact.sequence(fade_out,vizact.method.visible(False)))
	flash_quad.runAction(vizact.call(blurEffect.setDistance,vizact.mix(50,0,time=2.5)),pool=1)
示例#10
0
	def ChangeGuide (self, dir):	#dir=1 -> move right, -1 -> move left
		if dir > 0:
			self.PlayAudio('laval_start', self.object, viz.PLAY)
		else:
			self.AdjustAudio(0)
			self.PlayAudio('laval_stop', self.object, viz.PLAY)
		guide = self.components['handle'+self.LR]
		pos = guide.getPosition()
		newPos = [pos[0]+.25*dir, pos[1], pos[2]]
		self.faClass.belts['laval'+self.LR].MoveBelt(-dir, .09)
		guide.addAction(vizact.moveTo(newPos, time=2, interpolate=vizact.easeInOut))
		if dir > 0:
			guide.addAction(vizact.call(self.StopCrazy))
			guide.addAction(vizact.call(self.SetMotion))
		else:
			guide.addAction(vizact.call(self.StartCrazy))
			guide.addAction(vizact.call(self.EndMotion))
def FallAction():
	"""Flashes screen red and animates blur effect"""

	flash_quad.visible(True)
	flash_quad.color(viz.RED)
	fade_out = vizact.fadeTo(viz.BLACK,time=2.5)
	flash_quad.runAction(vizact.sequence(fade_out,vizact.method.visible(False)))
	flash_quad.runAction(vizact.call(blurEffect.setDistance,vizact.mix(50,0,time=2.5)),pool=1)
示例#12
0
	def UpdateScore(self, points):
		curScore = int(self._score.getMessage())
		if self._newScore == None:	#this ensures correct update of the score
			self._newScore = curScore + points
		else:
			self._newScore += points
		self.SOUNDS['score'+str(int(points>0))].play()
		resize = vizact.sizeTo([1.5-(points<0),1.5-(points<0),0], time=.25)	#resizes to .5 if deducting points
		color = [viz.RED, viz.GREEN][points>0]
		fade = vizact.fadeTo(color, time=.25)
		self._scoreIcon.addAction(vizact.parallel(resize, fade))
		waitAnim = vizact.signal()
		self._scoreIcon.addAction(waitAnim.trigger)
		self._score.addAction(waitAnim.wait)
		self._score.addAction(vizact.method.message(str(self._newScore)))
		self._score.addAction(vizact.call(self.resetNewScore))
		resize = vizact.sizeTo([1,1,0], time=.25)
		fade = vizact.fadeTo(viz.YELLOW, time=.25)
		self._scoreIcon.addAction(vizact.parallel(resize, fade))
示例#13
0
	def MoveTank (self):
		#change tank and cart animation depending on mill
		if self.LR == 'L':
			offset = .50
			self.cart = self.factory.add('models/objects/cart.osgb', pos = [-23.835,0,3.97])
		else:
			offset = 0
			self.cart = self.factory.add('models/objects/cart.osgb', pos = [-5.2166,0,4.448])
		self.cart.setEuler(360*offset,0,0)	#millL: rotate 180 deg
		cTank = self.cart.insertGroupBelow('tank')
		cTank.visible(0)
		cTank.alpha(0, node='pourPulp')
		tank = self.components['tank'+self.LR]
		tank.addAction(vizact.moveTo([-0.25+offset,0,-.5], time=1, interpolate=vizact.easeInOutSine))
		tank.addAction(vizact.moveTo([-0.25+offset,.5,-.5], time=.5, interpolate=vizact.easeInOutSine))
		tank.addAction(vizact.spinTo(euler=[60-270*offset,0,0], time=.5))	#millL: rotate -75 deg
		tank.addAction(vizact.moveTo([offset,.5,-1.5], time=1, interpolate=vizact.easeInOutSine))
		tank.addAction(vizact.moveTo([offset,.2,-1.5], time=.5, interpolate=vizact.easeInSine))
		waitLoad = vizact.signal()
		tank.addAction(waitLoad.trigger)
		tank.addAction(vizact.method.visible(0))
		cTank.addAction(waitLoad.wait)
		cTank.addAction(vizact.method.visible(1))
		self.cart.addAction(waitLoad.wait)
		self.cart.addAction(vizact.call(self.PlayAudio, 'cart_roll', self.cart, viz.PLAY))
		self.cart.addAction(vizact.spinTo(euler=[-20+440*offset,0,0], time=.5))	#millL: rotate to 200 deg
		moveCart = vizact.moveTo([-14.65-4.9*offset, 0, .75], time=3, interpolate=vizact.easeInOut)
		rotateCart = vizact.spinTo(euler=[0+360*offset,0,0], time=3)	#millL: rotate to 180 deg
		self.cart.addAction(vizact.parallel(moveCart, rotateCart))
		waitMove = vizact.signal()
		self.cart.addAction(waitMove.trigger)
		cTank.addAction(waitMove.wait)
		cTank.addAction(vizact.moveTo([0,1,-0.1], time=1))
		cTank.addAction(vizact.spinTo(euler=[0,-90,0], time=1))
		cTank.addAction(vizact.fadeTo(1, time=.5, node='pourPulp'))
		cTank.addAction(vizact.fadeTo(0, time=3, node='pulp', interpolate=vizact.easeInExp))
		cTank.addAction(vizact.fadeTo(0, time=.5, node='pourPulp'))
示例#14
0
	def SetMotion (self):
		self.power_wheel.addAction(vizact.call(self.PlayAudio, 'laval_separate'))
		self.power_wheel.addAction(vizact.spin(1,0,0, 90,viz.FOREVER))
示例#15
0
	def execute_actions (self, actList):
		# check if this is a valid list and if it contains at least one action
		try:
			if len(actList) > 0:
				print self._name.getMessage(), "executing...", actList
				ex = True
			else:
				ex = False
		except:
			ex = False
			pass
		
		if not ex: return
		#action list
		for action in actList:
			#get a list timer delay(s) (contained inside brackets, e.g. [10,20])
			if '[' in action:
				action, delay = self.parse_action(action)
			########## ENGINE ACTIONS ##############
			if action == 'turning_valve_on':
				self._factory.factory.addAction(vizact.call(self._factory.engine.E_openValve, 3))
			elif action == 'turning_valve_off':
				self._factory.factory.addAction(vizact.call(self._factory.engine.E_closeValve, 3))
			elif action == 'starting_engine':
				self._factory.factory.addAction(vizact.waittime(3))	#wait for valve animation
				self._factory.factory.addAction(vizact.call(self._factory.StartFactory))
			elif action == 'stopping_engine':
				self._factory.StopFactory()
			########## BOILER ACTIONS ##############
			elif action == 'loading_boiler':
				self._factory.boiler.OpenCloseHatch(True)
				self._factory.factory.addAction(vizact.waittime(2))
				self._factory.factory.addAction(vizact.call(self._factory.boiler.CoalAction, 1))
				#self._factory.factory.addAction(vizact.waittime(1))
				#self._factory.factory.addAction(vizact.call(self._factory.boiler.CoalAction, 2))
			elif action == 'starting_timer':
				viz.starttimer(10, delay[0], 0)	#timer for the first warning
				viz.starttimer(15, delay[1], 0)	#timer for the second warning
				viz.starttimer(20, delay[2], 0)	#timer for stopping factory
			elif action == 'stopping_timer':
				viz.killtimer(10)
				viz.killtimer(15)
				viz.killtimer(20)
			elif 'pressure' in action:
				#get the pressure and send it as an argument to the machine specified by the first word
				machine = action.partition('_')[0]
				pressure = action.rpartition('_')[2][:-3]	#get psi or rpm value
				exec('self._factory.'+machine+'.ChangePressure('+pressure+','+str(delay[0])+')')
			elif action == 'lighting_furnace':	#coals appear inside furnace and light up
				self._factory.boiler.CoalAction(2)
				self._factory.factory.addAction(vizact.waittime(2))
				self._factory.factory.addAction(vizact.call(self._factory.boiler.OpenCloseHatch, False))
			elif action == 'dying_away_fire':	#fire dies away and coals are wasted
				self._factory.boiler.CoalAction(3)
			elif action == 'renewing_fire':	#fire dies away and coals are wasted
				self._factory.boiler.CoalAction(4)
			elif action == 'exhausting_fire':	#fire dies away and coals are wasted
				self._factory.boiler.CoalAction(5)
				viz.starttimer(5, 5, 0)	#timer for waiting fire die out, before sending anim-finished
				
			########## MILL ACTIONS ##############
			elif 'loading_mill' in action:	#has * at the end
				if '*' in action:	#don't let the second player (no *) execute the animation again
					LR = action[-2:-1]
					viz.starttimer(ord(LR), 5, 0)	#timer while loading the olives -> anim-finished
					mill = 'mill'+ LR
					sackID = action[-3:-1]
					exec('self._factory.'+mill+'.SackAnim(\"'+sackID+'\")')
			elif 'starting_crash' in action:
				LR = action[-1:]
				mill = 'mill'+ LR
				exec('self._factory.'+mill+'.OlivesToPaste()')
			elif 'pouring_paste' in action:
				LR = action[-1:]
				mill = 'mill'+ LR
				viz.starttimer(ord(LR), 5, 0)	#timer while pouring the paste -> anim-finished
				exec('self._factory.'+mill+'.PasteInTank()')
			elif 'wasting_paste' in action:
				LR = action[-1:]
				mill = 'mill'+ LR
				viz.starttimer(ord(LR), delay[0], 0)	#timer while wasting the paste -> anim-finished
				exec('self._factory.'+mill+'.Damage(True)')
				exec('self._factory.'+mill+'.WastePaste()')
			elif 'transferring_tank' in action:
				if '*' in action:	#don't let the second player (no *) execute the action again
					LR = action[-2:-1]
					mill = 'mill'+ LR
					viz.starttimer(ord(LR), 10, 0)	#timer while transferring the tank -> anim-finshed
					exec('self._factory.'+mill+'.MoveTank()')
			elif 'finishing_transfer' in action:
				LR = action[-1:]
				mill = 'mill'+ LR
				viz.starttimer(ord(LR), 4, 0)	#timer while big tank fills up -> anim-finshed
			elif 'replenishing_sacks' in action:
				LR = action[-1:]
				mill = 'mill'+ LR
				exec('self._factory.'+mill+'.ReplenishSacks()')
			elif 'resetting_mill' in action:
				LR = action[-1:]
				mill = 'mill'+ LR
				exec('self._factory.'+mill+'.ResetMill()')
			elif 'timerM' in action:
				LR = action[-1:]
				action = action.replace(LR, '')	#delete the last character
				timerTag = action.partition('_')[2]
				timerCode = action.partition('_')[0][-1:]	#1=set timer, 0=kill timer
				#e.g., (1,5) -> set timer id=77 (76+1) or id=83 (82+1) for 5 secs
				#wasted is called with thick and hot and needs to expire later
				timers = {'dilute':1, 'thick':2, 'ready':3, 'hot':4, 'wasted':5}
				if int(timerCode) == 1:
					viz.starttimer(ord(LR)+timers[timerTag], delay[0], 0)
				else:
					viz.killtimer(ord(LR)+timers[timerTag])
					
			########## LOADER ACTIONS ##############
			elif action == 'serving_mat':
				self._factory.loader.MatOnTable()
			elif 'getting_pulp' in action:
				amount = delay[0]*.5
				self._factory.loader.PulpInTank(amount)
			elif action == 'scooping_pulp':
				self._CanFull(True)	# sent to player holding can
			elif 'filling_mat' in action:
				if '*' in action:	#don't let the second player (no *) execute the action again
					self._factory.loader.FillMat()
				if self._selected == 'canful':	#the one holding the can should...
					self._CanFull(False)	#empty the can being held
			elif action == 'picking_mat':
				if self.AddToToolbox('mat'):	#prevents picking the mat when inventory full
					viz.starttimer(200+self._player, .1, 0)	#send mat-picked event from this player
					self._feedback = 'picked'	#avoids displaying the 'undefined' message
					self.SelectTool('mat')		#select the mat from the toolbox
					self.HoldObject('mat')		#sets the mat as the holding object (cursor)
					self._factory.loader.PickMat()
			elif action == 'mat_as_tool':
				matObj = self._factory.loader.components['mat']
				self._factory.AddMatAsTool('matP', matObj)
				
			######## PRESS ACTIONS ###############
			elif 'loading_press' in action:
				LR = action[-1:]
				press = 'press'+ LR
				matsLoaded = eval('self._factory.'+press+'.LoadMat()')
				matsFull = delay[0]	#delay->number of mats to load before full
				if matsLoaded == matsFull:
					viz.starttimer(ord(LR)+501, 2, 0)	#timer for filling up press	
			elif action == 'dropping_mat':
				self.DropObject(putBack=False, matOnTray=True)
			elif 'fillingup_press' in action:
				LR = action[-1:]					#L:76, R:82
				press = 'press'+ LR
				exec('self._factory.'+press+'.FillUp()')
			elif 'starting_press' in action:	# called from the pump
				LR = action[-1:]
				viz.starttimer(ord(LR)+502, 1, 0)	#timer for staring press
			elif 'finishing_press' in action:	# called from the pump
				LR = action[-1:]
				viz.starttimer(ord(LR)+503, 1, 0)	#timer for finishing press
			elif 'pumping_oil_press' in action:	# called from the oil pump
				LR = action[-1:]
				viz.starttimer(ord(LR)+505, 1, 0)	#timer for emptying the oil tanks
			elif 'resetting_press' in action:	# called from the pump
				LR = action[-1:]
				viz.starttimer(ord(LR)+504, 1, 0)	#timer for releasing press
			elif 'releasing_press' in action:	# used as delay to send the 'anim-finished' event
				LR = action[-1:]
				press = 'press'+ LR
				viz.starttimer(ord(LR)+500, 10, 0)	#waiting to send anim-finished
				exec('self._factory.'+press+'.Releasing(10)')
			elif 'pressing_press' in action:
				LR = action[-1:]
				press = 'press'+ LR
				exec('self._factory.'+press+'.Pressing()')
			elif 'removing_mats' in action:
				LR = action[-1:]
				press = 'press'+ LR
				exec('self._factory.'+press+'.RestoreMats()')
			elif 'damaging_press' in action:
				LR = action[-1:]
				press = 'press'+ LR
				viz.starttimer(ord(LR)+500, delay[0], 0)	#waiting to send anim-finished
				exec('self._factory.'+press+'.Damage(True)')
			elif 'emptying_oil' in action:
				LR = action[-1:]
				press = 'press'+ LR
				exec('self._factory.'+press+'.PumpOil()')
				
			######## PUMP ACTIONS ###############
			elif 'starting_pump' in action:
				LR = action[-1:]
				pump = 'pump'+ LR
				func = 'self._factory.'+pump+'.ChangeGuide, 1'
				exec('self._factory.factory.addAction(vizact.call('+func+'))')
				func = 'self._factory.'+pump+'.StopCrazy'
				exec('self._factory.factory.addAction(vizact.call('+func+'))')
				func = 'self._factory.'+pump+'.SetMotion'
				exec('self._factory.factory.addAction(vizact.call('+func+'))')
			elif 'stopping_pump' in action:
				LR = action[-1:]
				pump = 'pump'+ LR
				func = 'self._factory.'+pump+'.ChangeGuide, -1'
				exec('self._factory.factory.addAction(vizact.call('+func+'))')
				func = 'self._factory.'+pump+'.StartCrazy'
				exec('self._factory.factory.addAction(vizact.call('+func+'))')
				func = 'self._factory.'+pump+'.EndMotion'
				exec('self._factory.factory.addAction(vizact.call('+func+'))')
			elif 'opening_bypass' in action:
				LR = action[-1:]
				pump = 'pump'+ LR
				exec('self._factory.'+pump+'.TurnValve(1)')
			elif 'closing_bypass' in action:
				LR = action[-1:]
				pump = 'pump'+ LR
				exec('self._factory.'+pump+'.TurnValve(-1)')
			elif 'lifting_bar' in action:
				LR = action[-1:]
				pump = 'pump'+ LR
				exec('self._factory.'+pump+'.LiftBar(True)')
			elif 'dropping_bar' in action:
				LR = action[-1:]
				pump = 'pump'+ LR
				exec('self._factory.'+pump+'.LiftBar(False)')
			elif 'damaging_pump' in action:
				LR = action[-1:]
				pump = 'pump'+ LR
				viz.starttimer(ord(LR)+100, delay[0], 0)
			elif 'timerP' in action:
				LR = action[-1:]
				action = action.replace(LR, '')	#delete the last character
				timerTag = action.partition('_')[2]
				timerCode = action.partition('_')[0][-1:]	#1=set timer, 0=kill timer
				#e.g., (101,20) -> set timer id=177 (76+101) or id=184 (82+102) for 20 secs
				#safe+done=60 (the duration of the pressing animation)
				#10, 60, 30 secs should be also set in the pump's ChangePressure function 
				timers = {'good':101, 'safe':102, 'done':103, 'high':104, 'max':105}
				if int(timerCode) == 1:
					viz.starttimer(ord(LR)+timers[timerTag], delay[0], 0)
				else:
					viz.killtimer(ord(LR)+timers[timerTag])
					
			######## OIL PUMP ACTIONS ###############
			elif action == 'start_pumping':
				self._factory.oilPump.ChangeGuide(1)
			elif action == 'stop_pumping':
				self._factory.oilPump.ChangeGuide(-1)
			elif action == 'filling_lavals':
				self._factory.oilPump.OilPourInLavals(1)
			elif action == 'emptying_tanks':
				self._factory.oilPump.OilPourInLavals(0)
			elif 'timerO' in action:
				timerTag = action.partition('_')[2]
				timerCode = action.partition('_')[0][-1:]	#1=set timer, 0=kill timer
				timers = {'tanks':(701,5), 'lavals':(702,10)}
				if int(timerCode) == 1:
					viz.starttimer(timers[timerTag][0], timers[timerTag][1], 0)
				else:
					viz.killtimer(timers[timerTag][0])

			######## LAVAL ACTIONS ###############
			elif action == 'detaching_laval_belt':
				self._factory.lavalR.DetachBelt()
			elif 'attaching_belt' in action:	#has * at the end
				if '*' in action:	#execute the action only the first time (second no *)
					print "ATTACHING BELTTTTTTTTTTT by", self._name.getMessage()
					self._factory.lavalR.AttachBelt()
				if self._selected == 'belt':#the one holding the belt should...	
					self.DropObject(False)	#drop it without putting in back in place
			elif 'starting_laval' in action:
				LR = action[-1:]
				laval = 'laval'+ LR
				exec('self._factory.'+laval+'.ChangeGuide(1)')
			elif 'stopping_laval' in action:
				LR = action[-1:]
				laval = 'laval'+ LR
				exec('self._factory.'+laval+'.ChangeGuide(-1)')
			elif 'starting_separation' in action:
				LR = action[-1:]
				laval = 'laval'+ LR
				exec('self._factory.'+laval+'.StartSeparation(1)')
			elif 'stopping_separation' in action:
				LR = action[-1:]
				laval = 'laval'+ LR
				exec('self._factory.'+laval+'.StartSeparation(0)')
			elif 'transferring_pitcher' in action:
				if '*' in action:	#don't let the second player execute the animation again
					LR = action[-2:-1]
					laval = 'laval'+ LR
					viz.starttimer(400+ord(LR), 7, 0)	#timer while transferring the pitcher -> anim-finshed
					exec('self._factory.'+laval+'.MovePitcher('+str(delay[0])+')')
			elif 'damaging_laval' in action:
				LR = action[-1:]
				laval = 'laval'+ LR
				viz.starttimer(ord(LR)+400, delay[0], 0)	#waiting to send anim-finished
				exec('self._factory.'+laval+'.Damage(True)')
			elif 'timerL' in action:
				LR = action[-1:]
				action = action.replace(LR, '')	#delete the last character
				timerTag = action.partition('_')[2]
				timerCode = action.partition('_')[0][-1:]	#1=set timer, 0=kill timer
				#e.g., (401,10) -> set timer id=477 (76+401) or id=484 (82+402) for 10 secs
				#10, 30, 30 secs should be also set in the laval's ChangePressure function 
				timers = {'start':401, 'done':402, 'critical':403, 'max':404}
				if int(timerCode) == 1:
					viz.starttimer(ord(LR)+timers[timerTag], delay[0], 0)
				else:
					viz.killtimer(ord(LR)+timers[timerTag])
			
			######## SCALE ACTIONS ###############
			elif action == 'pitcher_on_scale':	#called from the lavals
				viz.starttimer(801, 1, 0)
			elif action == 'weighing_pitcher':	#increase counter by delay[1] lbs in delay[0] secs
				self._factory.scale.WeighPitcher(delay[0], delay[1], delay[2])
			elif 'timerS' in action:
				viz.starttimer(802, delay[0], 0)
			elif action == 'finishing_production':
				viz.starttimer(803, delay[0], 0)
			elif action == 'finishing_game':
				self._mapWin.GameFinish(delay[0])
			elif action == 'save_data':
				viz.starttimer(2000, 0, 0)
			
			####### WATER PIPE ACTIONS [PRACTICE] ######
			elif 'detaching_pipe' in action:
				self._factory.waterPipe.DetachPipe()
			elif 'attaching_pipe' in action:
				if '*' in action:
					self._factory.waterPipe.AttachPipe()
				if self._selected == 'pipe':#the one holding the pipe should...	
					self.DropObject(False)	#drop it without putting in back in place
			elif action == 'opening_valve':
				self._factory.waterPipe.OpenValve(2)
			elif action == 'closing_valve':
				self._factory.waterPipe.CloseValve(2)
				viz.starttimer(1000, 10, 0)
			elif action == 'damaging_pipe':
				viz.starttimer(1000, delay[0], 0)
				self._factory.waterPipe.Damage(True)
			elif action == 'resetting_pipe':
				self.AddToWorld('pipe')
			elif 'timerW' in action:
				timerTag = action.partition('_')[2]
				timerCode = action.partition('_')[0][-1:]	#1=set timer, 0=kill timer
				timers = {'done':1001, 'high':1002, 'max':1003}
				if int(timerCode) == 1:
					viz.starttimer(timers[timerTag], delay[0], 0)
				else:
					viz.killtimer(timers[timerTag])
			
			####### WHEEL BARROW ACTIONS [PRACTICE] ######
			elif 'moving_barrow' in action:
				if '*' in action:
					self._factory.wheelBarrow.MoveBarrow()
			elif action == 'reset_delay':
				viz.starttimer(1010, delay[0], 0)
			elif action == 'resetting_barrow':
				self._factory.wheelBarrow.ResetBarrow()
			
			# CHECK IF IN 1P CONDITION AND REMOVE SECOND PLAYER DEMAND
			elif 'enable1P' in action:
				otherAct = action.partition('_')[2]
				self.EnablePlayer1ForMultiInput(otherAct)
				
			# REMOVING SMOKE FROM MACHINERY
			elif 'removing_smoke' in action:
				mach = action.rpartition('_')[2]
				exec('self._factory.'+mach+'.Damage(False)')
				
			# ALERTS ON MACHINERY
			elif 'error' in action:
				mach = action.partition('_')[2]
				machPos = self._factory.machines[mach].object.getPosition()
				errorCode = action.partition('_')[0][-1:]	#1=error on, 0=error off
				self._mapWin.ShowErrorOnMap(mach, machPos, int(errorCode))
				#check if any of the players is near a machine and update their alert panels
				for p in self.PLAYERS.values():
					p.CheckForAlertNearMachine(mach, int(errorCode))
			
			# SCORE KEEPING
			elif 'score' in action:
				print "Points:", delay[0]
				self._mapWin.UpdateScore(delay[0])
			elif action == 'revealing_total_counter':
				self._mapWin.ShowTotalScore()
			elif action == 'increasing_total':
				self._mapWin.IncreaseOilTotal(delay[0], delay[1])