All pastes #85961 Raw Edit

Siegel

public text v1 · immutable
·published 2006-07-12 10:32 UTC
rendered paste body
import GameLogic as g
c= g.getCurrentController()
ns=c.getActuator('act')

#module functions
global test
test = 'global'
#get ob data
def getOBData(g, bi):
	c = g.getCurrentController()
	o = c.getOwner()
	p = o.getParent()
	act = {}
	sen = {}
	for a in c.getActuators():
		act[bi.str(a)] = a
	for s in c.getSensors():
		sen[bi.str(s)] = s
	return c, o, act, sen

#dynamically sets name for newly added objects
def setDynName(g, bi, ob):
	oblist = ''
	for x in g.getCurrentScene().getObjectList():
		oblist+=x.name+' '
	print 'count',oblist.count(ob.name)
	newname = ob.name+bi.str(oblist.count(ob.name))
	ob.name = newname

#save the functions into global variables
g.getOBData = getOBData	
g.setDynName = setDynName	
g.addActiveActuator(ns, 1)