def __init__(self, energy, power, team): self.inputs = Items.MultiSlot([ Items.FilterSlot(Items.resources["SP%s" % n]) for n in range(1, 7) ]) self.energy = energy self.power = power / 60 self.team = team
def __init__(self, recipe, energy, power): self.inputs = Items.MultiSlot([ Items.FilterSlot(Items.get_item(k), v) for k, v in recipe[0].items() ]) self.output = Items.FilterSlot(recipe[1][0]) self.recipe = recipe self.energy = energy self.power = power / 60 self.tar_inputs = Counter(self.recipe[0])
def __init__(self, ctype, colour=None, max_output=None): self.slot = Items.Slot() if colour: self.colour = colour self.slot.backcol = self.colour self.ctype = ctype self.max_output = None if max_output is None else max_output / 60
def starting_inv(self,inv): inv.add(Items.Placeable(Basic.Furnace)) inv.add(Items.Placeable(Production.Miner)) inv.add(Items.Placeable(Vehicles.Boat)) inv.add(Items.Placeable(Boxes.StdBox)) inv.add(Items.Placeable(Basic.Generator)) inv.add(Items.Placeable(Basic.Electrolyser))
def render(self, screen, y, size, rcpos=None): for x, (i, (p, q)) in enumerate(self.rs): Img.draw_with_num(screen, p.img, q, (x % size.x * 64, y + x // size.x * 64), 4) if rcpos is not None: screen.blit(sel[3], rcpos * 64 + Vector.VectorX(0, y)) selr = self.rs[rcpos.x + rcpos.y * size.x] i, (p, q) = selr l = len(i) offset = (size.x - l - 2) * 32 for x, (item, n) in enumerate(i.items()): Img.draw_with_num(screen, Items.get_item_image(item), n, (offset + x * 64, (size.y - 1) * 64), 4) screen.blit(arrow[3], (offset + l * 64, (size.y - 1) * 64)) Img.draw_with_num(screen, p.img, q, (offset + (l + 1) * 64, (size.y - 1) * 64), 4)
def render(self, screen, y, size, rcpos=None): if Research.current[self.team]: for x, r in enumerate(Research.current[self.team]): if r is Research.current_research[self.team]: draw.rect( screen, (100, 100, 100), Rect(x % size.x * 64, y + x // size.x * 64, 64, 64)) screen.blit(r.img[3], (x % size.x * 64, y + x // size.x * 64)) if rcpos is not None: screen.blit(sel[3], rcpos * 64 + Vector.VectorX(0, y)) selr = Research.current[self.team][rcpos.x + rcpos.y * size.x] l = len(selr.packs) offset = (size.x - l) * 32 for x, p in enumerate(selr.packs): Img.draw_with_num(screen, Items.get_item_image("SP%s" % p), selr.n, (offset + x * 64, (size.y - 1) * 64), 4) else: Img.bcentrex(tfont, "NO RESEARCH AVAILABLE", screen, y - 16)
self.crop = Agriculture.crops[args[0]] def update(self, pos, area, events): if self.crops: if not randint(0, self.crop.gspeed // 25): tpos, ch = choice(list(self.crops.items())) if ch: if not ch.exists: self.crops[tpos] = None elif ch.growth < ch.max_g: ch.growth += 1 elif self.add_output(ch.mined()): ch.growth = ch.harvest_state elif self.crop: self.init_crops(area, pos) super().update(pos, area, events) def on_dest(self, area, pos): if self.crops: for tpos, crop in self.crops.items(): if crop: crop.bound = None area.ups.add((tpos, crop)) Registry.add_recipe({"Iron": 4, "Gear": 2}, Items.Placeable(Miner)) Research.add_recipesearch({ "Copper": 8, "Gear": 4 }, Items.Placeable(Farmer), [1], 20)
def mined(self): return Items.Placeable(self.__class__)
area.create_exp(pos, 1, "Cross", 1) else: self.state = "Taxi" elif self.player: j = self.player.j if not self.mprog: buttons = j.get_buttons(events) if buttons[1]: if area.move(self.player, pos, self.lv, True, 64): self.player.vehicle = None self.player = None self.team = None return elif buttons[0]: self.state = "Takeoff" for v in j.get_dirs(): self.lv = v if area.move(self, pos, v): break else: rs = j.get_rstick() if rs: self.lv = rs Registry.add_recipe({"Log": 10}, Items.Placeable(Boat)) Research.add_recipesearch({ "Steel": 5, "Furnace": 1 }, Items.Placeable(Plane), [1], 30)
def mined(self): return Items.ObjPlaceable(self)
Object.__init__(self, c) self.dummy = EntangledDummy(self) self.area = Area(self.internalsize, self.gen, self.dummy) def in_warp(self, d): hb = self.area.bounds // 2 return Coordinate(self.area, hb - d * hb - V(bool(d.y), bool(d.x))) class EntangledBox2(Box): img = Img.imgstripxf("Buildings/EntangledBox")[1] def __init__(self, c, a, d): Object.__init__(self, c) self.area = a self.dummy = d self.dummy.es.append(self) def update(self, pos, area, events): if not self.dummy.es[0].exists: super().update(pos, area, events) else: self.area.generate(area.get_power) def in_warp(self, d): hb = self.area.bounds // 2 return Coordinate(self.area, hb - d * hb + V(bool(d.y), bool(d.x))) Registry.add_recipe({"Steel": 4, "ChaosCrystal": 1}, Items.Placeable(StdBox))
def mined(self): return Items.ObjPlaceable(self) if self.gui else Items.Placeable(self.__class__)
def add_output(self,item,add_r=0,override_d=None): d=override_d or Vector.vdirs[(self.r+add_r)%4] if not self.output[d]: self.output[d]=Items.ItemObject(self.coords.copy(),item) return True return False
def respawn(self): self.inv = Items.MultiSlot([Items.Slot() for _ in range(7)]) self.spawn.respawn(self) self.hp=1
def __init__(self,coords,j): super().__init__(coords) self.col=j.col self.j=j self.inv=Items.MultiSlot([Items.Slot() for _ in range(7)]) self.pick=Tools.Pickaxe()
def __init__(self, recipe, power): self.input = Items.Slot() self.output = Items.Slot() self.recipe = recipe self.power = power / 60