def think(self, dt): if self.done or not self.available: return self.t += dt if self.progress == 0 and self.t > 1: dialog.play("convo2") self.progress = 1 payloads = [ thing.Payload(pos = pos) for pos in state.worlddata["payloads"][:3] ] state.objs.extend(payloads) state.goals.extend(payloads) self.goals = [p.thingid for p in payloads] if self.progress == 1: if any(window.distance(thing.get(goal), state.you) < 20 for goal in self.goals): dialog.play("convo3") self.progress = 2 if self.progress >= 2: nvisible = sum(thing.get(goal).isvisible() for goal in self.goals) if self.progress == 2 and nvisible >= 1: dialog.play("convo4") self.progress = 3 if self.progress == 3 and nvisible >= 2: dialog.play("convo7") self.progress = 4 if self.progress == 4 and nvisible == 3: dialog.play("convo8") self.progress = 5 self.done = True quests["Act2"].setup() if not self.distressed and state.you.y < 270: dialog.play("distress")
def load(self, obj): from src import thing (self.X0, self.y0, self.R, self.following, self.oldX, self.oldy, self.tfollow) = obj if self.following is not None: self.following = thing.get(self.following) self.setlimits()
def think(self, dt): if self.done or not self.available: return self.t += dt inmapper = isinstance(state.you, thing.Mapper) showingmap = inmapper and state.you.deployed if self.progress == 0: self.progress = 1 payloads = [ thing.Payload(pos = pos) for pos in state.worlddata["payloads"][:3] ] state.objs.extend(payloads) state.goals.extend(payloads) self.goals = [p.thingid for p in payloads] if self.progress == 1 and self.t > 2: dialog.play("start1") if self.progress == 1 and self.t > 3 and dialog.tquiet and not inmapper: mappers = [ship for ship in state.ships if isinstance(ship, thing.Mapper)] nearestid = min(mappers, key = lambda obj: window.distance(obj, state.you)).thingid if mappers else None if not self.mappertargetid or thing.get(self.mappertargetid).parentid != nearestid: if self.mappertargetid: thing.get(self.mappertargetid).die() if nearestid: mappertarget = thing.ShipTarget(parentid = nearestid) state.effects.append(mappertarget) self.mappertargetid = mappertarget.thingid if self.progress > 1 and self.mappertargetid: if thing.get(self.mappertargetid): thing.get(self.mappertargetid).die() self.mappertargetid = None if self.progress == 1 and inmapper: self.progress = 2 dialog.play("start2") if self.progress == 2 and showingmap: self.progress = 3 if self.progress == 3 and not showingmap and dialog.tquiet > 5: dialog.play("start3") if self.progress >= 1: if any(window.distance(thing.get(goal), state.you) < 20 for goal in self.goals): dialog.play("convo3") self.progress = 4 if self.progress >= 4: nvisible = sum(thing.get(goal).isvisible() for goal in self.goals) if self.progress == 4 and nvisible >= 1: dialog.play("convo4") self.progress = 5 if self.progress == 5 and nvisible >= 2: dialog.play("convo7") self.progress = 6 if self.progress == 6 and nvisible == 3: dialog.play("convo8") self.progress = 7 self.done = True quests["Act2"].setup() if not self.distressed and state.you.y < 270: dialog.play("distress")
def think(self, dt): if self.done or not self.available: return self.t += dt inmapper = isinstance(state.you, thing.Mapper) showingmap = inmapper and state.you.deployed if self.progress == 0: self.progress = 1 payloads = [thing.Payload(pos=pos) for pos in state.worlddata["payloads"][:3]] state.objs.extend(payloads) state.goals.extend(payloads) self.goals = [p.thingid for p in payloads] if self.progress == 1 and self.t > 2: dialog.play("start1") if self.progress == 1 and self.t > 3 and dialog.tquiet and not inmapper: mappers = [ship for ship in state.ships if isinstance(ship, thing.Mapper)] nearestid = min(mappers, key=lambda obj: window.distance(obj, state.you)).thingid if mappers else None if not self.mappertargetid or thing.get(self.mappertargetid).parentid != nearestid: if self.mappertargetid: thing.get(self.mappertargetid).die() if nearestid: mappertarget = thing.ShipTarget(parentid=nearestid) state.effects.append(mappertarget) self.mappertargetid = mappertarget.thingid if self.progress > 1 and self.mappertargetid: if thing.get(self.mappertargetid): thing.get(self.mappertargetid).die() self.mappertargetid = None if self.progress == 1 and inmapper: self.progress = 2 dialog.play("start2") if self.progress == 2 and showingmap: self.progress = 3 if self.progress == 3 and not showingmap and dialog.tquiet > 5: dialog.play("start3") if self.progress >= 1: if any(window.distance(thing.get(goal), state.you) < 20 for goal in self.goals): dialog.play("convo3") self.progress = 4 if self.progress >= 4: nvisible = sum(thing.get(goal).isvisible() for goal in self.goals) if self.progress == 4 and nvisible >= 1: dialog.play("convo4") self.progress = 5 if self.progress == 5 and nvisible >= 2: dialog.play("convo7") self.progress = 6 if self.progress == 6 and nvisible == 3: dialog.play("convo8") self.progress = 7 self.done = True quests["Act2"].setup() if not self.distressed and state.you.y < 270: dialog.play("distress")
def buildnetwork(): from src import thing, window del network[:] nobjs = [mother.thingid] + [ship.thingid for ship in ships if ship.rnetwork()] if len(nobjs) < 2: return ds = {} for id0 in nobjs: for id1 in nobjs: if id0 >= id1: continue thing0, thing1 = thing.get(id0), thing.get(id1) rmax = max(thing0.rnetwork(), thing1.rnetwork()) d = window.distance(thing0, thing1) if d <= rmax: ds[(id0, id1)] = d # TODO: remove triangles for id0, id1 in ds: network.append((thing.get(id0), thing.get(id1)))
def endregenerate(): state.you = thing.get(state.you.targetid) window.camera.X0 = state.you.X window.camera.y0 = state.you.y clearfull() populatefull() background.wash() background.drawwash() if settings.saveonemergency: state.save()
def buildnetwork(): from src import thing, window del network[:] nobjs = [mother.thingid ] + [ship.thingid for ship in ships if ship.rnetwork()] if len(nobjs) < 2: return ds = {} for id0 in nobjs: for id1 in nobjs: if id0 >= id1: continue thing0, thing1 = thing.get(id0), thing.get(id1) rmax = max(thing0.rnetwork(), thing1.rnetwork()) d = window.distance(thing0, thing1) if d <= rmax: ds[(id0, id1)] = d # TODO: remove triangles for id0, id1 in ds: network.append((thing.get(id0), thing.get(id1)))
def think(self, dt): if self.done or not self.available: return self.t += dt if not self.cutscened: if self.t > 15 and dialog.tquiet > 15: self.cutscened = True from src.scenes import act2cutscene from src import scene scene.current = act2cutscene scene.toinit = act2cutscene if self.progress == 0 and thing.get(self.goal).isvisible(): dialog.play("convo10") self.progress = 1 if self.progress == 1 and self.cutscened: self.done = True quests["Seek"].setup()
def getthings(x): if pklsave or x is None: return x if isinstance(x, list): return [thing.get(a) for a in x] return thing.get(x)
def getthings(x): if x is None: return None if isinstance(x, list): return [thing.get(a) for a in x] return thing.get(x)