Beispiel #1
0
def privmsg(self, user, channel, msg):
	msg = self._forMe(msg)
	if not msg:
		return False

	dst = user.split('!', 1)[0]
	if channel != self.nickname:
		dst = channel

	if pom() < 99 and pom() > 1:
		return False

	# The "Phase of the moon" is 99% - 100% or 0% - 1%;
	# let's play ball.

	global NH_FIRED
	if not dst in NH_FIRED.keys():
		NH_FIRED[dst] = 0

	if NH_FIRED[dst] > (time() - 7200):
		# We fired recently (within the last 2h), so 
		# please donut annoy the channel.
		return

	if not load_fortunes():
		self.msg(dst, "The filesystem error hits! Your nethack.nki turns to dust!--More--")
		NH_FIRED[dst] = time();

	if len(FORTUNES) > 0:
		NH_FIRED[dst] = time();
		self.msg(dst, FORTUNES[randint(0, len(FORTUNES) - 1)])
Beispiel #2
0
def keyboard(key, x, y):
    # cette salete...
    # Je vais devoir inventer un format d'interface entre l'objet clavier
    # et l'objet galaxie.
    if key == 'q':
        sys.exit(0)
    if key == 'p':
        # mhhhh... Le append ne devrait pas reellement etre la.
        galaxie.armes.append(galaxie.vaisseaux[0].shoot(10))
    if key == 'd':
        galaxie.vaisseaux[0].commande(pom(0, 0, 0, 0, 0, 0.1))
    if key == 'a':
        galaxie.vaisseaux[0].commande(pom(0, 0, 0, 0, 0, -0.1))
Beispiel #3
0
def keyboard(key, x, y):
	# cette salete...
	# Je vais devoir inventer un format d'interface entre l'objet clavier
	# et l'objet galaxie. 
	if key == 'q':
		sys.exit(0)
	if key == 'p':
		# mhhhh... Le append ne devrait pas reellement etre la.
		galaxie.armes.append(galaxie.vaisseaux[0].shoot(10))
	if key == 'd':
		galaxie.vaisseaux[0].commande(pom(0, 0, 0, 0, 0, 0.1))
	if key == 'a':
		galaxie.vaisseaux[0].commande(pom(0, 0, 0, 0, 0, -0.1))
Beispiel #4
0
def privmsg(self, user, channel, msg):
	""" See description in file header for explanation of this."""
	msg = self._forMe(msg)
	if not msg:
		return False

	dst = user.split('!', 1)[0]
	if channel != self.nickname:
		dst = channel

	curPom = pom()
	if curPom < config.getInt("pom_high") and curPom > config.getInt("pom_low"):
		return False

	# The "Phase of the moon" is 99% - 100% or 0% - 1%;
	# let's play ball.
	global NH_FIRED
	if dst not in NH_FIRED.keys():
		NH_FIRED[dst] = 0

	if NH_FIRED[dst] > (time() - config.getInt("backoff")):
		# We fired recently (within the last 2h), so
		# please donut annoy the channel.
		return

	if not load_fortunes():
		self.msg(dst, ERRMSG)
		NH_FIRED[dst] = time()

	if len(FORTUNES) > 0:
		NH_FIRED[dst] = time()
		self.msg(dst, FORTUNES[randint(0, len(FORTUNES) - 1)])
Beispiel #5
0

def tick(foo):
    galaxie.Tick()
    glutPostRedisplay()
    glutTimerFunc(50, tick, 0)


def init():
    glClearColor(0, 0, 0, 0)
    glLoadIdentity()


galaxie = galaxy()

centre = ship(pom(0, 0, 0, 0, 10**2), cercle(10, 20))
galaxie.planetes.append(centre)

# orbite rond
Test = ship(pom(-30, 0, 0, 14.8), triangle(), "hiro p.")
Test2 = ship(pom(-20, 0, 0, 18.166), triangle())

galaxie.vaisseaux.append(Test)
galaxie.vaisseaux.append(Test2)
# escape velocity
# Test = ship(pom(-10, 0, 0, 36.33), triangle())

# centre.rayon = 10
# centre.smoothness = 20
# systemeSolaire = []
# Test = cercle(vector(-20, 0), vector(0, 20))
Beispiel #6
0

def tick(foo):
	galaxie.Tick()
 	glutPostRedisplay()
 	glutTimerFunc(50, tick, 0)



def init():
	glClearColor(0, 0, 0, 0)
	glLoadIdentity()

galaxie = galaxy()
	
centre = ship(pom(0, 0, 0, 0, 10 ** 2), cercle(10,20))
galaxie.planetes.append(centre)

# orbite rond
Test = ship(pom(-30, 0, 0, 14.8), triangle(), "hiro p.")
Test2 = ship(pom(-20, 0, 0, 18.166), triangle())

galaxie.vaisseaux.append(Test)
galaxie.vaisseaux.append(Test2)
# escape velocity
# Test = ship(pom(-10, 0, 0, 36.33), triangle())




# centre.rayon = 10