Jump to content

[0.21.1] Entity:removeCargo()


Recommended Posts

While modding I have encountered a bug, where

Entity():removeCargo(good, amount)

would remove the cargo from the entity on the serverside, but does not synch this change with the client.

It only occurs when "good" is represented as string and not the tradingGood.

Changing sectors or log out and back in fixes the clients cargobay.


Steps to reproduce:

[*]Entity():addCargo("Coffee", 10)

[*]Entity():removeCargo("Coffee", 5)

The serverside now has 5 "Coffee", the client still thinks it has 10 "Coffee"

This persist for the whole time the ship stays in a sector/ gets loaded/unloaded. It is also visible in the vanilla shipoverviewmenu on the cargo tab.



Link to comment
Share on other sites

  • 4 years later...

Did this ever get patched because I'm having the same problem -- regardless if represented as a string or as a TradingGood.


I managed to get it working by attaching the script to a player on both client and server, but I couldn't get it to sync attaching a script to a sector because I  could only seem to do that on the server alone.

Edited by nand
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...