Exemplo n.º 1
0
 def mined(self):
     return Placeable(self.__class__)
Exemplo n.º 2
0
 def mined(self):
     return Placeable(Tunnel)
Exemplo n.º 3
0
    def input(self,d,i):
        return chaos_slots[self.p.team].add(i,1)
    def re_own(self,p):
        self.p=p
        self.inv.team=p.team
class Tunnel(Rotatable):
    imgs=Img.imgstripxf("Transport/Tunnel")
    updates = False
    layers = ["Conv","Items","Objects"]
    renderlayer = "Objects"
    exoff = Vector.VectorX(0,-8)
    hardness = 60
    def in_warp(self,d):
        if d==Vector.vdirs[self.r]:
            for x in range(1,6):
                tc=self.coords+d*x
                o=tc.get("Objects")
                if isinstance(o,Tunnel) and o.r==(self.r+2)%4:
                    tc.pos+=d
                    return tc
    def mined(self):
        return Placeable(Tunnel)
add_recipe({"Gear":1,"Iron":2},(Placeable(Conveyor),5))
add_recipe({"Conveyor1":2,"Iron":4},Placeable(Crossover))
add_recipe({"Conveyor1":2,"Iron":3},Placeable(Splitter))
add_recipe({"Log":5},Placeable(Storage))
add_recipesearch({"Conveyor1":1,"Gear":3},Placeable(Conveyor2),[1],40)
add_recipe({"Brick":2},Placeable(Tunnel))
add_recipesearch({"Steel":2,"Storage":1},Placeable(Buffer),[1],10)
add_recipesearch({"ChaosCrystal":1,"Storage":1},Placeable(ChaosChest),[1],40)
add_recipe({"Conveyor1":1,"Iron":3},Placeable(Input))
Exemplo n.º 4
0
class Lab(FixedMachine):
    imgs = Img.imgstripxf("Machines/Lab")
    working = False

    def __init__(self, c, p):
        super().__init__(c, p)
        self.lab = MUI.Lab(100, 10, p.team)
        self.gui = MUI.MUI("LAB", [self.lab, MUI.ElectroSlot(self)])

    def update(self, pos, area, events):
        lp = self.lab.progress
        super().update(pos, area, events)
        self.working = self.lab.progress != lp

    def input(self, d, i):
        return self.lab.inputs.add(i)

    @property
    def img(self):
        return self.imgs[self.working]


add_recipe({"Stone": 5}, Placeable(Furnace))
add_recipe({"Iron": 10, "Circuit": 3}, Placeable(AutoCrafter))
add_recipe({"Furnace": 1, "Wire": 8}, Placeable(Generator))
add_recipe({"AutoCrafter": 1, "SP1": 5}, Placeable(Lab))
add_recipesearch({
    "Furnace": 1,
    "Circuit": 5
}, Placeable(Electrolyser), [1], 30)
Exemplo n.º 5
0
class GunTurret(Turret):
    fx =FX.Gunfire
    reload=0
    damage = 0.105
    fire_rate=10
    def __init__(self,c,r,p):
        super().__init__(c,r,p)
        self.ammo=MUI.ConsumableSlot(ammos,(50,100,50))
        self.gui=MUI.MUI("GunTurret",[self.ammo])
    def input(self,d,i):
        if i.name in ammos:
            return self.ammo.slot.add(i,1)
    def update(self, pos, area, events):
        if self.reload:
            self.reload-=1
        super().update(pos,area,events)
    def shoot(self,area,target):
        if self.reload or not self.ammo.get(1):
            return False
        self.reload=self.fire_rate
        return super().shoot(area,target)
class GunTurret2(GunTurret):
    rspeed = 0.12
    fire_rate = 4
    turret = Img.lotsrots(Img.imgx("War/GunTurret2"), 1)
    rng = 8
add_recipesearch({"Iron":3,"Circuit":1,"Bomb":1},Placeable(Mine),[1],30)
add_recipesearch({"Iron":4,"Gear":2},Placeable(GunTurret),[1],10)
add_recipesearch({"Steel":4,"Circuit":5},Placeable(GunTurret2),[1,2],50)
add_recipesearch({"Coal":1,"Copper":2},resources["Ammo"],[1],5)
add_recipe({"Iron":2,"Coal":2},Placeable(Bomb))
Exemplo n.º 6
0
class Monolith(Owned):
    imgs=Img.imgstripxf("Buildings/Monolith",16)
    t=0
    layers = ["Conv","Items","Objects"]
    renderlayer = "Objects"
    def update(self, pos, area, events):
        self.t+=1
        if self.t==240:
            from Lib import GUI
            raise GUI.GameEnd(self.p.team)
    @property
    def img(self):
        return self.imgs[self.t%20==19]
class ChaosCrystal(Object):
    layers = ["Conv","Items","Objects"]
    renderlayer = "Objects"
    cimg=resources["ChaosCrystal"].img
    shadow=Img.imgx("Shadow")
    tick=0
    def interact(self,player,ppos,pos,area):
        if player.inv.add(resources["ChaosCrystal"]):
            area.dobj(self,pos)
    def update(self, pos, area, events):
        self.tick+=0.1
        self.tick%=math.tau
    def render(self, layer, surf, tpos, area,scale=3):
        if layer==self.renderlayer:
            surf.blit(self.shadow[scale],tpos)
            surf.blit(self.cimg[scale],[tpos[0],tpos[1]-8+(scale+1)*math.sin(self.tick)])
add_recipesearch({"Girder":20,"Circuit":100,"ChaosCrystal":20},Placeable(Monolith),[1,2],100)