Skip to content

Commit

Permalink
changed to work with rate limiter and fixed build script
Browse files Browse the repository at this point in the history
  • Loading branch information
arihant2math committed May 26, 2023
1 parent 2bbd515 commit 885184d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install build
pip install autotraders pyyaml build
- name: Build package
run: python -m build
- name: Publish package
Expand Down
5 changes: 1 addition & 4 deletions spacelang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from autotraders.agent import Agent
from autotraders.ship import Ship

import secret
from spacelang.step import Step


Expand All @@ -27,7 +26,6 @@ def execute(self, ship, events, session):
def run(self, ships, events, session):
for ship in ships:
self.execute(ship, events, session)
time.sleep(1)


class Trigger:
Expand Down Expand Up @@ -63,7 +61,6 @@ def run(self, session):
ships = {}
for group in self.ship_groups:
ships[group] = [Ship(ship, session) for ship in self.ship_groups[group]]
time.sleep(0.5)
contains_onstart = len([trigger for trigger in self.triggers if trigger.name == "on_start"]) == 1
if contains_onstart:
on_start = [trigger for trigger in self.triggers if trigger.name == "on_start"][0]
Expand All @@ -72,7 +69,7 @@ def run(self, session):
thread.start()
while True:
logging.debug("Checking triggers ...")
# agent.update()
agent.update()
time.sleep(10) # TODO: Actually check triggers


Expand Down
2 changes: 0 additions & 2 deletions spacelang/step/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ def execute(self, ship: Ship, events, session):
for i in ship.cargo.inventory:
if i not in exclude:
ship.sell(i, ship.cargo.inventory[i])
time.sleep(0.1)
elif self.command == "sleep":
if type(self.args) is int:
time.sleep(self.args)
else:
raise NotImplementedError("TODO")
else:
raise NotImplementedError("TODO")
time.sleep(1)
1 change: 0 additions & 1 deletion spacelang/step/navigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def execute(self, ship, session):
accepted = self.query.query(ship, session)
if str(accepted.symbol) != str(ship.nav.location):
ship.navigate(str(accepted.symbol))
time.sleep(1)
ship.update()
if ship.nav.status == "IN_TRANSIT":
time.sleep((ship.nav.route.arrival - datetime.now(timezone.utc)).seconds)

0 comments on commit 885184d

Please sign in to comment.