cyphesis/rulesets/basic/scripts/terrain.py
2018-10-11 23:02:05 +02:00

73 lines
2.1 KiB
Python

# This file is distributed under the terms of the GNU General Public license.
# Copyright (C) 1999 Aloril (See the file COPYING for details).
from atlas import *
from random import *
from mind.panlingua import interlinguish
il = interlinguish
from world import probability
from editor import editor
from physics import Quaternion
from Vector3D import Vector3D
import time
from math import *
def plain(mapeditor):
# general things
m = editor(mapeditor)
world = m.look()
points = {}
for i in range(-6, 7):
for j in range(-6, 7):
points['%ix%i' % (i, j)] = [i, j, 8]
m.set(world.id, terrain={'points': points})
def modify_terrain(mapeditor):
# general things
m = editor(mapeditor)
world = m.look()
points = {}
for i in range(-6, 7):
for j in range(-6, 7):
if i >= 5 or j >= 5:
points['%ix%i' % (i, j)] = [i, j, uniform(100, 150)]
elif i <= -5 or j <= -5:
points['%ix%i' % (i, j)] = [i, j, uniform(-30, -10)]
elif (i == 2 or i == 3) and (j == 2 or j == 3):
points['%ix%i' % (i, j)] = [i, j, uniform(20, 25)]
elif i == 4 or j == 4:
points['%ix%i' % (i, j)] = [i, j, uniform(30, 80)]
elif i == -4 or j == -4:
points['%ix%i' % (i, j)] = [i, j, uniform(-5, 5)]
else:
points['%ix%i' % (i, j)] = [i, j, 1 + uniform(3, 11) * (abs(i) + abs(j))]
points['-4x-1'] = [-4, -1, 12.4]
points['-4x-2'] = [-4, -2, -8.3]
points['-3x-2'] = [-3, -2, -6.2]
points['-3x-1'] = [-3, -1, -5.3]
points['-2x-1'] = [-2, -1, -4.1]
points['-1x-1'] = [-1, -1, -16.8]
points['0x-1'] = [0, -1, -3.8]
points['-1x0'] = [-1, 0, -2.8]
points['-1x1'] = [-1, 1, -1.8]
points['-1x2'] = [-1, 2, -1.7]
points['0x2'] = [0, 2, -1.6]
points['1x2'] = [1, 2, -1.3]
points['1x3'] = [1, 3, -1.1]
points['1x4'] = [1, 4, -0.6]
points['1x-1'] = [1, -1, 15.8]
points['0x0'] = [0, 0, 12.8]
points['1x0'] = [1, 0, 23.1]
points['0x1'] = [0, 1, 14.2]
points['1x1'] = [1, 1, 19.7]
m.set(world.id, terrain={'points': points})