MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.67k stars 1.33k forks source link

PlayerStartingInventorySystem is unable to give items to remote player (read description) #1690

Open MarcinSc opened 9 years ago

MarcinSc commented 9 years ago

If you try to "giveItem" of an non-block-item from a module, the remote player does not see it in inventory. It works fine for block-items from a module, or for core items (any kind).

Weirdly, if after a couple of "giveItem" with a non-block-item like that in PlayerStartingInventorySystem you use "giveItem" with a block-item, the block ends up couple of empty slots away, so it seems it works fine on the server side, just the info is not correctly passed to the remote client.

Cervator commented 9 years ago

More intel:

org.terasology.ligthandshadow.componentsystem.controllers.LASSystem#onPlayerSpawn

The three items from Pathfinding work

The three items from LASR do not (and are not qualified with the module name)

They're given in different ways and one set is unstackable while the other stackable, for what it is worth

Cervator commented 7 years ago

Bump - just for reference this issue is still valid. I tried the Light & Shadow scenario after merging #1988 since that one dealt with module prefixing of assets too, but no change (expected, since that change was specific to "auto" blocks). But maybe there is something similar at work here.

nihal111 commented 7 years ago

@Cervator Will look into this. Could you write down the steps to reproduce this?

Cervator commented 7 years ago

@nihal111 easiest is simply try Light & Shadow

  1. Start a game client, host a multiplayer game with the Light & Shadow gameplay template. Use seed "donthurtme" (some seeds in L&S can lead to the player spawning outside the dome, usually resulting in an infinite death loop)
  2. Connect to the server with a different game client

You may want to also activate CheatsForAll so you can experiment with something like giveItem clubsAce and giveItem lightandshadowresources:clubsAce for the second game client

Oddly, the client player when picking up items will first fill toolbar slot 1 (truly empty) then further items will skip slots 7-10 and go straight to the main inventory. Yet you can place items on top of slots 7-10 and you won't get anything back like you would if there were items there.

It seems like those four items are not fully created somehow, when given to a client player (without the authority (server) present)

The LASSystem class is adding the items differently. three different ways no less. They all use GiveItemAction which is deprecated, probably there's a better/newer way to do it.

I wonder if that matches entirely with @MarcinSc's use cases. Blocks are fine, items are not if they're not qualified (although maybe they work even unqualified if they come from Core?)

Might also relate to #2430 and/or #1619 although it isn't exclusively happening from console commands (since the starting items are affected as well)

Cervator commented 6 years ago

Old issue yet still some related oddities. Current state in Light and Shadow multiplayer for some Alpha 9 release testing:

Host+Client player: Empty slot 1, the two spawn blocks in 5+6 missing, the command items and ace blocks work Solo-Client joining: Empty slot 1 (do we even have anything there anymore?) yet the spawn blocks do show up and work.

Sort of the opposite of what I expected but hey. Wanted to make a note of it.