1
0
Fork 0

[golang] implement shipyards visits

This commit is contained in:
Julien Dessaux 2025-02-17 00:40:43 +01:00
parent 3cae67aea4
commit bd2fb50c81
Signed by: adyxax
GPG key ID: F92E51B86E07177E
15 changed files with 299 additions and 45 deletions

View file

@ -11,7 +11,7 @@ func (a *agent) autoContracting(ship *model.Ship) {
defer a.wg.Done()
contracts, err := a.client.MyContracts()
if err != nil {
a.sendShipError(fmt.Errorf("failed to get my contracts: %w", err), ship)
a.channel <- fmt.Errorf("failed to get my contracts with ship %s: %w", ship.Symbol, err)
return
}
for _, contract := range contracts {
@ -21,12 +21,12 @@ func (a *agent) autoContracting(ship *model.Ship) {
now := time.Now()
if now.Before(contract.Terms.Deadline) {
if err := a.runContract(&contract, ship); err != nil {
a.sendShipError(fmt.Errorf("failed to run contracts: %w", err), ship)
a.channel <- fmt.Errorf("failed to run contracts with ship %s: %w", ship.Symbol, err)
return
}
}
}
a.sendShipError(fmt.Errorf("failed to run contracts: negotiating new contracts is not implemented yet"), ship)
a.channel <- fmt.Errorf("failed to run contracts: negotiating new contracts is not implemented yet")
// TODO
//for {
// negotiate