Author Topic: [MOD] Goods Hauler (Automatically buy/sell/move goods!)  (Read 40520 times)

Laserzwei

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    391
    • View Profile
on: November 22, 2017, 08:18:56 AM
Does this still work in the .15 beta? I've been trying to see what's changed, and the cargo shuttles are...underwhelming.
http://www.avorion.net/forum/index.php/topic,4015.0.html
If something changes correct it in the topic
My Mod Collection
My Discord     screw google captcha
My Github
Questions?
> PM me here on the forums!



Evil33

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    6
    • View Profile
on: November 29, 2017, 05:13:34 PM
As far as I can see, it still works.
But as I checked the script I got the feeling, that after a server restart a player must visit the sector once, because the docking sequence doesn't finish. After a first visit they can be left alone again.  :-\
Maybe the lazy update in the server config can change that behavior.
Edit: I've added another debug message for the first server update after startup and made some minor fixes to the secure and restore functions. It works after server restarts, if the sector was visited once after script/game update, at least it worked like that for me.
« Last Edit: November 30, 2017, 04:01:41 PM by Evil33 »



Maxx4u

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    8
    • View Profile
on: December 05, 2017, 11:20:45 PM
Like i see, the mod does not work with the beta branch
he try do use the "old" docking mechanism.

he dont use docking stages.



zgrillo2004

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    6
    • View Profile
on: December 07, 2017, 12:14:50 AM
I can confirm it doesnt work

Code: [Select]
data/scripts/entity/ai/haulgoods.lua:370: in function 'haulGoodsMoveToSeller'
data/scripts/entity/ai/haulgoods.lua:457: in function <data/scripts/entity/ai/haulgoods.lua:428>

If you say that this is using the old docking mechanism then what does 0.15 use as it's replacement?



Azerik

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    47
    • View Profile
on: December 07, 2017, 05:07:16 AM
I'd be eternally in your debt if some intrepid soul could make this work again.

I need to have the ability to run routes at a loss and this is the perfect mechanism for me.



Evil33

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    6
    • View Profile
on: December 09, 2017, 06:15:38 PM
I missed that you were looking for an update for the beta ^^" sry
I fixed the script (as far as I see) for the 0.15.6 update released yesterday.
Might be that I missed something, so tell me about your results :)



Azerik

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    47
    • View Profile
on: December 10, 2017, 03:23:45 AM
Thank you.  I've spent most of this week scrambling to get things updated and fixed and such for our reset today.  I didn't even find out until Friday that cargo shuttles only take 1 cargo at a time.  There is *no* way I will sustain my production lines with that.  Unless we can suddenly have a couple thousand cargo shuttles at a time.

I won't be able to fully test things for a bit, but I'll let you know if there are any problems.



Samjam

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: December 29, 2017, 09:26:30 PM
Really useful looking mod. Im pretty new to the avorion forums, and i cant seem to find the place to download the .zip file... could someone point it out to me?



Splutty

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    258
    • View Profile
on: January 02, 2018, 11:11:38 PM
Good to see people provide updates for my mod while I was AWOL :)

I'm not sure if I'm coming back to Avorion any time soon. This mod was the thing I wrote while I was stuck sick at home, just to see if I still could. It was mainly meant to be used by myself, but I decided to post it.

Good to see people have been using it and thanks from everyone for those who modified it to make things work with newer versions!



Splutty

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    258
    • View Profile
on: January 02, 2018, 11:15:04 PM
I missed that you were looking for an update for the beta ^^" sry
I fixed the script (as far as I see) for the 0.15.6 update released yesterday.
Might be that I missed something, so tell me about your results :)

I've added your message to the original post for now. Thanks for updating things in my absence!



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 11, 2018, 07:54:03 PM
Hey, I installed this mod, but whenever I click on "Haul Goods", the ship just sits there and does nothing. I made sure to be in a system where there's trade happening, and checked with the Trade Module to see if there was anything to be traded profitably (there was). Does anyone have any idea why this is happening?
Shrooblord



Evil33

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    6
    • View Profile
on: January 12, 2018, 03:04:40 PM
Try it with the chat command /haulgoods start
I didn't use the UI very much, perhaps it's only a problem in this part.



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 12, 2018, 04:54:20 PM
That doesn't seem to do anything either. I was outside of my captained craft with my mining drone, selected it, and used "/haulgoods start" but nothing happened. Am I doing it right?

EDIT: Nevermind, it works now! After trying to activate this again, I decided to manually trade with a station, but as I approached the docking port, I was pulled towards it with light beams while I was still pilotting (I gotta say, being beamed up by a tractor beam while immobilised is freaking scary), automatically attained 50 displays and was immediately expelled from the docking port. When I hopped into my mining drone, the ship lay still doing nothing, but then I gave it the UI order to Haul Goods, and off it went! Very cool. I'm now watching my little ship zoom around the Sector making trades. Very cool.

Not sure what I did to "fix" the issue though; maybe you just need to try a couple of times before it works?

EDIT II: This is fantastic. One of my favourite new things now is editing a ship in Building Mode while it's in the process of hauling goods. It's a nice change of background, and also I'm making money while doing something else: excellent! :D

EDIT III: I figured out how this works:
  • have a Captained Ship with a Cargo Hold, and either be in a Sector with profitable trade routes, or have cargo you can sell;
  • use the command /haulgoods start. From this moment on, that ship is considered a "hauler";
  • now you can enter and leave the ship as you will, piloting itself or letting it do its hauling duty. When you are not piloting it, you can give the Haul Goods command through the UI Orders interface. This doesn't work as the ship isn't considered a "hauler" before you use /haulgoods start (as evidenced by the error message response /haulgoods status gives you if you have not called /haulgoods start on that ship yet).
« Last Edit: January 12, 2018, 06:01:48 PM by Shrooblord »
Shrooblord



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    578
    • View Profile
on: January 15, 2018, 03:43:49 PM
Hey there. Not a big fan of double-posting, but with lack of a delete button, I can't delete-edit-update my post like I'd do everywhere else and I'd like this to be seen.

I found a "bug" of sorts while using this mod. Although I'm not sure if that's at the mod's fault or simply due to the nature of how Avorion works with the player not being present in a Sector, I've noticed that while I'm away, the Captained ships that are hauling goods don't move assets or make me any money. In fact, when I return to the Sector they are in, they're in the exact state and position they were in, carrying the goods they had, as when I left. The Sector, apparently, is literally frozen in time until my return.

Is there any way to simulate the Captained ships still moving assets around while out of Sector? Like with the Out of Sector Production Mod? I've seen in the Documentation that there's a whole bunch of functions for teleporting entities around, adding and removing their cargo and so forth. So while the "simulation part" could be just that: a faking of them moving goods around, upon re-entry, you might find them in another place you expected them, teleported by the script to some location that makes sense based on the time you've been away and the number of goods they've been simulated to have hauled.

I don't know how easy it is to register the haulers in a list of entities you can keep track of, though I must admit I haven't taken a look at whether Goods Hauler already does that or not. In my view, if it does, that's already a large part of the heavy lifting underway. My mind is already racing with possibilities on how to "fix" the other parts of this idea. Just to sum up what's on my mind:
  • We need to gather a list of the Stations that exist in the Sector. Documentation shows there's a "get all entities" function with an option to filter for a specific type, such as Traders, or Factories.

  • We need to know what these places regularly have in stock. I'm not sure how this is determined in-game, but surely there's some way to determine their regular production ticks, how much storage they have, and roundabout estimate how much of that product gets stored, and how much is used up by other factories in the system, or traded away to other people (or AI) than the player. I.e. how much cargo is actually available for us when we are in the Sector? Our simulated amount should be around the same amounts, or things will be very fishy and obviously fudged (and more exploitable).

  • During regular or random intervals, the Haulers are marked for "picking up goods", "in transit" or "delivering goods". These are three separate states they can exist in, and these states are tracked for each Hauler individually.

  • In the "picking up goods" state, if the player warps in at that time, the Hauler is teleported to the Station they were assigned to be "picking up goods" from, then buy the amount of goods from that Station as per normal with this mod installed while inside the Sector.

  • In the "in transit" state, if the player warps in at that time, the Hauler is teleported to some point in the Sector along the expected travel path between the Station where it was "picking up goods" just before, and the Station where it's set to be "delivering goods". This point along the travel path is determined by the measure of time between the completion of the "picking up goods" state, the player warping in on them, the Hauler's maximum velocity and the distance of the Station where it's meant to be "delivering goods" from the Station where it was "picking up goods".
    At the same time, the Hauler's cargo bay is stocked up with the goods in question.

  • In the "delivering goods" state, if the player warps in at that time, the Hauler is teleported to the Station they were assigned to be "delivering goods" to, then sell the goods they're carrying.

  • In each of these states, if the player does not warp in, a number of things happen to simulate the Haulers performing the work they're not actually performing (due to how the game unloads Sectors, apparently):
    • At the end of the "picking up goods" state, which lasts for some predetermined amount of time, money is deducted from the player's total,
       and a message is posted in the Economy chatlog to indicate that money was spent to buy goods.
    • During the "in transit" state, a non-arbitrary timer is going off that is determining when the Hauler transitions into the "delivering goods" state.
    • At the end of the "delivering goods" state, which lasts for some predetermined amount of time, money is added to the player's total, and a message is posted in the Economy chatlog to indicate that the player received money for selling goods.
    • No cargo changes or teleporting around of entities is actually performed if the player does not warp in, save for some "virtual cargo"
       that tries to keep track of how much the Stations in the Sector currently have in stock; this should follow the method of how the OoSP mod does this; perhaps these changes I propose are a new mod unto themselves, which hybridises the Goods Hauler and OoSP mods together.

  • We can fudge most of the points on this list, as long as it's in a realm of reasonable possibilities. For example, Diamond Factories don't suddenly sell Clothes, and the Energy Cell Factory that's always out of Energy Cells doesn't suddenly have them in stock while we're away. And goods sell and are bought for realistic prices, as if normal transactions are actually taking place.


These additions would be a little bit of work to be sure, but would make the galaxy feel that much more alive. Moreover, it would allow players to set up little trading routes and trading convoys that actually function, which would be super cool.

Anyway, if anyone has any insights into how this could be done, please do contact me. I'm very interested in trying to set this up.

P.S.
And after writing all of that, now my mind is racing with the possibilities of adding multi-sector trading convoys going out to trade with Stations elsewhere than the current Station. I guess I'm starting to try and make the galaxy into a persistent universe-type deal. xD
« Last Edit: January 15, 2018, 03:47:49 PM by Shrooblord »
Shrooblord



Hammelpilaw

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    534
    • View Profile
    • Scrap Yard - Avofactory
on: January 15, 2018, 06:17:43 PM
P.S.
And after writing all of that, now my mind is racing with the possibilities of adding multi-sector trading convoys going out to trade with Stations elsewhere than the current Station. I guess I'm starting to try and make the galaxy into a persistent universe-type deal. xD


Already thought about that, but never had time to do this. Also I think it should be a completely new mod instead of changing this one. Very great idea though.


I thought about Anno-like trading routes, wich can be configured. There is only one problem when you use out of sector production mod: An AI controlled ship would not trigger the oosp production, cause oosp mod is only attached to the player.
Scrap Yard Galaxy
My mods and tools
My Workshop

If you find a bug in my mods please contact me.