Code: Select all
Instead of a boring ol text thing, here is the result; """
thepolm3
Does crazy stuff
"""
def mean(*args):
sum = 0
for number in args:
sum+=number
sum/=len(args)
return sum
def colour_average(one,two):
ra,ga,ba=one
rb,gb,bb=two
return (mean(ra,rb),mean(ga,gb),mean(ba,bb))
def apply_script(protocol,connection,config):
class MergerProtocol(protocol):
old_map=None
def on_map_change(self,map):
oldmap = self.old_map
if oldmap:
print("Map merging in process...")
for x in range(512):
for y in range(512):
oz,nz = oldmap.get_z(x,y),map.get_z(x,y)
oc,nc = oldmap.get_color(x,y,oz),map.get_color(x,y,nz)
colour = colour_average(oc,nc)
newz = mean(oz,nz)
for z in range(63):
if z<newz:
map.remove_point(x,y,z)
else:
map.set_point(x,y,z,colour)
print("Map merging complete.")
self.old_map=map.copy()
return protocol.on_map_change(self,map)
return MergerProtocol,connection
BRIDGEWAY or hallwars
I planned to do more examples, but this just blew me away;
Spoiler: