- Code: Select all
from twisted.internet.task import LoopingCall
import random
import commands
@commands.name('seizure')
@commands.admin
def toggle_seizure(connection):
protocol = connection.protocol
protocol.seizure = not protocol.seizure
if protocol.seizure:
protocol.seizure_loop.start(0.05)
protocol.send_chat('ENJOY YOUR SEIZURE')
else:
protocol.seizure_loop.stop()
protocol.send_chat('SEIZURE DONE')
commands.add(toggle_seizure)
SEIZURE_COLORS = set([
(255, 0, 0),
(0, 0, 255),
(255, 255, 0),
(255, 28, 174),
(0, 255, 0),
(255, 127, 0)
])
def apply_script(protocol, connection, config):
class SeizureProtocol(protocol):
current_colors = None
seizure = False
def __init__(self, *arg, **kw):
protocol.__init__(self, *arg, **kw)
self.seizure_loop = LoopingCall(self.update_color)
def update_color(self):
if not self.current_colors:
self.current_colors = SEIZURE_COLORS.copy()
color = self.current_colors.pop()
self.set_fog_color(color)
return SeizureProtocol, connection
And for the lazy, just download this.
http://www.mediafire.com/?ak5t3e1d833a399