from __future__ import generators
import plus
import Arenas
import random
import Hazards
import math

class BoxArena(Arenas.SuperArena):
    "On your mark, get set, GO! Make sure to turn hazards off."
    name = "Drag Race"
    preview = "dragrace/drag.bmp"
    game_types = ['DEATHMATCH', 'BATTLE ROYAL', 'TEAM MATCH']
    extent = (-30, 30, 30, -30)

    def __init__(self):
        Arenas.SuperArena.__init__(self, "Arenas/dragrace/dragrace.gmf")
        #plus.Arena.__init__(self, "")
        plus.setBackColor(0,0,0)
        
        degrad = 0.01745
        self.AddStaticCamera("Static Cam 1", (0, 8, 10), (30*degrad,math.pi), 84*degrad)
	self.AddStaticCamera("Static Cam 2", (0, 15, 12), (45*degrad,math.pi), 84*degrad)
	self.AddStaticCamera("Static Cam 3", (0, 20, 14), (60*degrad,math.pi), 84*degrad)
	self.AddStaticCamera("Static Cam 4", (0, 24, 16), (75*degrad,math.pi), 84*degrad)
	self.AddWatchCamera("Watch Cam 1", (0, 18, 6), (6, 18, 30*degrad, 10*degrad))
	self.AddWatchCamera("Watch Cam 2", (0, 20, 9), (6, 20, 30*degrad, 20*degrad))
	self.AddWatchCamera("Watch Cam 3", (0, 22, 12), (6, 22, 30*degrad, 30*degrad))
	self.AddWatchCamera("Watch Cam 4", (0, 24, 15), (6, 24, 30*degrad, 40*degrad))
        self.SetSubMaterialSound("lavafloor", "metal", 999999999, "Sounds\\hissnsizzle.wav")
        self.SetSubMaterialSound("lavawallr", "metal", 999999999, "Sounds\\hissnsizzle.wav")
        self.SetSubMaterialSound("lavawalll", "metal", 999999999, "Sounds\\hissnsizzle.wav")
        self.SetSubMaterialSound("lavawalllava", "metal", 999999999, "Sounds\\hissnsizzle.wav")
        self.SetSubMaterialSound("lavawalllava2", "metal", 999999999, "Sounds\\hissnsizzle.wav")
        self.SetSubMaterialSound("lavawallr2", "metal", 999999999, "Sounds\\hissnsizzle.wav")
        self.SetSubMaterialSound("lavawalll2", "metal", 999999999, "Sounds\\hissnsizzle.wav")
	
        self.players = ()

    def Activate(self, on):
        if on: self.players = plus.getPlayers()
        
        Arenas.SuperArena.Activate(self, on)

        # check to see if anyone has been "eliminated" by falling off the tabletop
        for each in self.players:
            if plus.getLocation(each)[1] < -200:
                plus.eliminatePlayer(each)

        return Arenas.SuperArena.Tick(self)
        
Arenas.register(BoxArena)
