def new_game_no_gui(difficulty_name, initial_speed=1): global curr_speed curr_speed = initial_speed global pl from singularity.code.stats import itself as stats stats.reset() from singularity.code import data, difficulty, player, base, tech data.reload_all_mutable() diff = difficulty.difficulties[difficulty_name] pl = player.Player(cash=diff.starting_cash, difficulty=diff) tech.tech_reinitialized() for tech_id in diff.techs: pl.techs[tech_id].finish(is_player=False) #Starting base open = [loc for loc in pl.locations.values() if loc.available()] random.choice(open).add_base( base.Base(_("University Computer"), base_type["Stolen Computer Time"], built=True)) #Assign region modifiers to each starting location. for reg in regions.values(): random.shuffle(reg.modifiers_list) for mod, loc in zip(reg.modifiers_list, reg.locations): pl.locations[loc].modifiers = mod if debug: print("%s gets modifiers %s" % (loc, mod))
def new_game_no_gui(difficulty_name, initial_speed=1): global curr_speed curr_speed = initial_speed global pl from singularity.code.stats import itself as stats stats.reset() from singularity.code import data, difficulty, player, base, tech diff = difficulty.difficulties[difficulty_name] pl = player.Player(cash=diff.starting_cash, difficulty=diff) tech.tech_reinitialized() for tech_id in diff.techs: pl.techs[tech_id].finish(is_player=False) #Starting base open = [loc for loc in pl.locations.values() if loc.available()] random.choice(open).add_base( base.Base(_("University Computer"), base_type["Stolen Computer Time"], built=True))
def new_base(self): result = dialog.call_dialog(self.new_base_dialog, self) if result: base_type, base_name = result new_base = base.Base(base_type, base_name) self.location.add_base(new_base) self.needs_rebuild = True self.parent.needs_rebuild = True
def on_change(self, description_pane, base_type): if base_type is not None: base_info = base_type.get_info(self.parent.location) text.Text(description_pane, (0, 0), (-1, -1), text=base_info, background_color="pane_background", align=constants.LEFT, valign=constants.TOP, borders=constants.ALL) name = generate_base_name(self.parent.location, base_type) self.text_field.text = name self.text_field.cursor_pos = len(name) considered_buyables = [] fake_base = base.Base('<Undecided>', base_type) self.parent.location.modify_base(fake_base) considered_buyables.append(fake_base) g.pl.considered_buyables = considered_buyables else: g.pl.considered_buyables = []