Skip to content

Commit

Permalink
chain trading now only buys 2x tradevolume max
Browse files Browse the repository at this point in the history
  • Loading branch information
Ctri-The-Third committed Jan 14, 2024
1 parent d6fadc5 commit 1d1a801
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 6 additions & 1 deletion behaviours/chain_trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ def _run(self):
buy_wp = st.waypoints_view_one(params["buy_wp"])
sell_wp = st.waypoints_view_one(params["sell_wp"])
tradegood = params["tradegood"]
buy_market = st.system_market(buy_wp)
target_tg = buy_market.get_tradegood(params["tradegood"])
max_to_buy = ship.cargo_capacity
if target_tg:
max_to_buy = target_tg.trade_volume * 2
pass
if not tradegood in [x.symbol for x in ship.cargo_inventory]:
self.go_and_buy(
tradegood,
buy_wp,
max_to_buy=self.ship.cargo_capacity,
burn_allowed=True,
max_to_buy=max_to_buy,
)

self.go_and_sell_or_fulfill(tradegood, sell_wp, burn_allowed=True)
Expand Down
8 changes: 4 additions & 4 deletions behaviours/emergency_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ def select_positive_trade(self):
behaviour_params = {
"priority": 3,
}

bhvr = EmergencyReboot(agent, ship, behaviour_params or {})

lock_ship(ship_number, "MANUAL", bhvr.st.db_client.connection, 60 * 24)
bhvr.st.ships_view_one(ship, True)
lock_ship(ship_number, "MANUAL", 60 * 24)
while True:
bhvr.st.ships_view_one(ship, True)

bhvr.run()
lock_ship(ship_number, "MANUAL", bhvr.st.db_client.connection, 0)
lock_ship(ship_number, "MANUAL", 0)

0 comments on commit 1d1a801

Please sign in to comment.