mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 10:49:53 +02:00
getheader now compiles python files
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import tpt
|
||||
import random
|
||||
import time
|
||||
import utils
|
||||
# example script
|
||||
|
||||
def noise(typ,amount=50):
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import tpt
|
||||
from tpt import *
|
||||
from utils import *
|
||||
import sys
|
||||
import code
|
||||
import ctypes
|
||||
import traceback
|
||||
from threading import Thread
|
||||
print "console module loaded."
|
||||
#print "console module loaded."
|
||||
#redirect stdout like this:
|
||||
class logger:
|
||||
def write(self,txt):
|
||||
@@ -39,35 +39,7 @@ element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7,
|
||||
"lote":142,"frg2":143,"star":144,"frog":145,"bran":146,"wind":147,
|
||||
"num":148}
|
||||
|
||||
class _fork(Thread):
|
||||
def __init__ (self,func):
|
||||
Thread.__init__(self)
|
||||
self.func=func
|
||||
def run(self):
|
||||
self.func(self)
|
||||
def fork(func):
|
||||
try:
|
||||
a=fork.threads
|
||||
except:
|
||||
fork.threads={}
|
||||
fork.i=0
|
||||
tmp=_fork(func)
|
||||
fork.threads[fork.i]=tmp
|
||||
fork.i+=1
|
||||
tmp.start()
|
||||
return tmp
|
||||
tpt.log("Thread #%d started"%(fork.i-1))
|
||||
def fork_status():
|
||||
count=0
|
||||
remove=[]
|
||||
for key in fork.threads:
|
||||
if(fork.threads[key].is_alive()):
|
||||
count+=1
|
||||
else:
|
||||
remove.append[key]
|
||||
for item in remove:
|
||||
del fork.threads[item]
|
||||
tpt.log("%d threads alive. %d threads stopped since last status."%(count,len(remove)))
|
||||
|
||||
def fork_unblock():
|
||||
pass#i need to implement this some day.
|
||||
def error(ex):
|
||||
|
Reference in New Issue
Block a user